コード例 #1
0
  private void doLayout() {
    layout.clear();

    for (int i = 0; i < model.getFieldValues().length; i++) {
      ActionFieldValue val = model.getFieldValues()[i];

      layout.setWidget(i, 0, getSetterLabel());
      layout.setWidget(i, 1, fieldSelector(val));
      layout.setWidget(i, 2, valueEditor(val));
      final int idx = i;
      Image remove = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
      remove.addClickHandler(
          new ClickHandler() {

            public void onClick(ClickEvent event) {
              if (Window.confirm(Constants.INSTANCE.RemoveThisItem())) {
                model.removeField(idx);
                setModified(true);
                getModeller().refreshWidget();

                // Signal possible change in Template variables
                TemplateVariablesChangedEvent tvce =
                    new TemplateVariablesChangedEvent(getModeller().getModel());
                getEventBus().fireEventFromSource(tvce, getModeller().getModel());
              }
            }
          });
      if (!this.readOnly) {
        layout.setWidget(i, 3, remove);
      }
    }

    if (model.getFieldValues().length == 0) {
      HorizontalPanel h = new HorizontalPanel();
      h.add(getSetterLabel());
      if (!this.readOnly) {
        Image image = GuidedRuleEditorImages508.INSTANCE.Edit();
        image.setAltText(Constants.INSTANCE.AddFirstNewField());
        image.setTitle(Constants.INSTANCE.AddFirstNewField());
        image.addClickHandler(
            new ClickHandler() {

              public void onClick(ClickEvent sender) {
                showAddFieldPopup(sender);
              }
            });
        h.add(image);
      }
      layout.setWidget(0, 0, h);
    }

    // layout.setWidget( 0, 1, inner );

  }
コード例 #2
0
ファイル: CallMethodWidget.java プロジェクト: Brianxia/guvnor
  private void doLayout() {
    layout.clear();
    layout.setWidget(0, 0, getSetterLabel());
    DirtyableFlexTable inner = new DirtyableFlexTable();
    int i = 0;
    for (CallFieldValue val : mCall.getCallFieldValues()) {

      inner.setWidget(i, 0, fieldSelector(val));
      inner.setWidget(i, 1, valueEditor(val));
      i++;
    }
    layout.setWidget(0, 1, inner);
    layout.setWidget(0, 2, new DeleteButton());
  }
コード例 #3
0
  @Override
  protected Widget getCompositeLabel() {

    ClickHandler click =
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            Widget w = (Widget) event.getSource();
            showFactTypeSelector(w);
          }
        };
    String lbl =
        "<div class='form-field'>" + HumanReadable.getCEDisplayName("from entry-point") + "</div>";

    DirtyableFlexTable panel = new DirtyableFlexTable();

    int r = 0;

    if (pattern.getFactPattern() == null) {
      panel.setWidget(
          r,
          0,
          new ClickableLabel(
              "<br> <font color='red'>" + Constants.INSTANCE.clickToAddPatterns() + "</font>",
              click,
              !this.readOnly));
      r++;
    }

    panel.setWidget(r, 0, new HTML(lbl));

    this.txtEntryPoint = new TextBox();
    this.txtEntryPoint.setText(getFromEntryPointPattern().getEntryPointName());
    this.txtEntryPoint.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            getFromEntryPointPattern().setEntryPointName(txtEntryPoint.getText());
            setModified(true);
          }
        });
    panel.setWidget(r, 1, this.txtEntryPoint);

    return panel;
  }
コード例 #4
0
  protected Widget getCompositeLabel() {

    ClickHandler click =
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            Widget w = (Widget) event.getSource();
            showFactTypeSelector(w);
          }
        };
    String lbl = "<div class='form-field'>" + HumanReadable.getCEDisplayName("from") + "</div>";

    DirtyableFlexTable panel = new DirtyableFlexTable();

    int r = 0;

    if (pattern.getFactPattern() == null) {
      panel.setWidget(
          r,
          0,
          new ClickableLabel(
              "<br> <font color='red'>" + Constants.INSTANCE.clickToAddPatterns() + "</font>",
              click,
              !this.readOnly));
      r++;
    }

    panel.setWidget(r, 0, new HTML(lbl));
    ExpressionBuilder expressionBuilder =
        new ExpressionBuilder(
            this.getModeller(), this.getEventBus(), this.pattern.getExpression(), this.readOnly);
    expressionBuilder.addOnModifiedCommand(
        new Command() {
          public void execute() {
            setModified(true);
          }
        });
    panel.setWidget(r, 1, expressionBuilder);

    return panel;
  }
コード例 #5
0
 private void createWidgetForEditorLayout(
     DirtyableFlexTable editorLayout, int layoutRow, int layoutColumn, Widget widget) {
   editorLayout.setWidget(layoutRow, layoutColumn, widget);
 }