示例#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
  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());
  }