/** * Updates the bean value with the current value of the component and all its bean-bound children. By default this * method will only process visible components. * * @param component the component whose contents need to be copied to the bean. */ public static void updateBeanValue(final WComponent component) { updateBeanValue(component, true); }
@Override public void execute(final ActionEvent event) { WebUtilities.updateBeanValue(layout); } });
@Override public void execute(final ActionEvent event) { WebUtilities.updateBeanValue(beanContainer); } });
@Override public void execute(final ActionEvent event) { WebUtilities.updateBeanValue(beanContainer); } });
@Override public void executeOnValid(final ActionEvent event) { WebUtilities.updateBeanValue(layout); messages.success("OK"); } });
/** * Override updateBeanValue to update the bean value for all WBeanComponents Updates the bean value with the value * returned by {@link #getData()}. */ @Override public void updateBeanValue() { List<?> beanList = this.getBeanList(); WComponent renderer = getRepeatedComponent(); for (int i = 0; i < beanList.size(); i++) { Object rowData = beanList.get(i); UIContext rowContext = getRowContext(rowData, i); UIContextHolder.pushContext(rowContext); try { WebUtilities.updateBeanValue(renderer); } finally { UIContextHolder.popContext(); } } }
/** * Update the expandable row renderer. * * @param rowRenderer the table row renderer * @param rowContext the row context * @param expandRenderer the renderer for the expandable row. */ private void updateBeanValueForRowRenderer(final WTableRowRenderer rowRenderer, final UIContext rowContext, final Class<? extends WComponent> expandRenderer) { Container expandWrapper = (Container) rowRenderer. getExpandedTreeNodeRenderer(expandRenderer); if (expandWrapper == null) { return; } // The actual component is wrapped in a renderer wrapper, so we have to fetch it from that WComponent expandInstance = expandWrapper.getChildAt(0); UIContextHolder.pushContext(rowContext); try { // Will apply updates to the "bean" returned by the model for this expanded renderer (ie // getValueAt(rowIndex, -1)) WebUtilities.updateBeanValue(expandInstance); } finally { UIContextHolder.popContext(); } }
/** * Updates the bean value with the current value of the component and all its bean-bound children. * * @param component the component whose contents need to be copied to the bean. * @param visibleOnly - whether to include visible components only. */ public static void updateBeanValue(final WComponent component, final boolean visibleOnly) { // Do not process if component is invisble and ignore visible is true. Will ignore entire branch from this point. if (!component.isVisible() && visibleOnly) { return; } if (component instanceof WBeanComponent) { ((WBeanComponent) component).updateBeanValue(); } // These components recursively update bean values themselves, // as they have special requirements due to repeating data. if (component instanceof WDataTable || component instanceof WTable || component instanceof WRepeater) { return; } if (component instanceof Container) { for (int i = ((Container) component).getChildCount() - 1; i >= 0; i--) { updateBeanValue(((Container) component).getChildAt(i), visibleOnly); } } }
WebUtilities.updateBeanValue(renderer); } else if (renderer instanceof DataBound) { // Update Databound renderer Object oldValue = model.getValueAt(rowIndex, col);