private G createCancelAction(IWizardStepDescriptor wizardStep, IActionHandler actionHandler, IView<E> view, Locale locale, Map<String, Object> context) { IDisplayableAction cancelActionAdapter = new CancelAction(wizardStep, cancelAction); G cancelGAction = getActionFactory(context).createAction( cancelActionAdapter, actionHandler, view, locale); return cancelGAction; }
private Map<String, Object> getModuleActionContext(String workspaceName) { IMapView<E> moduleAreaView = workspaceViews.get(workspaceName); if (moduleAreaView != null) { IView<E> moduleView = moduleAreaView.getCurrentView(); if (moduleView != null) { return getViewFactory().getActionFactory().createActionContext(this, moduleView, moduleView.getConnector(), null, null); } } return new HashMap<>(); }
private G createNextAction(IWizardStepDescriptor wizardStep, IActionHandler actionHandler, IView<E> view, ITranslationProvider translationProvider, Locale locale, IValueConnector modelConnector, Map<String, Object> context) { NextAction nextAction = new NextAction(wizardStep, modelConnector); nextAction .setIconImageURL(getIconFactory(context).getForwardIconImageURL()); G nextGAction = getActionFactory(context).createAction(nextAction, actionHandler, view, locale); if (wizardStep.getNextStepDescriptor(context) != null) { getActionFactory(context).setActionEnabled(nextGAction, true); } else { getActionFactory(context).setActionEnabled(nextGAction, false); } if (wizardStep.getNextLabelKey() != null) { getActionFactory(context).setActionName( nextGAction, translationProvider.getTranslation(wizardStep.getNextLabelKey(), locale)); } else { getActionFactory(context).setActionName( nextGAction, translationProvider.getTranslation( IWizardStepDescriptor.DEFAULT_NEXT_KEY, locale)); } return nextGAction; }
private G createFinishAction(IWizardStepDescriptor wizardStep, IActionHandler actionHandler, IView<E> view, Locale locale, Map<String, Object> context) { IDisplayableAction finishActionAdapter = new FinishAction(wizardStep, finishAction); G finishGAction = getActionFactory(context).createAction( finishActionAdapter, actionHandler, view, locale); if (wizardStep.canFinish(context)) { getActionFactory(context).setActionEnabled(finishGAction, true); } else { getActionFactory(context).setActionEnabled(finishGAction, false); } return finishGAction; }
@Override public void propertyChange(PropertyChangeEvent evt) { getActionFactory().setActionEnabled(editAction, (Boolean) evt.getNewValue()); } });
@Override public void propertyChange(PropertyChangeEvent evt) { getActionFactory().setActionEnabled(editAction, (Boolean) evt.getNewValue()); } });
private IView<SComponent> createBinaryPropertyView( IBinaryPropertyDescriptor propertyDescriptor, IActionHandler actionHandler, Locale locale) { SActionField viewComponent = createSActionField(false); SActionFieldConnector connector = new SActionFieldConnector( propertyDescriptor.getName(), viewComponent); connector.setExceptionHandler(actionHandler); Action openAction = actionFactory.createAction( openFileAsBinaryPropertyAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); Action saveAction = actionFactory.createAction( saveBinaryPropertyAsFileAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); Action resetAction = actionFactory.createAction(resetPropertyAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); Action infoAction = actionFactory.createAction(binaryPropertyInfoAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); viewComponent.setActions(Arrays.asList(new Action[] {openAction, saveAction, resetAction, infoAction})); adjustSizes(viewComponent, null, null); return constructView(viewComponent, null, connector); }
private G createPreviousAction(IWizardStepDescriptor wizardStep, IActionHandler actionHandler, IView<E> view, ITranslationProvider translationProvider, Locale locale, IValueConnector modelConnector, Map<String, Object> context) { PreviousAction previousAction = new PreviousAction(wizardStep, modelConnector); previousAction.setIconImageURL(getIconFactory(context) .getBackwardIconImageURL()); G previousGAction = getActionFactory(context).createAction(previousAction, actionHandler, view, locale); if (wizardStep.getPreviousStepDescriptor(context) != null) { getActionFactory(context).setActionEnabled(previousGAction, true); } else { getActionFactory(context).setActionEnabled(previousGAction, false); } if (wizardStep.getPreviousLabelKey() != null) { getActionFactory(context).setActionName( previousGAction, translationProvider.getTranslation(wizardStep.getPreviousLabelKey(), locale)); } else { getActionFactory(context).setActionName( previousGAction, translationProvider.getTranslation( IWizardStepDescriptor.DEFAULT_PREVIOUS_KEY, locale)); } return previousGAction; }
private void triggerCharAction() { String text = viewComponent.getText(); Map<String, Object> context = getActionFactory().createActionContext(actionHandler, view, view.getConnector(), null, view.getPeer()); context.put(ActionContextConstants.ACTION_COMMAND, text); actionHandler.execute(action, context); }
private IView<ULCComponent> createBinaryPropertyView( IBinaryPropertyDescriptor propertyDescriptor, IActionHandler actionHandler, Locale locale) { ULCActionField viewComponent = createULCActionField(false); ULCActionFieldConnector connector = new ULCActionFieldConnector( propertyDescriptor.getName(), viewComponent); connector.setExceptionHandler(actionHandler); IAction openAction = actionFactory.createAction( openFileAsBinaryPropertyAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); IAction saveAction = actionFactory.createAction( saveBinaryPropertyAsFileAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); IAction resetAction = actionFactory.createAction(resetPropertyAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); IAction infoAction = actionFactory.createAction(binaryPropertyInfoAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); viewComponent.setActions(Arrays.asList(new IAction[] {openAction, saveAction, resetAction, infoAction})); adjustSizes(viewComponent, null, null); return constructView(viewComponent, null, connector); }
@Override public void focusLost(FocusEvent e) { Map<String, Object> context = getActionFactory().createActionContext(actionHandler, view, view.getConnector(), null, view.getPeer()); actionHandler.execute(action, context); } }
private IView<JComponent> createBinaryPropertyView( IBinaryPropertyDescriptor propertyDescriptor, IActionHandler actionHandler, Locale locale) { JActionField viewComponent = createJActionField(false); JActionFieldConnector connector = new JActionFieldConnector( propertyDescriptor.getName(), viewComponent); connector.setExceptionHandler(actionHandler); Action openAction = actionFactory.createAction( openFileAsBinaryPropertyAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); Action saveAction = actionFactory.createAction( saveBinaryPropertyAsFileAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); Action resetAction = actionFactory.createAction(resetPropertyAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); Action infoAction = actionFactory.createAction(binaryPropertyInfoAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); viewComponent.setActions(Arrays.asList(new Action[] {openAction, saveAction, resetAction, infoAction})); adjustSizes(viewComponent, null, null); return constructView(viewComponent, null, connector); }
@Override public void focusGained(FocusEvent e) { Map<String, Object> context = getActionFactory().createActionContext(actionHandler, view, view.getConnector(), null, view.getPeer()); actionHandler.execute(action, context); } }
private JMenuItem createMenuItem(IDisplayableAction action) { return new JMenuItem(getViewFactory().getActionFactory().createAction( action, this, null, getLocale())); }
private void handleTableCellSelectionEvent(ListSelectionEvent lse, boolean focusGained, EnhancedJTable table, int columnIndex, IActionHandler actionHandler, IAction focusAction, IView<JComponent> view) { if (!lse.getValueIsAdjusting()) { int focusedRow; int focusedColumn; if (focusGained) { focusedRow = table.getSelectedRow(); focusedColumn = table.getSelectedColumn(); } else { focusedRow = table.getLastFocusedRow(); focusedColumn = table.getLastFocusedColumn(); } if (focusedRow >= 0 && focusedColumn >= 0) { if (focusedColumn == table.convertColumnIndexToView(columnIndex)) { actionHandler.execute(focusAction, getActionFactory() .createActionContext(actionHandler, view, view.getConnector(), focusedRow + ";" + columnIndex, table)); } } } }
private JMenuItem createMenuItem(IDisplayableAction action, IView<JComponent> view, IActionHandler actionHandler, Locale locale) { Action swingAction = getActionFactory().createAction(action, actionHandler, view, locale); JMenuItem actionItem = createJMenuItem(); actionItem.setAction(swingAction); return actionItem; }
getSourceComponent(context), context, dialogSize, reuseCurrent); context.putAll(getActionFactory(context).createActionContext(actionHandler, view, view.getConnector(), getActionCommand(context), getActionWidget(context)));
@SuppressWarnings("unchecked") private RAction createRAction(IAction action, Map<String, Object> context) { return getViewFactory().getActionFactory().createAction(wrapAction(action, context), this, (IView<RComponent>) context.get(ActionContextConstants.VIEW), getLocale()); }
private SMenuItem createMenuItem(IDisplayableAction action) { return new SMenuItem(getViewFactory().getActionFactory().createAction( action, this, null, getLocale())); }
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; }