List of usage examples for com.vaadin.ui TextArea setValue
@Override public void setValue(String value)
From source file:org.apache.openaz.xacml.admin.components.PIPManagement.java
License:Apache License
protected void initializeTree(boolean isReadOnly) { ////from w w w. j a v a2s . c o m // Initialize GUI properties // this.tablePIP.setImmediate(true); this.tablePIP.setContainerDataSource(this.container); this.tablePIP.setItemCaptionMode(ItemCaptionMode.PROPERTY); this.tablePIP.setItemCaptionPropertyId("name"); this.tablePIP.setVisibleColumns(visibleColumns); this.tablePIP.setColumnHeaders(columnHeaders); this.tablePIP.setSizeFull(); // // Access? // if (isReadOnly) { if (logger.isDebugEnabled()) { logger.debug("read only pip access"); } return; } this.tablePIP.setSelectable(true); // // Setup click handler // this.tablePIP.addItemClickListener(new ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { PIPManagement.editConfiguration(self.container.getItem(event.getItemId())); } } }); // // Setup action handler // this.tablePIP.addActionHandler(new Handler() { private static final long serialVersionUID = 1L; @Override public Action[] getActions(Object target, Object sender) { if (target == null) { return new Action[] { ADD_CONFIGURATION }; } // // Target is an Object ID // EntityItem<PIPConfiguration> config = self.container.getItem(target); if (config != null && config.getEntity().isReadOnly() == false) { if (config.getEntity().requiresResolvers()) { return new Action[] { EDIT_CONFIGURATION, CLONE_CONFIGURATION, REMOVE_CONFIGURATION, PUBLISH_CONFIGURATION, ADD_RESOLVER }; } else { return new Action[] { EDIT_CONFIGURATION, CLONE_CONFIGURATION, REMOVE_CONFIGURATION, PUBLISH_CONFIGURATION }; } } if (logger.isDebugEnabled()) { logger.debug("Could not find item: " + target); } return null; } @Override public void handleAction(Action action, Object sender, Object target) { EntityItem<PIPConfiguration> config = self.container.getItem(target); if (config == null) { if (logger.isDebugEnabled()) { logger.debug("Could not find item: " + target); } return; } if (action == ADD_CONFIGURATION) { PIPManagement.editConfiguration(self.container.createEntityItem(new PIPConfiguration())); return; } if (action == EDIT_CONFIGURATION) { PIPManagement.editConfiguration(config); return; } if (action == CLONE_CONFIGURATION) { self.cloneConfiguration(config); return; } if (action == REMOVE_CONFIGURATION) { self.removeConfiguration(config); return; } if (action == ADD_RESOLVER) { PIPResolverComponent.addResolver(config.getEntity(), null); return; } if (action == PUBLISH_CONFIGURATION) { PIPResolverComponent.publishConfiguration(config); return; } } }); // // When a selection changes listener // this.tablePIP.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { self.setupButtons(); } }); this.tablePIP.addGeneratedColumn("description", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { EntityItem<PIPConfiguration> entity = self.container.getItem(itemId); if (entity != null && entity.getEntity() != null) { TextArea area = new TextArea(); area.setValue(entity.getEntity().getDescription()); area.setNullRepresentation(""); area.setSizeFull(); area.setReadOnly(true); return area; } return null; } }); this.tablePIP.addGeneratedColumn("piptype", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { EntityItem<PIPConfiguration> entity = self.container.getItem(itemId); if (entity != null && entity.getEntity() != null) { return entity.getEntity().getPiptype().getType(); } return null; } }); // // Customize the resolver column // this.tablePIP.addGeneratedColumn("Resolvers", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { EntityItem<PIPConfiguration> entity = self.container.getItem(itemId); if (entity != null && entity.getEntity() != null && entity.getEntity().requiresResolvers()) { PIPResolverComponent component = new PIPResolverComponent(entity.getEntity()); return component; } return null; } }); }
From source file:org.apache.openaz.xacml.admin.view.windows.PDPStatusWindow.java
License:Apache License
protected TextArea createTextArea(String value, int lines) { TextArea area = new TextArea(); area.setValue(value); area.setNullRepresentation(""); area.setSizeFull();/*from w w w . j a va2s . com*/ area.setReadOnly(true); area.setRows(lines); return area; }
From source file:org.apache.tamaya.ui.views.ConfigView.java
License:Apache License
private Component createRuntimeTab() { VerticalLayout tabLayout = new VerticalLayout(); TextArea runtimeProps = new TextArea(); runtimeProps.setRows(25);//from w w w . ja va 2 s .c o m StringBuilder b = new StringBuilder(); b.setLength(0); b.append("Available Processors : ").append(Runtime.getRuntime().availableProcessors()).append('\n'); b.append("Free Memory : ").append(Runtime.getRuntime().freeMemory()).append('\n'); b.append("Max Memory : ").append(Runtime.getRuntime().maxMemory()).append('\n'); b.append("Total Memory : ").append(Runtime.getRuntime().totalMemory()).append('\n'); b.append("Default Locale : ").append(Locale.getDefault()).append('\n'); runtimeProps.setValue(b.toString()); runtimeProps.setReadOnly(true); runtimeProps.setHeight("100%"); runtimeProps.setWidth("100%"); tabLayout.addComponents(runtimeProps); tabLayout.setHeight("100%"); tabLayout.setWidth("100%"); return tabLayout; }
From source file:org.apache.tamaya.ui.views.ConfigView.java
License:Apache License
private Component createSysPropsTab() { VerticalLayout tabLayout = new VerticalLayout(); TextArea sysProps = new TextArea(); sysProps.setRows(25);//from w ww.java 2 s. co m StringBuilder b = new StringBuilder(); for (Map.Entry<Object, Object> en : new TreeMap<>(System.getProperties()).entrySet()) { b.append(en.getKey()).append("=").append(en.getValue()).append('\n'); } sysProps.setValue(b.toString()); sysProps.setReadOnly(true); sysProps.setHeight("100%"); sysProps.setWidth("100%"); tabLayout.addComponents(sysProps); tabLayout.setHeight("100%"); tabLayout.setWidth("100%"); return tabLayout; }
From source file:org.apache.tamaya.ui.views.ConfigView.java
License:Apache License
private Component createEnvTab() { VerticalLayout tabLayout = new VerticalLayout(); TextArea envProps = new TextArea(); StringBuilder b = new StringBuilder(); envProps.setRows(25);// ww w.j av a 2 s .co m for (Map.Entry<String, String> en : new TreeMap<>(System.getenv()).entrySet()) { b.append(en.getKey()).append("=").append(en.getValue()).append('\n'); } envProps.setValue(b.toString()); envProps.setReadOnly(true); envProps.setHeight("100%"); envProps.setWidth("100%"); tabLayout.addComponents(envProps); tabLayout.setHeight("100%"); tabLayout.setWidth("100%"); return tabLayout; }
From source file:org.bpmnwithactiviti.explorer.form.TextAreaFormPropertyRenderer.java
License:Apache License
@Override public Field getPropertyField(FormProperty formProperty) { TextArea textArea = new TextArea(getPropertyLabel(formProperty)); textArea.setRequired(formProperty.isRequired()); textArea.setEnabled(formProperty.isWritable()); textArea.setRows(10);/*from w ww . j av a2s. com*/ textArea.setColumns(50); textArea.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty))); if (formProperty.getValue() != null) { textArea.setValue(formProperty.getValue()); } return textArea; }
From source file:org.bubblecloud.ilves.comment.CommentAddComponent.java
License:Open Source License
/** * The default constructor which instantiates Vaadin * component hierarchy./* w ww. j a v a2s. c o m*/ */ public CommentAddComponent() { final User user = DefaultSiteUI.getSecurityProvider().getUserFromSession(); final String contextPath = VaadinService.getCurrentRequest().getContextPath(); final Site site = Site.getCurrent(); final Company company = site.getSiteContext().getObject(Company.class); final EntityManager entityManager = site.getSiteContext().getObject(EntityManager.class); final Panel panel = new Panel(site.localize("panel-add-comment")); setCompositionRoot(panel); final VerticalLayout mainLayout = new VerticalLayout(); panel.setContent(mainLayout); mainLayout.setMargin(true); mainLayout.setSpacing(true); final TextArea commentMessageField = new TextArea(site.localize("field-comment-message")); mainLayout.addComponent(commentMessageField); commentMessageField.setWidth(100, Unit.PERCENTAGE); commentMessageField.setRows(3); commentMessageField.setMaxLength(255); final Button addCommentButton = new Button(site.localize("button-add-comment")); mainLayout.addComponent(addCommentButton); if (user == null) { commentMessageField.setEnabled(false); commentMessageField.setInputPrompt(site.localize("message-please-login-to-comment")); addCommentButton.setEnabled(false); } addCommentButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { final String commentMessage = commentMessageField.getValue(); if (StringUtils.isEmpty(commentMessage)) { return; } final Comment comment = new Comment(company, user, contextPath, commentMessage); entityManager.getTransaction().begin(); try { entityManager.persist(comment); entityManager.getTransaction().commit(); commentMessageField.setValue(""); if (commentListComponent != null) { commentListComponent.refresh(); } } finally { if (entityManager.getTransaction().isActive()) { entityManager.getTransaction().rollback(); } } } }); }
From source file:org.diretto.web.richwebclient.view.windows.UploadSettingsWindow.java
/** * Constructs an {@link UploadSettingsWindow}. * /*from w w w . j a v a 2 s . com*/ * @param mainWindow The corresponding {@code MainWindow} * @param uploadSection The corresponding {@code UploadSection} * @param fileInfo The {@code FileInfo} object * @param mediaType The {@code MediaType} of the file * @param uploadSettings The corresponding {@code UploadSettings} * @param otherFiles The names of the other upload files */ public UploadSettingsWindow(final MainWindow mainWindow, final UploadSection uploadSection, FileInfo fileInfo, MediaType mediaType, UploadSettings uploadSettings, List<String> otherFiles) { super("Upload Settings"); this.mainWindow = mainWindow; setModal(true); setStyleName(Reindeer.WINDOW_BLACK); setWidth("940px"); setHeight((((int) mainWindow.getHeight()) - 160) + "px"); setResizable(false); setClosable(false); setDraggable(false); setPositionX((int) (mainWindow.getWidth() / 2.0f) - 470); setPositionY(126); wrapperLayout = new HorizontalLayout(); wrapperLayout.setSizeFull(); wrapperLayout.setMargin(true, true, true, true); addComponent(wrapperLayout); mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.setSpacing(true); HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setWidth("100%"); mainLayout.addComponent(titleLayout); HorizontalLayout leftTitleLayout = new HorizontalLayout(); titleLayout.addComponent(leftTitleLayout); titleLayout.setComponentAlignment(leftTitleLayout, Alignment.MIDDLE_LEFT); Label fileNameLabel = StyleUtils.getLabelH2(fileInfo.getName()); leftTitleLayout.addComponent(fileNameLabel); leftTitleLayout.setComponentAlignment(fileNameLabel, Alignment.MIDDLE_LEFT); Label bullLabel = StyleUtils.getLabelHTML( " • "); leftTitleLayout.addComponent(bullLabel); leftTitleLayout.setComponentAlignment(bullLabel, Alignment.MIDDLE_LEFT); Label titleLabel = StyleUtils.getLabelHTML("<b>Title</b> "); leftTitleLayout.addComponent(titleLabel); leftTitleLayout.setComponentAlignment(titleLabel, Alignment.MIDDLE_LEFT); final TextField titleField = new TextField(); titleField.setMaxLength(50); titleField.setWidth("100%"); titleField.setImmediate(true); if (uploadSettings != null && uploadSettings.getTitle() != null) { titleField.setValue(uploadSettings.getTitle()); } titleField.focus(); titleField.setCursorPosition(((String) titleField.getValue()).length()); titleLayout.addComponent(titleField); titleLayout.setComponentAlignment(titleField, Alignment.MIDDLE_RIGHT); titleLayout.setExpandRatio(leftTitleLayout, 0); titleLayout.setExpandRatio(titleField, 1); mainLayout.addComponent(StyleUtils.getHorizontalLine()); GridLayout topGridLayout = new GridLayout(2, 3); topGridLayout.setColumnExpandRatio(0, 1.0f); topGridLayout.setColumnExpandRatio(1, 0.0f); topGridLayout.setWidth("100%"); topGridLayout.setSpacing(true); mainLayout.addComponent(topGridLayout); Label descriptionLabel = StyleUtils.getLabelBold("Description"); topGridLayout.addComponent(descriptionLabel, 0, 0); final TextArea descriptionArea = new TextArea(); descriptionArea.setSizeFull(); descriptionArea.setImmediate(true); if (uploadSettings != null && uploadSettings.getDescription() != null) { descriptionArea.setValue(uploadSettings.getDescription()); } topGridLayout.addComponent(descriptionArea, 0, 1); VerticalLayout tagsWrapperLayout = new VerticalLayout(); tagsWrapperLayout.setHeight("30px"); tagsWrapperLayout.setSpacing(false); topGridLayout.addComponent(tagsWrapperLayout, 0, 2); HorizontalLayout tagsLayout = new HorizontalLayout(); tagsLayout.setWidth("100%"); tagsLayout.setSpacing(true); Label tagsLabel = StyleUtils.getLabelBoldHTML("Tags "); tagsLabel.setSizeUndefined(); tagsLayout.addComponent(tagsLabel); tagsLayout.setComponentAlignment(tagsLabel, Alignment.MIDDLE_LEFT); addTagField = new TextField(); addTagField.setImmediate(true); addTagField.setInputPrompt("Enter new Tag"); addTagField.addShortcutListener(new ShortcutListener(null, KeyCode.ENTER, new int[0]) { private static final long serialVersionUID = -4767515198819351723L; @Override public void handleAction(Object sender, Object target) { if (target == addTagField) { addTag(); } } }); tagsLayout.addComponent(addTagField); tagsLayout.setComponentAlignment(addTagField, Alignment.MIDDLE_LEFT); tabSheet = new TabSheet(); tabSheet.setStyleName(Reindeer.TABSHEET_SMALL); tabSheet.addStyleName("view"); tabSheet.addListener(new ComponentDetachListener() { private static final long serialVersionUID = -657657505471281795L; @Override public void componentDetachedFromContainer(ComponentDetachEvent event) { tags.remove(tabSheet.getTab(event.getDetachedComponent()).getCaption()); } }); Button addTagButton = new Button("Add", new Button.ClickListener() { private static final long serialVersionUID = 5914473126402594623L; @Override public void buttonClick(ClickEvent event) { addTag(); } }); addTagButton.setStyleName(Reindeer.BUTTON_DEFAULT); tagsLayout.addComponent(addTagButton); tagsLayout.setComponentAlignment(addTagButton, Alignment.MIDDLE_LEFT); Label spaceLabel = StyleUtils.getLabelHTML(""); spaceLabel.setSizeUndefined(); tagsLayout.addComponent(spaceLabel); tagsLayout.setComponentAlignment(spaceLabel, Alignment.MIDDLE_LEFT); tagsLayout.addComponent(tabSheet); tagsLayout.setComponentAlignment(tabSheet, Alignment.MIDDLE_LEFT); tagsLayout.setExpandRatio(tabSheet, 1.0f); tagsWrapperLayout.addComponent(tagsLayout); tagsWrapperLayout.setComponentAlignment(tagsLayout, Alignment.TOP_LEFT); if (uploadSettings != null && uploadSettings.getTags() != null && uploadSettings.getTags().size() > 0) { for (String tag : uploadSettings.getTags()) { addTagField.setValue(tag); addTag(); } } Label presettingLabel = StyleUtils.getLabelBold("Presetting"); topGridLayout.addComponent(presettingLabel, 1, 0); final TwinColSelect twinColSelect; if (otherFiles != null && otherFiles.size() > 0) { twinColSelect = new TwinColSelect(null, otherFiles); } else { twinColSelect = new TwinColSelect(); } twinColSelect.setWidth("400px"); twinColSelect.setRows(10); topGridLayout.addComponent(twinColSelect, 1, 1); topGridLayout.setComponentAlignment(twinColSelect, Alignment.TOP_RIGHT); Label otherFilesLabel = StyleUtils .getLabelSmallHTML("Select the files which should get the settings of this file as presetting."); otherFilesLabel.setSizeUndefined(); topGridLayout.addComponent(otherFilesLabel, 1, 2); topGridLayout.setComponentAlignment(otherFilesLabel, Alignment.MIDDLE_CENTER); mainLayout.addComponent(StyleUtils.getHorizontalLine()); final UploadGoogleMap googleMap; if (uploadSettings != null && uploadSettings.getTopographicPoint() != null) { googleMap = new UploadGoogleMap(mediaType, 12, uploadSettings.getTopographicPoint().getLatitude(), uploadSettings.getTopographicPoint().getLongitude(), MapType.HYBRID); } else { googleMap = new UploadGoogleMap(mediaType, 12, 48.42255269321401d, 9.956477880477905d, MapType.HYBRID); } googleMap.setWidth("100%"); googleMap.setHeight("300px"); mainLayout.addComponent(googleMap); mainLayout.addComponent(StyleUtils.getHorizontalLine()); GridLayout bottomGridLayout = new GridLayout(3, 3); bottomGridLayout.setSizeFull(); bottomGridLayout.setSpacing(true); mainLayout.addComponent(bottomGridLayout); Label licenseLabel = StyleUtils.getLabelBold("License"); bottomGridLayout.addComponent(licenseLabel, 0, 0); final TextArea licenseArea = new TextArea(); licenseArea.setWidth("320px"); licenseArea.setHeight("175px"); licenseArea.setImmediate(true); if (uploadSettings != null && uploadSettings.getLicense() != null) { licenseArea.setValue(uploadSettings.getLicense()); } bottomGridLayout.addComponent(licenseArea, 0, 1); final Label startTimeLabel = StyleUtils.getLabelBold("Earliest possible Start Date"); startTimeLabel.setSizeUndefined(); bottomGridLayout.setComponentAlignment(startTimeLabel, Alignment.TOP_CENTER); bottomGridLayout.addComponent(startTimeLabel, 1, 0); final InlineDateField startTimeField = new InlineDateField(); startTimeField.setImmediate(true); startTimeField.setResolution(InlineDateField.RESOLUTION_SEC); boolean currentTimeAdjusted = false; if (uploadSettings != null && uploadSettings.getTimeRange() != null && uploadSettings.getTimeRange().getStartDateTime() != null) { startTimeField.setValue(uploadSettings.getTimeRange().getStartDateTime().toDate()); } else { currentTimeAdjusted = true; startTimeField.setValue(new Date()); } bottomGridLayout.setComponentAlignment(startTimeField, Alignment.TOP_CENTER); bottomGridLayout.addComponent(startTimeField, 1, 1); final CheckBox exactTimeCheckBox = new CheckBox("This is the exact point in time."); exactTimeCheckBox.setImmediate(true); bottomGridLayout.setComponentAlignment(exactTimeCheckBox, Alignment.TOP_CENTER); bottomGridLayout.addComponent(exactTimeCheckBox, 1, 2); final Label endTimeLabel = StyleUtils.getLabelBold("Latest possible Start Date"); endTimeLabel.setSizeUndefined(); bottomGridLayout.setComponentAlignment(endTimeLabel, Alignment.TOP_CENTER); bottomGridLayout.addComponent(endTimeLabel, 2, 0); final InlineDateField endTimeField = new InlineDateField(); endTimeField.setImmediate(true); endTimeField.setResolution(InlineDateField.RESOLUTION_SEC); if (uploadSettings != null && uploadSettings.getTimeRange() != null && uploadSettings.getTimeRange().getEndDateTime() != null) { endTimeField.setValue(uploadSettings.getTimeRange().getEndDateTime().toDate()); } else { endTimeField.setValue(startTimeField.getValue()); } bottomGridLayout.setComponentAlignment(endTimeField, Alignment.TOP_CENTER); bottomGridLayout.addComponent(endTimeField, 2, 1); if (!currentTimeAdjusted && ((Date) startTimeField.getValue()).equals((Date) endTimeField.getValue())) { exactTimeCheckBox.setValue(true); endTimeLabel.setEnabled(false); endTimeField.setEnabled(false); } exactTimeCheckBox.addListener(new ValueChangeListener() { private static final long serialVersionUID = 7193545421803538364L; @Override public void valueChange(ValueChangeEvent event) { if ((Boolean) event.getProperty().getValue()) { endTimeLabel.setEnabled(false); endTimeField.setEnabled(false); } else { endTimeLabel.setEnabled(true); endTimeField.setEnabled(true); } } }); mainLayout.addComponent(StyleUtils.getHorizontalLine()); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setMargin(true, false, false, false); buttonLayout.setSpacing(false); HorizontalLayout uploadButtonLayout = new HorizontalLayout(); uploadButtonLayout.setMargin(false, true, false, false); uploadButton = new Button("Upload File", new Button.ClickListener() { private static final long serialVersionUID = 8013811216568950479L; @Override @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { String titleValue = titleField.getValue().toString().trim(); Date startTimeValue = (Date) startTimeField.getValue(); Date endTimeValue = (Date) endTimeField.getValue(); boolean exactTimeValue = (Boolean) exactTimeCheckBox.getValue(); if (titleValue.equals("")) { ConfirmWindow confirmWindow = new ConfirmWindow(mainWindow, "Title Field", StyleUtils.getLabelHTML("A title entry is required.")); mainWindow.addWindow(confirmWindow); } else if (titleValue.length() < 5 || titleValue.length() > 50) { ConfirmWindow confirmWindow = new ConfirmWindow(mainWindow, "Title Field", StyleUtils .getLabelHTML("The number of characters of the title has to be between 5 and 50.")); mainWindow.addWindow(confirmWindow); } else if (!exactTimeValue && startTimeValue.after(endTimeValue)) { ConfirmWindow confirmWindow = new ConfirmWindow(mainWindow, "Date Entries", StyleUtils.getLabelHTML("The second date has to be after the first date.")); mainWindow.addWindow(confirmWindow); } else if (startTimeValue.after(new Date()) || (!exactTimeValue && endTimeValue.after(new Date()))) { ConfirmWindow confirmWindow = new ConfirmWindow(mainWindow, "Date Entries", StyleUtils.getLabelHTML("The dates are not allowed to be in the future.")); mainWindow.addWindow(confirmWindow); } else { disableButtons(); String descriptionValue = descriptionArea.getValue().toString().trim(); String licenseValue = licenseArea.getValue().toString().trim(); TopographicPoint topographicPointValue = googleMap.getMarkerPosition(); Collection<String> presettingValues = (Collection<String>) twinColSelect.getValue(); if (exactTimeValue) { endTimeValue = startTimeValue; } TimeRange timeRange = new TimeRange(new DateTime(startTimeValue), new DateTime(endTimeValue)); UploadSettings uploadSettings = new UploadSettings(titleValue, descriptionValue, licenseValue, new Vector<String>(tags), topographicPointValue, timeRange); mainWindow.removeWindow(event.getButton().getWindow()); requestRepaint(); uploadSection.upload(uploadSettings, new Vector<String>(presettingValues)); } } }); uploadButton.setStyleName(Reindeer.BUTTON_DEFAULT); uploadButtonLayout.addComponent(uploadButton); buttonLayout.addComponent(uploadButtonLayout); HorizontalLayout cancelButtonLayout = new HorizontalLayout(); cancelButtonLayout.setMargin(false, true, false, false); cancelButton = new Button("Cancel", new Button.ClickListener() { private static final long serialVersionUID = -2565870159504952913L; @Override public void buttonClick(ClickEvent event) { disableButtons(); mainWindow.removeWindow(event.getButton().getWindow()); requestRepaint(); uploadSection.cancelUpload(); } }); cancelButton.setStyleName(Reindeer.BUTTON_DEFAULT); cancelButtonLayout.addComponent(cancelButton); buttonLayout.addComponent(cancelButtonLayout); cancelAllButton = new Button("Cancel All", new Button.ClickListener() { private static final long serialVersionUID = -8578124709201789182L; @Override public void buttonClick(ClickEvent event) { disableButtons(); mainWindow.removeWindow(event.getButton().getWindow()); requestRepaint(); uploadSection.cancelAllUploads(); } }); cancelAllButton.setStyleName(Reindeer.BUTTON_DEFAULT); buttonLayout.addComponent(cancelAllButton); mainLayout.addComponent(buttonLayout); mainLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_CENTER); wrapperLayout.addComponent(mainLayout); }
From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryTable.java
License:Open Source License
/** * create Message block for Actions.//from w w w. j a v a 2 s .c om * * @param messages * as List of msg * @return Component as UI */ protected Component createMessagesBlock(final List<String> messages) { final TextArea textArea = new TextArea(); textArea.addStyleName(ValoTheme.TEXTAREA_BORDERLESS); textArea.addStyleName(ValoTheme.TEXTAREA_TINY); textArea.addStyleName("inline-icon"); textArea.setSizeFull(); int index = 1; final StringBuilder updateStatusMessages = new StringBuilder(); if (messages != null && !messages.isEmpty()) { /* Messages are available */ for (final String msg : messages) { updateStatusMessages.append('[').append(index).append("]: ").append(msg).append('\n'); index++; } } else { /* Messages are not available */ updateStatusMessages.append(i18n.get("message.no.available")); } textArea.setValue(updateStatusMessages.toString()); textArea.setReadOnly(Boolean.TRUE); return textArea; }
From source file:org.escidoc.browser.ui.listeners.OnContextAdminDescriptor.java
License:Open Source License
/** * Editing since it has a parameter/*from w ww . ja v a2 s. co m*/ * * @param adminDescriptor */ public void adminDescriptorForm(AdminDescriptor adminDescriptor) { // Editing final Window subwindow = new Window("A modal subwindow"); subwindow.setModal(true); subwindow.setWidth("650px"); VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); final TextField txtName = new TextField("Name"); txtName.setValue(adminDescriptor.getName()); txtName.setImmediate(true); txtName.setValidationVisible(true); final TextArea txtContent = new TextArea("Content"); txtContent.setColumns(30); txtContent.setRows(40); try { txtContent.setValue(adminDescriptor.getContentAsString()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } txtContent.setColumns(30); Button addAdmDescButton = new Button("Add Description"); addAdmDescButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (txtName.getValue().toString() == null) { router.getMainWindow().showNotification(ViewConstants.PLEASE_ENTER_A_NAME, Notification.TYPE_ERROR_MESSAGE); } else if (!XmlUtil.isWellFormed(txtContent.getValue().toString())) { router.getMainWindow().showNotification(ViewConstants.XML_IS_NOT_WELL_FORMED, Notification.TYPE_ERROR_MESSAGE); } else { controller.addAdminDescriptor(txtName.getValue().toString(), txtContent.getValue().toString()); (subwindow.getParent()).removeWindow(subwindow); router.getMainWindow().showNotification("Addedd Successfully", Notification.TYPE_HUMANIZED_MESSAGE); } } }); subwindow.addComponent(txtName); subwindow.addComponent(txtContent); subwindow.addComponent(addAdmDescButton); Button close = new Button(ViewConstants.CLOSE, new Button.ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); layout.addComponent(close); layout.setComponentAlignment(close, Alignment.TOP_RIGHT); router.getMainWindow().addWindow(subwindow); }