private SecurityContextBuilder append(ActionList actionList) { if (actionList != null) { currentSecurityContext.put(SecurityContextConstants.ACTION_LIST, actionList.getPermId()); } return this; }
private SecurityContextBuilder append(ActionMap actionMap) { if (actionMap != null) { currentSecurityContext.put(SecurityContextConstants.ACTION_MAP, actionMap.getPermId()); } return this; }
if (actionMap != null) { List<ActionList> filteredActionLists = null; for (ActionList actionList : actionMap.getActionLists(securityHandler)) { List<IDisplayableAction> filteredActions = null; for (IDisplayableAction action : actionList.getActions()) { if ((keepCollectionBased && action.isCollectionBased()) || (!keepCollectionBased && !action .isCollectionBased())) { if (filteredActions == null) { filteredActions = new ArrayList<>(); ActionList filteredActionList = actionList.clone(); filteredActionList.setActions(filteredActions); if (filteredActionLists == null) { filteredActionLists = new ArrayList<>(); filteredActionMap = actionMap.clone(); filteredActionMap.setActionLists(filteredActionLists);
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; }
/** * {@inheritDoc} */ public Object invoke(@SuppressWarnings("unused") Object proxy, Method method, Object[] args) throws Throwable { if (method.getName().equals("getName")) { return delegate.getI18nName(translationProvider, locale); } else if (method.getName().equals("getDescription")) { return delegate.getI18nDescription(translationProvider, locale); } return method.invoke(delegate, args); } }
private List<SMenu> createMenus(ActionMap actionMap) { List<SMenu> menus = new ArrayList<SMenu>(); if (actionMap != null) { for (ActionList actionList : actionMap.getActionLists()) { SMenu menu = createActionMenu(actionList); menus.add(menu); } } return menus; }
/** * {@inheritDoc} */ @Override public ActionList clone() { ActionList clonedActionList = (ActionList) super.clone(); clonedActionList .setActions(new ArrayList<IDisplayableAction>(getActions())); return clonedActionList; }
/** * Gets the list of action sets composing the parent action maps with the * local one. * * @return the actions list. */ public List<ActionList> getActionLists() { Map<String, ActionList> buffer = new LinkedHashMap<String, ActionList>(); if (parentActionMaps != null) { for (ActionMap parentActionMap : parentActionMaps) { completeActionMap(buffer, parentActionMap.getActionLists()); } } if (actionLists != null) { completeActionMap(buffer, actionLists); } return new ArrayList<ActionList>(buffer.values()); }
/** * 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; }
/** * 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); } }
String amPermId = actionMap.getPermId(); if (amPermId != null) { if (isPermIdExcluded(amPermId) || actionPermIds.contains(amPermId)) { for (ActionList actionList : actionMap.getActionLists(new ISecurityHandler() {
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; }
/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final IDisplayableAction other = (IDisplayableAction) obj; if (getName() == null) { return false; } else if (!getName().equals(other.getName())) { return false; } return true; }
/** * Process. * * @param action * the action * @param path * the path */ protected void process(IDisplayableAction action, String path) { String actionPermId = action.getPermId(); if (actionPermId != null) { if (path != null) { actionPermId = path + "." + actionPermId; } if (isPermIdExcluded(actionPermId) || actionPermIds.contains(actionPermId)) { return; } actionPermIds.add(actionPermId); } }
protected IDisplayableAction completeOkDialogAction(IAction okNextAction) { IDisplayableAction refinedOkCloseDialogAction = getOkCloseDialogAction(); if (refinedOkCloseDialogAction instanceof AbstractAction && okNextAction != null) { refinedOkCloseDialogAction = (IDisplayableAction) refinedOkCloseDialogAction.clone(); ((AbstractAction) refinedOkCloseDialogAction).setNextAction(okNextAction); } return refinedOkCloseDialogAction; }
/** * {@inheritDoc} */ @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.getName().equals("getName")) { return delegate.getI18nName(translationProvider, locale); } if (method.getName().equals("getDescription")) { return delegate.getI18nDescription(translationProvider, locale); } return method.invoke(delegate, args); } }
private List<ULCMenu> createMenus(ULCComponent sourceComponent, ActionMap actionMap) { List<ULCMenu> menus = new ArrayList<ULCMenu>(); if (actionMap != null) { for (ActionList actionList : actionMap.getActionLists()) { ULCMenu menu = createActionMenu(actionList, sourceComponent); menus.add(menu); } } return menus; }
private List<JMenu> createMenus(ActionMap actionMap) { List<JMenu> menus = new ArrayList<JMenu>(); if (actionMap != null) { for (ActionList actionList : actionMap.getActionLists()) { JMenu menu = createActionMenu(actionList); menus.add(menu); } } return menus; }
private JToolBar createSecondaryApplicationToolBar() { JToolBar applicationToolBar = new JToolBar(); applicationToolBar.setRollover(true); applicationToolBar.setFloatable(false); if (getSecondaryActionMap() != null) { for (ActionList actionList : getSecondaryActionMap().getActionLists(this)) { completeApplicationToolBar(applicationToolBar, actionList); } } return applicationToolBar; }
private RActionList[] createRActionLists(ActionMap actionMap, IView<RComponent> view) { List<RActionList> actionLists = new ArrayList<>(); if (actionMap != null) { if (isAccessGranted(actionMap)) { try { pushToSecurityContext(actionMap); for (ActionList actionList : actionMap.getActionLists(this)) { if (isAccessGranted(actionList)) { try { pushToSecurityContext(actionList); RActionList rActionList = createRActionList(actionList, view); if (rActionList != null) { actionLists.add(rActionList); } } finally { restoreLastSecurityContextSnapshot(); } } } } finally { restoreLastSecurityContextSnapshot(); } } } return actionLists.toArray(new RActionList[actionLists.size()]); }