public SelectUserOrRoleDialog(
      ArrayList<String> existing, final IUserRoleSelectedCallback callback) {
    super(
        Messages.getString("selectUserOrRole"),
        Messages.getString("ok"),
        Messages.getString("cancel"),
        false,
        true,
        contentTable); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    usersListBox.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            rolesListBox.setSelectedIndex(-1);
            okButton.setEnabled(true);
          }
        });
    rolesListBox.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            usersListBox.setSelectedIndex(-1);
            okButton.setEnabled(true);
          }
        });

    setCallback(
        new IDialogCallback() {

          public void cancelPressed() {}

          public void okPressed() {
            if (getSelectedUser() != null) {
              callback.userSelected(getSelectedUser());
            } else {
              callback.roleSelected(getSelectedRole());
            }
          }
        });

    // Unique ids are important for test automation
    contentTable.getElement().setId("userOrRoleDialogContentTable");
    usersListBox.getElement().setId("userOrRoleDialogUsersList");
    rolesListBox.getElement().setId("userOrRoleDialogRolesList");
    okButton.getElement().setId("userOrRoleDialogOkButton");
    okButton.setEnabled(false);
    cancelButton.getElement().setId("userOrRoleDialogCancelButton");

    usersListBox.setVisibleItemCount(5);
    rolesListBox.setVisibleItemCount(5);
    rolesListBox.setWidth("100%"); // $NON-NLS-1$
    usersListBox.setWidth("100%"); // $NON-NLS-1$
    contentTable.clear();
    contentTable.setWidth("100%"); // $NON-NLS-1$
    contentTable.setWidget(0, 0, new Label(Messages.getString("users"))); // $NON-NLS-1$
    contentTable.setWidget(1, 0, usersListBox);
    contentTable.setWidget(2, 0, new Label(Messages.getString("roles"))); // $NON-NLS-1$
    contentTable.setWidget(3, 0, rolesListBox);
    fetchAllUsers(existing);
    fetchAllRoles(existing);
    setWidth("200px"); // $NON-NLS-1$
  }
Example #2
0
  @Override
  public void onModuleLoad() {
    addList();

    mainPanel.setLeftWidget(listbox);
    setListitems();
    listbox.setWidth("100%");
    listbox.setHeight("100%");

    listbox.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            String testcaseName = listbox.getItemText(listbox.getSelectedIndex());
            TestcaseWrapper widget = map.get(testcaseName);
            widget.show();
            panel.clear();
            panel.add(widget);
          }
        });

    mainPanel.setSplitPosition("300px");
    mainPanel.setRightWidget(panel);

    RootPanel.get().add(mainPanel);
  }
Example #3
0
  public AddRouteWorkList(
      JobOrder jobOrder, BusinessWorkListManagerTable businessWorkListManagerTable) {
    setWidget(uiBinder.createAndBindUi(this));

    this.jobOrder = jobOrder;
    this.businessWorkListManagerTable = businessWorkListManagerTable;

    bWorkListAName.setHTML(jobOrder.getAmeCode());
    bworkListZName.setHTML(jobOrder.getZmeCode());

    setSize("743px", "420px");
    setGlassEnabled(true);

    type.setValue(true);

    previewA.addClickHandler(previewAClickhandler);
    previewZ.addClickHandler(previewZClickhandler);
  }
  public ActionRetractFactPopup(
      final GuidedDecisionTable52 model,
      final GenericColumnCommand refreshGrid,
      final ActionRetractFactCol52 col,
      final boolean isNew,
      final boolean isReadOnly) {
    this.rm = new BRLRuleModel(model);
    this.editingCol = cloneActionRetractColumn(col);
    this.model = model;

    setTitle(GuidedDecisionTableConstants.INSTANCE.ColumnConfigurationDeleteAFact());
    setModal(false);

    // Show available pattern bindings, if Limited Entry
    if (model.getTableFormat() == TableFormat.LIMITED_ENTRY) {
      final LimitedEntryActionRetractFactCol52 ler =
          (LimitedEntryActionRetractFactCol52) editingCol;
      final ListBox patterns = loadBoundFacts(ler.getValue().getStringValue());
      patterns.setEnabled(!isReadOnly);
      if (!isReadOnly) {
        patterns.addClickHandler(
            new ClickHandler() {

              public void onClick(ClickEvent event) {
                int index = patterns.getSelectedIndex();
                if (index > -1) {
                  ler.getValue().setStringValue(patterns.getValue(index));
                }
              }
            });
      }
      addAttribute(GuidedDecisionTableConstants.INSTANCE.FactToDeleteColon(), patterns);
    }

    // Column header
    final TextBox header = new TextBox();
    header.setText(col.getHeader());
    header.setEnabled(!isReadOnly);
    if (!isReadOnly) {
      header.addChangeHandler(
          new ChangeHandler() {
            public void onChange(ChangeEvent event) {
              editingCol.setHeader(header.getText());
            }
          });
    }
    addAttribute(GuidedDecisionTableConstants.INSTANCE.ColumnHeaderDescription(), header);

    // Hide column tick-box
    addAttribute(
        new StringBuilder(GuidedDecisionTableConstants.INSTANCE.HideThisColumn())
            .append(GuidedDecisionTableConstants.COLON)
            .toString(),
        DTCellValueWidgetFactory.getHideColumnIndicator(editingCol));

    Button apply = new Button(GuidedDecisionTableConstants.INSTANCE.ApplyChanges());
    apply.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent w) {
            if (null == editingCol.getHeader() || "".equals(editingCol.getHeader())) {
              Window.alert(
                  GuidedDecisionTableConstants.INSTANCE
                      .YouMustEnterAColumnHeaderValueDescription());
              return;
            }
            if (isNew) {
              if (!unique(editingCol.getHeader())) {
                Window.alert(
                    GuidedDecisionTableConstants.INSTANCE
                        .ThatColumnNameIsAlreadyInUsePleasePickAnother());
                return;
              }

            } else {
              if (!col.getHeader().equals(editingCol.getHeader())) {
                if (!unique(editingCol.getHeader())) {
                  Window.alert(
                      GuidedDecisionTableConstants.INSTANCE
                          .ThatColumnNameIsAlreadyInUsePleasePickAnother());
                  return;
                }
              }
            }

            // Pass new\modified column back for handling
            refreshGrid.execute(editingCol);
            hide();
          }
        });
    addAttribute("", apply);
  }
  public ActionRetractFactPopup(
      final GuidedDecisionTable52 model,
      final GenericColumnCommand refreshGrid,
      final ActionRetractFactCol52 col,
      final boolean isNew,
      final boolean isReadOnly) {
    super(GuidedDecisionTableConstants.INSTANCE.ColumnConfigurationDeleteAFact());
    this.rm = new BRLRuleModel(model);
    this.editingCol = cloneActionRetractColumn(col);
    this.model = model;

    // Show available pattern bindings, if Limited Entry
    if (model.getTableFormat() == TableFormat.LIMITED_ENTRY) {
      final LimitedEntryActionRetractFactCol52 ler =
          (LimitedEntryActionRetractFactCol52) editingCol;
      final ListBox patterns = loadBoundFacts(ler.getValue().getStringValue());
      patterns.setEnabled(!isReadOnly);
      if (!isReadOnly) {
        patterns.addClickHandler(
            new ClickHandler() {

              public void onClick(ClickEvent event) {
                int index = patterns.getSelectedIndex();
                if (index > -1) {
                  ler.getValue().setStringValue(patterns.getValue(index));
                }
              }
            });
      }
      addAttribute(GuidedDecisionTableConstants.INSTANCE.FactToDeleteColon(), patterns);
    }

    // Column header
    final TextBox header = new TextBox();
    header.setText(col.getHeader());
    header.setEnabled(!isReadOnly);
    if (!isReadOnly) {
      header.addChangeHandler(
          new ChangeHandler() {
            public void onChange(ChangeEvent event) {
              editingCol.setHeader(header.getText());
            }
          });
    }
    addAttribute(GuidedDecisionTableConstants.INSTANCE.ColumnHeaderDescription(), header);

    // Hide column tick-box
    addAttribute(
        new StringBuilder(GuidedDecisionTableConstants.INSTANCE.HideThisColumn())
            .append(GuidedDecisionTableConstants.COLON)
            .toString(),
        DTCellValueWidgetFactory.getHideColumnIndicator(editingCol));

    // Apply button
    add(
        new ModalFooterOKCancelButtons(
            new Command() {
              @Override
              public void execute() {
                applyChanges(refreshGrid, col, isNew);
              }
            },
            new Command() {
              @Override
              public void execute() {
                hide();
              }
            }));
  }