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); } } } } } }
/** * {@inheritDoc} */ @Override public ActionList clone() { ActionList clonedActionList = (ActionList) super.clone(); clonedActionList .setActions(new ArrayList<IDisplayableAction>(getActions())); return clonedActionList; }
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; }
/** * 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 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) {
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; }
for (ActionList actionList : actionMap.getActionLists(securityHandler)) { List<IDisplayableAction> filteredActions = null; for (IDisplayableAction action : actionList.getActions()) { if ((keepCollectionBased && action.isCollectionBased()) || (!keepCollectionBased && !action .isCollectionBased())) {
try { actionHandler.pushToSecurityContext(nextActionList); for (IDisplayableAction action : nextActionList.getActions()) { if (actionHandler.isAccessGranted(action)) { try {
for (IDisplayableAction action : actionList.getActions()) { JButton button = new JButton(getViewFactory().getActionFactory().createAction(action, getViewFactory().getIconFactory().getSmallIconSize(), this, loginView, getLocale()));
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 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; }
private ULCPopupMenu createULCPopupMenu(ULCComponent sourceComponent, ActionMap actionMap, IModelDescriptor modelDescriptor, IViewDescriptor viewDescriptor, IValueConnector viewConnector, IActionHandler actionHandler, Locale locale) { ULCPopupMenu popupMenu = createULCPopupMenu(); ULCLabel titleLabel = createULCLabel(); titleLabel.setText(viewDescriptor.getI18nName(getTranslationProvider(), locale)); titleLabel.setIcon(iconFactory.getIcon(viewDescriptor.getIconImageURL(), IIconFactory.TINY_ICON_SIZE)); titleLabel.setHorizontalAlignment(IDefaults.CENTER); popupMenu.add(titleLabel); popupMenu.addSeparator(); for (Iterator<ActionList> iter = actionMap.getActionLists().iterator(); iter .hasNext();) { ActionList nextActionList = iter.next(); for (IDisplayableAction action : nextActionList.getActions()) { IAction ulcAction = actionFactory.createAction(action, actionHandler, sourceComponent, modelDescriptor, viewConnector, locale); ULCMenuItem actionItem = createULCMenuItem(); actionItem.setAction(ulcAction); popupMenu.add(actionItem); } if (iter.hasNext()) { popupMenu.addSeparator(); } } return popupMenu; }
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; }
.getActionLists().iterator(); iter.hasNext();) { ActionList nextActionList = iter.next(); for (IDisplayableAction action : nextActionList.getActions()) { Action swingAction = actionFactory.createAction(action, actionHandler, view, locale);
renderingOptions = actionMap.getRenderingOptions(); for (IDisplayableAction action : nextActionList.getActions()) { if (actionHandler.isAccessGranted(action)) { Action wingsAction = getActionFactory().createAction(action,
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; }
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()) { if (actionHandler.isAccessGranted(action)) { try {
.getActionLists().iterator(); iter.hasNext();) { ActionList nextActionList = iter.next(); for (IDisplayableAction action : nextActionList.getActions()) { Action wingsAction = actionFactory.createAction(action, actionHandler, view, locale);
.getActionLists().iterator(); iter.hasNext();) { ActionList nextActionList = iter.next(); for (IDisplayableAction action : nextActionList.getActions()) { IAction ulcAction = actionFactory.createAction(action, actionHandler, view, locale);