private JMenu createActionMenu(ActionList actionList) { JMenu menu = new JMenu(actionList.getI18nName(getTranslationProvider(), getLocale())); if (actionList.getDescription() != null) { menu.setToolTipText(actionList.getI18nDescription( getTranslationProvider(), getLocale()) + IActionFactory.TOOLTIP_ELLIPSIS); } menu.setIcon(getIconFactory().getIcon(actionList.getIconImageURL(), IIconFactory.SMALL_ICON_SIZE)); for (IDisplayableAction action : actionList.getActions()) { menu.add(new JMenuItem(getViewFactory().getActionFactory().createAction( action, this, menu, null, null, getLocale()))); } return menu; }
/** * {@inheritDoc} */ @Override public ActionList clone() { ActionList clonedActionList = (ActionList) super.clone(); clonedActionList .setActions(new ArrayList<IDisplayableAction>(getActions())); return clonedActionList; }
private static void completeActionMap( Map<String, ActionList> bufferActionMap, List<ActionList> actionLists) { if (actionLists != null) { Map<String, ActionList> mapOfActionLists = new HashMap<String, ActionList>(); for (ActionList al : actionLists) { mapOfActionLists.put(al.getName(), al); } for (Map.Entry<String, ActionList> actionListEntry : mapOfActionLists .entrySet()) { ActionList bufferActionList = bufferActionMap.get(actionListEntry .getKey()); if (bufferActionList == null) { bufferActionList = actionListEntry.getValue().clone(); bufferActionMap.put(actionListEntry.getKey(), bufferActionList); } else { for (IDisplayableAction localAction : actionListEntry.getValue() .getActions()) { int existingIndex = bufferActionList.getActions().indexOf( localAction); if (existingIndex >= 0) { bufferActionList.getActions().set(existingIndex, localAction); } else { bufferActionList.getActions().add(localAction); } } } } } }
/** * Creates the workspace action map. * * @return the workspace action map. */ protected ActionMap createWorkspaceActionMap() { ActionMap workspaceActionMap = new ActionMap(); List<ActionList> workspaceActionLists = new ArrayList<>(); ActionList exitActionList = new ActionList(); exitActionList.setName("file"); exitActionList.setIconImageURL(getWorkspacesMenuIconImageUrl()); List<IDisplayableAction> exitActions = new ArrayList<>(); exitActions.add(getExitAction()); exitActionList.setActions(exitActions); workspaceActionLists.add(createWorkspaceActionList()); workspaceActionLists.add(exitActionList); workspaceActionMap.setActionLists(workspaceActionLists); return workspaceActionMap; }
actionHandler.pushToSecurityContext(actionList); ERenderingOptions renderingOptions = actionMapRenderingOptions; if (actionList.getRenderingOptions() != null) { renderingOptions = actionList.getRenderingOptions(); if (actionList.getHideActionWhenDisabled() != null) { hideActionWhenDisabled = actionList.getHideActionWhenDisabled(); viewActionList.setCollapsable(actionList.isCollapsable()); viewActionList.setName(actionList.getName()); viewActionList.setDescription(actionList.getDescription()); Dimension iconDimension = getIconFactory().getSmallIconSize(); if (isAsideActionDisplay(view.getDescriptor())) { iconDimension = getIconFactory().getTinyIconSize(); viewActionList.setIcon(getIconFactory().getIcon(actionList.getIcon(), iconDimension)); List<RAction> actions = new ArrayList<>(); for (IDisplayableAction action : actionList.getActions()) { if (actionHandler.isAccessGranted(action)) { try {
private List<SMenuItem> createMenuItems(ActionList actionList) { List<SMenuItem> menuItems = new ArrayList<SMenuItem>(); for (IDisplayableAction action : actionList.getActions()) { if (isAccessGranted(action)) { try { pushToSecurityContext(action); menuItems.add(createMenuItem(action)); } finally { restoreLastSecurityContextSnapshot(); } } } return menuItems; }
private RActionList createRActionList(ActionList actionList, IView<RComponent> view) { if (isAccessGranted(actionList)) { try { pushToSecurityContext(actionList); RActionList rActionList = new RActionList(getGuidGenerator().generateGUID()); rActionList.setName(actionList.getI18nName(this, getLocale())); rActionList.setDescription(actionList.getI18nDescription(this, getLocale())); rActionList.setIcon(getIconFactory().getIcon(actionList.getIcon(), getIconFactory().getTinyIconSize())); List<RAction> actions = new ArrayList<>(); for (IDisplayableAction action : actionList.getActions()) { if (isAccessGranted(action)) { try { pushToSecurityContext(action); actions.add(getViewFactory().getActionFactory().createAction(action, this, view, getLocale())); } finally { restoreLastSecurityContextSnapshot(); } } } rActionList.setActions(actions.toArray(new RAction[actions.size()])); rActionList.setCollapsable(actionList.isCollapsable()); return rActionList; } finally { restoreLastSecurityContextSnapshot(); } } return null; }
actionHandler.pushToSecurityContext(actionList); ERenderingOptions renderingOptions = actionMapRenderingOptions; if (actionList.getRenderingOptions() != null) { renderingOptions = actionList.getRenderingOptions(); if (actionList.getHideActionWhenDisabled() != null) { hideActionWhenDisabled = actionList.getHideActionWhenDisabled(); if (actionList.isCollapsable()) { final JButton actionButton; List<IDisplayableAction> actions = new ArrayList<>(); for (IDisplayableAction action : actionList.getActions()) { if (actionHandler.isAccessGranted(action)) { actions.add(action); for (IDisplayableAction action : actionList.getActions()) { if (actionHandler.isAccessGranted(action)) { boolean hiddenWhenDisabled = hideActionWhenDisabled;
for (ActionList actionList : actionMap.getActionLists(securityHandler)) { List<IDisplayableAction> filteredActions = null; for (IDisplayableAction action : actionList.getActions()) { if ((keepCollectionBased && action.isCollectionBased()) || (!keepCollectionBased && !action .isCollectionBased())) { ActionList filteredActionList = actionList.clone(); filteredActionList.setActions(filteredActions); if (filteredActionLists == null) { filteredActionLists = new ArrayList<>();
actionHandler.pushToSecurityContext(nextActionList); ERenderingOptions renderingOptions = getDefaultActionMapRenderingOptions(); if (nextActionList.getRenderingOptions() != null) { renderingOptions = nextActionList.getRenderingOptions(); } else if (actionMap.getRenderingOptions() != null) { renderingOptions = actionMap.getRenderingOptions(); for (IDisplayableAction action : nextActionList.getActions()) { if (actionHandler.isAccessGranted(action)) { Action wingsAction = getActionFactory().createAction(action,
/** * Process. * * @param actionList * the action list * @param path * the path */ protected void process(ActionList actionList, String path) { String alPermId = actionList.getPermId(); if (alPermId != null) { if (path != null) { alPermId = path + "." + alPermId; } if (isPermIdExcluded(alPermId) || actionPermIds.contains(alPermId)) { return; } actionPermIds.add(alPermId); } for (IDisplayableAction action : actionList.getActions()) { process(action, alPermId); } }
private void completeApplicationToolBar(JToolBar applicationToolBar, ActionList actionList) { if (isAccessGranted(actionList)) { try { pushToSecurityContext(actionList); if (actionList.isCollapsable()) { applicationToolBar.add(createComboButton(actionList)); } else { for (IDisplayableAction da : actionList.getActions()) { if (isAccessGranted(da)) { JButton b = new JButton(); b.setAction(getViewFactory().getActionFactory().createAction(da, this, null, getLocale())); applicationToolBar.add(b); } } } applicationToolBar.addSeparator(); } finally { restoreLastSecurityContextSnapshot(); } } }
private JButton createComboButton(ActionList actionList) { JButton button; List<IDisplayableAction> actions = new ArrayList<>(); for (IDisplayableAction action : actionList.getActions()) { if (isAccessGranted(action)) { try { actionList.getActions().get(0), this, null, getLocale()); button.setAction(action); if (actions.size() > 1) {
/** * Creates the workspace action list. * * @return the workspace action list. */ protected ActionList createWorkspaceActionList() { ActionList workspaceSelectionActionList = new ActionList(); workspaceSelectionActionList.setName("workspaces"); workspaceSelectionActionList.setIconImageURL(getWorkspacesMenuIconImageUrl()); List<IDisplayableAction> workspaceSelectionActions = new ArrayList<>(); for (String workspaceName : getWorkspaceNames()) { Workspace workspace = getWorkspace(workspaceName); if (isAccessGranted(workspace)) { try { pushToSecurityContext(workspace); IViewDescriptor workspaceViewDescriptor = getWorkspace(workspaceName).getViewDescriptor(); WorkspaceSelectionAction<E, F, G> workspaceSelectionAction = createWorkspaceSelectionAction(workspaceName, workspaceViewDescriptor); workspaceSelectionActions.add(workspaceSelectionAction); } finally { restoreLastSecurityContextSnapshot(); } } } workspaceSelectionActionList.setActions(workspaceSelectionActions); workspaceSelectionActionList.setCollapsable(true); return workspaceSelectionActionList; }
private SMenu createMenu(ActionList actionList) { SMenu menu = new SMenu(actionList.getI18nName(this, getLocale())); if (actionList.getDescription() != null) { menu.setToolTipText(actionList.getI18nDescription( this, getLocale()) + IActionFactory.TOOLTIP_ELLIPSIS); } menu.setIcon(getIconFactory().getIcon(actionList.getIconImageURL(), getIconFactory().getSmallIconSize())); for (SMenuItem menuItem : createMenuItems(actionList)) { menu.add(menuItem); } return menu; }
private JPopupMenu createJPopupMenu(JComponent sourceComponent, ActionMap actionMap, IModelDescriptor modelDescriptor, IViewDescriptor viewDescriptor, IValueConnector viewConnector, IActionHandler actionHandler, Locale locale) { JPopupMenu popupMenu = createJPopupMenu(); JLabel titleLabel = createJLabel(); titleLabel.setText(viewDescriptor.getI18nName(getTranslationProvider(), locale)); titleLabel.setIcon(iconFactory.getIcon(viewDescriptor.getIconImageURL(), IIconFactory.TINY_ICON_SIZE)); titleLabel.setHorizontalAlignment(SwingConstants.CENTER); titleLabel.setAlignmentX(Component.CENTER_ALIGNMENT); popupMenu.add(titleLabel); popupMenu.addSeparator(); for (Iterator<ActionList> iter = actionMap.getActionLists().iterator(); iter .hasNext();) { ActionList nextActionSet = iter.next(); for (IDisplayableAction action : nextActionSet.getActions()) { Action swingAction = actionFactory.createAction(action, actionHandler, sourceComponent, modelDescriptor, viewConnector, locale); JMenuItem actionItem = createJMenuItem(); actionItem.setAction(swingAction); popupMenu.add(actionItem); } if (iter.hasNext()) { popupMenu.addSeparator(); } } return popupMenu; }
private SMenu createActionMenu(ActionList actionList) { SMenu menu = new SMenu(actionList.getI18nName(getTranslationProvider(), getLocale())); if (actionList.getDescription() != null) { menu.setToolTipText(actionList.getI18nDescription( getTranslationProvider(), getLocale()) + IActionFactory.TOOLTIP_ELLIPSIS); } menu.setIcon(getIconFactory().getIcon(actionList.getIconImageURL(), IIconFactory.SMALL_ICON_SIZE)); for (IDisplayableAction action : actionList.getActions()) { menu.add(new SMenuItem(getViewFactory().getActionFactory().createAction( action, this, menu, null, null, getLocale()))); } return menu; }
try { actionHandler.pushToSecurityContext(nextActionList); for (IDisplayableAction action : nextActionList.getActions()) { if (actionHandler.isAccessGranted(action)) { try {
private ULCMenu createActionMenu(ActionList actionList, ULCComponent sourceComponent) { ULCMenu menu = new ULCMenu(actionList.getI18nName(getTranslationProvider(), getLocale())); if (actionList.getDescription() != null) { menu.setToolTipText(actionList.getI18nDescription( getTranslationProvider(), getLocale()) + IActionFactory.TOOLTIP_ELLIPSIS); } menu.setIcon(getIconFactory().getIcon(actionList.getIconImageURL(), IIconFactory.SMALL_ICON_SIZE)); for (IDisplayableAction action : actionList.getActions()) { menu .add(new ULCMenuItem(getViewFactory().getActionFactory() .createAction(action, this, sourceComponent, null, null, getLocale()))); } return menu; }
for (IDisplayableAction action : actionList.getActions()) { JButton button = new JButton(getViewFactory().getActionFactory().createAction(action, getViewFactory().getIconFactory().getSmallIconSize(), this, loginView, getLocale()));