예제 #1
0
  public PropertyEditor attach(RootedProperty model) {
    if (model == null) {
      detach();
      return this;
    }

    if (!canEdit(model.getValueType(false)) && !canEdit(model.getValueType(true))) {
      throw new InvalidModelForEditorException();
    }
    if (this.model != null) {
      throw new EditorNotDetachedException();
    }

    model.getRoot().addParentPath(this, "");
    this.model = model;

    updateView();

    return this;
  }
예제 #2
0
 public void detach() {
   if (model != null) {
     model.getRoot().removeParentPath(this, "");
     model = null;
   }
 }