/** * Configures the view descriptor used to construct the view that will be * displayed when this module is selected. * * @param projectedViewDescriptor * the projectedViewDescriptor to set. */ public void setProjectedViewDescriptor(IViewDescriptor projectedViewDescriptor) { if (projectedViewDescriptor instanceof BasicViewDescriptor) { ((BasicViewDescriptor) projectedViewDescriptor).setModelDescriptor(null); } this.projectedViewDescriptor = projectedViewDescriptor; }
/** * Create default property view descriptor basic property view descriptor. * * @param queriableProperty * the queriable property * @param actualPropertyDescriptor * the actual property descriptor * @return the basic property view descriptor */ protected BasicPropertyViewDescriptor createDefaultPropertyViewDescriptor(String queriableProperty, IPropertyDescriptor actualPropertyDescriptor) { BasicPropertyViewDescriptor propertyView; if (actualPropertyDescriptor instanceof IStringPropertyDescriptor) { propertyView = new BasicStringPropertyViewDescriptor(); } else { propertyView = new BasicPropertyViewDescriptor(); } propertyView.setName(queriableProperty); return propertyView; }
/** * {@inheritDoc} */ @Override public String getI18nName(ITranslationProvider translationProvider, Locale locale) { if (getName() == null) { if (getModelDescriptor() != null) { return getModelDescriptor().getI18nName(translationProvider, locale); } } return super.getI18nName(translationProvider, locale); }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public ITreeLevelDescriptor getRootSubtreeDescriptor() { if (rootSubtreeDescriptor == null) { BasicCollectionDescriptor<Object> fakeCollDescriptor = new BasicCollectionDescriptor<Object>(); fakeCollDescriptor .setElementDescriptor((IComponentDescriptor<Object>) getModelDescriptor()); BasicCollectionPropertyDescriptor<Object> fakeCollPropDescriptor = new BasicCollectionPropertyDescriptor<Object>(); fakeCollPropDescriptor.setReferencedDescriptor(fakeCollDescriptor); BasicListViewDescriptor fakeListViewDescriptor = new BasicListViewDescriptor(); fakeListViewDescriptor.setRenderedProperty(renderedProperty); fakeListViewDescriptor.setModelDescriptor(fakeCollPropDescriptor); rootSubtreeDescriptor = new BasicSimpleTreeLevelDescriptor(); ((BasicSimpleTreeLevelDescriptor) rootSubtreeDescriptor) .setNodeGroupDescriptor(fakeListViewDescriptor); ((BasicSimpleTreeLevelDescriptor) rootSubtreeDescriptor) .setChildDescriptor(childDescriptor); } return rootSubtreeDescriptor; }
/** * Create default projected view descriptor. * * @return the view descriptor */ protected IViewDescriptor createDefaultProjectedViewDescriptor() { BasicComponentViewDescriptor defaultProjectedViewDescriptor = new BasicComponentViewDescriptor(); defaultProjectedViewDescriptor.setModelDescriptor(componentDescriptor); defaultProjectedViewDescriptor.setBorderType(EBorderType.TITLED); defaultProjectedViewDescriptor.setName(componentDescriptor.getName()); defaultProjectedViewDescriptor.setColumnCount(3); return defaultProjectedViewDescriptor; }
/** * Constructs a new {@code ChangePasswordAction} instance. */ public ChangePasswordAction() { BasicComponentViewDescriptor viewDescriptor = new BasicComponentViewDescriptor(); viewDescriptor.setModelDescriptor(AbstractChangePasswordAction.PASSWD_CHANGE_DESCRIPTOR); setViewDescriptor(viewDescriptor); }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public IViewDescriptor createLovViewDescriptor( IReferencePropertyDescriptor entityRefDescriptor) { BasicSplitViewDescriptor lovViewDescriptor = new BasicSplitViewDescriptor(); lovViewDescriptor.setLeftTopViewDescriptor(queryViewDescriptorFactory .createQueryViewDescriptor( entityRefDescriptor.getComponentDescriptor())); lovViewDescriptor .setRightBottomViewDescriptor(createResultViewDescriptor(entityRefDescriptor .getComponentDescriptor())); return lovViewDescriptor; }
/** * {@inheritDoc} */ @Override public String getI18nDescription(ITranslationProvider translationProvider, Locale locale) { if (getDescription() == null) { if (getModelDescriptor() != null) { return getModelDescriptor().getI18nDescription(translationProvider, locale); } } return super.getI18nDescription(translationProvider, locale); }
/** * {@inheritDoc} */ @Override public String getIconImageURL() { String iconImageURL = super.getIconImageURL(); if (iconImageURL == null && getModelDescriptor() instanceof IComponentDescriptor) { iconImageURL = ((IComponentDescriptor<?>) getModelDescriptor()) .getIconImageURL(); setIconImageURL(iconImageURL); } return iconImageURL; }
/** * {@inheritDoc} */ @Override public String getIconImageURL() { String iconImageURL = super.getIconImageURL(); if (iconImageURL == null) { iconImageURL = ((IComponentDescriptorProvider<?>) getModelDescriptor()) .getComponentDescriptor().getIconImageURL(); setIconImageURL(iconImageURL); } return iconImageURL; }
/** * If no model is defined on this composite view descriptor, gets the one from * its leading child. * <p> * {@inheritDoc} */ @Override public IModelDescriptor getModelDescriptor() { IModelDescriptor modelDescriptor = super.getModelDescriptor(); if (isCascadingModels() && modelDescriptor == null) { List<IViewDescriptor> childViewDescriptors = getChildViewDescriptors(); if (childViewDescriptors != null && !childViewDescriptors.isEmpty()) { modelDescriptor = childViewDescriptors.get(0).getModelDescriptor(); } } return modelDescriptor; } }
/** * {@inheritDoc} */ @Override public String getIconImageURL() { String iconImageURL = super.getIconImageURL(); if (iconImageURL == null) { iconImageURL = ((ICollectionDescriptorProvider<?>) getModelDescriptor()) .getCollectionDescriptor().getElementDescriptor().getIconImageURL(); setIconImageURL(iconImageURL); } return iconImageURL; } }
/** * {@inheritDoc} */ @Override public Collection<String> getGrantedRoles() { Collection<String> grantedRoles = super.getGrantedRoles(); if (grantedRoles == null && getModelDescriptor() != null) { IComponentDescriptor<?> componentDescriptor = ((IComponentDescriptorProvider<?>) getModelDescriptor()) .getComponentDescriptor(); grantedRoles = componentDescriptor.getGrantedRoles(); } return grantedRoles; } }
/** * {@inheritDoc} */ @Override public String getIconImageURL() { String iconImageURL = super.getIconImageURL(); if (iconImageURL == null) { iconImageURL = rootSubtreeDescriptor.getNodeGroupDescriptor() .getIconImageURL(); setIconImageURL(iconImageURL); } return iconImageURL; }
/** * Gets the model descriptor this action was triggered on. * * @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 context * the action context. * @return the model connector this action was triggered on. */ protected IModelDescriptor getModelDescriptorFromPermId(String viewPermId, Map<String, Object> context) { int[] viewPathFromPermId = ViewHelper.getViewPathFromPermId(viewPermId, getView(context)); return getModelDescriptor(viewPathFromPermId, context); }
/** * Constructs a new <code>BasicWorkspaceViewDescriptor</code> instance. */ public BasicWorkspaceViewDescriptor() { BasicSimpleTreeLevelDescriptor modulesTreeLevelDescriptor = new BasicSimpleTreeLevelDescriptor(); BasicListViewDescriptor moduleNodeGroupDescriptor = new BasicListViewDescriptor(); moduleNodeGroupDescriptor .setModelDescriptor(WorkspaceDescriptor.WORKSPACE_DESCRIPTOR .getPropertyDescriptor("modules")); moduleNodeGroupDescriptor.setRenderedProperty("i18nName"); modulesTreeLevelDescriptor.setNodeGroupDescriptor(moduleNodeGroupDescriptor); modulesTreeLevelDescriptor.setChildDescriptor(new BasicModuleViewDescriptor()); setChildDescriptor(modulesTreeLevelDescriptor); setRenderedProperty("i18nName"); } }
/** * Constructs a new <code>ChangePasswordAction</code> instance. */ public ChangePasswordAction() { putInitialContext(ActionContextConstants.ACTION_PARAM, new HashMap<String, Object>()); BasicComponentViewDescriptor viewDescriptor = new BasicComponentViewDescriptor(); viewDescriptor .setModelDescriptor(AbstractChangePasswordAction.PASSWD_CHANGE_DESCRIPTOR); setViewDescriptor(viewDescriptor); } }
/** * 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 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 selectedModels * the list of models to select in the view connector. * @param context * the action context. */ protected void setSelectedModelsFromPermId(String viewPermId, Collection<?> selectedModels, Map<String, Object> context) { int[] viewPathFromPermId = ViewHelper.getViewPathFromPermId(viewPermId, getView(context)); setSelectedModels(viewPathFromPermId, selectedModels, context); }
/** * Gets the model this action was triggered on. * * @param <T> * type inference return. * @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 context * the action context. * @return the model. */ protected <T> T getModelFromPermId(String viewPermId, Map<String, Object> context) { int[] viewPathFromPermId = ViewHelper.getViewPathFromPermId(viewPermId, getView(context)); return getModel(viewPathFromPermId, context); }
/** * Gets the selected indices out of the UI component if it is a collection * component (table, list, ...). More accurately, the selected indices are * taken from 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 context * the action context. * @return the selected indices stored in the action context. */ protected int[] getSelectedIndicesFromPermId(String viewPermId, Map<String, Object> context) { int[] viewPathFromPermId = ViewHelper.getViewPathFromPermId(viewPermId, getView(context)); return getSelectedIndices(viewPathFromPermId, context); }