/** * Sets the ActionContextConstants.ACTION_PARAM with the selected components * of the backend connector. * <p> * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { setActionParameter(getSelectedModels(context), context); return super.execute(actionHandler, context); } }
/** * Refined to return a collection descriptor. * <p> * {@inheritDoc} */ @Override protected ICollectionDescriptorProvider<?> getModelDescriptor(Map<String, Object> context) { IModelDescriptor modelDescriptor = super.getModelDescriptor(context); if (modelDescriptor instanceof ICollectionDescriptorProvider<?>) { return (ICollectionDescriptorProvider<?>) modelDescriptor; } return (ICollectionDescriptorProvider<?>) getModelConnector(context).getModelDescriptor(); }
/** * Gets the selected objects from the backend collection connector and the * selected indices. * * @param context * the action context. * @return the list of selected objects. * @deprecated use getSelectedModels instead. */ @Deprecated protected List<?> getSelectedObjects(Map<String, Object> context) { return getSelectedModels(getViewPath(), context); }
/** * refined to return a collection connector. * <p> * {@inheritDoc} */ @Override protected ICollectionConnector getModelConnector(Map<String, Object> context) { IValueConnector connector = super.getModelConnector(getViewPath(), context); // for handling table editing connectors... while (connector != null && !(connector instanceof ICollectionConnector)) { connector = connector.getParentConnector(); } return (ICollectionConnector) connector; }
/** * Adds a new object in the projected collection. * <p> * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { BeanCollectionModule module = (BeanCollectionModule) getModule(context); List<Object> projectedCollection; if (module.getModuleObjects() == null) { projectedCollection = new ArrayList<>(); } else { projectedCollection = new ArrayList<>(module.getModuleObjects()); } Object newModuleObject = createNewModuleObject(actionHandler, context); projectedCollection.add(newModuleObject); module.setModuleObjects(projectedCollection); setSelectedModels(Collections.singleton(newModuleObject), context); return super.execute(actionHandler, context); }
/** * Retrieves the managed collection from the model connector then clones the * selected elements. * <p> * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { int[] selectedIndices = getSelectedIndices(context); ICollectionConnector collectionConnector = getModelConnector(context); if (selectedIndices == null || selectedIndices.length == 0 || collectionConnector == null) { return false; } Collection<Object> elementClones = new ArrayList<Object>(); for (int i = 0; i < selectedIndices.length; i++) { Object element = collectionConnector .getChildConnector(selectedIndices[i]).getConnectorValue(); elementClones.add(cloneElement(element, context)); } context.put(ActionContextConstants.SELECTED_INDICES, ConnectorHelper .getIndicesOf(collectionConnector, elementClones)); return super.execute(actionHandler, context); }
/** * Adds a new object in the projected collection. * <p> * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { ICompositeValueConnector moduleConnector = getModuleConnector(context); BeanCollectionModule module = (BeanCollectionModule) moduleConnector .getConnectorValue(); Collection<Object> projectedCollection; if (module.getModuleObjects() == null) { projectedCollection = new ArrayList<Object>(); } else { projectedCollection = new ArrayList<Object>(module.getModuleObjects()); } Object newModuleObject = createNewModuleObject(actionHandler, context); projectedCollection.add(newModuleObject); module.setModuleObjects(projectedCollection); ICollectionConnector moduleObjectsConnector = getSourceModelConnector(context); if (moduleObjectsConnector == null) { moduleObjectsConnector = getModelConnector(context); } moduleObjectsConnector.setConnectorValue(projectedCollection); context.put(ActionContextConstants.SELECTED_INDICES, ConnectorHelper .getIndicesOf(moduleObjectsConnector, Collections .singleton(newModuleObject))); return super.execute(actionHandler, context); }
.getIndicesOf(collectionConnector, elementsToMove)); return super.execute(actionHandler, context);
return super.execute(actionHandler, context);
return super.execute(actionHandler, context);
return super.execute(actionHandler, context);
return super.execute(actionHandler, context);
/** * Retrieves the managed collection from the model connector then registers * the selected elements. * <p> * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { int[] selectedIndices = getSelectedIndices(context); ICollectionConnector collectionConnector = getModelConnector(context); if (selectedIndices == null || selectedIndices.length == 0 || collectionConnector == null) { return false; } List<Object> transferedComponents = new ArrayList<Object>(); for (int i = 0; i < selectedIndices.length; i++) { transferedComponents.add(collectionConnector.getChildConnector( selectedIndices[i]).getConnectorValue()); } getController(context).storeComponents( new ComponentTransferStructure(getModelDescriptor(context) .getCollectionDescriptor().getElementDescriptor(), transferedComponents, transferMode)); return super.execute(actionHandler, context); }
return super.execute(actionHandler, context);
return super.execute(actionHandler, context);
return super.execute(actionHandler, context);
return super.execute(actionHandler, context);
setSelectedModels(getViewPath(), newComponents, context); return super.execute(actionHandler, context);
return super.execute(actionHandler, context);
.getIndicesOf(collectionConnector, newComponents)); return super.execute(actionHandler, context);