public static DelegateMap of(EditorDriver<?> driver, KeyMethod key) { final DelegateMap toReturn = new DelegateMap(key); driver.accept(new EditorVisitor() { @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); } } }); return toReturn; }
<T> void put(String path, Editor<T> editor) { add(editorsByPath, path, editor); }
@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); } } });
/** * Records an error in any editors that match the path, returning true * if any editors matched. */ private static boolean processEditors(DelegateMap delegateMap, AbstractEditorDelegate<?, ?> baseDelegate, String absolutePath, SimpleViolation error) { List<Editor<?>> editors = delegateMap.getEditorByPath(absolutePath); if (editors == null) { return false; } // No EditorDelegate to attach it to, so record on the baseDelegate // with the appropriate editor & path. for (Editor<?> editor : editors) { baseDelegate.recordError(error.getMessage(), null, error.getUserDataObject(), error.getPath(), editor); } return true; }
delegateMap.getDelegatesByPath(absolutePath); if (leafDelegates == null) { return false;
@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); } } });
/** * Records an error in any editors that match the path, returning true * if any editors matched. */ private static boolean processEditors(DelegateMap delegateMap, AbstractEditorDelegate<?, ?> baseDelegate, String absolutePath, SimpleViolation error) { List<Editor<?>> editors = delegateMap.getEditorByPath(absolutePath); if (editors == null) { return false; } // No EditorDelegate to attach it to, so record on the baseDelegate // with the appropriate editor & path. for (Editor<?> editor : editors) { baseDelegate.recordError(error.getMessage(), null, error.getUserDataObject(), error.getPath(), editor); } return true; }
delegateMap.getDelegatesByPath(absolutePath); if (leafDelegates == null) { return false;
@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); } } });
public static DelegateMap of(EditorDriver<?> driver, KeyMethod key) { final DelegateMap toReturn = new DelegateMap(key); driver.accept(new EditorVisitor() { @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); } } }); return toReturn; }
/** * Records an error in any editors that match the path, returning true * if any editors matched. */ private static boolean processEditors(DelegateMap delegateMap, AbstractEditorDelegate<?, ?> baseDelegate, String absolutePath, SimpleViolation error) { List<Editor<?>> editors = delegateMap.getEditorByPath(absolutePath); if (editors == null) { return false; } // No EditorDelegate to attach it to, so record on the baseDelegate // with the appropriate editor & path. for (Editor<?> editor : editors) { baseDelegate.recordError(error.getMessage(), null, error.getUserDataObject(), error.getPath(), editor); } return true; }
delegateMap.getDelegatesByPath(absolutePath); if (leafDelegates == null) { return false;
<T> void put(String path, Editor<T> editor) { add(editorsByPath, path, editor); }
public static DelegateMap of(EditorDriver<?> driver, KeyMethod key) { final DelegateMap toReturn = new DelegateMap(key); driver.accept(new EditorVisitor() { @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); } } }); return toReturn; }
<T> void put(String path, Editor<T> editor) { add(editorsByPath, path, editor); }