/** * 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 selectedIndices * the selected indices to store in the action context. * @param context * the action context. */ protected void setSelectedIndices(int[] selectedIndices, Map<String, Object> context) { setSelectedIndices(null, selectedIndices, context); }
/** * 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 viewPermId * the view permId to search for. The view hierarchy is climed to the top and then a chid view with the searched * permId is recursively searched. * @param selectedIndices * the selected indices to store in the action context. * @param context * the action context. */ protected void setSelectedIndicesFromPermId(String viewPermId, int[] selectedIndices, Map<String, Object> context) { int[] viewPathFromPermId = ViewHelper.getViewPathFromPermId(viewPermId, getView(context)); setSelectedIndices(viewPathFromPermId, selectedIndices, context); }
/** * Retrieves the selected models indices out of the model connector if it's a * collection connector and set them as selected indices in the action * context. * * @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 selectedModels * the list of models to select in the view connector. * @param context * the action context. */ protected void setSelectedModels(int[] viewPath, Collection<?> selectedModels, Map<String, Object> context) { IValueConnector modelConnector = getModelConnector(viewPath, context); if (modelConnector instanceof ICollectionConnector) { setSelectedIndices(viewPath, ConnectorHelper.getIndicesOf((ICollectionConnector) modelConnector, selectedModels), context); } }