/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { setActionParameter(translate(getMessageCode(context), context), context); return super.execute(actionHandler, context); }
/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { setActionParameter(translate(getMessageCode(context), context), context); return super.execute(actionHandler, context); }
/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { setActionParameter(translate(getMessageCode(context), context), context); return super.execute(actionHandler, context); }
/** * Displays the message using a {@code JOptionPane.YES_NO_CANCEL_OPTION}. * <p> * {@inheritDoc} * * @param actionHandler * the action handler * @param context * the context * @return the boolean */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { getController(context).popupYesNoCancel(getSourceComponent(context), getI18nName(getTranslationProvider(context), getLocale(context)), getIconImageURL(), getMessage(context), getYesAction(context), getNoAction(context), getCancelAction(context), context); return super.execute(actionHandler, context); }
/** * Displays the message using a {@code JOptionPane.YES_NO_OPTION}. * <p> * {@inheritDoc} * * @param actionHandler * the action handler * @param context * the context * @return the boolean */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { getController(context).popupYesNo(getSourceComponent(context), getI18nName(getTranslationProvider(context), getLocale(context)), getIconImageURL(), getMessage(context), getYesAction(context), getNoAction(context), context); return super.execute(actionHandler, context); }
/** * Displays an ok cancel dialog * <p> * {@inheritDoc} * * @param actionHandler * the action handler * @param context * the context * @return the boolean */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { getController(context) .popupOkCancel(getSourceComponent(context), getI18nName(getTranslationProvider(context), getLocale(context)), getIconImageURL(), getMessage(context), getOkAction(context), getCancelAction(context), context); return super.execute(actionHandler, context); }
/** * Displays the message using a {@code JOptionPane.INFORMATION_MESSAGE}. * <p> * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { getController(context).popupInfo(getSourceComponent(context), getI18nName(getTranslationProvider(context), getLocale(context)), getIconImageURL(), getMessage(context)); return super.execute(actionHandler, context); } }
/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { BasicListDescriptor<IDescriptor> modelDescriptor = new BasicListDescriptor<>(); modelDescriptor.setElementDescriptor(BasicDescriptorDescriptor.INSTANCE); modelDescriptor.setName(ACTION_MODEL_NAME); // IValueConnector actionsConnector = modelConnectorFactory // .createModelConnector(ACTION_MODEL_NAME, modelDescriptor, actionHandler // .getSubject()); IValueConnector actionsConnector = getBackendController(context) .createModelConnector(ACTION_MODEL_NAME, modelDescriptor); actionsConnector.setConnectorValue(createActionProxies( getTranslationProvider(context), getLocale(context))); setActionParameter(actionsConnector, context); return super.execute(actionHandler, context); }
/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { BasicCollectionDescriptor<IDescriptor> modelDescriptor = new BasicCollectionDescriptor<IDescriptor>(); modelDescriptor.setCollectionInterface(List.class); modelDescriptor.setElementDescriptor(BasicDescriptorDescriptor.INSTANCE); modelDescriptor.setName(ACTION_MODEL_NAME); IValueConnector actionsConnector = modelConnectorFactory .createModelConnector(ACTION_MODEL_NAME, modelDescriptor); actionsConnector.setConnectorValue(createActionProxies( getTranslationProvider(context), getLocale(context))); context.put(ActionContextConstants.ACTION_PARAM, actionsConnector); return super.execute(actionHandler, context); }
/** * {@inheritDoc} * * @param actionHandler * the action handler * @param context * the context * @return the boolean */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { setActionParameter(translate(getMessageCode(context), context), context); return super.execute(actionHandler, context); }
/** * Utility method used to translate a code using the context translation * provider. If {@link #getMessageArgs(Map)} returns a not-null array or * arguments, they are passed to the translation provider to be used as message * format arguments. * * @param messageCode * the message code to translate. * @param context * the action context. * @return the translated message. */ protected String translate(String messageCode, Map<String, Object> context) { Object[] messageArgs = getMessageArgs(context); String translation; if (messageArgs == null) { translation = getTranslationProvider(context).getTranslation(messageCode, getLocale(context)); } else { translation = getTranslationProvider(context).getTranslation(messageCode, messageArgs, getLocale(context)); } return translation; }
private List<IDisplayableAction> createActionProxies( ITranslationProvider translationProvider, Locale locale) { List<IDisplayableAction> actionProxies = new ArrayList<IDisplayableAction>( actions.size()); for (IDisplayableAction action : actions) { actionProxies.add(createActionProxy(action, translationProvider, locale)); } return actionProxies; }
private IDisplayableAction createActionProxy(IDisplayableAction delegate, ITranslationProvider translationProvider, Locale locale) { return (IDisplayableAction) Proxy.newProxyInstance(delegate.getClass() .getClassLoader(), new Class<?>[] { IDisplayableAction.class }, new I18nActionInvocationHandler(delegate, translationProvider, locale)); }
/** * Gets the message. * * @param context * the actionContext. * @return the message. */ protected String getMessage(Map<String, Object> context) { String msg = getActionParameter(context); if (msg == null || HtmlHelper.isHtml(msg)) { return msg; } return HtmlHelper .toHtml(HtmlHelper.emphasis(HtmlHelper.escapeForHTML(msg))); }
private List<IDisplayableAction> createActionProxies( ITranslationProvider translationProvider, Locale locale) { List<IDisplayableAction> actionProxies = new ArrayList<>( actions.size()); for (IDisplayableAction action : actions) { actionProxies.add(createActionProxy(action, translationProvider, locale)); } return actionProxies; }
private IDisplayableAction createActionProxy(IDisplayableAction delegate, ITranslationProvider translationProvider, Locale locale) { return (IDisplayableAction) Proxy.newProxyInstance(delegate.getClass() .getClassLoader(), new Class[] {IDisplayableAction.class}, new I18nActionInvocationHandler(delegate, translationProvider, locale)); }