Beispiel #1
0
 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;
 }
 /**
  * Constructs a new {@code DurationFormatter} instance.
  *
  * @param translationProvider the translation provider for duration labels.
  * @param locale the locale the formatter must be constructed in.
  */
 public DurationFormatter(
     ITranslationProvider translationProvider,
     Locale locale,
     boolean secondsAware,
     boolean millisecondsAware) {
   super();
   PeriodFormatterBuilder builder = new PeriodFormatterBuilder();
   builder.appendDays();
   builder.appendSuffix(
       " " + translationProvider.getTranslation("day", locale),
       " " + translationProvider.getTranslation("days", locale));
   builder.appendSeparator(" ");
   builder.appendHours();
   builder.appendSuffix(
       " " + translationProvider.getTranslation("hour", locale),
       " " + translationProvider.getTranslation("hours", locale));
   builder.appendSeparator(" ");
   builder.appendMinutes();
   builder.appendSuffix(
       " " + translationProvider.getTranslation("minute", locale),
       " " + translationProvider.getTranslation("minutes", locale));
   if (secondsAware) {
     builder.appendSeconds();
     builder.appendSuffix(
         " " + translationProvider.getTranslation("second", locale),
         " " + translationProvider.getTranslation("seconds", locale));
   }
   if (millisecondsAware) {
     builder.appendMillis();
     builder.appendSuffix(
         " " + translationProvider.getTranslation("millisecond", locale),
         " " + translationProvider.getTranslation("milliseconds", locale));
   }
   this.formatter = builder.toFormatter().withLocale(locale);
 }
Beispiel #3
0
 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;
 }