List of usage examples for com.vaadin.ui TextArea TextArea
public TextArea()
From source file:com.expressui.core.view.security.role.RoleForm.java
License:Open Source License
@Override public void init(FormFieldSet formFields) { formFields.setCoordinates("name", 1, 1); formFields.setCoordinates("allowOrDenyByDefault", 1, 2); formFields.setCoordinates("description", 2, 1, 2, 2); formFields.setField("description", new TextArea()); formFields.setWidth("description", 40, Sizeable.UNITS_EM); formFields.setHeight("description", 5, Sizeable.UNITS_EM); formFields.setAutoAdjustWidthMode("description", FormField.AutoAdjustWidthMode.NONE); }
From source file:com.expressui.sample.view.role.RoleForm.java
License:Open Source License
@Override public void configureFields(FormFields formFields) { formFields.setPosition("name", 1, 1); formFields.setPosition("allowOrDenyByDefault", 1, 2); formFields.setPosition("description", 2, 1, 2, 2); formFields.setField("description", new TextArea()); formFields.setWidth("description", 40, Sizeable.UNITS_EM); formFields.setHeight("description", 5, Sizeable.UNITS_EM); formFields.setAutoAdjustWidthMode("description", FormField.AutoAdjustWidthMode.NONE); }
From source file:com.fatminds.vaadin_cmis_integration.demo.DemoFieldFactory.java
License:Apache License
public Field createField(Item item, Object propertyId, Component uiContext) { if (null == propertyId) throw new IllegalArgumentException("Cannot create field for null propertyId"); if (null != getField(propertyId)) { return getField(propertyId); }/*w w w . j a va2 s. c o m*/ // Identify the fields by their Property ID or other metadata String pid = (String) propertyId; CmisProperty prop = (CmisProperty) item.getItemProperty(propertyId); Class<?> type = prop.getType(); CmisItem cmisItem = (CmisItem) item; String title = prop.getTitle(); if (title == null || title.isEmpty()) { title = (String) propertyId; } // Note, THIS IS NULL if we have a transient (new) Item String thisObjId = (null == cmisItem.getCmisObject() ? null : cmisItem.getCmisObject().getId()); // This field is returned by the method. // If you don't want a TextField, set it to something else in your specialization clause. Field retField = null; // By default, a TextField is returned. Use this reference to set TextField-specific properties in your // specialization clause. TextField textField; retField = textField = new TextField(); textField.setNullRepresentation(""); //textField.setWidth("100%"); textField.setCaption(title); textField.setImmediate(true); textField.setValidationVisible(false); /*** * Handle your non-standard fields by name or id here. */ if ("fmexample:description".equals(pid)) { //RichTextArea rta = new RichTextArea(); TextArea ta = new TextArea(); ta.setCaption(title); ta.setNullRepresentation("Enter formatted description"); // rta.setSizeFull(); //rta.setImmediate(true); retField = ta; } /** * Adapt to taste for handling multi-valued CMIS properties. The following uses TokenField plus a FieldWrapper and ArrayListPropertyConverter * to provide for inline suggestion, and inline storage of newly entered values for future suggestions, for multi-valued string properties. * else if (prop.isMultivalued()) { TokenField tf = new TokenField(); tf.setWidth("1000px"); PropertyConverter pc = new ArrayListPropertyConverter(); FieldWrapper fw = new CmisManyField(tf, pc, ArrayList.class); fw.setCaption(title); fw.setReadOnly(true); retField = fw; if (null != catSvc.getCmisDatalistContainer(parentInstitution, pid)) { tf.setContainerDataSource(catSvc.getCmisDatalistContainer(parentInstitution, pid)); tf.setTokenCaptionPropertyId(propertyId); tf.setImmediate(true); } else { PropertysetItem pitem = new PropertysetItem(); pitem.addItemProperty(propertyId, new ObjectProperty(propertyId)); Set<Object> s = new HashSet<Object>(); s.add(propertyId); IndexedContainer ic = new IndexedContainer(s); tf.setContainerDataSource(ic); tf.setTokenCaptionPropertyId(propertyId); } } **/ else if (Double.class.isAssignableFrom(type) || Float.class.isAssignableFrom(type) || //Number.class.isAssignableFrom(type) || //BigInteger.class.isAssignableFrom(type) || BigDecimal.class.isAssignableFrom(type)) { textField.setMaxLength(10); textField.setCaption(title); textField.setImmediate(true); textField.setPropertyDataSource(new PropertyFormatter(item.getItemProperty(propertyId)) { public String format(Object value) { return value.toString(); } public Object parse(String formattedValue) throws Exception { return new BigDecimal(Double.parseDouble(formattedValue)); } }); retField = textField; } else if (Calendar.class.isAssignableFrom(type)) { CmisDateField dateFld = new CmisDateField(title); retField = dateFld; } else if (Boolean.class.isAssignableFrom(type)) { CheckBox cb = new CheckBox(title); cb.setDescription(title); retField = cb; } // Bind to CmisProperty retField.setPropertyDataSource(prop); // Be careful with this - if it's <mandatory> in the alfresco content model, it's mandatory in your forms. boolean isRequired = prop.isMandatory(); retField.setRequired(false); putField(propertyId, retField); //Add Validators addValidators(pid, retField, title, cmisItem); log.debug("Returning a " + retField.getClass() + " for cmis property " + propertyId); return retField; }
From source file:com.foo01.ui.ReservationDetailView.java
@Override protected final void onBecomingVisible() { getNavigationBar().setCaption("Detail Rezervace"); //buttony pod navbarem HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setStyleName("buttonToolBarLayout"); buttonsLayout.setWidth("100%"); Button deleteButton = new Button(); deleteButton.setCaption("SMAZAT"); deleteButton.setWidth(null);/* w ww. j a v a2s . com*/ buttonsLayout.addComponent(deleteButton); Label plug = new Label(); buttonsLayout.addComponent(plug); Button saveButton = new Button(); saveButton.setCaption("ULOIT"); saveButton.setWidth(null); buttonsLayout.addComponent(saveButton); buttonsLayout.setExpandRatio(plug, 1.0f); List<Source> sourcesList = MockSource.mockSources(); //combobox na zdroje a jmeno uzivatele HorizontalLayout sourceAndNameLayout = new HorizontalLayout(); sourceAndNameLayout.setWidth("100%"); sourceAndNameLayout.setStyleName("sourceAndNameLayout"); NativeSelect select = new NativeSelect(); select.setNullSelectionAllowed(false); System.out.println(Page.getCurrent().getBrowserWindowWidth()); String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px"; select.setWidth(width); select.addItems(sourcesList); for (Source s : sourcesList) { if (reservation.getSource().equals(s)) { select.select(s); break; } } sourceAndNameLayout.addComponent(select); Label plug2 = new Label(); sourceAndNameLayout.addComponent(plug2); Label name = new Label(reservation.getUser()); name.setWidth(null); sourceAndNameLayout.addComponent(name); sourceAndNameLayout.setExpandRatio(plug2, 1.0f); //datepickery DatePicker dateFrom = new DatePicker(); dateFrom.setStyleName("datePickerDetailView"); dateFrom.setValue(reservation.getBeginning()); dateFrom.setUseNative(true); dateFrom.setResolution(Resolution.TIME); dateFrom.setWidth("100%"); DatePicker dateTo = new DatePicker(); dateTo.setStyleName("datePickerDetailView"); dateTo.setValue(reservation.getEnding()); dateTo.setUseNative(true); dateTo.setResolution(Resolution.TIME); dateTo.setWidth("100%"); //layout pro slider a popisky HorizontalLayout sliderLayout = new HorizontalLayout(); sliderLayout.setStyleName("sliderLayout"); sliderLayout.setWidth("100%"); sliderLayout.setSpacing(true); Label sliderCaption = new Label("Po?et: "); sliderCaption.addStyleName("sliderCaption"); sliderCaption.setWidth(null); sliderLayout.addComponent(sliderCaption); final Label horvalue = new Label(); horvalue.setWidth("45px"); horvalue.setStyleName("value"); sliderLayout.addComponent(horvalue); final Slider horslider = new Slider(1, 10); horslider.setOrientation(SliderOrientation.HORIZONTAL); horslider.setValue(Double.valueOf(1)); horslider.getState(); horslider.getValue(); horslider.setImmediate(true); horslider.setWidth("100%"); sliderLayout.addComponent(horslider); sliderLayout.setExpandRatio(horslider, 1.0f); horvalue.setValue(String.valueOf(horslider.getValue().intValue())); horslider.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { int value = horslider.getValue().intValue(); horvalue.setValue(String.valueOf(value)); } }); //switch schvaleno HorizontalLayout switchLayout = new HorizontalLayout(); switchLayout.setStyleName("switchLayout"); switchLayout.addComponent(new Label("Schvleno:")); switchLayout.setSpacing(true); Switch checkbox = new Switch(null, true); switchLayout.addComponent(checkbox); //popis rezervace TextArea description = new TextArea(); description.setStyleName("descriptionDetailView"); description.setWidth("100%"); description.setImmediate(false); description.setCaption("Popis:"); description.setValue(reservation.getDescription()); //description.setRequired(true); description.setRequiredError("Popis mus bt zadn!"); description.setNullRepresentation(""); description.setReadOnly(true); //description.setRows(0); final VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); content.setStyleName(width); content.addComponent(buttonsLayout); content.addComponent(sourceAndNameLayout); content.addComponent(dateFrom); content.addComponent(dateTo); content.addComponent(sliderLayout); content.addComponent(switchLayout); content.addComponent(description); setContent(content); }
From source file:com.foo01.ui.ReservationView.java
@Override protected final void onBecomingVisible() { getNavigationBar().setCaption("Detail Rezervace"); //buttony pod navbarem // HorizontalLayout buttonsLayout = new HorizontalLayout(); // buttonsLayout.setStyleName("buttonToolBarLayout"); // buttonsLayout.setWidth("100%"); ////from www .j a v a 2 s .c om // Button deleteButton = new Button(); // deleteButton.setCaption("SMAZAT"); // deleteButton.setWidth(null); // buttonsLayout.addComponent(deleteButton); // // Label plug = new Label(); // buttonsLayout.addComponent(plug); // // Button saveButton = new Button(); // saveButton.setCaption("ULOIT"); // saveButton.setWidth(null); // buttonsLayout.addComponent(saveButton); // buttonsLayout.setExpandRatio(plug, 1.0f); //combobox na zdroje a jmeno uzivatele List<Source> sourcesList = MockSource.mockSources(); HorizontalLayout sourceAndNameLayout = new HorizontalLayout(); sourceAndNameLayout.setWidth("100%"); sourceAndNameLayout.setStyleName("sourceAndNameLayout"); NativeSelect select = new NativeSelect(); select.setNullSelectionAllowed(false); System.out.println(Page.getCurrent().getBrowserWindowWidth()); String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px"; select.setWidth(width); select.addItems(sourcesList); for (Source s : sourcesList) { if (reservation.getSource().equals(s)) { select.select(s); break; } } sourceAndNameLayout.addComponent(select); Label plug2 = new Label(); sourceAndNameLayout.addComponent(plug2); Label name = new Label(reservation.getUser()); name.setWidth(null); sourceAndNameLayout.addComponent(name); sourceAndNameLayout.setExpandRatio(plug2, 1.0f); //datepickery DatePicker dateFrom = new DatePicker(); dateFrom.setStyleName("datePickerDetailView"); dateFrom.setValue(reservation.getBeginning()); dateFrom.setUseNative(true); dateFrom.setResolution(Resolution.TIME); dateFrom.setWidth("100%"); DatePicker dateTo = new DatePicker(); dateTo.setStyleName("datePickerDetailView"); dateTo.setValue(reservation.getEnding()); dateTo.setUseNative(true); dateTo.setResolution(Resolution.TIME); dateTo.setWidth("100%"); //layout pro slider a popisky HorizontalLayout sliderLayout = new HorizontalLayout(); sliderLayout.setStyleName("sliderLayout"); sliderLayout.setWidth("100%"); sliderLayout.setSpacing(true); Label sliderCaption = new Label("Po?et: "); sliderCaption.addStyleName("sliderCaption"); sliderCaption.setWidth(null); sliderLayout.addComponent(sliderCaption); final Label horvalue = new Label(); horvalue.setWidth("45px"); horvalue.setStyleName("value"); sliderLayout.addComponent(horvalue); final Slider horslider = new Slider(1, 10); horslider.setOrientation(SliderOrientation.HORIZONTAL); horslider.setValue(Double.valueOf(1)); horslider.getState(); horslider.getValue(); horslider.setImmediate(true); horslider.setWidth("100%"); sliderLayout.addComponent(horslider); sliderLayout.setExpandRatio(horslider, 1.0f); horvalue.setValue(String.valueOf(horslider.getValue().intValue())); horslider.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { int value = horslider.getValue().intValue(); horvalue.setValue(String.valueOf(value)); } }); //switch schvaleno HorizontalLayout switchLayout = new HorizontalLayout(); switchLayout.setStyleName("switchLayout"); switchLayout.addComponent(new Label("Schvleno:")); switchLayout.setSpacing(true); Switch checkbox = new Switch(null, true); switchLayout.addComponent(checkbox); //popis rezervace TextArea description = new TextArea(); description.setStyleName("descriptionDetailView"); description.setWidth("100%"); description.setImmediate(false); description.setCaption("Popis:"); description.setValue(reservation.getDescription()); //description.setRequired(true); description.setRequiredError("Popis mus bt zadn!"); description.setNullRepresentation(""); description.setReadOnly(true); //description.setRows(0); final VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); content.addComponent(new ButtonToolBarLayout(this)); content.addComponent(sourceAndNameLayout); content.addComponent(dateFrom); content.addComponent(dateTo); content.addComponent(sliderLayout); content.addComponent(switchLayout); content.addComponent(description); setContent(content); }
From source file:com.github.mjvesa.herd.HerdIDE.java
License:Apache License
private TextArea createConsole() { consoleString = new StringBuffer(); TextArea ta = new TextArea(); ta.setSizeFull();// ww w. ja v a 2 s.c o m return ta; }
From source file:com.github.moscaville.contactsdb.main.DetailView.java
private TextArea createNotesField(String inputPrompt, HorizontalLayout horizontalLayout) { TextArea textArea = new TextArea(); textArea.setInputPrompt(inputPrompt); textArea.setImmediate(true);//w ww.j ava 2 s . c o m textArea.setNullRepresentation(""); if (horizontalLayout != null) { horizontalLayout.addComponent(textArea); } return textArea; }
From source file:com.haulmont.cuba.web.exception.ExceptionDialog.java
License:Apache License
public ExceptionDialog(Throwable throwable, @Nullable String caption, @Nullable String message) { final AppUI ui = AppUI.getCurrent(); String closeShortcut = clientConfig.getCloseShortcut(); KeyCombination closeCombination = KeyCombination.create(closeShortcut); com.vaadin.event.ShortcutAction closeShortcutAction = new com.vaadin.event.ShortcutAction( "closeShortcutAction", closeCombination.getKey().getCode(), KeyCombination.Modifier.codes(closeCombination.getModifiers())); addActionHandler(new com.vaadin.event.Action.Handler() { @Override/*from w ww. j a v a2s. c o m*/ public com.vaadin.event.Action[] getActions(Object target, Object sender) { return new com.vaadin.event.Action[] { closeShortcutAction }; } @Override public void handleAction(com.vaadin.event.Action action, Object sender, Object target) { if (Objects.equals(action, closeShortcutAction)) { close(); } } }); setCaption(caption != null ? caption : messages.getMainMessage("exceptionDialog.caption")); ThemeConstants theme = ui.getApp().getThemeConstants(); setWidth(theme.get("cuba.web.ExceptionDialog.width")); center(); final String text = message != null ? message : getText(throwable); Throwable exception = removeRemoteException(throwable); final String stackTrace = getStackTrace(exception); mainLayout = new VerticalLayout(); mainLayout.setSpacing(true); TextArea textArea = new TextArea(); textArea.setHeight(theme.get("cuba.web.ExceptionDialog.textArea.height")); textArea.setWidth(100, Unit.PERCENTAGE); boolean showExceptionDetails = userSessionSource.getUserSession() != null && security.isSpecificPermitted("cuba.gui.showExceptionDetails"); if (showExceptionDetails) { textArea.setValue(text); } else { textArea.setValue(messages.getMainMessage("exceptionDialog.contactAdmin")); } textArea.setReadOnly(true); mainLayout.addComponent(textArea); HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSpacing(true); buttonsLayout.setWidth("100%"); mainLayout.addComponent(buttonsLayout); Button closeButton = new CubaButton(messages.getMainMessage("exceptionDialog.closeBtn")); closeButton.addClickListener((Button.ClickListener) event -> this.close()); buttonsLayout.addComponent(closeButton); showStackTraceButton = new CubaButton(messages.getMainMessage("exceptionDialog.showStackTrace")); showStackTraceButton .addClickListener((Button.ClickListener) event -> setStackTraceVisible(!isStackTraceVisible)); buttonsLayout.addComponent(showStackTraceButton); showStackTraceButton.setVisible(showExceptionDetails); Label spacer = new Label(); buttonsLayout.addComponent(spacer); buttonsLayout.setExpandRatio(spacer, 1); String cubaLogContentClass = "c-exception-dialog-log-content"; String cubaCopyLogContentClass = cubaLogContentClass + "-" + UUID.randomUUID(); if (browserSupportCopy()) { copyButton = new CubaButton(messages.getMainMessage("exceptionDialog.copyStackTrace")); copyButton.setVisible(false); CubaCopyButtonExtension copyExtension = CubaCopyButtonExtension.copyWith(copyButton, cubaCopyLogContentClass); copyExtension .addCopyListener( event -> Notification.show( messages.getMainMessage(event.isSuccess() ? "exceptionDialog.copingSuccessful" : "exceptionDialog.copingFailed"), Notification.Type.TRAY_NOTIFICATION)); buttonsLayout.addComponent(copyButton); } if (userSessionSource.getUserSession() != null) { if (!StringUtils.isBlank(clientConfig.getSupportEmail())) { Button reportButton = new CubaButton(messages.getMainMessage("exceptionDialog.reportBtn")); reportButton.addClickListener((Button.ClickListener) event -> { sendSupportEmail(text, stackTrace); reportButton.setEnabled(false); }); buttonsLayout.addComponent(reportButton); if (ui.isTestMode()) { reportButton.setCubaId("errorReportButton"); } } } Button logoutButton = new CubaButton(messages.getMainMessage("exceptionDialog.logout")); logoutButton.addClickListener((Button.ClickListener) event -> logoutPrompt()); buttonsLayout.addComponent(logoutButton); stackTraceTextArea = new TextArea(); stackTraceTextArea.setSizeFull(); stackTraceTextArea.setWordwrap(false); stackTraceTextArea.setValue(stackTrace); stackTraceTextArea.setStyleName(cubaLogContentClass); stackTraceTextArea.addStyleName(cubaCopyLogContentClass); stackTraceTextArea.setReadOnly(true); setContent(mainLayout); setResizable(false); if (ui.isTestMode()) { setId(ui.getTestIdManager().getTestId("exceptionDialog")); setCubaId("exceptionDialog"); closeButton.setCubaId("closeButton"); if (copyButton != null) { copyButton.setCubaId("copyStackTraceButton"); } showStackTraceButton.setCubaId("showStackTraceButton"); stackTraceTextArea.setCubaId("stackTraceTextArea"); logoutButton.setCubaId("logoutButton"); } }
From source file:com.jain.addon.web.bean.factory.AbstractFieldFactory.java
License:Apache License
protected Field<?> createTextField(JNIProperty property) { if (property.getType() == JPropertyType.TEXT_AREA) { TextArea field = new TextArea(); field.setInputPrompt(getCaption(property)); field.setNullRepresentation(""); field.setRows(5);/*w w w. j ava2s. com*/ return field; } if (property.getType() == JPropertyType.RICH_TEXT_AREA) { RichTextArea field = new RichTextArea(); field.setNullRepresentation(""); return field; } if (property.getType() == JPropertyType.IMAGE) { JImage image = new JImage(); image.setInterruptionMessage(property.getName() + ".upload.interruption"); image.setUploadButtonCaption(property.getName() + ".upload.button.caption"); return image; } TextField field = new TextField(); field.setInputPrompt(getCaption(property)); field.setNullRepresentation(""); return field; }
From source file:com.jain.addon.web.bean.factory.generator.text.TextAreaFieldGenerator.java
License:Apache License
public Field<?> createField(Class<?> type, JNIProperty property) { TextArea field = new TextArea(); field.setInputPrompt(getCaption(property)); field.setNullRepresentation(""); field.setRows(5);//from ww w . j a va 2 s.c om return field; }