Example usage for com.google.gwt.user.client Cookies getCookie

List of usage examples for com.google.gwt.user.client Cookies getCookie

Introduction

In this page you can find the example usage for com.google.gwt.user.client Cookies getCookie.

Prototype

public static String getCookie(String name) 

Source Link

Document

Gets the cookie associated with the given name.

Usage

From source file:org.kuali.continuity.admin.main.client.MajorDivision.java

License:Educational Community License

public void onModuleLoad() {
    // Get parameters from HTML
    Element screenelement = DOM.getElementById("itemdata");
    Element pluralelement = DOM.getElementById("plural");
    Element formelement = DOM.getElementById("formelement");
    Element columnelement = DOM.getElementById("columnelement");
    String formItemName = formelement.getTitle();
    String plural = pluralelement.getTitle();
    String pageInfo = screenelement.getTitle();
    String columnTitle = columnelement.getTitle();

    // Set Columns.
    ColumnConfig divisionCol = new ColumnConfig(columnTitle, "name", gcsize[0], true);
    ColumnModel columnModel = new ColumnModel(new ColumnConfig[] { divisionCol });

    // Set backend.
    this.formController = sf;

    // Set up form.
    formItemName = this.setElementNames(columnModel, recordDef);

    // MajorDivision.java also handles Instructional Departments which is also 50.
    // MajorDivision requires a form label of "Major Division" which is wider than "Name."

    textBox.setMaxLength(50);/*w w w  .  jav  a  2 s .com*/
    HTML formItemHTML = null;
    /* There is probably a way to measure the HTML once created and subtract from the form
     * width.  However, according to experiments with FireBug, we would still
     * need the non-breaking space in the label to represent it on one line.
     */
    if (pageInfo.equals("Division")) {
        formItemHTML = new HTML("Major Division"); // Setup to prevent splitting
        textBox.setWidth("550px");
    } else {
        textBox.setWidth("600px");
        formItemHTML = new HTML(formItemName);

    }
    flexForm.addIdentifiedItem(formItemHTML, textBox);
    itemRootName = pageInfo.toLowerCase(); // Backend Item 
    this.formController = sf;

    // set token
    String token = Cookies.getCookie(CSRF_TOKEN);
    csrfToken.setValue(token);
    flexForm.registerWidget(csrfToken);
}

From source file:org.kuali.continuity.admin.main.client.Reference.java

License:Educational Community License

public void onModuleLoad() {
    // Top level info

    itemService = (ItemServiceAsync) GWT.create(ItemService.class);

    // Grid/*from  w  w  w  .  ja  v a 2s  .c o m*/
    this.gpheight = "260px";
    String formItemName = this.setElementNames();

    // Admin item specific settings

    // Form
    Panel extPanel = new Panel();
    FormPanel extFormPanel = new FormPanel();
    extFormPanel.setFrame(false);
    extFormPanel.setWidth(642);
    extFormPanel.setLabelAlign(Position.TOP);
    extFormPanel.add(gridPanel);
    HTML orderLabel = null;
    orderLabel = new HTML("<B>Order</B>");
    flexForm.addIdentifiedItem(orderLabel, orderBox);
    // Create Rich Text Area
    richBox.ensureDebugId("cwRichText-area");
    richBox.setSize("642px", "14em");
    RichTextToolbar toolbar = new RichTextToolbar(richBox);
    toolbar.ensureDebugId("cwRichText-toolbar");
    toolbar.setWidth("642px");
    Grid grid = new Grid(2, 1);
    grid.setStyleName("cw-RichText");
    grid.setWidget(0, 0, toolbar);
    grid.setWidget(1, 0, richBox);
    flexForm.addRow();
    HTML itemName = new HTML("<B>" + formItemName + "</B>");

    flexForm.addIdentifiedItemVertical(itemName, grid);
    flexForm.registerWidget(richBox);

    itemRootName = itemRootName.toLowerCase();

    // set token
    String token = Cookies.getCookie(CSRF_TOKEN);
    csrfToken.setValue(token);
    flexForm.registerWidget(csrfToken);

}

From source file:org.kuali.continuity.admin.main.client.Setting.java

License:Educational Community License

public void onModuleLoad() {

    RootPanel rootPanel = RootPanel.get("gwtRoot");
    rootPanel.setWidth("760px");

    VerticalPanel vp = new VerticalPanel();
    vp.add(new HTML("<h1>Setup System Parameters</h1>"));
    switchAccessOnoffHTML.setWidth("282px");
    vp.add(switchAccessOnoffHTML);/*  w  ww.  j  a v a 2  s  .  c  o  m*/

    HorizontalPanel switchAccessPanel = new HorizontalPanel();
    switchAccessPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    switchAccessPanel.setWidth("700px");
    switchAccessPanel.add(locationLabel);

    locationTextLabel.setWidth("151px");
    locationTextLabel.setText("");
    locationTextLabel.addStyleName("settings-read-only");

    locationTextBox.setText("");
    locationTextBox.setReadOnly(true);
    locationTextBox.setStyleName("SettingsLocationTextBox");
    locationTextBox.setWidth("300px");
    //      locationTextBox.addStyleName("SettingsLocationTextBox");
    //      locationTextBox.setStylePrimaryName("SettingsLocationTextBox");

    //      switchAccessPanel.add(locationTextLabel);
    switchAccessPanel.add(locationTextBox);
    switchAccessPanel.add(accessLabel);
    switchAccessPanel.add(accessListBox);
    switchAccessPanel.setCellVerticalAlignment(locationLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    switchAccessPanel.setCellVerticalAlignment(accessLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    switchAccessPanel.setCellVerticalAlignment(locationTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    switchAccessPanel.setCellVerticalAlignment(accessListBox, HasVerticalAlignment.ALIGN_MIDDLE);

    vp.add(switchAccessPanel);

    final Label usingThisControlLabel = new HTML(
            "<p class='StandardWidth'>Using this control, an Institution Administrator or Local Administrator can specify who may access this planning tool, at any location under his/her control. One use of this is to \"turn off\" access to end-users (\"Local Users\") while customization is being done to the application</p>");
    vp.add(usingThisControlLabel);

    // --- test mode
    vp.add(testModePanel);
    testModePanel.add(new HTML("<hr style='margin-top:10px;'/>"));
    testModePanel.add(new HTML("<h3>Testing mode:</h3>"));
    testModePanel.add(testModeCheckBox);
    testModeCheckBox.setHTML(
            "<span class=\"gwt-HTML-location\">&nbsp;&nbsp;Check here to place the system in Testing Mode.  Testing Mode temporarily disables the automated email messages that are generated when you add a person's name onto the Add/Remove User screen, or when you approve/deny a password request on the Moderator's Approval screen.   Do this when testing, troubleshooting, setting up plans, etc. to avoid sending unwanted emails.   Uncheck to turn back on.</span>");
    FlexTable testModeTable = new FlexTable();
    testModeTable.setWidth("700px");
    testModeTable.getFlexCellFormatter().setColSpan(0, 0, 2);
    testModeTable.setHTML(0, 0, "<span class=\"gwt-HTML-location\">&nbsp;</span>");
    testModeTable.getFlexCellFormatter().setColSpan(1, 0, 2);
    testModeTable.setHTML(1, 0, "<span class=\"gwt-HTML-location\">Please note:</span>");
    testModeTable.setHTML(2, 0, "<span class=\"gwt-HTML-location\">(1)&nbsp;</span>");
    testModeTable.setHTML(2, 1,
            "<span class=\"gwt-HTML-location\">Testing Mode disables only the emails that would be generated by YOU.  Testing Mode has no impact on other users:  they will continue to experience normal system behavior.</span>");
    testModeTable.setHTML(3, 0, "<span class=\"gwt-HTML-location\">(2)&nbsp;</span>");
    testModeTable.setHTML(3, 1,
            "<span class=\"gwt-HTML-location\">Testing Mode disables only those emails generated by the Add/Remove User screen and by the Moderator's Approval screen.  Emails generated by the login screens (to create a new account, or replace a forgotten password) will continue to be generated as normal.</span>");
    testModeTable.setHTML(4, 0, "<span class=\"gwt-HTML-location\">(3)&nbsp;</span>");
    testModeTable.setHTML(4, 1,
            "<span class=\"gwt-HTML-location\">Emails are never generated by the Manage User Accounts screen, so that screen is not of concern.</span>");
    testModePanel.add(testModeTable);

    // -- email
    VerticalPanel emailVPanel = new VerticalPanel();
    vp.add(emailVPanel);
    emailVPanel.add(new HTML("<hr style='margin-top:10px;'/>"));
    emailVPanel.add(new HTML("<h3>Return Address for System-Generated Emails:</h3>"));
    emailVPanel.add(new HTML(
            "<p class=\"StandardWidth\">Under certain circumstances, this tool will generate &amp; send emails to users (details are given in the Administrator's Manual).</p>"
                    + "<p class=\"StandardWidth\">Please choose here the <span style='font-weight:bold;'>return address</span> that will be displayed on these emails.</p>"
                    + "<ul class=\"bulletlist\">"
                    + "<li>You might  use the email address of one of  your Local Administrators</li>"
                    + "<li>You might use  the address of  a departmental email account, if you have one; or</li>"
                    + "<li>You might create a special email account for this purpose.</li>" + "</ul><p>"
                    + "<p class=\"StandardWidth\">Keep in mind that  recipients are often reluctant  to open emails that have odd-looking  return addresses.</p>"
                    + "<p class=\"StandardWidth\">You may change this return address at any time in future by simply entering a new address here.</p>"));
    emailVPanel.add(emailPanel);
    emailPanel.setWidth("700px");
    HTML emailLabel = new HTML(
            "<span style='font-weight:bold;'>Return address for system-generated emails:</span>");
    emailTextBox.setStyleName("SettingDomainTextBox");
    emailTextBox.setWidth("300px");
    emailPanel.add(emailLabel);
    emailPanel.add(emailTextBox);

    // -- screen options
    vp.add(new HTML("<hr style='margin-top:10px;'/>"));
    vp.add(screenOptionsHTML);
    vp.add(showTeamsCheckBox);
    showTeamsCheckBox.setText("Show Teams");
    showTeamsCheckBox.addStyleName("optional-screen-list");
    vp.add(showSkillsCheckBox);
    showSkillsCheckBox.setText("Show Skills");
    showSkillsCheckBox.addStyleName("optional-screen-list");
    vp.add(showStaffingBox);
    showStaffingBox.setText("Show Staffing Requirements");
    showStaffingBox.addStyleName("optional-screen-list");
    vp.add(showExamplesOfCheckBox);
    showExamplesOfCheckBox.setWidth("240px");
    showExamplesOfCheckBox.setText("Show Examples of Critical Functions");
    showExamplesOfCheckBox.addStyleName("optional-screen-list");
    vp.add(replaceStep4);
    replaceStep4.setSize("455px", "22px");
    replaceStep4.setText("Replace Step 4: Instruction with Step 4: Faculty Preparedness");
    replaceStep4.addStyleName("optional-screen-list");

    final HTML theseSettingsControlLabel = new HTML(
            "<p class=\"StandardWidth\">These settings control the display or non-display of certain screens. When checked, the screen in question will appear for ALL users at a location. When un-checked, the screen will be hidden from ALL users at that location.</p>"
                    + "<p class=\"StandardWidth\">These settings apply to one location (campus) only. In a multi-campus institution, the settings would have to be done separately for each campus - they cannot be done for the whole institution.</p>"
                    + "<p class=\"StandardWidth\">These settings do not affect the data in the database. Hence when you switch a screen off, any data displayed on that screen remains in the database and will re-appear if you switch the screen on again at some future time.</p>");
    vp.add(theseSettingsControlLabel);
    theseSettingsControlLabel.setSize("709px", "107px");

    // --- select other optional features
    vp.add(otherPanel);
    otherPanel.add(new HTML("<hr style='margin-top:10px;'/>"));
    otherPanel.add(new HTML("<h3>Select Other Optional Features:</h3>"));
    otherPanel.add(showCriticalLevelCheckBox);
    showCriticalLevelCheckBox.setHTML(
            "&nbsp;&nbsp;<span style='font-weight:bold;'>Detail Screens:</span>  In Step 2 Critical Functions, display the detail screens for ALL functions, "
                    + "regardless of criticality level.  If unchecked, the detail screens will be displayed for functions whose criticality level is one of "
                    + "the top three levels, but will NOT be displayed for functions assigned  the fourth (lowest) level of criticality.");

    // --- select the rule for issuing passwords
    vp.add(modPanel);
    modPanel.setVisible(false);
    modPanel.add(new HTML("<hr style='margin-top:10px;'/>"));

    modPanel.add(new HTML("<h3>Select the Rule for Issuing Passwords:</h3>"));
    modPanel.add(new HTML(
            "<p class='StandardWidth'>This selection applies only when the location (campus) is configured for Direct Login (i.e., when Ariah Continuity issues passwords to users via email). </p>"));

    modPanel.add(radioFull);
    radioFull.setText(
            "Full Moderation (every password request is submitted to the Moderator for approval before a password is issued)");
    radioFull.addStyleName("password-rules-list");
    radioFull.setChecked(true);
    modPanel.add(radioPartial);
    radioPartial.setText(
            "Partial Moderation (issue passwords to users from the following email domains, submit other requests to Moderator):");
    radioPartial.addStyleName("password-rules-list");

    // set token
    String token = Cookies.getCookie(CSRF_TOKEN);
    csrfToken.setValue(token);
    vp.add(csrfToken);

    rootPanel.add(vp);

    // rootPanel.setStyleName("delText");

    // Buttons
    backButton.setStyleName("BackButtonClass");
    saveSettingsButton.setStyleName("SaveButtonClass");
    // SimplePanel rootPanel = new SimplePanel();

    itemService = (SimpleServiceAsync) GWT.create(SimpleService.class);

    backButton.setStyleName("BackButtonClass");

    backButton.setText("Back");
    backButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            redirect("/continuity/admin/adminHome");
        }
    });

    saveSettingsButton.setStyleName("SaveButtonClass");
    saveSettingsButton.setText("Save Settings");

    saveSettingsButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            invalidEmailHTML.setVisible(false);
            String retEmailAddr = emailTextBox.getText();
            if (retEmailAddr != null && retEmailAddr.trim().length() != 0
                    && !retEmailAddr.matches("^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$")) {
                invalidEmailHTML.setVisible(true);
                return;
            }

            domainList = new ArrayList();
            for (Iterator i = tableRoot.iterator(); i.hasNext();) {

                HorizontalPanel hp = (HorizontalPanel) i.next();
                Label dl = (Label) hp.getWidget(0);
                // Window.alert("Adding "+(String) dl.getText() );
                domainList.add((String) dl.getText());

            }
            boolean ok = true;

            //            if (domainList.size() > 0 && radioFull.isChecked()) {
            //
            //               radioPartial.setChecked(false);
            //               radioFull.setChecked(true);
            //               ok = true;
            //            }
            if (domainList.size() == 0 && radioPartial.isChecked()) {
                ok = false;
                boolean uncheck = Window.confirm(
                        "You have selected partial moderation with no email domains. Do you wish to use full moderation instead?");

                if (!uncheck) {
                    Window.alert(
                            "Please enter email domains for partial moderation, or select full moderation.");
                } else {
                    radioPartial.setChecked(false);
                    radioFull.setChecked(true);
                    ok = true;
                }
            }
            if (ok)
                ok = Window.confirm("Update  System Parameters: " + "are you sure?");
            if (ok) {
                SettingItem item = new SettingItem();
                item.setAccess(new Integer(accessListBox.getValue(accessListBox.getSelectedIndex())));
                Boolean[] opts = { false, false, false, false, false, false };
                opts[SettingItem.optionType.Teams.ordinal()] = showTeamsCheckBox.isChecked();
                opts[SettingItem.optionType.Skills.ordinal()] = showSkillsCheckBox.isChecked();
                opts[SettingItem.optionType.Staffing.ordinal()] = showStaffingBox.isChecked();
                opts[SettingItem.optionType.Functions.ordinal()] = showExamplesOfCheckBox.isChecked();
                opts[SettingItem.optionType.Replace.ordinal()] = !replaceStep4.isChecked();
                opts[SettingItem.optionType.CriticalityLevel.ordinal()] = showCriticalLevelCheckBox.isChecked();

                item.setOptions(opts);
                // ArrayList<String> domainList = new ArrayList();

                // admin email disabled
                item.setInTestMode(testModeCheckBox.isChecked());

                if (radioFull.isChecked()) {
                    item.setFullModeration("1");
                } else if (radioPartial.isChecked()) {
                    item.setFullModeration("2");
                }

                item.setSystemName(systemNameTextBox.getText());
                item.setEmail(emailTextBox.getText());
                item.setCsrfToken(csrfToken.getValue());

                String str[] = new String[domainList.size()];
                domainList.toArray(str);
                item.setDomainList(str);
                String[] str2 = item.getDomainList();
                // String slist="";
                // for (String s: str) {
                // slist+=s+" ";
                // }
                // Window.alert("Saving: "+slist);
                itemService.updateItem("setting", item, updateItemCallback);

            }

        }
    });

    final HorizontalPanel buttonPanel = new HorizontalPanel();

    buttonPanel.add(backButton);
    buttonPanel.add(saveSettingsButton);

    final HorizontalPanel domainPanel = new HorizontalPanel();
    modPanel.add(domainPanel);

    //      vp.add(domainPanel);
    final Label allowThisDomainLabel = new Label("Allow this domain (e.g. tufts.edu, tuftsfund.org):");
    domainPanel.add(allowThisDomainLabel);
    allowThisDomainLabel.setWidth("284px");
    allowThisDomainLabel.addStyleName("SettingAllowThisDomainLabel");

    domainPanel.add(domainTextBox);
    domainTextBox.setSize("255px", "20px");
    domainTextBox.setStyleName("SettingDomainTextBox");

    final Button addButton = new Button();

    domainPanel.add(addButton);
    addButton.setSize("103px", "22px");
    addButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            // Label listItem = new Label();
            // listItem.setText(domainTextBox.getText());
            // domainList.add(listItem);

            addDomain();

        }
    });
    addButton.setStyleName("ButtonClass");
    addButton.setText("Add to List");

    // Setup test code: delete
    final Label domain1 = new Label("l1");
    // rootPanel.add(domain1, 345, 460);
    domain1.setSize("255px", "15px");

    final Label del1 = new Label("delete");
    // rootPanel.add(del1, 620, 460);
    //del1.setStylePrimaryName("gwt-Labeld");
    del1.setStyleName("SettingDomainDeleteLink");
    del1.setSize("47px", "15px");

    formLoad();
    tableRoot = new VerticalPanel();
    tableRoot.addStyleName("domain_list");
    //tableRoot.addStyleName("partial-moderation-margin");

    HTML allowedDomainLab = new HTML("<p><strong>Allowed Domains:</strong></p>");
    allowedDomainLab.addStyleName("SettingAllowDomainLabel");
    modPanel.add(allowedDomainLab);

    modPanel.add(tableRoot);
    tableRoot.setWidth("300px");

    vp.add(new HTML("<hr style='margin-top:10px;'/>"));
    vp.add(new HTML("<h3>Create a Name for this Planning Tool:</h3>"));
    vp.add(new HTML(
            "<p class='StandardWidth'>Please enter here a name for your local version of the Ariah Continuity tool.  This name will appear in the system-generated emails that notify users about new accounts, passwords, etc.   Some possible examples:  Indiana Ready, UBC Ready, Penn State Continuity Planner.  For consistency, please use the same name as will appear in your custom graphics at the top of every page.</p>"));
    systemNameTextBox.setSize("644px", "20px");

    systemNameTextBox.setMaxLength(1000);
    systemNameTextBox.setStyleName("SettingDomainTextBox");
    vp.add(systemNameTextBox);

    vp.add(new HTML("<hr style='margin-top:10px;'/>"));

    invalidEmailHTML.setVisible(false);
    vp.add(invalidEmailHTML);
    vp.add(buttonPanel);

}

From source file:org.kuali.continuity.admin.main.client.Skill.java

License:Educational Community License

public void onModuleLoad() {
    // Grid//from ww  w  .  j av a  2s.  c  o  m
    String proxyUrl = "./items.lst";
    RecordDef recordDef = new RecordDef(new FieldDef[] { new StringFieldDef("id"), new StringFieldDef("name"),
            new IntegerFieldDef("order"), new StringFieldDef("description") });

    itemService = (ItemServiceAsync) GWT.create(ItemService.class);
    Element screenelement = DOM.getElementById("itemdata");
    Element formelement = DOM.getElementById("formelement");
    Element pluralelement = DOM.getElementById("plural");
    Element dataelement = DOM.getElementById("dataelement");
    itemRootName = dataelement.getTitle();
    this.formController = sfc;
    itemRootName = "skill";
    columnModel = new ColumnModel(new ColumnConfig[] { orderColumn, skillCol, descriptionCol });

    onModuleLoad("Skills", proxyUrl, columnModel, recordDef);

    // Buttons
    String name = "Skill";
    setButtonNames("Skill");

    // Heading
    String plural = pluralelement.getTitle();
    setHeadingName(plural + " Setup");

    // Form
    flexForm.setRowWidth("642px");
    flexForm.addFormItem(name, textBox);
    flexForm.addFormItem("Order", orderBox);
    description.setSize("642px", "64px");
    textBox.setWidth("500px");
    textBox.setMaxLength(50);
    formPanel.add(new Label("Description"));

    formPanel.add(description);
    flexForm.registerWidget(description); // All this does is enable the UI to clear the field when it is supposed to.

    // set token
    String token = Cookies.getCookie(CSRF_TOKEN);
    csrfToken.setValue(token);
    flexForm.registerWidget(csrfToken);
}

From source file:org.kuali.continuity.admin.project.client.ImageViewer.java

License:Educational Community License

public void onModuleLoad() {

    ////from  w w  w .j  a va2  s  . c  o  m
    // Grid
    //
    if (!showingscrollbar) {
        pageSize = 7;
    }

    kcpService = (KcpServiceAsync) GWT.create(KcpService.class);
    int startinstitutionId = curinst;
    kcpService.getUserArray(startinstitutionId, callbackUserload);

    // PagingMemoryProxy memproxy = new PagingMemoryProxy(userData);

    store.setDefaultSort("name", SortDir.ASC);

    reader.setRoot("persons");

    // reader.setTotalProperty("totalPersons");
    reader.setId("UserID");

    RootPanel rootPanel = RootPanel.get();
    rootPanel.setStylePrimaryName("user-accounts-page");
    VerticalPanel vp = new VerticalPanel();
    rootPanel.add(vp);
    vp.add(new HTML("<h1>Manage User Accounts</h1>"));
    vp.add(new HTML(
            "<p class='StandardWidth'>Please use this page to manage user accounts and access roles.</p>"));
    vp.add(new HTML(
            "<p class='StandardWidth'>To modify an existing item, first highlight that row on the grid then use the entry-forms at the bottom to modify.</p>"));
    HTMLPanel buttonPanel = new HTMLPanel(
            "<div class='MyButtonsDivClass'><div class='floatLeft' id='leftButtons'></div><div class='floatRight' id='rightButtons'></div></div>");
    // rootPanel.add(formPanel, 20, 581);
    // formPanel.setSize("639px", "39px");
    // formPanel.setTitle(" ");

    roleGrid.setStore(store);

    // EXT roleGrid.addTableListener(new TableListener() {

    // EXT roleGrid.setCellPadding(0);
    // EXT initData(roleGrid);
    // EXT highlight(roleGrid, 1);
    // EXT ColumnFormatter cf = roleGrid.getColumnFormatter();
    // EXT roleGrid.addTableListener(this);
    // EXT roleGrid.setCellSpacing(0);
    // roleGrid.addGridHeaderListener(headerlistener);
    roleGrid.addGridRowListener(rowlistener);
    roleGrid.setTitle("Accounts");
    roleGrid.setCls(".myclass");

    roleGrid.setColumnModel(columnModel);

    roleGrid.setTrackMouseOver(true);

    roleGrid.setLoadMask(true);
    roleGrid.setSelectionModel(new RowSelectionModel());
    roleGrid.setStripeRows(true);
    roleGrid.setIconCls("grid-icon");
    roleGrid.setEnableColumnResize(true);
    GridView view = new GridView();
    view.setForceFit(true);
    roleGrid.setView(view);

    //
    if (showpagingbar) {
        PagingToolbar pagingToolbar = new PagingToolbar(store);
        pagingToolbar.setPageSize(pageSize);
        pagingToolbar.setDisplayMsg("");
        pagingToolbar.setDisplayInfo(false);

        roleGrid.setBottomToolbar(pagingToolbar);
    }
    if (!showingscrollbar) {
        pageSize = 7;
    }

    final UrlParam[] urlParams = {
            // new UrlParam("start", 0),
            new UrlParam("limit", pageSize), new UrlParam("institution", curinst), new UrlParam("sort", "name"),
            new UrlParam("dir", "ASC") };
    store.setBaseParams(urlParams);
    store.setRemoteSort(false);

    if (localpaging) {
        store.load(0, pageSize);
    } else {
        roleGrid.addListener(new PanelListenerAdapter() {
            public void onRender(Component component) {

                // store.load(urlParams,false);
                store.load(0, pageSize);
            }
        });
    }
    vp.add(roleGrid);
    roleGrid.setSize("660px", "226px");
    vp.add(universityListBox);
    universityListBox.addStyleName("insselector-row");
    vp.add(trustAccessLabel);

    headingLabel.setStylePrimaryName("h1");
    headingLabel.addStyleName("h1");
    headingLabel.setWidth("212px");

    buttonPanel.add(backButton, "leftButtons");
    backButton.setWidth("41px");
    backButton.setStyleName("ButtonClass");
    backButton.setText("Back");
    backButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            redirect("/continuity/admin/adminHome");
        }
    });

    buttonPanel.add(insertAccountButton, "rightButtons");
    insertAccountButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            boolean ok = Window.confirm("Insert new user account: " + firstNameTextBox.getText() + " "
                    + lastNameTextBox.getText() + ". are you sure?");
            if (ok) {
                buttonPressed = "insert";
                UserInfo ui = new UserInfo();
                saveUserFields(ui, true);
                validateUser(ui, errlist);
                if (errlist != null && errlist.getItemCount() > 0) {
                    showErr(true);
                } else {
                    kcpService.createUser(ui, callbackCreateUser);
                    //                  StringBuilder error = new StringBuilder();
                    //                  kcpService.createUser(ui, error, callbackUpdate);
                    //                  
                    //                  if (error.length() > 0){
                    //                     setError("Specified login name already exists");
                    //                     showErr(true);
                    //                  }

                }
            }

        }
    });

    insertAccountButton.setText("Insert Account");
    insertAccountButton.setStyleName("ButtonClass");

    buttonPanel.add(updateAccountButton, "rightButtons");
    updateAccountButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            boolean ok = Window.confirm("Update  user account " + firstNameTextBox.getText() + " "
                    + lastNameTextBox.getText() + ": are you sure?");
            if (ok) {
                buttonPressed = "update";
                UserInfo ui = new UserInfo();
                saveUserFields(ui);
                validateUser(ui, errlist);
                if (errlist != null && errlist.getItemCount() > 0) {
                    showErr(true);
                } else {
                    kcpService.updateUser(ui, callbackUpdateUser);
                }
            }

        }
    });
    updateAccountButton.setText("Update Account");
    updateAccountButton.setStyleName("ButtonClass");

    // public void onClick(final Widget sender) {
    //
    // kcpService.getButtonAnswer(callback);
    //
    // }
    buttonPanel.add(deleteAccountButton, "rightButtons");
    deleteAccountButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            boolean ok = Window.confirm("Delete user account " + firstNameTextBox.getText() + " "
                    + lastNameTextBox.getText() + " " + idTextBox.getText() + ": are you sure?");
            if (ok) {
                buttonPressed = "delete";
                UserInfo ui = new UserInfo();

                saveUserFields(ui);
                kcpService.deleteUser(ui, callbackUpdateUser);
            }

        }
    });
    deleteAccountButton.setText("Delete Account");
    deleteAccountButton.setStyleName("ButtonClass");

    FlexTable formTable = new FlexTable();
    vp.add(formTable);
    vp.add(buttonPanel);
    formTable.setStylePrimaryName("user-accounts-form");
    formTable.setWidget(0, 0, firstNameLabel);
    formTable.setWidget(0, 1, firstNameTextBox);

    /* NOT SURE what the ID Box is for, so disabling it 
    idTextBox.setVisible(false);
    formTable.setWidget(0,2,idTextBox);
    idTextBox.setWidth("7px");
    */

    firstNameTextBox.setWidth("120px");
    firstNameTextBox.setMaxLength(20);

    //formPanel1.add(starLabel1);
    formTable.setWidget(0, 2, new HTML("<span class='required'>*</span>Last&nbsp;Name"));

    formTable.setWidget(0, 3, lastNameTextBox);
    lastNameTextBox.setWidth("115px");
    lastNameTextBox.setMaxLength(30);

    formTable.setWidget(0, 4, roleLabel);
    formTable.setWidget(0, 5, roleListBox);
    // xxxx
    // ROLE VALUE List 2 of 4 .  Next go to DisplayUtil
    roleListBox.setStyleName("AccountRoleSelectClass");

    roleListBox.setWidth("120px");
    roleListBox.setVisibleItemCount(1);

    formTable.setWidget(1, 0, titleLabel);

    formTable.setWidget(1, 1, titleTextBox);
    titleTextBox.setWidth("552px");
    titleTextBox.setMaxLength(100);

    formTable.getFlexCellFormatter().setColSpan(1, 1, 5);

    formTable.setWidget(2, 0, departmentLabel);

    formTable.setWidget(2, 1, departmentTextBox);
    departmentTextBox.setWidth("552px");
    departmentTextBox.setMaxLength(100);
    formTable.getFlexCellFormatter().setColSpan(2, 1, 5);

    formTable.setWidget(3, 0, emailLabel);

    HTMLPanel hpanel = new HTMLPanel(
            "<div class='gwt-HTML'><span id='emailTextBox'></span> Phone <span id='phoneTextBox'></span> Access  <span id='accessListBox'></span></div>");
    hpanel.add(emailTextBox, "emailTextBox");
    emailTextBox.setWidth("252px");
    //emailTextBox.setMaxLength(50);

    //hpanel.add(phoneLabel,"items");
    hpanel.add(phoneTextBox, "phoneTextBox");
    //hpanel.add(accessLabel,"items");
    hpanel.add(accessListBox, "accessListBox");

    formTable.setWidget(3, 1, hpanel);
    formTable.getFlexCellFormatter().setColSpan(3, 1, 5);
    //formTable.setWidget(3,3,phoneTextBox);
    phoneTextBox.setWidth("115px");
    phoneTextBox.setMaxLength(20);

    //formTable.setWidget(3,4,accessLabel);
    //formTable.setWidget(3,5,accessListBox);

    accessListBox.addItem("OFF", "0");
    accessListBox.addItem("ON", "1");

    accessListBox.setSize("63px", "22px");
    accessListBox.setVisibleItemCount(1);
    accessListBox.setSelectedIndex(1);
    // loginLabel.setWidth("72px");
    formTable.setWidget(4, 0, loginLabel);

    // rootPanel.add(starLabel4, 420, 545);
    // rootPanel.add(passwordLabel, 430, 548);
    // passwordLabel.setWidth("71px");

    // rootPanel.add(directoryIdLabel,475,25);
    // directoryIdLabel.setWidth("71px");
    // rootPanel.add(directoryIdTextBox,475,107);
    // directoryIdTextBox.setWidth("552px");

    formTable.setWidget(4, 1, loginTextBox);
    loginTextBox.setWidth("252px"); // Was 552
    loginTextBox.setMaxLength(256);
    formTable.getFlexCellFormatter().setColSpan(4, 1, 3);
    formTable.getFlexCellFormatter().setColSpan(4, 2, 3);

    // formTable.setWidget(4, 3, passwordLabel);
    // formTable.setWidget(4,4,passwordTextBox);
    passwordTextBox.setWidth("135px");
    passwordTextBox.setMaxLength(50);

    // HorizontalPanel hpanel2 = new HorizontalPanel();

    passwordPanel.setStylePrimaryName("gwt-HTML");
    passwordPanel.add(passwordTextBox, "passwordTextBox");

    // hpanel2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    formTable.setWidget(4, 2, passwordPanel);

    //formTable.setWidget(5,0,directoryidLabel);
    //formTable.setWidget(5,1,directoryidTextBox);

    //directoryidTextBox.setWidth("552px");
    //directoryidTextBox.setMaxLength(12);
    formTable.getFlexCellFormatter().setColSpan(5, 1, 5);

    universityListBox.setWidth("300px");
    universityListBox.addChangeListener(new ChangeListener() {
        public void onChange(final Widget sender) {
            showErr(false);
            int selectedItem = universityListBox.getSelectedIndex();

            final int institutionId = new Integer(universityListBox.getValue(selectedItem)).intValue();
            curinst = institutionId;
            currentSort = sorts[1];
            gridLoad(selectedItem, institutionId);

        }
    });

    universityListBox.setWidth("300px");

    universityListBox.setVisibleItemCount(1);

    //      rootPanel.add(firstSearchLabel, 280, 350);
    //      rootPanel.add(firstSearchTextBox, 350, 345);
    //      firstSearchTextBox.setWidth("90px");
    //      rootPanel.add(lastSearchLabel, 450, 350);
    //      lastSearchTextBox.setWidth("80px");
    //      rootPanel.add(lastSearchTextBox, 520, 345);
    //      rootPanel.add(searchButton, 605, 350);
    //      searchButton.addClickListener(new ClickListener() {
    //         public void onClick(final Widget sender) {
    //            showErr(false);
    //            Window.confirm("Search for: " + firstSearchTextBox.getText()
    //                  + " " + lastSearchTextBox.getText() + "?");
    //            setError("Search not allowed.");
    //            setError("Wait until next version.");
    //         }
    //      });

    //rootPanel.add(trustAccessLabel, 25, 375);

    // rootPanel.add(passwordTextBox, 500, 545);

    // passwordTextBox.setWidth("96px");
    // passwordTextBox.setMaxLength(12);

    formImage.setSize("52px", "70px");

    //rootPanel.add(formImage, 20, 393);
    formImage.setStylePrimaryName("gwt-Image1");
    formImage.setSize("649px", "217px");
    formImage.setVisibleRect(20, 393, 649, 217);

    kcpService.getInstitutions(callbackUload);

    // set token
    String token = Cookies.getCookie(CSRF_TOKEN);
    csrfToken.setValue(token);
    vp.add(csrfToken);

    CSS.swapStyleSheet("theme", "js/ext/resources/css/xtheme-gray.css");
    rootPanelLoadErrorSetup(rootPanel, 20, 602);
    onModuleSetup();

}

From source file:org.libredraw.client.ClientSession.java

License:Open Source License

private ClientSession() {
    String sessionId = Cookies.getCookie("SID");
    if (sessionId != null) {
        m_sessionId = Cookies.getCookie("SID");
        LibreRPCService.login(sessionId, new AsyncCallback<String>() {
            public void onFailure(Throwable caught) {
            }/*from ww  w. ja  v a  2s .c  o m*/

            public void onSuccess(String result) {
                if (result != "true")
                    m_sessionId = null;
            }
        });
    } else
        m_sessionId = null;
}

From source file:org.libredraw.client.Index.java

License:Open Source License

@Override
public void onModuleLoad() {
    String sessionId = Cookies.getCookie("SID");
    if (sessionId == null)
        sessionId = "NO_SESSION";
    LibreRPCService.login(sessionId, new AsyncCallback<String>() {
        public void onFailure(Throwable caught) {
            errorDialog = new StackTrace(caught);
        }//  w w  w  . jav  a  2  s. co  m

        public void onSuccess(String result) {
            //logger.log(Level.SEVERE, "request is back");
            if (result == "true") {
                //logger.log(Level.SEVERE, "true");
                TableView.navigateTo();
            } else {
                //logger.log(Level.SEVERE, "false");
                Login.navigateTo();
            }
        }
    });
}

From source file:org.libredraw.client.Logout.java

License:Open Source License

@UiHandler("logoutButton")
void onLogoutButtonClick(ClickEvent event) {
    String sessionId = Cookies.getCookie("SID");
    LibreRPCService.endSession(sessionId, new AsyncCallback<String>() {
        public void onFailure(Throwable caught) {
            TableView.registerErrorDialog(new StackTrace(caught));
        }/*from w w w .  j  a  v  a  2  s . c o  m*/

        public void onSuccess(String result) {
            Cookies.removeCookie("SID");
            Login.navigateTo();
        }
    });
}

From source file:org.mklab.taskit.client.activity.LoginActivity.java

License:Apache License

/**
 * ?????????????/* w  w w.  j  a v  a 2s  .  co  m*/
 * 
 * @return ???????
 */
private static boolean isAutoLoginEnabledClient() {
    String enabled = Cookies.getCookie(COOKIE_AUTO_LOGIN_KEY);
    if (enabled == null)
        return false;
    return enabled.toUpperCase().equals("TRUE"); //$NON-NLS-1$
}

From source file:org.obiba.opal.web.gwt.rest.client.RequestCredentials.java

License:Open Source License

/**
 * Returns the Opal session id.
 *
 * @return the opalsid.
 */
public String extractOpalCredentials() {
    return Cookies.getCookie(OPALSID);
}