/** * Gets the modules modules. * * @return the list of modules belonging to this workspace. */ public List<Module> getModules() { return getModules(false); }
private boolean belongsTo(Workspace owner, Module module) { for (Module child : owner.getModules()) { if (belongsTo(child, module)) { return true; } } return false; }
/** * Installs a list of module(s) into this workspace. Each module may own * sub-modules that form a (potentially complex and dynamic) hierarchy, that * is visually rendered as a tree view. * * @param modules * the modules modules to set. */ public void setModules(List<Module> modules) { List<Module> oldValue = null; if (getModules() != null) { oldValue = new ArrayList<>(getModules()); } this.modules = modules; if (this.modules != null) { for (Module module : this.modules) { module.setSecurityHandler(getSecurityHandler()); } } firePropertyChange(MODULES, oldValue, getModules()); }
/** * Constructs a new <code>WorkspaceCardViewDescriptor</code> instance. * * @param workspace * the workspace. * @param moduleDescriptorViewFactory * the view descriptor factory used to create (or decorate) the * modules projected views. */ public WorkspaceCardViewDescriptor(Workspace workspace, IModuleViewDescriptorFactory moduleDescriptorViewFactory) { Map<String, IViewDescriptor> moduleCards = new HashMap<String, IViewDescriptor>(); prepareModuleCards(moduleCards, workspace.getModules(), moduleDescriptorViewFactory); setCardViewDescriptors(moduleCards); }
/** * Returns all application modules. * <p> * {@inheritDoc} */ @Override protected Collection<Module> getModulesToCheck(Map<String, Object> context) { Collection<Module> modulesToCheck = new ArrayList<>(); for (String workspaceName : getController(context).getWorkspaceNames()) { Workspace ws = getController(context).getWorkspace(workspaceName); List<Module> modules = ws.getModules(); if (modules != null) { modulesToCheck.addAll(modules); } } return modulesToCheck; } }
private void removeFromWorkspaces(Collection<?> componentsToDelete, Map<String, Object> context) { IFrontendController<E, F, G> controller = getController(context); for (String wsName : controller.getWorkspaceNames()) { Workspace workspace = controller.getWorkspace(wsName); if (workspace != null) { for (Module module : workspace.getModules()) { Collection<Module> subModulesToRemove = cleanComponentsFromModules(module, componentsToDelete); removeSubModules(module, subModulesToRemove); } } } }
private void translateWorkspace(Workspace workspace) { workspace.setI18nName(getTranslationProvider().getTranslation( workspace.getName(), getLocale())); workspace.setI18nDescription(getTranslationProvider().getTranslation( workspace.getDescription(), getLocale())); if (workspace.getModules() != null) { for (Module module : workspace.getModules()) { translateModule(module); } } }
/** * Finds the parent module where to add the selected component. * * @param component * the component to add as module object. * @param context * the action context. * @return the parent module to add the new module to. */ @SuppressWarnings("UnusedParameters") protected Module findDestinationModule(Object component, Map<String, Object> context) { Workspace workspace = getParentWorkspace(context); String moduleName = getParentModuleName(context); if (workspace == null || moduleName == null) { return getCurrentModule(context); } for (Module m : workspace.getModules()) { Module m2 = findModule(m, moduleName, null); if (m2 != null) { return m2; } } return null; }
/** * {@inheritDoc} */ @Override protected void displayWorkspace(String workspaceName, boolean bypassModuleBoundaryActions) { boolean navigateToModule = workspaceName != null && !workspaceName.equals(getSelectedWorkspaceName()); super.displayWorkspace(workspaceName, bypassModuleBoundaryActions); Workspace workspace = getWorkspace(workspaceName); if (workspace != null) { RemoteHistoryDisplayCommand historyCommand = new RemoteHistoryDisplayCommand(); historyCommand.setName(workspace.getI18nName()); registerCommand(historyCommand); if (navigateToModule) { List<Module> modules = workspace.getModules(); if (isShortcutToSingleModule(modules)) { Module singleModule = modules.get(0); // This is a hack to detect that we are called for the second time. So we must not re-display the module, // otherwise the entry action is executed twice. if (!bypassModuleBoundaryActions) { displayModule(singleModule); } } } } }
/** * Translate workspace. * * @param workspace * the workspace */ protected void translateWorkspace(Workspace workspace) { workspace.setI18nName(getTranslation(workspace.getName(), getLocale())); workspace.setI18nDescription(getTranslation(workspace.getDescription(), "", getLocale())); workspace.setI18nHeaderDescription(getTranslation(workspace.getHeaderDescription(), "", getLocale())); workspace.setI18nPageHeaderDescription(getTranslation(workspace.getPageHeaderDescription(), "", getLocale())); if (workspace.getModules() != null) { for (Module module : workspace.getModules()) { translateModule(module); } } }
for (Module module : workspace.getModules()) { process(module, wsPermId);
for (String workspaceName : getController(context).getWorkspaceNames()) { Workspace ws = getController(context).getWorkspace(workspaceName); List<Module> modules = ws.getModules(); if (modules != null) { for (Module m : modules) {
try { getController(context).pushToSecurityContext(ws); List<Module> modules = ws.getModules(); if (modules != null) { for (Module m : modules) {
/** * {@inheritDoc} * * @param workspaceName * the workspace name * @return the r component */ @Override protected RComponent createWorkspaceView(String workspaceName) { Workspace workspace = getWorkspace(workspaceName); List<Module> modules = workspace.getModules(); IView<RComponent> moduleAreaView = createModuleAreaView(workspaceName); RMobileCardPage moduleAreaPage = new RMobileCardPage(workspaceName + "_moduleArea"); moduleAreaPage.setPages((RCardContainer) moduleAreaView.getPeer()); if (isShortcutToSingleModule(modules)) { return moduleAreaPage; } else { RMobileNavPage viewComponent = new RMobileNavPage(workspaceName + "_navigation"); viewComponent.setLabel(workspace.getI18nName()); viewComponent.setToolTip(workspace.getI18nDescription()); viewComponent.setHeaderText(workspace.getI18nPageHeaderDescription()); IViewDescriptor workspaceNavigatorViewDescriptor = workspace.getViewDescriptor(); IValueConnector workspaceConnector = getBackendController().getWorkspaceConnector(workspaceName); IView<RComponent> workspaceNavigator = createWorkspaceNavigator(workspaceName, workspaceNavigatorViewDescriptor); viewComponent.setSelectionView(workspaceNavigator.getPeer()); viewComponent.setNextPage(moduleAreaPage); getMvcBinder().bind(workspaceNavigator.getConnector(), workspaceConnector); return viewComponent; } }