List of usage examples for com.vaadin.ui TextArea TextArea
public TextArea(ValueChangeListener<String> valueChangeListener)
From source file:ru.codeinside.gses.apservice.ApServiceForm.java
License:Mozilla Public License
private Form editForm() { final Form form = new Form(); form.setCaption(" ?"); form.setWidth("100%"); TextField idField = new TextField(" ?"); idField.setRequired(false);//ww w . j av a 2 s . c om idField.setEnabled(true); idField.setVisible(true); idField.setReadOnly(true); form.addField(ID, idField); TextArea field = new TextArea("?"); field.setRequired(true); field.setWidth("100%"); field.setMaxLength(1500); form.addField(NAME, field); MaskedTextField code = new MaskedTextField(" ?", "# ### ### ### ### ### ###"); code.setColumns(19); code.addValidator(new FilteredLongValidator("[_ ]", " " + ApInfo.formatCode(Long.MAX_VALUE))); form.addField(CODE, code); ListSelect declarantTypes = new ListSelect(" ?"); declarantTypes.setWidth("100%"); declarantTypes.setHeight("50px"); declarantTypes.setMultiSelect(true); LazyQueryContainer container = new LazyQueryContainer(new DeclarantTypeQueryDefinition(), new DeclarantTypeQueryFactory()); declarantTypes.setContainerDataSource(container); declarantTypes.setItemCaptionPropertyId("value"); declarantTypes.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY); Flash.bind(DeclarantTypeChanged.class, container, "refresh"); field.setRequired(true); field.setWidth("100%"); field.setMaxLength(1500); form.addField(DeclarantService.DECLARANT_TYPES, declarantTypes); Layout footer = form.getFooter(); Button updateButton = createUpdateButton(); Button cancelButton = createCancelButton(form); footer.addComponent(updateButton); footer.addComponent(cancelButton); ((HorizontalLayout) footer).setSpacing(true); return form; }
From source file:ru.codeinside.gses.manager.ProcedureForm.java
License:Mozilla Public License
private Form buildCreateUpdateForm() { final Form form = new Form(); TextField createTextField = createTextField("?", false, true); createTextField.setEnabled(false);/*from w ww .j av a 2s .c o m*/ createTextField.setWidth("100%"); form.addField(ID, createTextField); TextArea areaName = new TextArea("?"); areaName.setRequired(true); areaName.setWidth("100%"); areaName.setMaxLength(1500); form.addField(NAME, areaName); TextArea descriptionArea = new TextArea("?"); descriptionArea.setWidth("100%"); descriptionArea.setMaxLength(1500); form.addField(DESCRIPTION, descriptionArea); servicesComboBox = createServicesComboBox("?"); servicesComboBox.setNullSelectionAllowed(false); form.addField(SERVICE_ID, servicesComboBox); MaskedTextField code = new MaskedTextField(" ?", "# ### ### ### ### ### ###"); code.setColumns(19); code.addValidator(new FilteredLongValidator("[_ ]", " " + ApInfo.formatCode(Long.MAX_VALUE))); form.addField(CODE, code); Layout footer = form.getFooter(); ((HorizontalLayout) footer).setSpacing(true); footer.addComponent(createUpdateButton()); footer.addComponent(createCancelButton()); return form; }
From source file:se.natusoft.osgi.aps.apsconfigadminweb.gui.vaadin.components.ConfigEnvEditor.java
License:Open Source License
/** * Setup for editing./*from w w w . j ava2s. co m*/ */ private void initForEdit() { if (this.configEnv == null) { setCaption("Creating new config environment"); } else { this.origName = this.configEnv.getName(); setCaption("Editing config environment '" + this.configEnv.getName() + "'"); } this.setStyleName(CSS.APS_EDITING_TEXT); VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(true); verticalLayout.setSpacing(true); verticalLayout.setStyleName(CSS.APS_EDITING_TEXT + " " + CSS.APS_CONTENT_PANEL); this.nameTextField = new TextField("Config environment name"); if (configEnv != null) { this.nameTextField.setValue(this.configEnv.getName()); } this.nameTextField.setColumns(30); this.nameTextField.setImmediate(true); this.nameTextField.setEnabled( configEnv != null && configEnv.equals(this.configEnvAdmin.getActiveConfigEnvironment()) ? false : true); verticalLayout.addComponent(this.nameTextField); this.descriptionTextArea = new TextArea("Description of config environment."); this.descriptionTextArea.setRows(3); this.descriptionTextArea.setColumns(60); this.descriptionTextArea.setImmediate(true); if (configEnv != null) { this.descriptionTextArea.setValue(this.configEnv.getDescription()); } verticalLayout.addComponent(this.descriptionTextArea); HorizontalLayout horizontalLayout = new HorizontalLayout(); verticalLayout.addComponent(horizontalLayout); horizontalLayout.setSpacing(true); Button saveButton = new Button("Save"); saveButton.addListener(new ClickListener() { /** Click handling. */ @Override public void buttonClick(ClickEvent event) { saveConfigEnv(); } }); horizontalLayout.addComponent(saveButton); Button cancelButton = new Button("Cancel"); cancelButton.addListener(new ClickListener() { /** Click handling. */ @Override public void buttonClick(ClickEvent event) { cancel(); } }); horizontalLayout.addComponent(cancelButton); setContent(verticalLayout); }
From source file:se.natusoft.osgi.aps.apsuseradminweb.vaadin.components.editors.RoleEditor.java
License:Open Source License
/** * Creates a new RoleEditor instance.//from w w w. j a va 2 s .c o m * * @param userServiceAdmin The user admin service for editing the role. */ public RoleEditor(APSSimpleUserServiceAdmin userServiceAdmin) { this.userServiceAdmin = userServiceAdmin; this.setStyleName(CSS.APS_EDITING_TEXT); VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(true); verticalLayout.setSpacing(true); verticalLayout.setStyleName(CSS.APS_EDITING_TEXT + " " + CSS.APS_CONTENT_PANEL); // Role id, master and description. { HorizontalLayout horizLayout = new HorizontalLayout(); horizLayout.setSpacing(true); this.idTextField = new TextField("Role id"); this.idTextField.setColumns(30); this.idTextField.setImmediate(false); this.idTextField.setEnabled(true); horizLayout.addComponent(this.idTextField); this.masterRole = new CheckBox("Master Role"); this.masterRole.setImmediate(false); this.masterRole.setEnabled(true); horizLayout.addComponent(this.masterRole); verticalLayout.addComponent(horizLayout); this.descriptionTextArea = new TextArea("Description of role"); this.descriptionTextArea.setRows(3); this.descriptionTextArea.setColumns(60); this.descriptionTextArea.setImmediate(false); this.descriptionTextArea.setEnabled(true); verticalLayout.addComponent(this.descriptionTextArea); } // Roles { HorizontalLayout rolesLayout = new HorizontalLayout(); rolesLayout.setSizeFull(); // Available this.availableRoles = new Table("Available roles"); this.availableRoles.setImmediate(true); this.availableRoles.setPageLength(10); this.availableRoles.setSortAscending(true); this.availableRoles.setSizeFull(); this.availableRoles.setDragMode(Table.TableDragMode.ROW); this.availableRoles.setDropHandler(new DropHandler() { @Override public void drop(DragAndDropEvent event) { DataBoundTransferable t = (DataBoundTransferable) event.getTransferable(); Object itemId = t.getItemId(); removeSubRole(itemId); } @Override public AcceptCriterion getAcceptCriterion() { return new RoleAcceptCriterion(RoleEditor.this.availableRoles); } }); VerticalLayout availableRolesFrame = new VerticalLayout(); availableRolesFrame.setMargin(false, true, false, false); availableRolesFrame.addComponent(this.availableRoles); rolesLayout.addComponent(availableRolesFrame); // Selected this.selectedRoles = new Table("Selected sub roles of the role"); this.selectedRoles.setImmediate(true); this.selectedRoles.setPageLength(10); this.selectedRoles.setSortAscending(true); this.selectedRoles.setSizeFull(); this.selectedRoles.setDragMode(Table.TableDragMode.ROW); this.selectedRoles.setDropHandler(new DropHandler() { @Override public void drop(DragAndDropEvent event) { DataBoundTransferable t = (DataBoundTransferable) event.getTransferable(); Object itemId = t.getItemId(); addSubRole(itemId); } @Override public AcceptCriterion getAcceptCriterion() { return new RoleAcceptCriterion(RoleEditor.this.selectedRoles); } }); VerticalLayout selectedRolesFrame = new VerticalLayout(); selectedRolesFrame.setMargin(false, false, false, true); selectedRolesFrame.addComponent(this.selectedRoles); rolesLayout.addComponent(selectedRolesFrame); rolesLayout.setExpandRatio(availableRolesFrame, 0.5f); rolesLayout.setExpandRatio(selectedRolesFrame, 0.5f); verticalLayout.addComponent(rolesLayout); /* Help text for the role tables. */ HelpText roleHelptext = new HelpText( "Drag and drop roles back and forth to set or remove a role. Also note that it is fully possible to " + "create circular role dependencies. Don't!"); verticalLayout.addComponent(roleHelptext); } // Save / Cancel { HorizontalLayout horizontalLayout = new HorizontalLayout(); verticalLayout.addComponent(horizontalLayout); horizontalLayout.setSpacing(true); Button saveButton = new Button("Save"); saveButton.addListener(new Button.ClickListener() { /** Click handling. */ @Override public void buttonClick(Button.ClickEvent event) { save(); } }); horizontalLayout.addComponent(saveButton); Button cancelButton = new Button("Cancel"); cancelButton.addListener(new Button.ClickListener() { /** Click handling. */ @Override public void buttonClick(Button.ClickEvent event) { cancel(); } }); horizontalLayout.addComponent(cancelButton); } setContent(verticalLayout); }
From source file:ui.button.CommentButton.java
License:Apache License
@Override public void buttonClick(ClickEvent event) { final TextArea text = new TextArea( Translator.getTranslation("Leave us a comment, suggestion or critics. ", language)); text.setSizeFull();/*from w ww. j av a2 s .c o m*/ LifetimeButtonLink go = new LifetimeButtonLink(Translator.getTranslation("Send", language), FontAwesome.SEND); go.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { String message = text.getValue(); ServiceLocator.findLifetimeService().addComment(userId, message, language); if (ServiceLocator.findLifetimeService().sendMail("vitaelifetime@gmail.com", "New User Comment", message)) { Notification.show( Translator.getTranslation("Email sent! Thanks for helping us improve.", language), Notification.Type.TRAY_NOTIFICATION); } window.close(); } }); window = new Window(Translator.getTranslation("Your opinion counts!", language), new VerticalLayout(text, go)); window.center(); window.setModal(true); window.setStyleName("window"); window.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent e) { window.close(); } }); getUI().addWindow(window); }
From source file:uicomponents.ConditionPropertyPanel.java
License:Open Source License
/** * Create a new Condition Property Panel * // ww w . j a v a2s.co m * @param condition The name of the condition selected * @param units An EnumSet of units (e.g. SI units) */ public ConditionPropertyPanel(String condition, EnumSet<properties.Unit> units) { this.condition = condition; type = new OptionGroup("", new ArrayList<String>(Arrays.asList("Continuous", "Categorical"))); // type = new CustomVisibilityComponent(new OptionGroup("", new // ArrayList<String>(Arrays.asList("Continuous", "Categorical")))); values = new TextArea("Values"); values.setWidth("300px"); values.setInputPrompt( "Please input different occurrences of the condition " + condition + ",\n" + "one per row."); Validator v = new PropertyValuesValidator(); values.addValidator(v); values.setValidationVisible(true); values.setImmediate(true); values.setRequired(true); values.setRequiredError("Please input at least one condition."); unitField = new ComboBox("Unit", units); unitField.setStyleName(Styles.boxTheme); unitField.setEnabled(false); unitField.setVisible(false); unitField.setNullSelectionAllowed(false); NullValidator uv = new NullValidator("If the condition is continuous, a unit must be selected.", false); unitField.addValidator(uv); unitField.setValidationVisible(false); initListener(); addComponent(values); addComponent(Styles.questionize(type, "Continuous variables can be measured and have units, " + "e.g. discrete time points, categorical variables don't, e.g. different genotypes.", "Variable Type")); addComponent(unitField); setSpacing(true); }
From source file:uicomponents.GeneralMSInfoPanel.java
License:Open Source License
public GeneralMSInfoPanel(DBVocabularies vocabs, String name) { this.setCaption(name); this.vocabs = vocabs; List<String> chromTypes = new ArrayList<String>(vocabs.getChromTypesMap().keySet()); Collections.sort(chromTypes); deviceBox = new ComboBox("MS Device"); deviceBox.setFilteringMode(FilteringMode.CONTAINS); deviceBox.setStyleName(Styles.boxTheme); deviceBox.setWidth("300px"); chromType = new ComboBox("MS Chromatography Type", chromTypes); chromType.setFilteringMode(FilteringMode.CONTAINS); chromType.setStyleName(Styles.boxTheme); lcmsMethodBox = new ComboBox("MS LCMS Method"); lcmsMethodBox.setFilteringMode(FilteringMode.CONTAINS); lcmsMethodBox.setStyleName(Styles.boxTheme); lcmsMethodBox.setWidth("350px"); lcmsSpecial = new TextArea("LCMS Method Name"); lcmsSpecial.setStyleName(Styles.areaTheme); lcmsSpecial.setVisible(false);// w ww . j a v a 2 s .c o m addComponent(Styles.questionize(deviceBox, "The MS device that is used to conduct the experiment.", "MS Device")); addComponent(Styles.questionize(chromType, "Specifies the kind of chromatography that is coupled to the mass spectrometer.", "Chromatography Type")); addComponent(Styles.questionize(lcmsMethodBox, "Labratory specific parameters for LCMS measurements.", "LCMS Method")); addComponent(lcmsSpecial); lcmsMethodBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String val = (String) lcmsMethodBox.getValue(); boolean special = val.equals("SPECIAL_METHOD"); lcmsSpecial.setVisible(special); if (!special) lcmsSpecial.setValue(""); } }); setSpacing(true); }
From source file:uicomponents.ProjectInformationComponent.java
License:Open Source License
public ProjectInformationComponent(List<String> spaces, Set<String> people) { setSpacing(true);// w w w. j a va 2 s.c o m setSizeUndefined(); Collections.sort(spaces); spaceBox = new ComboBox("Project", spaces); spaceBox.setStyleName(Styles.boxTheme); spaceBox.setNullSelectionAllowed(false); spaceBox.setImmediate(true); spaceBox.setFilteringMode(FilteringMode.CONTAINS); addComponent(Styles.questionize(spaceBox, "Name of the project", "Project Name")); ComboBox prBox = new ComboBox("Sub-Project"); prBox.setStyleName(Styles.boxTheme); projectBox = new CustomVisibilityComponent(prBox); projectBox.setStyleName(Styles.boxTheme); projectBox.setImmediate(true); addComponent(Styles.questionize(projectBox, "QBiC 5 letter project code", "Project")); project = new StandardTextField(); project.setStyleName(Styles.fieldTheme); project.setMaxLength(5); project.setWidth("90px"); project.setEnabled(false); project.setValidationVisible(true); reloadProjects = new Button(); Styles.iconButton(reloadProjects, FontAwesome.REFRESH); HorizontalLayout proj = new HorizontalLayout(); proj.setCaption("New Sub-Project"); proj.addComponent(project); proj.addComponent(reloadProjects); CustomVisibilityComponent newProj = new CustomVisibilityComponent(proj); addComponent(Styles.questionize(newProj, "Automatically create an unused QBiC project code or fill in your own. " + "The code consists of 5 characters, must start with Q and not contain Y or Z. You can create a random unused code by clicking " + FontAwesome.REFRESH.getHtml() + ".", "New Sub-Project")); expName = new StandardTextField("Short name"); expName.setWidth("200px"); // expName.setRequired(true); expName.setVisible(false); expName.setInputPrompt("Name of sub project"); addComponent(expName); HorizontalLayout persBoxH = new HorizontalLayout(); persBoxH.setCaption("Principal Investigator"); VerticalLayout persBox = new VerticalLayout(); piBox = new ComboBox(); piBox.addItems(people); piBox.setFilteringMode(FilteringMode.CONTAINS); piBox.setStyleName(Styles.boxTheme); contactBox = new ComboBox("Contact Person", people); contactBox.setFilteringMode(FilteringMode.CONTAINS); contactBox.setStyleName(Styles.boxTheme); managerBox = new ComboBox("Project Manager", people); managerBox.setFilteringMode(FilteringMode.CONTAINS); managerBox.setStyleName(Styles.boxTheme); persBox.addComponent(piBox); persBox.addComponent(contactBox); persBox.addComponent(managerBox); reloadPeople = new Button(); Styles.iconButton(reloadPeople, FontAwesome.REFRESH); persBoxH.addComponent(persBox); persBoxH.addComponent(reloadPeople); personBox = new CustomVisibilityComponent(persBoxH); personBox.setVisible(false); addComponent(Styles.questionize(personBox, "Investigator and contact person of this project. Please contact us if additional people need to be added. Press refresh button to show newly added people.", "Contacts")); projectDescription = new TextArea("Description"); projectDescription.setRequired(true); projectDescription.setStyleName(Styles.fieldTheme); projectDescription.setInputPrompt("Sub-Project description, maximum of 2000 symbols."); projectDescription.setWidth("100%"); projectDescription.setHeight("110px"); projectDescription.setVisible(false); StringLengthValidator lv = new StringLengthValidator( "Description is only allowed to contain a maximum of 2000 letters.", 0, 2000, true); projectDescription.addValidator(lv); projectDescription.setImmediate(true); projectDescription.setValidationVisible(true); addComponent(projectDescription); }
From source file:views.AdminView.java
License:Open Source License
public AdminView(IOpenBisClient openbis, DBVocabularies vocabularies, OpenbisCreationController creationController, String user) { this.user = user; this.registrator = creationController; this.openbis = openbis; tabs = new TabSheet(); tabs.setStyleName(ValoTheme.TABSHEET_FRAMED); VerticalLayout spaceView = new VerticalLayout(); spaceView.setSpacing(true);//from w ww. ja va 2 s. co m spaceView.setMargin(true); space = new TextField("Space"); space.setWidth("300px"); space.setStyleName(Styles.fieldTheme); users = new TextArea("Users"); users.setStyleName(Styles.areaTheme); users.setWidth("100px"); users.setHeight("100px"); createSpace = new Button("Create Space"); spaceView.addComponent(space); spaceView.addComponent(Styles.questionize(users, "Users must exist in openBIS, otherwise the space cannot be created!", "Add Users to Space")); spaceView.addComponent(createSpace); tabs.addTab(spaceView, "Create Space"); // METADATA // metadataUpload = new MetadataUploadView(openbis, vocabularies); // tabs.addTab(metadataUpload, "Update Metadata"); // MULTISCALE addMultiScale = new MCCView(openbis, creationController, user); addMultiScale.setSpacing(true); addMultiScale.setMargin(true); tabs.addTab(addMultiScale, "Add Multiscale Samples"); addComponent(tabs); initButtons(); }