Package pl.net.bluesoft.rnd.util.i18n

Examples of pl.net.bluesoft.rnd.util.i18n.I18NSource


  protected static String dumpTreeToJSON(Tree tree, WidgetItemInStep rootItem, Object assignee,
                                           Object candidateGroups, Object swimlane, String stepName,
                                           Object description, Object commentary,
                                           Collection<Permission> permissions) {
    I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource();
    TaskConfig tc = new TaskConfig();
    tc.setTaskName(stepName);
   
    Map<String, Object> treeMap = collectNode(tree, rootItem, 1);

        if (assignee != null) {
        treeMap.put(ASSIGNEE, assignee);
        }
        if (candidateGroups != null) {
        treeMap.put(CANDIDATE_GROUPS, candidateGroups);
        }
        if (swimlane != null) {
        treeMap.put(SWIMLANE, swimlane);
        }
        if (permissions != null) {
            treeMap.put(STEP_PERMISSIONS, permissions);
        }
        if (description != null) {
            treeMap.put(DESCRIPTION,description);
        }
        if (commentary != null) {
           
            treeMap.put(COMMENTARY, encodeString(commentary));
        }
   
        tc.setParams(treeMap);
       
    try {
            return mapper.writeValueAsString(tc);
    } catch (JsonGenerationException e) {
            logger.log(Level.SEVERE, "Error dumping tree", e);
    } catch (JsonMappingException e) {
            logger.log(Level.SEVERE, "Error dumping tree", e);
    } catch (IOException e) {
            logger.log(Level.SEVERE, "Error dumping tree", e);
    }
    return messages.getMessage("dump.failed");
  }
View Full Code Here


    ComponentContainer header = buildHeader(stepEditorWindow, stepType);
    refreshWindow(header, window);
  }

    public Label getHeaderLabel() {
      I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource();
      Label headerLabel = new Label();
        if (stepName != null && !stepName.isEmpty()) {
            headerLabel.setValue(messages.getMessage("userStep.stepName", new Object[] { stepName }));
        } else {
            headerLabel.setValue(messages.getMessage("userStep.noStepName"));
        }
        headerLabel.addStyleName("h1");

        return headerLabel;
    }
View Full Code Here

final class PropertiesDescriptionGenerator implements ItemDescriptionGenerator {
  private static final long serialVersionUID = -5377194182481601578L;

  @Override
  public String generateDescription(Component source, Object itemId, Object propertyId) {
    I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource();
    WidgetItemInStep item = (WidgetItemInStep) itemId;

    String parameters = messages.getMessage("stepTree.no.parameters.defined");

    if (item.getProperties() != null && item.getProperties().size() > 0) {
      Collection<?> properties = CollectionUtils.collect(item.getProperties(), new Transformer() {
        @Override
        public Object transform(Object arg0) {
View Full Code Here

        setColumnExpandRatio(0, 1);
        setColumnExpandRatio(1, 0);
    }

    private void initComponents() {
        I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource();

        tabSheet = new TabSheet();
        tabSheet.setSizeFull();
        tabSheet.addTab(permissionTab = new ProcessPermissionTab(), messages.getMessage("process.editor.process.permissions"));
        tabSheet.addTab(processDefinitionTab = new ProcessDefinitionTab(), messages.getMessage("process.editor.process.definition"));
        tabSheet.addTab(queueTab = new QueueTab(), messages.getMessage("process.editor.queues"));
        tabSheet.addTab(messageTab = new MessageTab(), messages.getMessage("process.editor.messages"));
        tabSheet.addTab(dictionaryTab = new DictionaryTab(), messages.getMessage("process.editor.dictionary"));
        tabSheet.addTab(otherTab = new OtherTab(), messages.getMessage("process.editor.other"));

        saveButton = VaadinUtility.button(messages.getMessage("process.editor.save"), new Runnable() {
            @Override
            public void run() {
                ((ProcessEditorApplication) ProcessEditorApplication.getCurrent()).saveAndCallback();
            }
        });
       
        titleLabel = new Label(messages.getMessage("process.editor.title"));
        titleLabel.addStyleName("h1");
    }
View Full Code Here

  @Override
    public void onTabClose(TabSheet tabsheet, final Component tabContent) {
    }

    private void initComponent() {
        I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource();

    dictionarySelect = new Select(messages.getMessage("dict.editor.dictionary"));
    dictionarySelect.setWidth("250px");
    dictionarySelect.setImmediate(true);
    dictionarySelect.addListener(new Property.ValueChangeListener() {
      @Override
      public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
        displaySelectedDictionary();
      }
    });

    languageSelect = new Select(messages.getMessage("dict.editor.lang"));
    languageSelect.setWidth("90px");
    languageSelect.setImmediate(true);
    languageSelect.addListener(new Property.ValueChangeListener() {
      @Override
      public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
        displaySelectedDictionary();
      }
    });

    addDictionaryButton = new Button(messages.getMessage("dict.editor.new.dict"));
    addDictionaryButton.addListener(this);

    addLanguageButton = new Button(messages.getMessage("dict.editor.new.lang"));
    addLanguageButton.addListener(this);

    defaultLanguageField = new Select(messages.getMessage("dict.editor.default.lang"));
    defaultLanguageField.setWidth("90px");
    defaultLanguageField.setImmediate(true);
    defaultLanguageField.setContainerDataSource(languageSelect.getContainerDataSource());

    overwriteField = new CheckBox(messages.getMessage("dict.editor.overwrite"));
    overwriteField.setImmediate(true);

    VerticalLayout newContent = new VerticalLayout();
    newContent.setSpacing(true);

    dictionaryLayout = new Panel(messages.getMessage("dict.editor.definition"));
    dictionaryLayout.setContent(newContent);
    dictionaryLayout.setWidth("100%");

    dictionaryNameField = new TextField(messages.getMessage("dict.editor.dict.name"));
    dictionaryNameField.setWidth("400px");
    dictionaryNameField.setNullRepresentation("");
    dictionaryNameField.setImmediate(true);
    dictionaryNameField.setRequired(true);

    dictionaryDescriptionField = new TextField(messages.getMessage("dict.editor.dict.descr"));
    dictionaryDescriptionField.setWidth("400px");
    dictionaryDescriptionField.setNullRepresentation("");
    dictionaryDescriptionField.setImmediate(true);
    dictionaryDescriptionField.setRequired(true);

    editPermissionField = new TextField(messages.getMessage("dict.editor.edit.roles"));
    editPermissionField.setWidth("400px");
    editPermissionField.setNullRepresentation("");
    editPermissionField.setImmediate(true);
    }
View Full Code Here

    return (String)dictionarySelect.getValue();
  }

  private Component getAddEntryButton() {
    if (addEntryButton == null) {
      I18NSource i18NSource = I18NSource.ThreadUtil.getThreadI18nSource();

      addEntryButton = addIcon(getApplication());
      addEntryButton.setCaption(i18NSource.getMessage("dict.addentry"));
      addEntryButton.addListener(this);
    }
    return addEntryButton;
  }
View Full Code Here

    // TODO
  }

  @Override
  public void buttonClick(Button.ClickEvent clickEvent) {
    final I18NSource i18NSource = I18NSource.ThreadUtil.getThreadI18nSource();

    if (clickEvent.getButton() == addDictionaryButton) {
      InputDialog dialog = new InputDialog(i18NSource.getMessage("dict.editor.adding.new.dict")) {
        @Override
        protected void handleAdd(String dictionaryId) {
          dictionarySelect.addItem(dictionaryId);
          dictionarySelect.setValue(dictionaryId);
        }
      };
      dialog.setInputCaption(i18NSource.getMessage("dict.editor.dict.id"));
      dialog.setInputRegexValidator("[a-zA-Z][a-zA-Z_\\-]*", i18NSource.getMessage("dict.editor.incorrect.dict.id"));
      dialog.show(getApplication());
    }
    else if (clickEvent.getButton() == addLanguageButton) {
      InputDialog dialog = new InputDialog(i18NSource.getMessage("dict.editor.adding.new.lang")) {
        @Override
        protected void handleAdd(String langCode) {
          languageSelect.addItem(langCode);
          languageSelect.setValue(langCode);
          if (languageSelect.getContainerDataSource().getItemIds().size() == 1
            && defaultLanguageField.getValue() == null) {
            defaultLanguageField.setValue(from(languageSelect.getContainerDataSource()).first());
          }
        }
      };
      dialog.setInputCaption(i18NSource.getMessage("dict.editor.lang.code"));
      dialog.setInputRegexValidator("[a-zA-Z]{2}(-[a-zA-Z]{2})?", i18NSource.getMessage("dict.editor.incorrect.lang.code"));
      dialog.show(getApplication());
    }
    else if (clickEvent.getButton() == addEntryButton) {
      XmlDictionaryItemWrapper item = new XmlDictionaryItemWrapper();

      builder.showItemDetails(new BeanItem<XmlDictionaryItemWrapper>(item), new DictionaryItemTableBuilder.SaveCallback<XmlDictionaryItemWrapper>() {
        @Override
        public void onSave(BeanItem<XmlDictionaryItemWrapper> item) {
          XmlDictionaryItemWrapper lookedUpItem = getCurrentDictionary().lookup(item.getBean().getKey());

          if (lookedUpItem != null) {
            validationNotification(getApplication(), i18NSource, i18NSource.getMessage("validate.dictentry.exists"));
          }
          else {
            getCurrentDictionary().addItem(item.getBean());
            container.addItem(item.getBean());
            container.sort(new Object[]{ XmlDictionaryItemWrapper._KEY }, new boolean[]{ true });
View Full Code Here

    @Override
    public void init() {
        super.init();

        I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource();

        mainWindow = new Window(messages.getMessage("process.editor.title"));
        mainWindow.addParameterHandler(this);

        mainWindowJavaScriptHelper = new JavaScriptHelper(mainWindow);
        mainWindowJavaScriptHelper.preventWindowClosing();
View Full Code Here

        addComponent(taskItemClassLabel);
        addComponent(taskItemClassField);
    }
   
    private void  initComponents(){
      I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource();
      taskItemClassLabel = styled(new Label(messages.getMessage("process.definition.taskItemClass")), "h2");
    taskItemClassField = new Select();
        taskItemClassField.setNewItemsAllowed(true);
        taskItemClassField.setWidth("100%");
    }
View Full Code Here

    private TextField inputField;

    public InputDialog(String title) {
      super(title);

      I18NSource i18NSource = I18NSource.ThreadUtil.getThreadI18nSource();

      inputField = new TextField();
      inputField.setNullRepresentation("");
      inputField.setWidth("300px");
      inputField.setRequired(true);
      addDialogContent(inputField);

      addDialogAction(i18NSource.getMessage("dict.editor.btn.add"), new Dialog.ActionListener() {
        @Override
        public void handleAction(String action) {
          inputField.commit();
          handleAdd((String)inputField.getValue());
        }
      });
      addDialogAction(i18NSource.getMessage("dict.editor.btn.cancel"), null);
    }
View Full Code Here

TOP

Related Classes of pl.net.bluesoft.rnd.util.i18n.I18NSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.