@Override public <T> boolean visit(EditorContext<T> ctx) { println(ctx.getAbsolutePath()); data(ctx.getEditedType().getName()); data(ctx.getEditor().getClass().getName()); data("Implements: " // + ctx.asCompositeEditor() == null ? "" : "CompositeEditor " // + ctx.asHasEditorDelegate() == null ? "" : "HasEditorDelegate " // + ctx.asHasEditorErrors() == null ? "" : "HasEditorErrors " // + ctx.asLeafValueEditor() == null ? "" : "LeafValueEditor " // + ctx.asValueAwareEditor() == null ? "" : "ValueAwareEditor "); level++; return true; }
@Override public <Q> void endVisit(EditorContext<Q> ctx) { // Flush ValueAware editors ValueAwareEditor<Q> asValue = ctx.asValueAwareEditor(); AbstractEditorDelegate<?, ?> delegate; if (ctx.getEditorDelegate() == null) { delegate = delegateStack.peek(); } else { delegate = delegateStack.pop(); } assert delegate != null; if (asValue != null) { if (delegate.shouldFlush()) { asValue.flush(); } } // Pull value from LeafValueEditors and update edited object LeafValueEditor<Q> asLeaf = ctx.asLeafValueEditor(); if (delegate.shouldFlush() && asLeaf != null && ctx.canSetInModel()) { ctx.setInModel(asLeaf.getValue()); } }
@Override public <Q> boolean visit(EditorContext<Q> ctx) { Q toSet = ctx.getFromModel(); @SuppressWarnings("unchecked") AbstractEditorDelegate<Q, ?> delegate = (AbstractEditorDelegate<Q, ?>) ctx.getEditorDelegate(); if (delegate != null) { delegate.setObject(delegate.ensureMutable(toSet)); delegate.setDirty(false); } ValueAwareEditor<Q> asValue = ctx.asValueAwareEditor(); if (asValue != null) { // Call setValue for ValueAware, non-leaf editors asValue.setValue(toSet); } else { LeafValueEditor<Q> asLeaf = ctx.asLeafValueEditor(); if (asLeaf != null) { // Call setvalue for LeafValueEditors. asLeaf.setValue(toSet); } } // CompositeEditor's setValue should create sub-editors and attach them to // the EditorChain, which will traverse them. Returning true here for a // CompositeEditor would then traverse it twice. See issue 7038. return ctx.asCompositeEditor() == null; } }
@Override public <T> boolean visit(EditorContext<T> ctx) { println(ctx.getAbsolutePath()); data(ctx.getEditedType().getName()); data(ctx.getEditor().getClass().getName()); data("Implements: " // + ctx.asCompositeEditor() == null ? "" : "CompositeEditor " // + ctx.asHasEditorDelegate() == null ? "" : "HasEditorDelegate " // + ctx.asHasEditorErrors() == null ? "" : "HasEditorErrors " // + ctx.asLeafValueEditor() == null ? "" : "LeafValueEditor " // + ctx.asValueAwareEditor() == null ? "" : "ValueAwareEditor "); level++; return true; }
@Override public <T> boolean visit(EditorContext<T> ctx) { println(ctx.getAbsolutePath()); data(ctx.getEditedType().getName()); data(ctx.getEditor().getClass().getName()); data("Implements: " // + ctx.asCompositeEditor() == null ? "" : "CompositeEditor " // + ctx.asHasEditorDelegate() == null ? "" : "HasEditorDelegate " // + ctx.asHasEditorErrors() == null ? "" : "HasEditorErrors " // + ctx.asLeafValueEditor() == null ? "" : "LeafValueEditor " // + ctx.asValueAwareEditor() == null ? "" : "ValueAwareEditor "); level++; return true; }
@Override public <Q> void endVisit(EditorContext<Q> ctx) { // Flush ValueAware editors ValueAwareEditor<Q> asValue = ctx.asValueAwareEditor(); AbstractEditorDelegate<?, ?> delegate; if (ctx.getEditorDelegate() == null) { delegate = delegateStack.peek(); } else { delegate = delegateStack.pop(); } assert delegate != null; if (asValue != null) { if (delegate.shouldFlush()) { asValue.flush(); } } // Pull value from LeafValueEditors and update edited object LeafValueEditor<Q> asLeaf = ctx.asLeafValueEditor(); if (delegate.shouldFlush() && asLeaf != null && ctx.canSetInModel()) { ctx.setInModel(asLeaf.getValue()); } }
@Override public <Q> void endVisit(EditorContext<Q> ctx) { // Flush ValueAware editors ValueAwareEditor<Q> asValue = ctx.asValueAwareEditor(); AbstractEditorDelegate<?, ?> delegate; if (ctx.getEditorDelegate() == null) { delegate = delegateStack.peek(); } else { delegate = delegateStack.pop(); } assert delegate != null; if (asValue != null) { if (delegate.shouldFlush()) { asValue.flush(); } } // Pull value from LeafValueEditors and update edited object LeafValueEditor<Q> asLeaf = ctx.asLeafValueEditor(); if (delegate.shouldFlush() && asLeaf != null && ctx.canSetInModel()) { ctx.setInModel(asLeaf.getValue()); } }
@Override public <Q> boolean visit(EditorContext<Q> ctx) { Q toSet = ctx.getFromModel(); @SuppressWarnings("unchecked") AbstractEditorDelegate<Q, ?> delegate = (AbstractEditorDelegate<Q, ?>) ctx.getEditorDelegate(); if (delegate != null) { delegate.setObject(delegate.ensureMutable(toSet)); delegate.setDirty(false); } ValueAwareEditor<Q> asValue = ctx.asValueAwareEditor(); if (asValue != null) { // Call setValue for ValueAware, non-leaf editors asValue.setValue(toSet); } else { LeafValueEditor<Q> asLeaf = ctx.asLeafValueEditor(); if (asLeaf != null) { // Call setvalue for LeafValueEditors. asLeaf.setValue(toSet); } } // CompositeEditor's setValue should create sub-editors and attach them to // the EditorChain, which will traverse them. Returning true here for a // CompositeEditor would then traverse it twice. See issue 7038. return ctx.asCompositeEditor() == null; } }
@Override public <Q> boolean visit(EditorContext<Q> ctx) { Q toSet = ctx.getFromModel(); @SuppressWarnings("unchecked") AbstractEditorDelegate<Q, ?> delegate = (AbstractEditorDelegate<Q, ?>) ctx.getEditorDelegate(); if (delegate != null) { delegate.setObject(delegate.ensureMutable(toSet)); delegate.setDirty(false); } ValueAwareEditor<Q> asValue = ctx.asValueAwareEditor(); if (asValue != null) { // Call setValue for ValueAware, non-leaf editors asValue.setValue(toSet); } else { LeafValueEditor<Q> asLeaf = ctx.asLeafValueEditor(); if (asLeaf != null) { // Call setvalue for LeafValueEditors. asLeaf.setValue(toSet); } } // CompositeEditor's setValue should create sub-editors and attach them to // the EditorChain, which will traverse them. Returning true here for a // CompositeEditor would then traverse it twice. See issue 7038. return ctx.asCompositeEditor() == null; } }