Example usage for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter

List of usage examples for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter.

Prototype

public FlexCellFormatter getFlexCellFormatter() 

Source Link

Document

Explicitly gets the FlexCellFormatter .

Usage

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.sdk.AddSdkProfileViewImpl.java

License:Apache License

@Override
protected void initDetailsTable() {

    detailsTable.getColumnFormatter().setWidth(0, "250px");
    detailsTable.getColumnFormatter().setWidth(1, "500px");

    int row = 0;//ww w  .  j ava  2s .  c  o m
    Widget label = new Label(Utils.constants.name());
    label.addStyleName(REQUIRED);
    name = new KaaAdminSizedTextBox(256);
    name.addInputHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, name);

    row++;
    label = new Label(Utils.constants.configurationSchemaVersion());
    label.addStyleName(REQUIRED);
    configurationSchemaVersion = new VersionListBox();
    configurationSchemaVersion.setWidth("80px");
    configurationSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, configurationSchemaVersion);

    row++;
    label = new Label(Utils.constants.profileSchemaVersion());
    label.addStyleName(REQUIRED);
    profileSchemaVersion = new VersionListBox();
    profileSchemaVersion.setWidth("80px");
    profileSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, profileSchemaVersion);

    row++;
    label = new Label(Utils.constants.notificationSchemaVersion());
    label.addStyleName(REQUIRED);
    notificationSchemaVersion = new VersionListBox();
    notificationSchemaVersion.setWidth("80px");
    notificationSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, notificationSchemaVersion);

    row++;
    label = new Label(Utils.constants.logSchemaVersion());
    label.addStyleName(REQUIRED);
    logSchemaVersion = new VersionListBox();
    logSchemaVersion.setWidth("80px");
    logSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, logSchemaVersion);

    row++;
    FlexTable ecfsTable = new FlexTable();
    ecfsTable.setCellSpacing(6);

    availableAefMaps = new MultiAefMapListBox();
    selectedAefMaps = new MultiAefMapListBox();

    addAefMapButton = new Button(Utils.constants.add());
    removeAefMapButton = new Button(Utils.constants.remove());

    VerticalPanel availableEcfsPanel = new VerticalPanel();
    availableEcfsPanel.setSpacing(6);
    Label availableLabel = new Label(Utils.constants.available());
    availableEcfsPanel.add(availableLabel);
    availableEcfsPanel.add(availableAefMaps);

    VerticalPanel ecfButtonsPanel = new VerticalPanel();
    ecfButtonsPanel.setSpacing(6);
    ecfButtonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    ecfButtonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    ecfButtonsPanel.add(addAefMapButton);
    ecfButtonsPanel.add(removeAefMapButton);

    VerticalPanel selectedEcfsPanel = new VerticalPanel();
    selectedEcfsPanel.setSpacing(6);
    Label selectedLabel = new Label(Utils.constants.selected());
    selectedEcfsPanel.add(selectedLabel);
    selectedEcfsPanel.add(selectedAefMaps);

    ecfsTable.setWidget(0, 0, availableEcfsPanel);
    ecfsTable.setWidget(0, 1, ecfButtonsPanel);
    ecfsTable.setWidget(0, 2, selectedEcfsPanel);

    ecfsTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    DisclosurePanel ecfsDisclosure = new DisclosurePanel(Utils.constants.ecfs());
    ecfsDisclosure.setAnimationEnabled(true);
    ecfsDisclosure.setContent(ecfsTable);

    addAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());
    removeAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());

    addAefMapButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            addAefMap();
        }
    });

    removeAefMapButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            removeAefMap();
        }
    });

    availableAefMaps.setSize("250px", "100px");
    selectedAefMaps.setSize("250px", "100px");

    availableAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() {
        @Override
        public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) {
            updateAefMapButtons();
        }
    });

    selectedAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() {
        @Override
        public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) {
            updateAefMapButtons();
        }
    });
    detailsTable.setWidget(row, 0, ecfsDisclosure);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);

    row++;
    label = new Label(Utils.constants.defaultUserVerifier());
    Renderer<UserVerifierDto> userVerifierRenderer = new Renderer<UserVerifierDto>() {
        @Override
        public String render(UserVerifierDto object) {
            if (object != null) {
                return object.getName();
            } else {
                return "";
            }
        }

        @Override
        public void render(UserVerifierDto object, Appendable appendable) throws IOException {
            appendable.append(render(object));
        }
    };
    defaultUserVerifier = new ValueListBox<>(userVerifierRenderer);
    defaultUserVerifier.addValueChangeHandler(new ValueChangeHandler<UserVerifierDto>() {
        @Override
        public void onValueChange(ValueChangeEvent<UserVerifierDto> event) {
            fireChanged();
        }
    });
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, defaultUserVerifier);
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.sdk.GenerateSdkViewImpl.java

License:Apache License

@Override
protected void initDetailsTable() {

    detailsTable.getColumnFormatter().setWidth(0, "250px");
    detailsTable.getColumnFormatter().setWidth(1, "500px");

    int row = 0;/*from www. java  2 s .  c o m*/
    Widget label = new Label(Utils.constants.configurationSchemaVersion());
    label.addStyleName(REQUIRED);
    configurationSchemaVersion = new SchemaListBox();
    configurationSchemaVersion.setWidth("80px");
    configurationSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, configurationSchemaVersion);

    row++;
    label = new Label(Utils.constants.profileSchemaVersion());
    label.addStyleName(REQUIRED);
    profileSchemaVersion = new SchemaListBox();
    profileSchemaVersion.setWidth("80px");
    profileSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, profileSchemaVersion);

    row++;
    label = new Label(Utils.constants.notificationSchemaVersion());
    label.addStyleName(REQUIRED);
    notificationSchemaVersion = new SchemaListBox();
    notificationSchemaVersion.setWidth("80px");
    notificationSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, notificationSchemaVersion);

    row++;
    label = new Label(Utils.constants.logSchemaVersion());
    label.addStyleName(REQUIRED);
    logSchemaVersion = new SchemaListBox();
    logSchemaVersion.setWidth("80px");
    logSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, logSchemaVersion);

    row++;
    label = new Label(Utils.constants.targetPlatform());
    label.addStyleName(REQUIRED);
    Renderer<SdkPlatform> targetPlatformRenderer = new Renderer<SdkPlatform>() {
        @Override
        public String render(SdkPlatform object) {
            if (object != null) {
                return Utils.constants.getString(object.getResourceKey());
            } else {
                return "";
            }
        }

        @Override
        public void render(SdkPlatform object, Appendable appendable) throws IOException {
            appendable.append(render(object));
        }
    };
    targetPlatform = new ValueListBox<>(targetPlatformRenderer);
    targetPlatform.addValueChangeHandler(new ValueChangeHandler<SdkPlatform>() {
        @Override
        public void onValueChange(ValueChangeEvent<SdkPlatform> event) {
            fireChanged();
        }
    });
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, targetPlatform);

    row++;
    FlexTable ecfsTable = new FlexTable();
    ecfsTable.setCellSpacing(6);

    availableAefMaps = new MultiAefMapListBox();
    selectedAefMaps = new MultiAefMapListBox();

    addAefMapButton = new Button(Utils.constants.add());
    removeAefMapButton = new Button(Utils.constants.remove());

    VerticalPanel availableEcfsPanel = new VerticalPanel();
    availableEcfsPanel.setSpacing(6);
    Label availableLabel = new Label(Utils.constants.available());
    availableEcfsPanel.add(availableLabel);
    availableEcfsPanel.add(availableAefMaps);

    VerticalPanel ecfButtonsPanel = new VerticalPanel();
    ecfButtonsPanel.setSpacing(6);
    ecfButtonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    ecfButtonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    ecfButtonsPanel.add(addAefMapButton);
    ecfButtonsPanel.add(removeAefMapButton);

    VerticalPanel selectedEcfsPanel = new VerticalPanel();
    selectedEcfsPanel.setSpacing(6);
    Label selectedLabel = new Label(Utils.constants.selected());
    selectedEcfsPanel.add(selectedLabel);
    selectedEcfsPanel.add(selectedAefMaps);

    ecfsTable.setWidget(0, 0, availableEcfsPanel);
    ecfsTable.setWidget(0, 1, ecfButtonsPanel);
    ecfsTable.setWidget(0, 2, selectedEcfsPanel);

    ecfsTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    DisclosurePanel ecfsDisclosure = new DisclosurePanel(Utils.constants.ecfs());
    ecfsDisclosure.setAnimationEnabled(true);
    ecfsDisclosure.setContent(ecfsTable);

    addAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());
    removeAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());

    addAefMapButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            addAefMap();
        }
    });

    removeAefMapButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            removeAefMap();
        }
    });

    availableAefMaps.setSize("250px", "100px");
    selectedAefMaps.setSize("250px", "100px");

    availableAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() {
        @Override
        public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) {
            updateAefMapButtons();
        }
    });

    selectedAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() {
        @Override
        public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) {
            updateAefMapButtons();
        }
    });
    detailsTable.setWidget(row, 0, ecfsDisclosure);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);

    row++;
    label = new Label(Utils.constants.defaultUserVerifier());
    Renderer<UserVerifierDto> userVerifierRenderer = new Renderer<UserVerifierDto>() {
        @Override
        public String render(UserVerifierDto object) {
            if (object != null) {
                return object.getName();
            } else {
                return "";
            }
        }

        @Override
        public void render(UserVerifierDto object, Appendable appendable) throws IOException {
            appendable.append(render(object));
        }
    };
    defaultUserVerifier = new ValueListBox<>(userVerifierRenderer);
    defaultUserVerifier.addValueChangeHandler(new ValueChangeHandler<UserVerifierDto>() {
        @Override
        public void onValueChange(ValueChangeEvent<UserVerifierDto> event) {
            fireChanged();
        }
    });
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, defaultUserVerifier);
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.struct.BaseStructView.java

License:Apache License

private void init() {

    getColumnFormatter().setWidth(0, "400px");
    getColumnFormatter().setWidth(1, "400px");

    // IE workaround
    getColumnFormatter().getElement(2).setAttribute("width", "0px");

    FlexTable dateTable = new FlexTable();
    FlexTable userTable = new FlexTable();

    dateTable.getColumnFormatter().setWidth(0, "200px");
    dateTable.getColumnFormatter().setWidth(1, "200px");

    userTable.getColumnFormatter().setWidth(0, "200px");
    userTable.getColumnFormatter().setWidth(1, "200px");

    dateTimeCreatedLabel = new Label(Utils.constants.dateTimeCreated());
    dateTimeCreatedLabel.setWidth("200px");
    createdDateTime = new KaaAdminSizedTextBox(-1, false, false);
    createdDateTime.setWidth("200px");
    dateTable.setWidget(0, 0, dateTimeCreatedLabel);
    dateTable.setWidget(0, 1, createdDateTime);

    dateTimeModifiedLabel = new Label(Utils.constants.dateTimeModified());
    dateTimeModifiedLabel.setWidth("200px");
    modifiedDateTime = new KaaAdminSizedTextBox(-1, false, false);
    modifiedDateTime.setWidth("200px");
    dateTable.setWidget(1, 0, dateTimeModifiedLabel);
    dateTable.setWidget(1, 1, modifiedDateTime);

    dateTimeActivatedLabel = new Label(Utils.constants.dateTimeActivated());
    dateTimeActivatedLabel.setWidth("200px");
    activatedDateTime = new KaaAdminSizedTextBox(-1, false, false);
    activatedDateTime.setWidth("200px");
    dateTable.setWidget(2, 0, dateTimeActivatedLabel);
    dateTable.setWidget(2, 1, activatedDateTime);

    dateTimeDeactivatedLabel = new Label(Utils.constants.dateTimeDectivated());
    dateTimeDeactivatedLabel.setWidth("200px");
    deactivatedDateTime = new KaaAdminSizedTextBox(-1, false, false);
    deactivatedDateTime.setWidth("200px");
    dateTable.setWidget(3, 0, dateTimeDeactivatedLabel);
    dateTable.setWidget(3, 1, deactivatedDateTime);

    authorLabel = new Label(Utils.constants.author());
    authorLabel.setWidth("200px");
    createdUsername = new KaaAdminSizedTextBox(-1, false, false);
    createdUsername.setWidth("200px");
    userTable.setWidget(0, 0, authorLabel);
    userTable.setWidget(0, 1, createdUsername);

    modifiedByLabel = new Label(Utils.constants.lastModifiedBy());
    modifiedByLabel.setWidth("200px");
    modifiedUsername = new KaaAdminSizedTextBox(-1, false, false);
    modifiedUsername.setWidth("200px");
    userTable.setWidget(1, 0, modifiedByLabel);
    userTable.setWidget(1, 1, modifiedUsername);

    activatedByLabel = new Label(Utils.constants.activatedBy());
    activatedByLabel.setWidth("200px");
    activatedUsername = new KaaAdminSizedTextBox(-1, false, false);
    activatedUsername.setWidth("200px");
    userTable.setWidget(2, 0, activatedByLabel);
    userTable.setWidget(2, 1, activatedUsername);

    deactivatedByLabel = new Label(Utils.constants.deactivatedBy());
    deactivatedByLabel.setWidth("200px");
    deactivatedUsername = new KaaAdminSizedTextBox(-1, false, false);
    deactivatedUsername.setWidth("200px");
    userTable.setWidget(3, 0, deactivatedByLabel);
    userTable.setWidget(3, 1, deactivatedUsername);

    setWidget(0, 0, dateTable);/*from w w w .j  a  va 2  s .c o m*/
    setWidget(0, 1, userTable);

    FlexTable detailsTable = new FlexTable();
    setWidget(1, 0, detailsTable);
    getFlexCellFormatter().setColSpan(1, 0, 3);

    detailsTable.getColumnFormatter().setWidth(0, "200px");
    detailsTable.getColumnFormatter().setWidth(1, "600px");

    // IE workaround
    detailsTable.getColumnFormatter().getElement(2).setAttribute("width", "0px");

    description = new SizedTextArea(1024);
    description.setWidth("600px");
    description.getTextArea().getElement().getStyle().setPropertyPx("minHeight", 100);
    Label descriptionLabel = new Label(Utils.constants.description());
    descriptionLabel.setWidth("200px");
    detailsTable.setWidget(0, 0, descriptionLabel);
    detailsTable.setWidget(0, 1, description);

    detailsTable.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);

    body = createBody(hasErrorMessage);

    if (hasLabel()) {
        bodyLabel = new Label(Utils.constants.body());
        bodyLabel.setWidth("200px");
        ((Widget) body).setWidth("600px");
        detailsTable.setWidget(1, 0, bodyLabel);
        detailsTable.setWidget(1, 1, (Widget) body);
        detailsTable.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP);
    } else {
        detailsTable.setWidget(1, 0, (Widget) body);
        detailsTable.getFlexCellFormatter().setColSpan(1, 0, 3);
    }

    buttonsPanel = new HorizontalPanel();
    buttonsPanel.setSpacing(5);

    detailsTable.setWidget(2, 0, buttonsPanel);
    detailsTable.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    detailsTable.getFlexCellFormatter().setColSpan(2, 0, 2);

    saveButton = new Button(Utils.constants.save());
    activateButton = new Button(Utils.constants.activate());
    deactivateButton = new Button(Utils.constants.deactivate());
    downloadConfigurationButton = new Button(Utils.constants.downloadConfiguration());
    buttonsPanel.add(saveButton);
    buttonsPanel.add(activateButton);
    buttonsPanel.add(deactivateButton);
    buttonsPanel.add(downloadConfigurationButton);

    description.setFocus(true);

    saveButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            updateSaveButton(false, false);
        }
    });

    downloadConfigurationButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            String url = Window.Location.getHref();
            Window.open("/kaaAdmin/servlet/kaaConfigurationDownloadServlet?schemaId="
                    + Utils.getSchemaIdFromUrl(url) + "&endGroupId=" + Utils.getEndpointGroupIdFromUrl(url),
                    "_blank", "status=0,toolbar=0,menubar=0,location=0");
        }
    });
}

From source file:org.kie.guvnor.guided.rule.client.widget.FactPatternWidget.java

License:Apache License

/**
 * This will show the constraint editor - allowing field constraints to be
 * nested etc./*  w  ww.j  av a  2 s  .c o m*/
 */
private Widget compositeFieldConstraintEditor(final CompositeFieldConstraint constraint) {
    FlexTable t = new FlexTable();
    String desc = null;

    ClickHandler click = new ClickHandler() {

        public void onClick(ClickEvent event) {
            popupCreator.showPatternPopupForComposite((Widget) event.getSource(), constraint);
        }
    };

    if (constraint.getCompositeJunctionType().equals(CompositeFieldConstraint.COMPOSITE_TYPE_AND)) {
        desc = Constants.INSTANCE.AllOf() + ":";
    } else {
        desc = Constants.INSTANCE.AnyOf() + ":";
    }

    t.setWidget(0, 0, new ClickableLabel(desc, click, !this.readOnly));
    t.getFlexCellFormatter().setColSpan(0, 0, 2);

    FieldConstraint[] nested = constraint.getConstraints();
    DirtyableFlexTable inner = new DirtyableFlexTable();
    if (nested != null) {
        for (int i = 0; i < nested.length; i++) {
            this.renderFieldConstraint(inner, i, nested[i], constraint, true, 0);
            //add in remove icon here...
            final int currentRow = i;
            Image clear = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
            clear.setTitle(Constants.INSTANCE.RemoveThisNestedRestriction());
            clear.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {
                    if (Window.confirm(Constants.INSTANCE.RemoveThisItemFromNestedConstraint())) {
                        setModified(true);
                        constraint.removeConstraint(currentRow);
                        getModeller().refreshWidget();
                    }
                }
            });
            if (!this.readOnly) {
                //This used to be 5 and Connectives were not rendered
                inner.setWidget(i, 6, clear);
            }
        }
    }

    t.setWidget(1, 1, inner);
    t.setWidget(1, 0, new HTML("&nbsp;&nbsp;&nbsp;&nbsp;"));
    return t;
}

From source file:org.kie.guvnor.testscenario.client.VerifyFactWidget.java

License:Apache License

private FlexTable render(final VerifyFact vf) {
    FlexTable data = new FlexTable();
    for (int i = 0; i < vf.getFieldValues().size(); i++) {
        final VerifyField fld = (VerifyField) vf.getFieldValues().get(i);
        data.setWidget(i, 1, new SmallLabel(fld.getFieldName() + ":"));
        data.getFlexCellFormatter().setHorizontalAlignment(i, 1, HasHorizontalAlignment.ALIGN_RIGHT);

        final ListBox opr = new ListBox();
        opr.addItem(TestScenarioConstants.INSTANCE.equalsScenario(), "==");
        opr.addItem(TestScenarioConstants.INSTANCE.doesNotEqualScenario(), "!=");
        if (fld.getOperator().equals("==")) {
            opr.setSelectedIndex(0);/*from  w  w w  .j  a va 2s.  com*/
        } else {
            opr.setSelectedIndex(1);
        }
        opr.addChangeHandler(new ChangeHandler() {
            public void onChange(ChangeEvent event) {
                fld.setOperator(opr.getValue(opr.getSelectedIndex()));
            }
        });

        data.setWidget(i, 2, opr);
        Widget cellEditor = new VerifyFieldConstraintEditor(type, new ValueChanged() {
            public void valueChanged(String newValue) {
                fld.setExpected(newValue);
            }

        }, fld, dmo, this.scenario, this.executionTrace);

        data.setWidget(i, 3, cellEditor);

        Image del = CommonAltedImages.INSTANCE.DeleteItemSmall();
        del.setAltText(TestScenarioConstants.INSTANCE.RemoveThisFieldExpectation());
        del.setTitle(TestScenarioConstants.INSTANCE.RemoveThisFieldExpectation());
        del.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent w) {
                if (Window.confirm(TestScenarioConstants.INSTANCE
                        .AreYouSureYouWantToRemoveThisFieldExpectation(fld.getFieldName()))) {
                    vf.getFieldValues().remove(fld);
                    FlexTable data = render(vf);
                    outer.setWidget(1, 0, data);
                }
            }
        });
        data.setWidget(i, 4, del);

        if (showResults && fld.getSuccessResult() != null) {
            if (!fld.getSuccessResult().booleanValue()) {
                data.setWidget(i, 0, new Image(CommonImages.INSTANCE.warning()));
                data.setWidget(i, 5,
                        new HTML(TestScenarioConstants.INSTANCE.ActualResult(fld.getActualResult())));

                data.getCellFormatter().addStyleName(i, 5, "testErrorValue"); //NON-NLS

            } else {
                data.setWidget(i, 0, new Image(TestScenarioImages.INSTANCE.testPassed()));
            }
        }

    }
    return data;
}

From source file:org.kie.guvnor.testscenario.client.VerifyRulesFiredWidget.java

License:Apache License

private FlexTable render(final FixtureList rfl, final Scenario sc) {
    FlexTable data = new DirtyableFlexTable();

    for (int i = 0; i < rfl.size(); i++) {
        final VerifyRuleFired v = (VerifyRuleFired) rfl.get(i);

        if (showResults && v.getSuccessResult() != null) {
            if (!v.getSuccessResult().booleanValue()) {
                data.setWidget(i, 0, new Image(CommonImages.INSTANCE.warning()));
                data.setWidget(i, 4,//www .  j  a  va 2 s .  c o m
                        new HTML(TestScenarioConstants.INSTANCE.ActualResult(v.getActualResult().toString())));

                data.getCellFormatter().addStyleName(i, 4, "testErrorValue"); //NON-NLS

            } else {
                data.setWidget(i, 0, new Image(TestScenarioImages.INSTANCE.testPassed()));
            }

        }
        data.setWidget(i, 1, new SmallLabel(v.getRuleName() + ":"));
        data.getFlexCellFormatter().setAlignment(i, 1, HasHorizontalAlignment.ALIGN_RIGHT,
                HasVerticalAlignment.ALIGN_MIDDLE);

        final ListBox b = new ListBox();
        b.addItem(TestScenarioConstants.INSTANCE.firedAtLeastOnce(), "y");
        b.addItem(TestScenarioConstants.INSTANCE.didNotFire(), "n");
        b.addItem(TestScenarioConstants.INSTANCE.firedThisManyTimes(), "e");
        final TextBox num = new TextBox();
        num.setVisibleLength(5);

        if (v.getExpectedFire() != null) {
            b.setSelectedIndex((v.getExpectedFire().booleanValue()) ? 0 : 1);
            num.setVisible(false);
        } else {
            b.setSelectedIndex(2);
            String xc = (v.getExpectedCount() != null) ? "" + v.getExpectedCount().intValue() : "0";
            num.setText(xc);
        }

        b.addChangeHandler(new ChangeHandler() {
            public void onChange(ChangeEvent event) {
                String s = b.getValue(b.getSelectedIndex());
                if (s.equals("y") || s.equals("n")) {
                    num.setVisible(false);
                    v.setExpectedFire((s.equals("y")) ? Boolean.TRUE : Boolean.FALSE);
                    v.setExpectedCount(null);
                } else {
                    num.setVisible(true);
                    v.setExpectedFire(null);
                    num.setText("1");
                    v.setExpectedCount(new Integer(1));
                }
            }
        });

        b.addItem(TestScenarioConstants.INSTANCE.ChooseDotDotDot());

        num.addChangeHandler(new ChangeHandler() {
            public void onChange(ChangeEvent event) {
                v.setExpectedCount(new Integer(num.getText()));
            }
        });

        HorizontalPanel h = new HorizontalPanel();
        h.add(b);
        h.add(num);
        data.setWidget(i, 2, h);

        Image del = CommonAltedImages.INSTANCE.DeleteItemSmall();
        del.setAltText(TestScenarioConstants.INSTANCE.RemoveThisRuleExpectation());
        del.setTitle(TestScenarioConstants.INSTANCE.RemoveThisRuleExpectation());
        del.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent w) {
                if (Window.confirm(
                        TestScenarioConstants.INSTANCE.AreYouSureYouWantToRemoveThisRuleExpectation())) {
                    rfl.remove(v);
                    sc.removeFixture(v);
                    outer.setWidget(1, 0, render(rfl, sc));
                }
            }
        });

        data.setWidget(i, 3, del);

        //we only want numbers here...
        num.addKeyPressHandler(new KeyPressHandler() {
            public void onKeyPress(KeyPressEvent event) {
                if (Character.isLetter(event.getCharCode())) {
                    ((TextBox) event.getSource()).cancelKey();
                }
            }
        });
    }
    return data;
}

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

License:Educational Community License

public void onModuleLoad() {

    this.formController = lfc;
    this.setElementNames(columnModel, recordDef);

    // labels/*  w  w w  . j  a  va  2  s  . com*/
    Label lblIns = new Label("Institution");
    Label lblLoc = new Label("Location");
    Label lblAcc = new Label("Access");
    Label lblCus = new Label("User Friendly Url:");
    Label lblCs1 = new Label("https://us.continuity.ariahgroup.org/");
    Label lblLog = new Label("Login Method");
    Label lblIdp = new Label("IDP");
    Label lblIdi = new Label("Shibboleth unique attribute");
    lblIns.setStyleName("gwt-HTML-location");
    lblLoc.setStyleName("gwt-HTML-location");
    lblAcc.setStyleName("gwt-HTML-location");
    lblCus.setStyleName("gwt-HTML-location");
    lblCs1.setStyleName("gwt-HTML-location");
    lblLog.setStyleName("gwt-HTML-location");
    lblIdp.setStyleName("gwt-HTML-location");
    lblIdi.setStyleName("gwt-HTML-location");

    instBox.setWidth("100px");
    textBox.setWidth("180px");
    customUrlBox.setWidth("100px");
    idpBox.setWidth("350px");
    shibUniqueIdBox.setWidth("350px");

    // enable text boxes
    enableTextBox(instBox, true);
    enableTextBox(textBox, true);
    enableTextBox(customUrlBox, true);
    enableTextBox(idpBox, false);
    enableTextBox(shibUniqueIdBox, false);

    // access
    access.setVisibleItemCount(1);
    access.addItem("System Admin Only", "0");
    access.addItem("System and Institutional Admins Only", "3");
    access.addItem("Admins Only", "1");
    access.addItem("All Users", "2");
    systemAccessIndex.put("0", "0"); // For System Admins
    systemAccessIndex.put("3", "1"); // For System and Insitutional
    systemAccessIndex.put("1", "2"); // For Admins
    systemAccessIndex.put("2", "3"); // For All Users

    // login method
    loginMethod.setVisibleItemCount(1);
    loginMethod.addItem("Direct Login", "0");
    loginMethod.addItem("Shibboleth Login", "1");
    loginMethod.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            showErr(false);
            int idx = loginMethod.getSelectedIndex();
            enableShibTextBoxes(idx);
        }
    });

    // tables
    FlexTable formTable = new FlexTable();
    formTable.setStylePrimaryName("location-form");
    formTable.setWidget(0, 0, lblIns);
    formTable.setWidget(0, 1, instBox);
    formTable.setWidget(0, 2, lblLoc);
    formTable.setWidget(0, 3, textBox);
    formTable.getFlexCellFormatter().setColSpan(1, 0, 4);
    formTable.setWidget(1, 0, lblCus);
    formTable.setWidget(2, 0, lblCs1);
    formTable.setWidget(2, 1, customUrlBox);
    formTable.setWidget(2, 2, lblAcc);
    formTable.setWidget(2, 3, access);

    FlexTable shibTable = new FlexTable();
    shibTable.setStylePrimaryName("location-shib-form");
    shibTable.setWidget(0, 0, lblLog);
    shibTable.setWidget(0, 1, loginMethod);
    shibTable.setWidget(0, 2, lblIdp);
    shibTable.setWidget(0, 3, idpBox);
    shibTable.setWidget(1, 0, new Label(" "));
    shibTable.setWidget(1, 1, new Label(" "));
    shibTable.setWidget(1, 2, lblIdi);
    shibTable.setWidget(1, 3, shibUniqueIdBox);

    flexForm.add(formTable);
    flexForm.add(shibTable);
    itemRootName = "location";

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

    this.doExtraSectionLoad();
}

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

License:Educational Community License

protected void doExtraSectionLoad() {
    // init form//  w ww  .j av a 2s.  c  om
    final VerticalPanel vPanel = new VerticalPanel();
    final FormPanel formPanel = new FormPanel();
    formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    formPanel.setMethod(FormPanel.METHOD_POST);
    formPanel.setAction(Window.Location.getProtocol() + "//" + Window.Location.getHost()
            + "/continuity/admin/customImageUpload");

    // set form handler
    formPanel.addFormHandler(new FormHandler() {
        public void onSubmit(FormSubmitEvent event) {
            // event.setCancelled(true);
        }

        public void onSubmitComplete(FormSubmitCompleteEvent event) {
            boolean isRestore = restore.getValue().equals("true");
            if (uiImageEnum.getValue().equals("BEGIN")) {
                imgRestoreButton1.setVisible(!isRestore);
            } else if (uiImageEnum.getValue().equals("BEGIN_TEXT")) {
                imgRestoreButton2.setVisible(!isRestore);
            } else if (uiImageEnum.getValue().equals("BANNER")) {
                imgRestoreButton3.setVisible(!isRestore);
            } else if (uiImageEnum.getValue().equals("BANNER_TEXT")) {
                imgRestoreButton4.setVisible(!isRestore);
            }
            csrfToken.setValue(Cookies.getCookie(CSRF_TOKEN));
            String message = isRestore ? "Default image restored!" : "Custom image upload completed!";
            Window.alert(message);
        }
    });

    // custom image labels
    Label lblImg1 = new Label("Entry screen top image:");
    Label lblImg2 = new Label("Entry screen bottom image:");
    Label lblImg3 = new Label("Banner left image:");
    Label lblImg4 = new Label("Banner right image:");
    Label lblImgDim1 = new Label("Recommended dimensions:  700 pixels x 200 pixels");
    Label lblImgDim2 = new Label("Recommended dimensions:  700 pixels x 100 pixels");
    Label lblImgDim3 = new Label("Recommended height:  80 pixels");
    Label lblImgDim4 = new Label("Recommended height:  80 pixels");

    // styles
    lblImg1.setStyleName("gwt-HTML-location-bold");
    lblImg2.setStyleName("gwt-HTML-location-bold");
    lblImg3.setStyleName("gwt-HTML-location-bold");
    lblImg4.setStyleName("gwt-HTML-location-bold");
    lblImgDim1.setStyleName("gwt-HTML-location");
    lblImgDim2.setStyleName("gwt-HTML-location");
    lblImgDim3.setStyleName("gwt-HTML-location");
    lblImgDim4.setStyleName("gwt-HTML-location");

    // entry fields
    imgInstallButton1.setStyleName("ButtonClass");
    imgInstallButton2.setStyleName("ButtonClass");
    imgInstallButton3.setStyleName("ButtonClass");
    imgInstallButton4.setStyleName("ButtonClass");
    imgRestoreButton1.setStyleName("ButtonClass");
    imgRestoreButton2.setStyleName("ButtonClass");
    imgRestoreButton3.setStyleName("ButtonClass");
    imgRestoreButton4.setStyleName("ButtonClass");
    imgUpload1.setStyleName("ButtonClass");
    imgUpload2.setStyleName("ButtonClass");
    imgUpload3.setStyleName("ButtonClass");
    imgUpload4.setStyleName("ButtonClass");
    imgUpload1.setWidth("300px");
    imgUpload2.setWidth("300px");
    imgUpload3.setWidth("300px");
    imgUpload4.setWidth("300px");
    imgUpload1.setName("uploadedImg1");
    imgUpload2.setName("uploadedImg2");
    imgUpload3.setName("uploadedImg3");
    imgUpload4.setName("uploadedImg4");

    // construct table
    FlexTable imageTable = new FlexTable();
    imageTable.setStylePrimaryName("location-form");

    imageTable.getFlexCellFormatter().setColSpan(0, 0, 3);
    imageTable.setWidget(0, 0, lblImg1);
    imageTable.getFlexCellFormatter().setColSpan(1, 0, 3);
    imageTable.setWidget(1, 0, lblImgDim1);
    imageTable.setWidget(2, 0, imgUpload1);
    imageTable.setWidget(2, 1, imgInstallButton1);
    imageTable.setWidget(2, 2, imgRestoreButton1);

    imageTable.getFlexCellFormatter().setColSpan(3, 0, 3);
    imageTable.setWidget(3, 0, lblImg2);
    imageTable.getFlexCellFormatter().setColSpan(4, 0, 3);
    imageTable.setWidget(4, 0, lblImgDim2);
    imageTable.setWidget(5, 0, imgUpload2);
    imageTable.setWidget(5, 1, imgInstallButton2);
    imageTable.setWidget(5, 2, imgRestoreButton2);

    imageTable.getFlexCellFormatter().setColSpan(6, 0, 3);
    imageTable.setWidget(6, 0, lblImg3);
    imageTable.getFlexCellFormatter().setColSpan(7, 0, 3);
    imageTable.setWidget(7, 0, lblImgDim3);
    imageTable.setWidget(8, 0, imgUpload3);
    imageTable.setWidget(8, 1, imgInstallButton3);
    imageTable.setWidget(8, 2, imgRestoreButton3);

    imageTable.getFlexCellFormatter().setColSpan(9, 0, 3);
    imageTable.setWidget(9, 0, lblImg4);
    imageTable.getFlexCellFormatter().setColSpan(10, 0, 3);
    imageTable.setWidget(10, 0, lblImgDim4);
    imageTable.setWidget(11, 0, imgUpload4);
    imageTable.setWidget(11, 1, imgInstallButton4);
    imageTable.setWidget(11, 2, imgRestoreButton4);

    imageTable.setWidget(12, 0, systemDomainId);
    imageTable.setWidget(12, 1, restore);
    imageTable.setWidget(12, 2, uiImageEnum);

    // button click listener
    imgInstallButton1.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            customImageFormSubmit(formPanel, imgUpload1, false, "BEGIN");
        }
    });
    imgInstallButton2.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            customImageFormSubmit(formPanel, imgUpload2, false, "BEGIN_TEXT");
        }
    });
    imgInstallButton3.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            customImageFormSubmit(formPanel, imgUpload3, false, "BANNER");
        }
    });
    imgInstallButton4.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            customImageFormSubmit(formPanel, imgUpload4, false, "BANNER_TEXT");
        }
    });
    imgRestoreButton1.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            customImageFormSubmit(formPanel, imgUpload1, true, "BEGIN");
        }
    });
    imgRestoreButton2.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            customImageFormSubmit(formPanel, imgUpload2, true, "BEGIN_TEXT");
        }
    });
    imgRestoreButton3.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            customImageFormSubmit(formPanel, imgUpload3, true, "BANNER");
        }
    });
    imgRestoreButton4.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            customImageFormSubmit(formPanel, imgUpload4, true, "BANNER_TEXT");
        }
    });

    // vertical panel
    vPanel.setStylePrimaryName("location-shib-form");
    vPanel.add(new HTML("<h1>Upload Custom Images</h1>"));
    vPanel.add(new HTML(
            "To upload custom images, highlight the row on the grid then use the entry form below to upload your images."));

    // add table to form
    formPanel.add(imageTable);
    vPanel.add(formPanel);

    // dock form
    //      dockPanel.add(vPanel, DockPanel.SOUTH);
    RootPanel rootPanel = RootPanel.get("gwtRoot");
    rootPanel.add(vPanel);
}

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 w w . j a  v a  2 s . co 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.project.client.ImageViewer.java

License:Educational Community License

public void onModuleLoad() {

    ///*from  w  w  w. j ava  2 s.co  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();

}