protected void doEdit(T object) { checkEditor(); object = delegate.ensureMutable(object); this.object = object; delegate.setObject(object); accept(createInitializerVisitor()); DirtCollector c = new DirtCollector(); accept(c); leafValueMap = c.getLeafValues(); }
public RootEditorContext(AbstractEditorDelegate<T, ?> editorDelegate, Class<T> editedType, T value) { super(editorDelegate.getEditor(), editorDelegate.getPath()); setEditorDelegate(editorDelegate); this.editedType = editedType; this.value = value; }
protected boolean doSetViolations(Iterable<SimpleViolation> violations) { checkObject(); SimpleViolation.pushViolations(violations, asEditorDriver(), getViolationKeyMethod()); // Collect the errors, which will take care of co-editor chains. errors = new ArrayList<EditorError>(); accept(new ErrorCollector(errors)); return hasErrors(); }
@SuppressWarnings(value = {"rawtypes", "unchecked"}) public void doTraverseSyntheticCompositeEditor(EditorVisitor visitor) { Editor<?> sample = this.asCompositeEditor().createEditorForTraversal(); AbstractEditorDelegate subDelegate = delegate.createComposedDelegate(); delegate.addSubDelegate(subDelegate, path, sample); delegate.getEditorChain().traverse(visitor, subDelegate); }
protected void doFlush() { checkObject(); errors = new ArrayList<EditorError>(); accept(new Flusher()); accept(new ErrorCollector(errors)); }
public boolean isDirty() { DirtCollector c = new DirtCollector(); accept(c); return c.isDirty() || !leafValueMap.equals(c.getLeafValues()); }
@Override @SuppressWarnings("unchecked") public void setInModel(T data) { ((AbstractEditorDelegate<T, ?>) getEditorDelegate()).setObject(data); } }
public boolean setConstraintViolations(final Iterable<ConstraintViolation<?>> violations) { return doSetViolations(violations == null ? null : SimpleViolation .iterableFromConstrantViolations(violations)); }
protected void configureDelegate(AbstractEditorDelegate<T, E> rootDelegate) { rootDelegate.initialize("", getEditor()); }
/** * For debugging use only. */ @Override public String toString() { return getMessage() + " @ " + getPath(); }
protected void doInitialize(E editor) { this.editor = editor; delegate = createDelegate(); configureDelegate(delegate); }
@Override public <T> void endVisit(EditorContext<T> ctx) { toReturn.put(ctx.getAbsolutePath(), ctx.getEditor()); @SuppressWarnings("unchecked") AbstractEditorDelegate<T, ?> delegate = (AbstractEditorDelegate<T, ?>) ctx.getEditorDelegate(); if (delegate != null) { toReturn.put(delegate.getObject(), delegate); } } });
/** * Initialize a sub-delegate whenever one is added to the editor hierarchy. */ protected <R, S extends Editor<R>> void addSubDelegate( AbstractEditorDelegate<R, S> subDelegate, String path, S subEditor) { subDelegate.initialize(path, subEditor); }
public void initialize(E editor) { doInitialize(editor); } }
public static Iterable<SimpleViolation> iterableFromConstrantViolations( Iterable<ConstraintViolation<?>> violations) { return new ConstraintViolationIterable(violations); }
protected void initialize(EventBus eventBus, RequestFactory factory, String pathSoFar, E editor) { this.eventBus = eventBus; this.factory = factory; super.initialize(pathSoFar, editor); }