@Override public <T> void endVisit(EditorContext<T> ctx) { LeafValueEditor<T> editor = ctx.asLeafValueEditor(); if (editor != null) { leafValues.put(editor, editor.getValue()); } @SuppressWarnings("unchecked") AbstractEditorDelegate<T, ?> delegate = (AbstractEditorDelegate<T, ?>) ctx.getEditorDelegate(); if (delegate != null) { dirty |= delegate.isDirty(); } }
@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; } }
setInModel(ctx, editor, editor.getValue()); (ev, sender, args) -> editor.setValue((T) ((EntityModel) sender).getEntity())); eventMap.registerListener(absolutePath, "ItemsChanged", //$NON-NLS-1$ (ev, sender, args) -> updateListEditor((TakesConstrainedValueEditor<T>) editor, (ListModel) sender)); T selectedItem = (T) ((ListModel) sender).getSelectedItem(); if (editor instanceof TakesConstrainedValueListEditor && ownerModels.get(absolutePath) instanceof ListModel) { editor.setValue((T)Arrays.asList(selectedItem)); } else { editor.setValue(selectedItem);
@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()); } }
private void editCheckBoxes(ConsoleModel consoleModel, EntityModelValueCheckBoxEditor<ConsoleModel>... checkBoxes) { for (EntityModelValueCheckBoxEditor<ConsoleModel> checkBox : checkBoxes) { checkBox.asEditor().getSubEditor().setValue(consoleModel); } }
private void flushCheckBoxes(EntityModelValueCheckBoxEditor<ConsoleModel>... checkBoxes) { for (EntityModelValueCheckBoxEditor<ConsoleModel> checkBox : checkBoxes) { checkBox.asEditor().getSubEditor().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> void endVisit(EditorContext<T> ctx) { LeafValueEditor<T> editor = ctx.asLeafValueEditor(); if (editor != null) { leafValues.put(editor, editor.getValue()); } @SuppressWarnings("unchecked") AbstractEditorDelegate<T, ?> delegate = (AbstractEditorDelegate<T, ?>) ctx.getEditorDelegate(); if (delegate != null) { dirty |= delegate.isDirty(); } }
@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> void endVisit(EditorContext<T> ctx) { LeafValueEditor<T> editor = ctx.asLeafValueEditor(); if (editor != null) { leafValues.put(editor, editor.getValue()); } @SuppressWarnings("unchecked") AbstractEditorDelegate<T, ?> delegate = (AbstractEditorDelegate<T, ?>) ctx.getEditorDelegate(); if (delegate != null) { dirty |= delegate.isDirty(); } }
@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()); } }