/** * Tracks changes in model selections to forward to a selectable. * <p> * {@inheritDoc} */ public void valueChanged(ListSelectionEvent e) { ULCListSelectionModel sm = (ULCListSelectionModel) e.getSource(); int[] selectedIndices = getSelectedIndices(sm); int[] modelIndices; if (selectedIndices.length > 0) { if (rowMapper != null) { int[] viewIndices = selectedIndices; modelIndices = new int[viewIndices.length]; for (int i = 0; i < viewIndices.length; i++) { modelIndices[i] = rowMapper.modelIndex(viewIndices[i]); } } else { modelIndices = selectedIndices; } } else { modelIndices = selectedIndices; } viewSelectable.setSelectedIndices(modelIndices); } }
/** * Sets the selected indices of the UI component if it is a collection * component (table, list, ...). More accurately, the selected indices are set * to the view connector that adapts the UI component to the Jspresso binding * architecture. * * @param viewPath * the view index path to follow. * <ul> * <li>A positive integer n means the nth child.</li> * <li>A negative integer -n means the nth parent.</li> * </ul> * @param selectedIndices * the selected indices to store in the action context. * @param context * the action context. */ protected void setSelectedIndices(int[] viewPath, int[] selectedIndices, Map<String, Object> context) { IValueConnector selectableConnector = getViewConnector(viewPath, context); while (selectableConnector != null && !(selectableConnector instanceof ISelectable)) { selectableConnector = selectableConnector.getParentConnector(); } if (selectableConnector != null) { ((ISelectable) selectableConnector).setSelectedIndices(selectedIndices); } }
/** * Tracks changes in model selections to forward to a selectable. * <p> * {@inheritDoc} */ public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } SListSelectionModel sm = (SListSelectionModel) e.getSource(); int[] selectedIndices = getSelectedIndices(sm); int[] modelIndices; if (selectedIndices.length > 0) { if (rowMapper != null) { int[] viewIndices = selectedIndices; modelIndices = new int[viewIndices.length]; for (int i = 0; i < viewIndices.length; i++) { modelIndices[i] = rowMapper.modelIndex(viewIndices[i]); } } else { modelIndices = selectedIndices; } } else { modelIndices = selectedIndices; } viewSelectable.setSelectedIndices(modelIndices, sm .getLeadSelectionIndex()); } }
/** * Tracks changes in model selections to forward to a selectable. * <p> * {@inheritDoc} */ public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } ListSelectionModel sm = (ListSelectionModel) e.getSource(); int[] selectedIndices = getSelectedIndices(sm); int[] modelIndices; if (selectedIndices.length > 0) { if (rowMapper != null) { int[] viewIndices = selectedIndices; modelIndices = new int[viewIndices.length]; for (int i = 0; i < viewIndices.length; i++) { modelIndices[i] = rowMapper.modelIndex(viewIndices[i]); } } else { modelIndices = selectedIndices; } } else { modelIndices = selectedIndices; } viewSelectable.setSelectedIndices(modelIndices, sm .getLeadSelectionIndex()); } }
modelLeadingIndex = viewLeadingIndex; viewSelectable.setSelectedIndices(modelIndices, modelLeadingIndex);
modelLeadingIndex = viewLeadingIndex; viewSelectable.setSelectedIndices(modelIndices, modelLeadingIndex);
selectable.setSelectedIndices(((RemoteSelectionCommand) command).getSelectedIndices(), leadingIndex);