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);
  }
 /**
  * @param selection a splittable which this function assumes is a list of {@link SelectionItem}s
  */
 public void setSelection(Splittable selection) {
   selectionItemsEditor.setSuppressEvent(true);
   AppTemplateAutoBeanFactory factory = GWT.create(AppTemplateAutoBeanFactory.class);
   SelectionItemList siList =
       AutoBeanCodex.decode(
               factory,
               SelectionItemList.class,
               "{\"selectionItems\": " + selection.getPayload() + "}")
           .as();
   List<SelectionItem> items = siList.getSelectionItems();
   tree.setSelection(items);
   selectionItemsEditor.setSuppressEvent(false);
 }
 @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);
   }
 }
 @Override
 public void setEnabled(boolean enabled) {
   super.setEnabled(enabled);
   tree.setEnabled(enabled);
   tree.getSelectionModel().setLocked(!enabled);
 }