private String getDescription(PermissionDefinition definition) { StringBuilder builder = new StringBuilder(); builder.append("<h2>"); builder.append(definition.getKey()); builder.append("</h2>"); if (definition.getDescription() != null && !definition.getDescription().trim().isEmpty()) { builder.append("<i>"); builder.append(I18NSource.ThreadUtil.getThreadI18nSource().getMessage(definition.getDescription())); builder.append("</i>"); } return builder.toString(); }
private Resource getResource(String pathKey) { I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource(); final String path = messages.getMessage(pathKey); final InputStream stream = getClass().getClassLoader().getResourceAsStream(path); if (stream != null) { String[] pathParts = path.split("/"); return new StreamResource(new StreamResource.StreamSource() { @Override public InputStream getStream() { return stream; } }, pathParts[pathParts.length - 1], application); } return null; }
@Override public Collection<PermissionDefinition> getPermissionDefinitions() { if (definitions == null) { I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource(); definitions = new ArrayList<PermissionDefinition>(); definitions.add(new PermissionDefinition("INCLUDE", messages.getMessage("process.permission.INCLUDE"))); definitions.add(new PermissionDefinition("RUN", messages.getMessage("process.permission.RUN"))); definitions.add(new PermissionDefinition("SEARCH", messages.getMessage("process.permission.SEARCH"))); } return definitions; }
private void initComponent() { I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource(); newLanguageButton = VaadinUtility.button( messages.getMessage("messages.language.new.button"), new Runnable() { @Override public void run() { Window window = new NewLanguageWindow(); MessageEditor.this.getApplication().getMainWindow().addWindow(window); } } ); defaultLanguageSelect = new Select(messages.getMessage("messages.default.language")); defaultLanguageSelect.setWidth(150, UNITS_PIXELS); languageDescriptionLabel = new Label(messages.getMessage("messages.language.description")); languageTabs = new TabSheet(); languageTabs.setCloseHandler(this); }
public void deleteTreeItem(final Object widget) { I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource(); ConfirmDialog.show(application.getMainWindow(), messages.getMessage("dialog.delete.title"), messages.getMessage("dialog.delete.question"), messages.getMessage("dialog.delete.confirm"), messages.getMessage("dialog.delete.cancel"), new ConfirmDialog.Listener() { public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { HierarchicalContainer hc = (HierarchicalContainer) stepTree.getContainerDataSource(); hc.removeItemRecursively(widget); showParams(null); } } } ); }
@Override public void run() { languageForm.commit(); Language lang = languageForm.getLanguage(); if (languageProperties.containsKey(lang)) { I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource(); VaadinUtility.errorNotification( getApplication(), messages, messages.getMessage("messages.language.new.exists") ); return; } addLanguageTab(lang, null); NewLanguageWindow.this.close(); } }
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); }
@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) { Property<?> property = (Property<?>) arg0; return property.getName() + ": " + (property.getValue() == null ? "" : property.getValue()); } }); parameters = StringUtils.join(properties.toArray(), "<br/>"); } return "<b>" + item.getWidgetItem().getDescription() + "</b><br/>" + parameters; } }
private void initComponent() { I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource(); logoUploader = new ProcessLogoUploader(); logoUploader.setProcessLogoHandler(this); logoDescriptionLabel = new Label(messages.getMessage( "process.logo.description", new Object[] { humanReadableByteCount(ModelConstants.PROCESS_LOGO_FILE_SIZE, false) } )); logoResetButton = new Button(messages.getMessage("process.logo.reset")); logoResetButton.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { handleProcessLogo(null); } }); }
public BaseUploader(Application application) { this.application = application; // TODO pass from ThreadLocal messages = I18NSource.ThreadUtil.getThreadI18nSource(); nullOut = new OutputStream() { @Override public void write(int b) throws IOException { // do nothing } }; maxFileSize = 1024; allowedMimeTypes = new HashSet<String>(); initComponent(); }
private void initComponent() { I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource(); descriptionLabel = styled(new Label(messages.getMessage("process.definition.description")), "h2"); descriptionInfoLabel = htmlLabel(messages.getMessage("process.definition.description.info")); descriptionField = new TextField(); descriptionField.setNullRepresentation(""); descriptionField.setWidth("100%"); commentLabel = styled(new Label(messages.getMessage("process.definition.comment")), "h2"); commentInfoLabel = htmlLabel(messages.getMessage("process.definition.comment.info")); commentArea = new RichTextArea(); commentArea.setNullRepresentation(""); commentArea.setWidth("100%"); }
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; }
@Override public void init() { super.init(); mainWindow = new Window(I18NSource.ThreadUtil.getThreadI18nSource().getMessage("application.title")); jsHelper = new JavaScriptHelper(mainWindow); jsHelper.preventWindowClosing(); mainWindow.addParameterHandler(this); setMainWindow(mainWindow); }
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 }; }
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; }
@Override public void init() { super.init(); mainWindow = new Window(I18NSource.ThreadUtil.getThreadI18nSource().getMessage("application.title")); mainWindow.addParameterHandler(this); jsHelper = new JavaScriptHelper(mainWindow); jsHelper.preventWindowClosing(); setMainWindow(mainWindow); }
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%"); }
@Override protected I18NSource getI18NSource() { return I18NSource.ThreadUtil.getThreadI18nSource(); } };
public static String getParametrizedLocalizedMessage(String key, Object... parameters) { return I18NSource.ThreadUtil.getThreadI18nSource().getMessage( (key.startsWith("processdata") ? "" : "widget.process_data_block.editor.") + key, parameters ); }
@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(); setMainWindow(mainWindow); }