Example usage for com.google.gwt.user.client Window confirm

List of usage examples for com.google.gwt.user.client Window confirm

Introduction

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

Prototype

public static boolean confirm(String msg) 

Source Link

Usage

From source file:org.kie.workbench.common.forms.crud.client.component.CrudComponentViewImpl.java

License:Apache License

@Override
public void showDeleteButtons() {
    final Column<MODEL, String> column = new Column<MODEL, String>(
            new ButtonCell(IconType.TRASH, ButtonType.DANGER, ButtonSize.SMALL)) {
        @Override/*from  w w w .jav a 2  s .  c o  m*/
        public String getValue(final MODEL model) {
            return translationService
                    .getTranslation(CrudComponentConstants.CrudComponentViewImplDeleteInstance);
        }
    };
    column.setFieldUpdater(new FieldUpdater<MODEL, String>() {
        @Override
        public void update(final int index, final Object model, final String s) {
            if (Window.confirm(translationService
                    .getTranslation(CrudComponentConstants.CrudComponentViewImplDeleteBody))) {
                presenter.deleteInstance(index);
            }
        }
    });
    table.addColumn(column, "");
}

From source file:org.kie.workbench.common.screens.datamodeller.client.widgets.DataModelBrowser.java

License:Apache License

private void deleteDataObject(final DataObjectTO dataObjectTO, final int index) {

    validatorService.canDeleteDataObject(getContext().getHelper(), dataObjectTO, getDataModel(),
            new ValidatorCallback() {
                @Override/*from  w ww  .j  ava 2s  .co m*/
                public void onFailure() {
                    ErrorPopup.showMessage(Constants.INSTANCE.validation_error_cannot_delete_object(
                            DataModelerUtils.getDataObjectUILabel(dataObjectTO)));
                }

                @Override
                public void onSuccess() {
                    if (Window.confirm(Constants.INSTANCE.modelEditor_confirm_delete())) {
                        getDataModel().removeDataObject(dataObjectTO);

                        dataObjectsProvider.getList().remove(index);
                        dataObjectsProvider.flush();
                        dataObjectsProvider.refresh();

                        notifyObjectDeleted(dataObjectTO);
                    }
                }
            });
}

From source file:org.kie.workbench.common.screens.datamodeller.client.widgets.old.DataModelBrowser.java

License:Apache License

private void deleteDataObject(final DataObject dataObject, final int index) {

    Collection<String> refs = validatorService.getDataObjectExternalReferences(getContext(), dataObject,
            getDataModel());/* w w  w.  j  ava 2  s  .c o  m*/
    if (refs != null && refs.size() > 0) {
        StringBuilder refString = new StringBuilder("<br><br>");
        for (String ref : refs) {
            refString.append("    --> " + ref + "<br>");
        }
        ErrorPopup.showMessage(Constants.INSTANCE.validation_error_cannot_delete_object(
                DataModelerUtils.getDataObjectUILabel(dataObject), refString.toString()));
    } else {
        if (Window.confirm(Constants.INSTANCE.modelEditor_confirm_delete())) {

            // commented when the data modeler was refactored getDataModel().removeDataObject( dataObject );
            //DataModelBrowser is no longer used.

            dataObjectsProvider.getList().remove(index);
            dataObjectsProvider.flush();
            dataObjectsProvider.refresh();

            notifyObjectDeleted(dataObject);
        }
    }
}

From source file:org.kie.workbench.common.screens.library.client.widgets.organizationalunit.OrganizationalUnitTileWidget.java

License:Apache License

boolean confirmRemove(OrganizationalUnit organizationalUnit) {
    return Window.confirm(view.getRemoveWarningMessage(organizationalUnit.getName()));
}

From source file:org.kie.workbench.common.widgets.client.menu.ResetPerspectivesMenuBuilder.java

License:Apache License

public ResetPerspectivesMenuBuilder() {
    link.setIcon(IconType.MEDKIT);// w  w w .j a va2s .  c  o m

    link.getWidget(0).setStyleName("nav-item-iconic"); // Fix for IE11

    link.setTitle(CommonConstants.INSTANCE.ResetPerspectivesTooltip());
    link.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (Window.confirm(CommonConstants.INSTANCE.PromptResetPerspectives())) {
                final PerspectiveActivity currentPerspective = perspectiveManager.getCurrentPerspective();
                perspectiveManager.removePerspectiveStates(new Command() {
                    @Override
                    public void execute() {
                        if (currentPerspective != null) {
                            //Use ForcedPlaceRequest to force re-loading of the current Perspective
                            final PlaceRequest pr = new ForcedPlaceRequest(currentPerspective.getIdentifier(),
                                    currentPerspective.getPlace().getParameters());
                            placeManager.goTo(pr);
                        }
                    }
                });
            }
        }
    });
}

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

License:Educational Community License

public void onModuleLoad() {
    // Grid//  w w  w . j av a 2  s  .c o  m
    String proxyUrl = "./items.lst";
    final DateTimeFormat dateFormater = DateTimeFormat.getFormat(datePattern);

    startDatePicker.setMinimalDate(dateFormater.parse("01/01/1901"));
    endDatePicker.setMinimalDate(dateFormater.parse("01/01/1901"));

    // set default dates
    Date startDefDate = new Date();
    Date endDefDate = new Date();
    int startDefMonth = startDefDate.getMonth() - 1;
    startDefDate.setMonth(startDefMonth);
    startDatePicker.setSelectedDate(startDefDate);
    endDatePicker.setSelectedDate(endDefDate);
    startDate.setText(DateTimeFormat.getFormat("MM/dd/yyyy").format(startDefDate));
    endDate.setText(DateTimeFormat.getFormat("MM/dd/yyyy").format(endDefDate));

    startDatePicker.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            Date date = startDatePicker.getSelectedDate();
            startDate.setText(dateFormater.format(date));
            startDatePicker.hide();

        }
    });

    endDatePicker.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            Date date = endDatePicker.getSelectedDate();
            endDate.setText(dateFormater.format(date));
            endDatePicker.hide();
        }
    });
    startDate.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            Date d1 = getDateFromString(((TextBox) sender).getText());
            ((TextBox) sender).setText(formatDate(d1));
        }
    });
    endDate.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            Date d1 = getDateFromString(((TextBox) sender).getText());
            ((TextBox) sender).setText(formatDate(d1));
        }
    });
    ClickListener startDateClickListener = new ClickListener() {
        public void onClick(Widget sender) {
            startDatePicker.show();
        }
    };

    ClickListener endDateClickListener = new ClickListener() {
        public void onClick(Widget sender) {
            endDatePicker.show();
        }
    };

    dateChooserS.addClickListener(startDateClickListener);
    dateChooserE.addClickListener(endDateClickListener);

    this.formController = sf;
    this.showButtonRow = false;
    String formItemName = this.setElementNames(columnModel, recordDef);
    planSearchStatus.setStyleName("ShowInfoClass");
    // Form

    Label lab1 = new Label("Plan Name");
    lab1.setWidth(w[0]);
    Label lab2 = new Label("Start");
    lab2.setWidth(w[1]);
    Label lab3 = new Label("End");
    lab3.setWidth(w[2]);

    // flexForm.addFormItem("",lab1);
    // flexForm.addFormItem("",lab2);
    // flexForm.addFormItem("",lab3);
    //      
    // flexForm.addRow();
    //      

    textBox.setMaxLength(120);
    planListBox.setWidth(w[0]);
    textBox.setWidth(w[0]);

    startDate.setMaxLength(10);
    startDate.setWidth(w[1]);
    String marginstr = "&nbsp;";
    HTML margin = new HTML(marginstr);
    HorizontalPanel sdp = new HorizontalPanel();
    sdp.setWidth(w2[1]);
    HorizontalPanel edp = new HorizontalPanel();
    HorizontalPanel bdp = new HorizontalPanel();
    bdp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    sdp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    sdp.add(startDate);
    sdp.add(margin);
    sdp.add(dateChooserS);

    sdp.add(margin);

    edp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    edp.add(endDate);
    edp.add(margin);
    edp.add(dateChooserE);
    edp.add(margin);
    edp.setWidth(w2[2]);
    endDate.setMaxLength(10);
    endDate.setWidth(w[2]);
    ((FlexFormPanel) flexForm).currentMargin = "   ";
    flexForm.setWidth("621px");
    HorizontalPanel pdp = new HorizontalPanel();
    pdp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    pdp.setWidth(w[0]);
    pdp.add(planListBox);
    flexForm.addVerticalItem("Plan Name", pdp, w[0]);

    flexForm.addVerticalItem(marginstr, margin, "2px");
    flexForm.addVerticalItem("Start", sdp, w2[1]);
    flexForm.addVerticalItem(marginstr, margin, "2px");
    flexForm.addVerticalItem("End", edp, w2[2]);
    flexForm.addVerticalItem(marginstr, margin, "2px");
    bdp.add(showActivityButton);

    HorizontalPanel fdp = new HorizontalPanel();
    fdp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    fdp.setWidth("" + showActivityButton.getWidth() + "px");
    fdp.add(showActivityButton);
    flexForm.addVerticalItem("&nbsp;", fdp, "60px");

    // flexForm.addFormItem(" ",textBox);
    // flexForm.addFormItem(" ", startDate);
    // flexForm.addFormItem(" ", endDate);
    // flexForm.add(showActivityButton);

    flexForm.addRow();
    flexForm.add(planSearchStatus);
    // planSearchStatus.setText(getPlanStatus("Complete"));
    planSearchStatus.setText("");
    planSearchStatus.setStylePrimaryName("ShowInfoClass");
    showActivityButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            boolean oktogo = Window.confirm("Search for Activities: from" + startDate.getText() + " through "
                    + endDate.getText() + "?");
            if (oktogo) {
                String planId = planListBox.getValue(planListBox.getSelectedIndex());
                String planStatusId = (String) statusMap.get(planId);
                String planStatus = "Complete";
                if (!planStatusId.equals("C")) {
                    planStatus = "In-Progress";
                }
                planSearchStatus.setText(getPlanStatus(planStatus));
                gridLoad(1, 1, "id", "activitylog", store);

            }

        }
    });
    itemRootName = "deptplan";

    planListBox.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            // display status
            String planId = planListBox.getValue(planListBox.getSelectedIndex());
            if ("0".equals(planId)) {
                planSearchStatus.setText("");
                return;
            }
            String planStatusId = (String) statusMap.get(planId);
            String planStatus = "In-Progress";
            if ("C".equals(planStatusId))
                planStatus = "Complete";
            else if ("D".equals(planStatusId))
                planStatus = "Deleted";
            planSearchStatus.setText(getPlanStatus(planStatus));
        }
    });

    itemService.getStringArray(itemRootName, institutionId, callbackPload);

}

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

License:Educational Community License

protected void customImageFormSubmit(FormPanel formPanel, FileUpload fileUpload, boolean isRestore,
        String uiImageEnumValue) {
    // check location
    if (systemDomainId.getValue() == null || systemDomainId.getValue().trim().length() == 0) {
        Window.alert("Please select your location first from the location grid.");
        return;//from   www. j a v  a  2s.c  om
    }

    if (systemDomainAccess.getValue().equals("2")) {
        boolean ok = Window.confirm("Access is set to 'All Users'.  Do you wish to proceed?");
        if (!ok)
            return;
    }

    if (!isRestore) {
        // check file
        String fileName = fileUpload.getFilename().toLowerCase();
        if (fileName == null || fileName.trim().length() == 0) {
            Window.alert("Please enter image to upload.");
            return;
        }

        int lastIndex = fileName.lastIndexOf('.');
        if (lastIndex < 0) {
            Window.alert("Invalid image file");
            return;
        }

        if (!(fileName.endsWith("gif") || fileName.endsWith("jpeg") || fileName.endsWith("jpg")
                || fileName.endsWith("tiff") || fileName.endsWith("bmp") || fileName.endsWith("png"))) {
            Window.alert("Invalid image file");
            return;
        }
    }

    restore.setValue(isRestore ? "true" : "false");
    uiImageEnum.setValue(uiImageEnumValue);

    formPanel.submit();
}

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

License:Educational Community License

public void doModuleLoad() {
    super.onModuleSetup();

    // Element gwtRoot= DOM.getElementById("gwtRoot");
    // rootPanel = RootPanel.get("gwtRoot");
    RootPanel rootPanel = RootPanel.get("gwtRoot");

    // Window.alert("Start at: "+rootPanel.getTitle());
    // Defaults for SimpleGridView
    textBox.setWidth("341px");
    orderBox.setWidth("40px");

    // Button Bar
    buttonBar.add(left, DockPanel.WEST);
    left.setWidth("200px");
    right.setWidth("440px");
    left.add(backButton);/*w  w  w.jav a  2 s  .  c  om*/
    buttonBar.add(right, DockPanel.EAST);
    HTML spacer = new HTML("&nbsp;");
    right.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    right.add(insertButton);
    right.add(updateButton);
    right.add(deleteButton);

    // Add button listeners.

    insertButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);

            boolean ok = Window.confirm("Insert new  entry: " + textBox.getText() + ": are you sure?");
            currentActiveItem = gridPanel.getActiveItem();
            if (ok) {
                buttonPressed = "insert";

                getFormController().insert(itemRootName, updateItemCallback);
            }

        }
    });
    updateButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            if (currentId <= 0) {
                setError("Record selection required");
                showErr(true);
            } else {
                currentActiveItem = gridPanel.getActiveItem();
                boolean ok = Window.confirm("Update entry: " + textBox.getText() + ": are you sure?");
                if (ok) {
                    buttonPressed = "update";
                    getFormController().update(itemRootName, updateItemCallback);
                }
            }

        }
    });

    deleteButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            if (currentId <= 0) {
                setError("Record selection required");
                showErr(true);
            } else {
                currentActiveItem = gridPanel.getActiveItem();
                boolean ok = Window.confirm(delAskMsg + textBox.getText() + ": are you sure?");
                if (ok) {
                    buttonPressed = "delete";
                    // Item item = new Item();
                    formController.delete(itemRootName, updateItemCallback);
                }
            }
        }
    });

    // Build up Main dock panel
    rootPanel.add(dockPanel);
    dockPanel.setWidth("642px");
    spacerBar.setSize(screenWidth, "10px");

    // Page heading
    // headingLabel.setHTML("<p>&nbsp;</p>");
    // headingBar.add(headingLabel);
    // headingBar.setSize(screenWidth,"30px");
    dockPanel.add(headingBar, DockPanel.NORTH);
    headingBar.setHeight("2px");
    headingBar.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    // Add panels below the gridpanel
    if (showButtonRow) {
        dockPanel.add(buttonBar, DockPanel.SOUTH);
    }

    dockPanel.add(errorTextPanel, DockPanel.SOUTH);
    dockPanel.add(errorPanel, DockPanel.SOUTH);

    errorPanel.setSize(screenWidth, "12px");
    errorTextPanel.setSize(screenWidth, "12px");

    buttonBar.setSize(screenWidth, "58px");
    dockPanel.add(formPanel, DockPanel.SOUTH);
    dockPanel.add(spacerBar, DockPanel.SOUTH);
    formPanel.add(flexForm);
    loadErrorSetup(errorPanel, errorTextPanel);

    loadErrorSetup(errorPanel, errorTextPanel);

    CSS.swapStyleSheet("theme", "js/ext/resources/css/xtheme-gray.css");

}

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

License:Educational Community License

public void doModuleLoad() {
    super.onModuleSetup();

    //Element gwtRoot= DOM.getElementById("gwtRoot");
    //rootPanel = RootPanel.get("gwtRoot");
    RootPanel rootPanel = RootPanel.get("gwtRoot");

    // Window.alert("Start at: "+rootPanel.getTitle());
    // Defaults for SimpleGridView
    textBox.setWidth("341px");
    orderBox.setWidth("40px");

    // Button Bar
    buttonBar.add(left, DockPanel.WEST);
    left.setWidth("200px");
    right.setWidth("440px");
    left.add(backButton);/*from   w  w  w .j a  v  a  2 s . c o  m*/
    buttonBar.add(right, DockPanel.EAST);
    HTML spacer = new HTML("&nbsp;");
    right.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    // right.add(insertButton);
    // right.add(updateButton);
    // right.add(deleteButton);

    // Add button listeners.

    insertButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);

            boolean ok = Window.confirm("Insert new  entry: " + textBox.getText() + ": are you sure?");
            if (ok) {

                getFormController().insert(itemRootName, updateItemCallback);
            }

        }
    });
    updateButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);

            boolean ok = Window.confirm("Update entry: " + textBox.getText() + ": are you sure?");
            if (ok) {
                getFormController().update(itemRootName, updateItemCallback);
            }

        }
    });
    deleteButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            boolean ok = Window.confirm("Delete  entry: " + textBox.getText() + ": are you sure?");
            if (ok) {

                Item item = new Item();
                formController.delete(itemRootName, item, updateItemCallback);
            }

        }
    });

    // Build up Main dock panel
    rootPanel.add(dockPanel);
    dockPanel.setWidth("642px");
    spacerBar.setSize(screenWidth, "10px");

    // Page heading
    // headingLabel.setHTML("<p>&nbsp;</p>");
    // headingBar.add(headingLabel);
    // headingBar.setSize(screenWidth,"30px");
    dockPanel.add(headingBar, DockPanel.NORTH);
    headingBar.setHeight("2px");
    headingBar.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    // Add panels below the gridpanel
    // if (showButtonRow) {
    dockPanel.add(buttonBar, DockPanel.SOUTH);
    // }

    dockPanel.add(errorTextPanel, DockPanel.SOUTH);
    dockPanel.add(errorPanel, DockPanel.SOUTH);

    errorPanel.setSize(screenWidth, "24px");
    buttonBar.setSize(screenWidth, "58px");
    dockPanel.add(formPanel, DockPanel.SOUTH);
    dockPanel.add(spacerBar, DockPanel.SOUTH);
    formPanel.add(flexForm);
    loadErrorSetup(errorPanel, errorTextPanel);
    CSS.swapStyleSheet("theme", "js/ext/resources/css/xtheme-gray.css");

}

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);/*from w  w  w  . j  a va2  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);

}