if (a.getCaption() != null) { paintTarget.addAttribute("caption", a.getCaption()); if (a.getIcon() != null) { paintTarget.addAttribute("icon", a.getIcon());
public UserStepEditorWindow(StepEditorApplication application, String jsonConfig, String url, String stepName, String stepType) { super(application, jsonConfig, url, stepName, stepType); permissions = new LinkedHashSet<Permission>(); actionDelete = new Action(I18NSource.ThreadUtil.getThreadI18nSource().getMessage("stepTree.action.delete")); actions = new Action[] { actionDelete }; }
@Override public void onWindowContextMenu() { Collection<Action> actions = getContextActions(CubaWindow.this); if (!actions.isEmpty()) { contextActionMapper = new KeyMapper<>(); List<ClientAction> actionsList = new ArrayList<>(actions.size()); for (Action action : actions) { ClientAction clientAction = new ClientAction(action.getCaption()); clientAction.setActionId(contextActionMapper.key(action)); actionsList.add(clientAction); } ClientAction[] clientActions = actionsList.toArray(new ClientAction[actions.size()]); getRpcProxy(CubaWindowClientRpc.class).showTabContextMenu(clientActions); } }
@Override public void handleAction(Action action, Object o, Object flow) { Item item = container.getItem(flow); ArrayList<Callable<String>> callables = new ArrayList<>(); ModuleControlRunnable moduleControlRunnable = new ModuleControlRunnable(authentication, (Flow)flow, item, flowStates , action.getCaption(), moduleTable); callables.add(moduleControlRunnable); try { List<Future<String>> futures = executorService.invokeAll(callables); StringBuffer result = new StringBuffer(); for(Future<String> future: futures) { result.append(future.get()).append("</br>"); } Notification notification = new Notification("Flow Control Notification", result.toString(), Notification.Type.TRAY_NOTIFICATION, true); notification.show(Page.getCurrent()); } catch (Exception e) { Notification.show("An error occurred performing flow actions: " + e.getMessage(), Notification.Type.ERROR_MESSAGE); } } });
private List<CalendarState.Action> createActionsList( Map<CalendarDateRange, Set<Action>> actionMap) { if (actionMap.isEmpty()) { return null; } List<CalendarState.Action> calendarActions = new ArrayList<CalendarState.Action>(); SimpleDateFormat formatter = new SimpleDateFormat( DateConstants.ACTION_DATE_FORMAT_PATTERN); formatter.setTimeZone(getTimeZone()); for (Entry<CalendarDateRange, Set<Action>> entry : actionMap .entrySet()) { CalendarDateRange range = entry.getKey(); Set<Action> actions = entry.getValue(); for (Action action : actions) { String key = actionMapper.key(action); CalendarState.Action calendarAction = new CalendarState.Action(); calendarAction.actionKey = key; calendarAction.caption = action.getCaption(); setResource(key, action.getIcon()); calendarAction.iconKey = key; calendarAction.startDate = formatter.format(range.getStart()); calendarAction.endDate = formatter.format(range.getEnd()); calendarActions.add(calendarAction); } } return calendarActions; }
@Override public void onTabContextMenu(int tabIndex) { Tab tab = getTab(tabIndex); if (tab != null) { Set<Action> actions = getActions(CubaMainTabSheet.this.getActionTarget(tab)); if (!actions.isEmpty()) { actionMapper = new KeyMapper<>(); List<ClientAction> actionsList = new ArrayList<>(actions.size()); for (Action action : actions) { ClientAction clientAction = new ClientAction(action.getCaption()); clientAction.setActionId(actionMapper.key(action)); actionsList.add(clientAction); } ClientAction[] clientActions = actionsList.toArray(new ClientAction[actions.size()]); getRpcProxy(CubaMainTabSheetClientRpc.class).showTabContextMenu(tabIndex, clientActions); } } }
@Override public com.vaadin.event.Action[] getActions(Object target, Object sender) { if (!initialized) { Messages messages = beanLocator.get(Messages.NAME); saveSettingsAction = new com.vaadin.event.Action(messages.getMainMessage("actions.saveSettings")); restoreToDefaultsAction = new com.vaadin.event.Action(messages.getMainMessage("actions.restoreToDefaults")); analyzeAction = new com.vaadin.event.Action(messages.getMainMessage("actions.analyzeLayout")); initialized = true; } List<Action> actions = new ArrayList<>(3); ClientConfig clientConfig = getClientConfig(); if (clientConfig.getManualScreenSettingsSaving()) { actions.add(saveSettingsAction); actions.add(restoreToDefaultsAction); } if (clientConfig.getLayoutAnalyzerEnabled()) { actions.add(analyzeAction); } return actions.toArray(new com.vaadin.event.Action[0]); }
private void paintActions(PaintTarget target, final Set<Action> actionSet) throws PaintException { if (!actionSet.isEmpty()) { target.addVariable(this, "action", ""); target.startTag("actions"); for (Action a : actionSet) { target.startTag("action"); if (a.getCaption() != null) { target.addAttribute("caption", a.getCaption()); } if (a.getIcon() != null) { target.addAttribute("icon", a.getIcon()); } target.addAttribute("key", actionMapper.key(a)); target.endTag("action"); } target.endTag("actions"); } }
@Override public <T extends Action & Action.Listener> void addAction(T action) { super.addAction(action); nameToKey.put(action.getCaption(), mapper.key(action)); }
Messages messages = AppBeans.get(Messages.NAME); closeAllTabs = new com.vaadin.event.Action(messages.getMainMessage("actions.closeAllTabs")); closeOtherTabs = new com.vaadin.event.Action(messages.getMainMessage("actions.closeOtherTabs")); closeCurrentTab = new com.vaadin.event.Action(messages.getMainMessage("actions.closeCurrentTab")); showInfo = new com.vaadin.event.Action(messages.getMainMessage("actions.showInfo")); analyzeLayout = new com.vaadin.event.Action(messages.getMainMessage("actions.analyzeLayout")); saveSettings = new com.vaadin.event.Action(messages.getMainMessage("actions.saveSettings")); restoreToDefaults = new com.vaadin.event.Action(messages.getMainMessage("actions.restoreToDefaults"));
final Action a = i.next(); target.startTag("action"); if (a.getCaption() != null) { target.addAttribute(TreeConstants.ATTRIBUTE_ACTION_CAPTION, a.getCaption()); if (a.getIcon() != null) { target.addAttribute(TreeConstants.ATTRIBUTE_ACTION_ICON, a.getIcon());
public void handleAction(Action action, Object sender, Object target) { if ("escape".equals(action.getCaption())) { resetAddButton(); } else if ("enter".equals(action.getCaption())) { if (newTaskTextField != null && newTaskTextField.getValue() != null && !"".equals(newTaskTextField.getValue().toString())) {
MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(m_messageSource); private static final long serialVersionUID = -5923269974651895441L; Action add = new Action(messageSourceAccessor.getMessage("add.new.row.to.table",null,"add.new.row.to.table")); Action remove = new Action(messageSourceAccessor.getMessage("delete.this.row",null,"delete.this.row")); Action edit = new Action(messageSourceAccessor.getMessage("edit.this.row",null,"edit.this.row"));
final Action[] delete = new Action[] { new Action("delete") };
final Action[] delete = new Action[] { new Action("delete") };