/** * based on i18n name. * <p/> * {@inheritDoc} */ @Override public String toString() { if (getI18nName() != null) { return getI18nName(); } return ""; }
/** * 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); } } }
/** * Gets i 18 n description. * * @param translationProvider * the translation provider * @param locale * the locale * @return the i 18 n description */ @Override public String getI18nDescription(ITranslationProvider translationProvider, Locale locale) { return getI18nDescription(); }
/** * 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()); }
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); } } }
private void updateFrameTitle() { String workspaceName = getSelectedWorkspaceName(); if (workspaceName != null) { controllerFrame.setTitle(getSelectedWorkspace() .getViewDescriptor().getI18nDescription(this, getLocale()) + " - " + getI18nName(this, getLocale())); } else { controllerFrame.setTitle(getI18nName(this, getLocale())); } }
/** * {@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; } }
/** * Gets the workspace view descriptor. Whenever the view descriptor has not * been set, a default one is generated. * * @return the viewDescriptor. */ public IViewDescriptor getViewDescriptor() { if (viewDescriptor == null) { AbstractTreeViewDescriptor workspaceViewDescriptor = createWorkspaceViewDescriptor(); workspaceViewDescriptor.setName(getName()); workspaceViewDescriptor.setDescription(getDescription()); workspaceViewDescriptor.setIcon(getIcon()); workspaceViewDescriptor.setIconImageURLProvider(getIconProvider()); workspaceViewDescriptor.setItemSelectionAction(getItemSelectionAction()); viewDescriptor = workspaceViewDescriptor; } return viewDescriptor; }
/** * Gets the modules modules. * * @return the list of modules belonging to this workspace. */ public List<Module> getModules() { return getModules(false); }
/** * {@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); } } } } }
/** * Gets the i18nName. * * @return the i18nName. */ public String getI18nName() { if (i18nName != null) { return i18nName; } return getName(); }
/** * Gets the workspace view descriptor. Whenever the view descriptor has not * been set, a default one is generated. * * @return the viewDescriptor. */ public IViewDescriptor getViewDescriptor() { if (viewDescriptor == null) { viewDescriptor = new BasicWorkspaceViewDescriptor(); ((BasicWorkspaceViewDescriptor) viewDescriptor).setName(getName()); ((BasicWorkspaceViewDescriptor) viewDescriptor) .setDescription(getDescription()); ((BasicWorkspaceViewDescriptor) viewDescriptor) .setIconImageURL(getIconImageURL()); if (iconImageURLProvider == null) { iconImageURLProvider = new WorkspaceIconImageURLProvider(); } ((BasicWorkspaceViewDescriptor) viewDescriptor) .setIconImageURLProvider(iconImageURLProvider); } return viewDescriptor; }
String wsPermId = workspace.getPermId(); if (wsPermId != null) { if (isPermIdExcluded(wsPermId) || navigationPermIds.contains(wsPermId)) { for (Module module : workspace.getModules()) { process(module, wsPermId);
/** * Gets the i18nDescription. * * @return the i18nDescription. */ public String getI18nDescription() { if (i18nDescription != null) { return i18nDescription; } return getDescription(); }
private JMenu createWorkspacesMenu() { JMenu workspacesMenu = new JMenu(getTranslationProvider().getTranslation( "workspaces", getLocale())); workspacesMenu.setIcon(getIconFactory().getIcon( getWorkspacesMenuIconImageUrl(), IIconFactory.SMALL_ICON_SIZE)); for (String workspaceName : getWorkspaceNames()) { IViewDescriptor workspaceViewDescriptor = getWorkspace(workspaceName) .getViewDescriptor(); JMenuItem workspaceMenuItem = new JMenuItem(new WorkspaceSelectionAction( workspaceName, workspaceViewDescriptor)); workspacesMenu.add(workspaceMenuItem); } workspacesMenu.addSeparator(); workspacesMenu.add(new JMenuItem(new QuitAction())); return workspacesMenu; }
private boolean belongsTo(Workspace owner, Module module) { for (Module child : owner.getModules()) { if (belongsTo(child, module)) { return true; } } return false; }
/** * Gets the permId. * * @return the permId. */ @Override public String getPermId() { if (permId != null) { return permId; } return getName(); }
/** * Gets the i18nDescription. * * @return the i18nDescription. */ public String getI18nDescription() { if (i18nDescription != null) { return i18nDescription; } return getDescription(); }
private void updateFrameTitle() { String workspaceName = getSelectedWorkspaceName(); if (workspaceName != null) { controllerFrame.setTitle(getWorkspace(getSelectedWorkspaceName()) .getViewDescriptor().getI18nDescription(getTranslationProvider(), getLocale()) + " - " + getI18nName(getTranslationProvider(), getLocale())); } else { controllerFrame.setTitle(getI18nName(getTranslationProvider(), getLocale())); } }
/** * 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); }