Exemplo n.º 1
0
 @Override
 public void setValue(Argument value) {
   super.setValue(value);
   argumentLabel.removeStyleName(appearance.getStyle().emptyGroupBgText());
   argumentLabel.setLabelSeparator("");
   final String id = Strings.nullToEmpty(value.getId());
   if (id.equals(AppTemplateUtils.EMPTY_GROUP_ARG_ID)) {
     handlerRegistration.removeHandler();
     argumentLabel.setStyleName(appearance.getStyle().emptyGroupBgText());
     argumentLabel.getElement().getStyle().setMarginTop(100, Style.Unit.PX);
     argumentLabel.getElement().getStyle().setMarginBottom(100, Style.Unit.PX);
   }
 }
 @Override
 public void setValue(Argument value) {
   if ((value == null) || !value.getType().equals(ArgumentType.TreeSelection)) {
     return;
   }
   List<SelectionItem> toBeRemoved =
       AutoBeanUtils.getAutoBean(value).getTag(SelectionItem.TO_BE_REMOVED);
   if (toBeRemoved != null) {
     selectionItemsEditor.setSuppressEvent(true);
     for (SelectionItem si : toBeRemoved) {
       tree.getStore().remove(si);
     }
     selectionItemsEditor.setSuppressEvent(false);
   }
   AutoBeanUtils.getAutoBean(value).setTag(SelectionItem.TO_BE_REMOVED, null);
   this.model = value;
   boolean restoreSelectionsFromDefaultValue =
       (value.getDefaultValue() != null)
           && (value.getDefaultValue().isIndexed())
           && (value.getDefaultValue().size() > 0);
   tree.setRestoreCheckedSelectionFromTree(!restoreSelectionsFromDefaultValue);
   selectionItemsEditor.setValue(value.getSelectionItems());
   if (restoreSelectionsFromDefaultValue) {
     /*
      * JDS If we're not in editing mode, and there is a list of items in the defaultValue field.
      * This should only happen when an app is being re-launched from the Analysis window, and
      * there were values selected for the Tree.
      */
     Splittable defValCopy = value.getDefaultValue().deepCopy();
     setSelection(defValCopy);
     /*
      * JDS Clear default value so future selections can be made (since they are made through
      * value.getSelectionItems() and not value.defaultValue()
      */
     value.setDefaultValue(null);
   }
 }