private SafeHtml createArgumentLabel(ArgumentEditor argEditor) {
    SafeHtmlBuilder labelText = new SafeHtmlBuilder();
    Boolean isRequired = argEditor.requiredEditor().getValue();
    if ((isRequired != null) && isRequired) {
      // If the field is required, it needs to be marked as such.
      labelText.append(appearance.getRequiredFieldLabel());
    }
    // JDS Remove the trailing colon. The FieldLabels will apply it automatically.
    String label = Strings.nullToEmpty(argEditor.labelEditor().getValue());
    SafeHtml safeHtmlLabel = SafeHtmlUtils.fromString(label.replaceFirst(":$", ""));
    ArgumentType argumentType = argEditor.typeEditor().getValue();
    if (Info.equals(argumentType)) {
      labelText.append(appearance.sanitizeHtml(label));
    } else {
      if (Flag.equals(argumentType)) {
        labelText.append(new SafeHtmlBuilder().appendHtmlConstant(" ").toSafeHtml());
      }
      String id = argEditor.idEditor().getValue();
      String description = argEditor.descriptionEditor().getValue();

      if (Strings.isNullOrEmpty(description) || EMPTY_GROUP_ARG_ID.equals(id)) {
        labelText.append(safeHtmlLabel);
      } else {
        labelText.append(appearance.getContextualHelpLabel(safeHtmlLabel, description));
      }
    }
    return labelText.toSafeHtml();
  }
  @Inject
  public DecimalInputPropertyEditor(
      AppTemplateWizardAppearance appearance,
      AppsWidgetsPropertyPanelLabels appLabels,
      AppsWidgetsContextualHelpMessages help,
      ArgumentValidatorEditor validatorsEditor) {
    super(appearance);
    this.appLabels = appLabels;
    this.doubleInputLabels = appLabels;
    this.validatorsEditor = validatorsEditor;

    SpinnerField<Double> dblSpinnerField =
        new SpinnerField<Double>(new NumberPropertyEditor.DoublePropertyEditor());
    dblSpinnerField.setErrorSupport(new IPlantSideErrorHandler(dblSpinnerField));
    dblSpinnerField.setMinValue(-Double.MAX_VALUE);
    dblSpinnerField.setEmptyText(doubleInputLabels.doubleInputWidgetEmptyEditText());
    defaultValueEditor =
        new ArgumentEditorConverter<Double>(dblSpinnerField, new SplittableToDoubleConverter());

    initWidget(uiBinder.createAndBindUi(this));

    argumentOptionEditor.addValidator(
        new CmdLineArgCharacterValidator(I18N.V_CONSTANTS.restrictedCmdLineChars()));

    defaultValueLabel.setHTML(
        appearance.createContextualHelpLabel(
            appLabels.integerInputDefaultLabel(), help.integerInputDefaultValue()));
    omitIfBlank.setHTML(
        new SafeHtmlBuilder()
            .appendHtmlConstant("&nbsp;")
            .append(
                appearance.createContextualHelpLabelNoFloat(
                    appLabels.excludeWhenEmpty(), help.integerInputExcludeArgument()))
            .toSafeHtml());
    toolTipLabel.setHTML(
        appearance.createContextualHelpLabel(appLabels.toolTipText(), help.toolTip()));
    argumentOptionLabel.setHTML(
        appearance.createContextualHelpLabel(appLabels.argumentOption(), help.argumentOption()));
    doNotDisplay.setHTML(
        new SafeHtmlBuilder()
            .appendHtmlConstant("&nbsp;")
            .append(appLabels.doNotDisplay())
            .toSafeHtml());

    requiredEditor.setHTML(
        new SafeHtmlBuilder()
            .appendHtmlConstant("&nbsp;")
            .append(appLabels.isRequired())
            .toSafeHtml());
    editorDriver.initialize(this);
    editorDriver.accept(new InitializeTwoWayBinding(this));
  }
  public TreeSelectionEditor(
      AppTemplateWizardAppearance appearance, SelectionItemProperties props) {
    TreeStore<SelectionItem> store = new TreeStore<SelectionItem>(props.id());

    tree = new SelectionItemTree(store, props.display());
    //        if (presenter.isEditingMode()) {
    //            /*
    //             * KLUDGE CORE-4653 JDS Set selection model to locked. This is to prevent the user
    // from
    //             * making any selections due to the issue described in CORE-4653.
    //             */
    //            tree.getSelectionModel().setLocked(true);
    //            tree.setCore4653Kludge();
    //        }
    tree.setHeight(appearance.getDefaultTreeSelectionHeight());

    tree.addValueChangeHandler(new TreeValueChangeHandler());
    selectionItemsEditor = new MyTreeStoreEditor(store, this);

    // This handler must be added after the store is added to the tree, since the tree adds its own
    // handlers that must trigger before this one.
    // Restore the tree's Checked state from each item's isDefault field after it's filtered.
    store.addStoreFilterHandler(new MyStoreFilterHandler());

    VerticalLayoutContainer vlc = new VerticalLayoutContainer();
    vlc.add(buildFilter(store), new VerticalLayoutData(1, -1));
    vlc.add(tree);

    argumentLabel = new FieldLabel(vlc);
    argumentLabel.setLabelAlign(TOP);
    argumentLabel.addDomHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            TreeSelectionEditor.this.fireEvent(new ArgumentSelectedEvent(model));
          }
        },
        ClickEvent.getType());

    labelLeafEditor = new LabelLeafEditor<String>(argumentLabel, this, appearance);
    idEditor = SimpleEditor.<String>of();
    typeEditor = SimpleEditor.<ArgumentType>of();
    requiredEditor = new LabelLeafEditor<Boolean>(argumentLabel, this, appearance);
    descriptionEditor = new LabelLeafEditor<String>(argumentLabel, this, appearance);

    initWidget(argumentLabel);
    visibilityEditor = new VisibilityEditor(this);
  }
Example #4
0
 @Override
 public void setValue(String value) {
   this.prefixedMmodel = value;
   peer.setHTML(appearance.getPropertyPanelLabels().detailsPanelHeader(value));
 }