Пример #1
0
  @PostConstruct
  public void init() {

    final ClickEvent ce =
        new ClickEvent() {
          public void selected(String text) {
            drlEditor.insertAtCursor(text);
          }
        };

    this.factTypeBrowser = new FactTypeBrowserWidget(ce);
    this.dslConditionsBrowser =
        new DSLSentenceBrowserWidget(
            ce,
            DRLTextEditorConstants.INSTANCE.showDSLConditions(),
            DRLTextEditorConstants.INSTANCE.dslConditions());
    this.dslActionsBrowser =
        new DSLSentenceBrowserWidget(
            ce,
            DRLTextEditorConstants.INSTANCE.showDSLActions(),
            DRLTextEditorConstants.INSTANCE.dslActions());
    initWidget(uiBinder.createAndBindUi(this));

    columnBrowsers.add(factTypeBrowser);
    columnBrowsers.add(dslConditionsBrowser);
    columnBrowsers.add(dslActionsBrowser);
  }
Пример #2
0
  private Column generateButtonColumn() {
    Column buttonColumn = new Column(buildColumnSize(12));
    buttonColumn.getElement().getStyle().setProperty("textAlign", "right");
    buttonColumn.getElement().getStyle().setProperty("paddingRight", "3px");
    buttonColumn.getElement().getStyle().setProperty("textTop", "2px");

    buttonColumn.add(generateRemoveButton());
    return buttonColumn;
  }
  private Widget createValuePairItem(
      final Annotation annotation,
      final AnnotationValuePairDefinition valuePairDefinition,
      final AnnotationSource annotationSource) {
    final Row valuePairRow = new Row();
    final FormGroup formGroup = new FormGroup();
    valuePairRow.add(formGroup);

    final FormLabel formLabel = new FormLabel();
    formLabel.addStyleName(ColumnSize.MD_3.getCssName());
    formLabel.setText(valuePairDefinition.getName());
    formGroup.add(formLabel);

    final Column column = new Column(ColumnSize.MD_9);
    formGroup.add(column);
    final TextBox content = new TextBox();
    column.add(content);
    final String valuePairString =
        getValuePairStringValue(annotation, valuePairDefinition, annotationSource);
    content.setText(valuePairString);
    content.setReadOnly(true);
    content.setTitle(valuePairString);

    final Button editButton =
        new Button(
            Constants.INSTANCE.advanced_domain_annotation_list_editor_action_edit(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                presenter.onEditValuePair(annotation, valuePairDefinition.getName());
              }
            });
    editButton.setEnabled(!readonly);
    editButton.setIcon(IconType.EDIT);

    final Button clearButton =
        new Button(
            Constants.INSTANCE.advanced_domain_annotation_list_editor_action_clear(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                presenter.onClearValuePair(annotation, valuePairDefinition.getName());
              }
            });
    clearButton.setEnabled(!readonly);
    clearButton.setIcon(IconType.ERASER);

    final FormGroup formGroupButton = new FormGroup();
    formGroupButton.add(editButton);
    formGroupButton.add(clearButton);
    final Column columnButton = new Column(ColumnSize.MD_9);
    columnButton.setOffset(ColumnOffset.MD_3);
    columnButton.add(formGroupButton);
    valuePairRow.add(columnButton);

    return valuePairRow;
  }
Пример #4
0
 @Override
 public void onResize() {
   final int height = getParent().getOffsetHeight() - VERTICAL_MARGIN;
   row.setHeight((height > 0 ? height : 0) + "px");
   drlContainer.setHeight(((height > 0 ? height : 0) + SCROLL_BAR_SIZE) + "px");
   drlEditor.onResize();
 }
Пример #5
0
 private DropColumnPanel generateDropColumnPanel(
     Column column, ColumnEditorWidget parent, boolean addToColumn) {
   final DropColumnPanel drop = new DropColumnPanel(parent);
   if (addToColumn) {
     column.add(drop);
   }
   return drop;
 }
Пример #6
0
  private void generateColumns(Row rowWidget, List<LayoutColumn> layoutColumns) {

    for (LayoutColumn layoutColumn : layoutColumns) {

      Column column = createColumn(layoutColumn);
      ColumnEditorWidget parent = new ColumnEditorWidget(row, column, layoutColumn.getSpan());

      // Create the drop panel always, but don't add it to the column in case we're reloading an
      // existing layout, and the column already contains elements
      DropColumnPanel dropColumnPanel =
          generateDropColumnPanel(column, parent, !layoutColumn.hasElements());

      for (LayoutRow editor : layoutColumn.getRows()) {
        column.add(createRowView(parent, dropColumnPanel, editor));
      }

      for (LayoutComponent layoutComponent : layoutColumn.getLayoutComponents()) {
        final LayoutDragComponent layoutDragComponent = getLayoutDragComponent(layoutComponent);
        column.add(createLayoutComponentView(parent, layoutComponent, layoutDragComponent));
      }

      rowWidget.add(column);
    }
  }
Пример #7
0
 private Column createColumn(String span) {
   Column column = new Column(buildColumnSize(Integer.valueOf(span)));
   ColumnEditorWidget columnEditor = new ColumnEditorWidget(row, column, span);
   column.add(new DropColumnPanel(columnEditor));
   return column;
 }
  @UiHandler("search")
  public void onSearchClick(final ClickEvent e) {
    errorPanel.clear();
    formGroup.setValidationState(ValidationState.NONE);
    final Map<String, Object> metadata = new HashMap<String, Object>();
    if (!sourceTextBox.getText().trim().isEmpty()) {
      metadata.put("dcore.source[0]", sourceTextBox.getText().trim());
    }

    if (!createdByTextBox.getText().trim().isEmpty()) {
      metadata.put("createdBy", createdByTextBox.getText().trim());
    }

    if (!descriptionByTextBox.getText().trim().isEmpty()) {
      metadata.put("dcore.description[0]", descriptionByTextBox.getText().trim());
    }

    if (!formatTypeahead.getText().trim().isEmpty()) {
      final String pattern =
          clientTypeRegistry.resolveWildcardPattern(formatTypeahead.getText().trim());
      metadata.put("filename", pattern);
    }

    if (!subjectTextBox.getText().trim().isEmpty()) {
      metadata.put("dcore.subject[0]", subjectTextBox.getText().trim());
    }

    if (!typeTextBox.getText().trim().isEmpty()) {
      metadata.put("dcore.type[0]", typeTextBox.getText().trim());
    }

    if (!lastModifiedByTextBox.getText().trim().isEmpty()) {
      metadata.put("lastModifiedBy", lastModifiedByTextBox.getText().trim());
    }

    if (!externalLinkTextBox.getText().trim().isEmpty()) {
      metadata.put("dcore.relation[0]", externalLinkTextBox.getText().trim());
    }

    if (!checkinCommentTextBox.getText().trim().isEmpty()) {
      metadata.put("checkinComment", checkinCommentTextBox.getText().trim());
    }

    boolean hasSomeDateValue = false;

    if (createdAfter.getValue() != null) {
      hasSomeDateValue = true;
    }

    if (createdBefore.getValue() != null) {
      hasSomeDateValue = true;
    }

    if (lastModifiedAfter.getValue() != null) {
      hasSomeDateValue = true;
    }

    if (lastModifiedBefore.getValue() != null) {
      hasSomeDateValue = true;
    }

    if (metadata.size() == 0 && !hasSomeDateValue) {
      formGroup.setValidationState(ValidationState.ERROR);
      Alert alert = new Alert(Constants.INSTANCE.AtLeastOneFieldMustBeSet(), AlertType.DANGER);
      alert.setVisible(true);
      alert.setDismissable(true);
      errorPanel.add(alert);
      return;
    }

    final SearchResultTable queryTable =
        new SearchResultTable(
            new QueryMetadataPageRequest(
                metadata,
                createdAfter.getValue(),
                createdBefore.getValue(),
                lastModifiedAfter.getValue(),
                lastModifiedBefore.getValue(),
                0,
                null));
    simplePanel.clear();

    simplePanel.add(queryTable);

    formAccordionCollapse.setIn(false);
    resultAccordionCollapse.setIn(true);
  }