private void applyChanges(
      final GenericColumnCommand refreshGrid,
      final ActionRetractFactCol52 col,
      final boolean isNew) {
    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();
  }
  private ListBox loadBoundFacts(String binding) {
    ListBox listBox = new ListBox();
    listBox.addItem(GuidedDecisionTableConstants.INSTANCE.Choose());
    List<String> factBindings = rm.getLHSBoundFacts();

    for (int index = 0; index < factBindings.size(); index++) {
      String boundName = factBindings.get(index);
      if (!"".equals(boundName)) {
        listBox.addItem(boundName);
        if (boundName.equals(binding)) {
          listBox.setSelectedIndex(index + 1);
        }
      }
    }

    listBox.setEnabled(listBox.getItemCount() > 1);
    if (listBox.getItemCount() == 1) {
      listBox.clear();
      listBox.addItem(GuidedDecisionTableConstants.INSTANCE.NoPatternBindingsAvailable());
    }
    return listBox;
  }
Example #3
0
  public AuditLogViewImpl(final AuditLog auditLog, final User identity) {
    this.auditLog = auditLog;
    this.identity = identity;

    setTitle(GuidedDecisionTableConstants.INSTANCE.DecisionTableAuditLog());
    setDataBackdrop(ModalBackdrop.STATIC);
    setDataKeyboard(true);
    setFade(true);
    setRemoveOnHide(true);
    // setMaxHeigth( P500 );
    setWidth(1000 + "px");

    setBody(uiBinder.createAndBindUi(AuditLogViewImpl.this));
    add(
        new ModalFooterOKButton(
            new Command() {
              @Override
              public void execute() {
                hide();
              }
            }));

    setup();
  }
  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);
  }
Example #5
0
  public void setup() {
    // BZ-996917: Use a the gwtboostrap style "row-fluid" to allow display some events in the same
    // row.
    eventTypes.setStyleName(Styles.ROW);

    // Fill panel with available events.
    for (Map.Entry<String, Boolean> e :
        auditLog.getAuditLogFilter().getAcceptedTypes().entrySet()) {
      eventTypes.add(makeEventTypeCheckBox(e.getKey(), e.getValue()));
    }

    // Create the GWT Cell Table as events container.
    // BZ-996942: Set custom width and table css style.
    events = new CellTable<AuditLogEntry>();
    events.setWidth("100%");
    events.addStyleName(Styles.TABLE);

    final ListDataProvider<AuditLogEntry> dlp =
        new ListDataProvider<AuditLogEntry>(filterDeletedEntries(auditLog));
    dlp.addDataDisplay(events);

    AuditLogEntrySummaryColumn summaryColumn =
        new AuditLogEntrySummaryColumn(style.auditLogDetailLabel(), style.auditLogDetailValue());
    AuditLogEntryCommentColumn commentColumn = new AuditLogEntryCommentColumn();

    events.addColumn(summaryColumn);
    events.addColumn(commentColumn);

    events.setColumnWidth(summaryColumn, 60.0, Unit.PCT);
    events.setColumnWidth(commentColumn, 40.0, Unit.PCT);

    // If the current user is not an Administrator include the delete comment column
    if (identity.getRoles().contains(new RoleImpl(AppRoles.ADMIN.getName()))) {

      AuditLogEntryDeleteCommentColumn deleteCommentColumn = new AuditLogEntryDeleteCommentColumn();
      deleteCommentColumn.setFieldUpdater(
          new FieldUpdater<AuditLogEntry, SafeHtml>() {

            public void update(int index, AuditLogEntry row, SafeHtml value) {
              row.setDeleted(true);
              dlp.setList(filterDeletedEntries(auditLog));
              dlp.refresh();
            }
          });
      events.addColumn(deleteCommentColumn);
      events.setColumnWidth(commentColumn, 35.0, Unit.PCT);
      events.setColumnWidth(deleteCommentColumn, 5.0, Unit.PCT);
    }

    events.setEmptyTableWidget(
        new Label(GuidedDecisionTableConstants.INSTANCE.DecisionTableAuditLogNoEntries()));
    events.setKeyboardPagingPolicy(KeyboardPagingPolicy.CHANGE_PAGE);
    events.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    events.setPageSize(PAGE_SIZE);

    // Configure the simple pager.
    pager.setDisplay(events);
    pager.setPageSize(PAGE_SIZE);

    events.addRangeChangeHandler(
        new RangeChangeEvent.Handler() {
          @Override
          public void onRangeChange(final RangeChangeEvent event) {
            cellTablePagination.rebuild(pager);
          }
        });

    cellTablePagination.rebuild(pager);

    // Add the table to the container.
    eventsContainer.add(events);
  }
 @Override
 public String getTitle() {
   return GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardFactPatternConstraints();
 }
  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();
              }
            }));
  }
 @Override
 public String getTitle() {
   return GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardActionInsertFacts();
 }
 @WorkbenchPartTitle
 public String getTitle() {
   return GuidedDecisionTableConstants.INSTANCE.Analysis();
 }
 @Override
 public String getTitle() {
   return GuidedDecisionTableConstants.INSTANCE.ConditionBRLFragmentConfiguration();
 }