public void extend(final TextArea textArea, List<String> users, List<String> projects) { if (textArea.getId() == null) { textArea.setId(UUID.randomUUID().toString().replace("-", "")); } StringBuilder execute = new StringBuilder("htextcomplete('#"); execute.append(textArea.getId()); execute.append("', ["); for (String user : users) { execute.append("'").append(user).append("',"); } execute.deleteCharAt(execute.length() - 1); execute.append("], ["); for (String project : projects) { execute.append("'").append(project).append("',"); } execute.deleteCharAt(execute.length() - 1); execute.append("])"); super.extend(textArea); com.vaadin.ui.JavaScript.getCurrent().execute(execute.toString()); }
private VerticalLayout getCopyPasteLayout() { VerticalLayout layout = new VerticalLayout(); Label label = new Label("Paste the complete Content of your java-file here:"); layout.addComponent(label); layout.setComponentAlignment(label, Alignment.TOP_CENTER); copyPasteTextfield = new TextArea(); copyPasteTextfield.setWordWrap(false); copyPasteTextfield.setWidth(30.0f, Unit.REM); copyPasteTextfield.setHeight(30.0f, Unit.REM); layout.addComponent(copyPasteTextfield); layout.setComponentAlignment(copyPasteTextfield, Alignment.MIDDLE_CENTER); Button button = new Button(ADD); button.addClickListener(x -> addPasteListener.accept(getCopyPasteText())); layout.addComponent(button); layout.setComponentAlignment(button, Alignment.BOTTOM_RIGHT); return layout; }
@Override public Component getDetails(final RowReference rowReference) { // Find the bean to generate details for final Item item = rowReference.getItem(); final String message = (String) item.getItemProperty(ProxyMessage.PXY_MSG_VALUE).getValue(); final TextArea textArea = new TextArea(); textArea.addStyleName(ValoTheme.TEXTAREA_BORDERLESS); textArea.addStyleName(ValoTheme.TEXTAREA_TINY); textArea.addStyleName("inline-icon"); textArea.setHeight(120, Unit.PIXELS); textArea.setWidth(100, Unit.PERCENTAGE); textArea.setValue(message); textArea.setReadOnly(Boolean.TRUE); return textArea; }
private Component getSimpleExamle() { VerticalLayout vlo = new VerticalLayout(); vlo.setMargin(true); vlo.setHeight("100%"); vlo.setWidth("100%"); vlo.setSpacing(true); vlo.addComponent(getTestButtons()); for (int i = 0; i < components.length; i++) { components[i] = new TextArea(); ((TextArea) components[i]).setValue(texts[i]); components[i].setSizeFull(); } bl = new BorderLayout(); vlo.addComponent(bl); vlo.setExpandRatio(bl, 1); bl.addComponent(components[0], BorderLayout.Constraint.NORTH); bl.addComponent(components[1], BorderLayout.Constraint.SOUTH); bl.addComponent(components[2], BorderLayout.Constraint.CENTER); bl.addComponent(components[3], BorderLayout.Constraint.EAST); bl.addComponent(components[4], BorderLayout.Constraint.WEST); return vlo; }
/** * Creates the description. * * @return the text area */ private static TextArea createDescription() { final TextArea totalpartytoplistLabel = new TextArea( "Party Ranking by topic", "Time served in Parliament:ALL:CURRENT:" + "\nTime served in Committees:ALL:CURRENT:" + "\nTime served in Government:ALL:CURRENT:" + "\nTop document author NR:ALL:YEAR:CURRENT:*FILTER:DocumnetType" + "\nTop document author SIZE:YEAR:ALL:CURRENT:*FILTER:DocumnetType" + "\nTop votes NR/PERCENTAGE :ALL:YEAR:CURRENT::#Views:List,Timeline,BarChart,PieChart" + "\nTop vote winner NR/PERCENTAGE :ALL:YEAR:CURRENT::#Views:List,Timeline,BarChart,PieChart" + "\nTop vote party rebel NR/PERCENTAGE :ALL:YEAR:CURRENT::#Views:List,Timeline,BarChart,PieChart" + "\nTop vote presence NR/PERCENTAGE :ALL:YEAR:CURRENT::#Views:List,Timeline,BarChart,PieChart" + "\nSearch by name"); totalpartytoplistLabel.setSizeFull(); totalpartytoplistLabel.setStyleName("Level2Header"); return totalpartytoplistLabel; }
/** * Creates the description. * * @return the text area */ private static TextArea createDescription() { final TextArea totalpoliticantoplistLabel = new TextArea("Politician Ranking by topic", "Time served in Parliament:ALL:CURRENT:*FILTER:Gender,Party,ElectionRegion" + "\nTime served in Committees:ALL:CURRENT:*FILTER:Gender,Party,ElectionRegion" + "\nTime served in Government:ALL:CURRENT:*FILTER:Gender,Party,ElectionRegion" + "\nTop document author NR:ALL:YEAR:CURRENT:*FILTER:DocumnetType,Gender,Party,ElectionRegion" + "\nTop document author SIZE:YEAR:ALL:CURRENT:*FILTER:DocumnetType,Gender,Party,ElectionRegion" + "\nTop votes:ALL:YEAR:CURRENT::*FILTER:Gender,Party,ElectionRegion" + "\nTop vote winner NR/PERCENTAGE :ALL:YEAR:CURRENT::*FILTER:Gender,Party,ElectionRegion" + "\nTop vote party rebel NR/PERCENTAGE :ALL:YEAR:CURRENT::*FILTER:Gender,Party,ElectionRegion" + "\nTop vote presence NR/PERCENTAGE :ALL:YEAR:CURRENT::*FILTER:Gender,Party,ElectionRegion" + "\nSearch by name"); totalpoliticantoplistLabel.setSizeFull(); totalpoliticantoplistLabel.setStyleName("Level2Header"); return totalpoliticantoplistLabel; }
public TestWindow() { super("Test Transformation"); setWidth(800f, Unit.PIXELS); setHeight(600f, Unit.PIXELS); content.setMargin(true); TextArea textField = new TextArea(); textField.setSizeFull(); textField.setWordwrap(false); Thread thread = Thread.currentThread(); ClassLoader previousLoader = thread.getContextClassLoader(); try { thread.setContextClassLoader(getClass().getClassLoader()); textField.setValue(XsltProcessor.getTransformedXml(textArea.getValue(), editor.getValue(), XsltProcessor.PRETTY_FORMAT, false)); } finally { thread.setContextClassLoader(previousLoader); } addComponent(textField); content.setExpandRatio(textField, 1.0f); addComponent(buildButtonFooter(buildCloseButton())); }
@Override protected void buildDialogLayout() { final VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.setSpacing(true); mainLayout.setMargin(true); checkPerGraph = new CheckBox(ctx.tr("sparqlUpdate.dialog.perGraph")); checkPerGraph.setWidth("100%"); mainLayout.addComponent(checkPerGraph); mainLayout.setExpandRatio(checkPerGraph, 0.0f); txtQuery = new TextArea(ctx.tr("sparqlUpdate.dialog.query")); txtQuery.setSizeFull(); txtQuery.setRequired(true); txtQuery.addValidator(createSparqlUpdateQueryValidator()); txtQuery.setImmediate(true); mainLayout.addComponent(txtQuery); mainLayout.setExpandRatio(txtQuery, 1.0f); setCompositionRoot(mainLayout); }
@Override protected void buildDialogLayout() { final VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.setSpacing(true); mainLayout.setMargin(true); optMessageType = new OptionGroup(ctx.tr("rdfvalidation.dialog.optMessageType.caption")); optMessageType.addItem(DPUContext.MessageType.ERROR); optMessageType.addItem(DPUContext.MessageType.WARNING); optMessageType.setValue(optMessageType.getItem(0)); mainLayout.addComponent(optMessageType); txtAskQuery = new TextArea(ctx.tr("rdfvalidation.dialog.txtAskQuery.caption")); txtAskQuery.setSizeFull(); txtAskQuery.setNullRepresentation(""); txtAskQuery.setNullSettingAllowed(true); mainLayout.addComponent(txtAskQuery); mainLayout.setExpandRatio(txtAskQuery, 1.0f); setCompositionRoot(mainLayout); }
@Override protected void buildDialogLayout() { final VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.setSpacing(true); mainLayout.setMargin(true); checkPerGraph = new CheckBox(ctx.tr("SparqlConstructVaadinDialog.perGraphMode")); checkPerGraph.setWidth("100%"); mainLayout.addComponent(checkPerGraph); mainLayout.setExpandRatio(checkPerGraph, 0.0f); txtQuery = new TextArea(ctx.tr("SparqlConstructVaadinDialog.constructQuery")); txtQuery.setSizeFull(); txtQuery.setRequired(true); txtQuery.addValidator(createSparqlQueryValidator()); txtQuery.setImmediate(true); mainLayout.addComponent(txtQuery); mainLayout.setExpandRatio(txtQuery, 1.0f); setCompositionRoot(mainLayout); }
@Override protected AbstractBeanFieldGroupEditFieldFactory<ProjectRole> initBeanFormFieldFactory() { return new AbstractBeanFieldGroupEditFieldFactory<ProjectRole>(editForm) { private static final long serialVersionUID = 1L; @Override protected Field<?> onCreateField(Object propertyId) { if (propertyId.equals("description")) { final TextArea textArea = new TextArea(); textArea.setNullRepresentation(""); return textArea; } else if (propertyId.equals("rolename")) { final TextField tf = new TextField(); if (isValidateForm) { tf.setNullRepresentation(""); tf.setRequired(true); tf.setRequiredError("Please enter a role name"); } return tf; } return null; } }; }
public ImportFromClipboardWindow(String typeName, String columnsStringLabel) { super(Constants.uiImportFromClipboard); setResizable(false); setWidth("420px"); TextArea textArea = new TextArea(); textArea.addListener(this); textArea.setImmediate(true); textArea.setBuffered(true); textArea.setWidth("100%"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.addComponent(new Label(Constants.uiImportFromClipboardInstructions(columnsStringLabel), Label.CONTENT_XHTML)); layout.addComponent(textArea); setContent(layout); textArea.focus(); }
@AutoGenerated private HorizontalLayout buildHorizontalLayout_1() { // common part: create layout horizontalLayout_1 = new HorizontalLayout(); horizontalLayout_1.setImmediate(false); horizontalLayout_1.setWidth("100.0%"); horizontalLayout_1.setHeight("-1px"); horizontalLayout_1.setMargin(false); // textArea textArea = new TextArea(); textArea.setImmediate(false); textArea.setWidth("100.0%"); textArea.setHeight("-1px"); horizontalLayout_1.addComponent(textArea); horizontalLayout_1.setExpandRatio(textArea, 1.0f); return horizontalLayout_1; }
private VerticalLayout buildVerticalLayoutFile() { // common part: create layout verticalLayoutFile = new VerticalLayout(); verticalLayoutFile.setImmediate(false); verticalLayoutFile.setWidth("100.0%"); verticalLayoutFile.setHeight("100.0%"); verticalLayoutFile.setMargin(false); // textAreaFile textAreaFile = new TextArea(); textAreaFile.setCaption("Comentarios"); textAreaFile.setImmediate(false); textAreaFile.setWidth("100.0%"); textAreaFile.setHeight("-1px"); verticalLayoutFile.addComponent(textAreaFile); // horizontalLayoutFileToolbox horizontalLayoutFileToolbox = buildHorizontalLayoutFileToolbox(); verticalLayoutFile.addComponent(horizontalLayoutFileToolbox); return verticalLayoutFile; }
private void addLogArea() { logArea = new TextArea( "Coordinator Logs" ); // TODO make this file point configurable file = new File( "/var/log/chop-webapp.log" ); try { r = new RandomAccessFile( file, "r" ); } catch ( FileNotFoundException e ) { LOG.error( "Error while accessing file {}: {}", file, e ); } logArea.setHeight( "100%" ); logArea.setWidth( "100%" ); getApplicationLog(); addComponent( logArea ); this.setComponentAlignment( logArea, Alignment.TOP_CENTER ); this.setExpandRatio( logArea, 0.95f ); }
@Override protected Component buildEditor(final ValidatingFieldGroup<Note> fieldGroup2) { final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); final MultiColumnFormLayout<Note> overviewForm = new MultiColumnFormLayout<Note>(1, this.fieldGroup); overviewForm.setColumnFieldWidth(0, 500); overviewForm.setColumnLabelWidth(0, 70); // overviewForm.setColumnExpandRatio(0, 1.0f); overviewForm.setSizeFull(); // overviewForm.colspan(2); overviewForm.bindDateField("Note Date", Note_.noteDate, "yyyy-MM-dd hh:mm", Resolution.MINUTE); overviewForm.newLine(); overviewForm.bindTextField("Subject", Note_.subject); overviewForm.newLine(); final TextArea detailsEditor = overviewForm.bindTextAreaField("Body", Note_.body, 6); detailsEditor.setSizeFull(); overviewForm.setExpandRatio(1.0f); layout.addComponent(overviewForm); return layout; }
private TextArea addConsole(String title, String key) { TextArea console = new TextArea(); console.setData(key); console.setWidth(100, Unit.PERCENTAGE); console.setWordWrap(false); console.setStyleName("console"); consoles.addTab(console, title); return console; }
private void startServer(String stripeName, String serverName, Button startBT, Button stopBT, Label stateLBL, Label pidLBL) { File stripeconfig = tcConfigLocationPerStripe.get(stripeName); if (stripeconfig == null) { generateXML(false); stripeconfig = tcConfigLocationPerStripe.get(stripeName); } File workDir = new File(settings.getKitPath()); String key = stripeName + "-" + serverName; TextArea console = getConsole(key); RunningServer runningServer = new RunningServer( workDir, stripeconfig, serverName, console, 500, () -> { runningServers.remove(key); access(() -> { stopBT.setEnabled(false); startBT.setEnabled(true); pidLBL.setValue(""); stateLBL.setValue("STOPPED"); }); }, newState -> access(() -> stateLBL.setValue("STATE: " + newState)), newPID -> access(() -> pidLBL.setValue("PID: " + newPID)) ); if (runningServers.put(key, runningServer) != null) { Notification.show("ERROR", "Server is running: " + serverName, Notification.Type.ERROR_MESSAGE); return; } consoles.setSelectedTab(console); stateLBL.setValue("STARTING"); runningServer.start(); startBT.setEnabled(false); stopBT.setEnabled(true); runningServer.refreshConsole(); }
private TextArea getConsole(String key) throws NoSuchElementException { for (Component console : consoles) { if (key.equals(((AbstractComponent) console).getData())) { return (TextArea) console; } } throw new NoSuchElementException("No console found for " + key); }
RunningServer(File workDir, File stripeconfig, String serverName, TextArea console, int maxLines, Runnable onStop, Consumer<String> onState, Consumer<Long> onPID) { this.workDir = workDir; this.stripeconfig = stripeconfig; this.serverName = serverName; this.lines = new ArrayBlockingQueue<>(maxLines); this.console = console; this.onStop = onStop; this.onState = onState; this.onPID = onPID; }
@Override public void addSystemInfo(Accordion systemInfoPanel) { VerticalLayout layout = new VerticalLayout(); textArea = new TextArea("System Info"); textArea.addStyleName(UIConstants.FIXED_FONT); textArea.setValue(getInfo()); textArea.setRows(20); textArea.setHeight("400px"); textArea.setWidth("100%"); layout.addComponents(textArea); systemInfoPanel.addTab(layout, getCaption()); }
private Component buildNotes() { TextArea notes = new TextArea("Notes"); notes.setValue("Remember to:\n· Zoom in and out in the Sales view\n· Filter the transactions and drag a set of them to the Reports tab\n· Create a new report\n· Change the schedule of the movie theater"); notes.setSizeFull(); notes.addStyleName(ValoTheme.TEXTAREA_BORDERLESS); Component panel = createContentWrapper(notes); panel.addStyleName("notes"); return panel; }
/** * Diese Methode erstellt das UI, bestehend aus Inputfeld für Projektname und * Projektbeschreibung. * * @author Marco Glaser */ public void generateUi(){ setWidth(95, UNITS_PERCENTAGE); setHeight(SIZE_UNDEFINED, 0); setStyleName("projectCreationLayout"); projectNameInput = new TextField(); projectDescriptionInput = new TextArea(); gap = new Label(); secondGap = new Label(); projectNameInput.setWidth(80, UNITS_PERCENTAGE); // projectNameInput.setHeight(30, UNITS_PIXELS); projectNameInput.setStyleName("projectNameInput"); projectDescriptionInput.setWidth(80, UNITS_PERCENTAGE); projectDescriptionInput.setHeight(300, UNITS_PIXELS); projectDescriptionInput.setStyleName("projectNameInput"); gap.setHeight("20px"); secondGap.setSizeFull(); projectNameInput.setValue("Geben Sie hier den Projektnamen ein."); projectDescriptionInput.setValue("Geben Sie hier eine Beschreibung des Projekts ein."); addComponent(projectNameInput); addComponent(gap); addComponent(projectDescriptionInput); projectNameInput.setCaption("Projektname"); projectNameInput.setValue("Geben Sie hier den Projektnamen ein."); projectDescriptionInput.setCaption("Projektbeschreibung"); projectDescriptionInput.setValue("Geben Sie hier eine Projektbeschreibung ein"); // addComponent(secondGap); // setExpandRatio(secondGap, 1.0f); }
protected TextArea createTextArea(String value, int lines) { TextArea area = new TextArea(); area.setValue(value); area.setNullRepresentation(""); area.setSizeFull(); area.setReadOnly(true); area.setRows(lines); return area; }
@AutoGenerated private VerticalLayout buildMainLayout() { // common part: create layout mainLayout = new VerticalLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("-1px"); mainLayout.setHeight("-1px"); mainLayout.setMargin(true); mainLayout.setSpacing(true); // top-level component properties setWidth("-1px"); setHeight("-1px"); // textAreaResults textAreaResults = new TextArea(); textAreaResults.setCaption("Synch Results"); textAreaResults.setImmediate(false); textAreaResults.setWidth("462px"); textAreaResults.setHeight("222px"); mainLayout.addComponent(textAreaResults); // buttonSynchronize buttonSynchronize = new Button(); buttonSynchronize.setCaption("Synchronize"); buttonSynchronize.setImmediate(true); buttonSynchronize.setWidth("-1px"); buttonSynchronize.setHeight("-1px"); mainLayout.addComponent(buttonSynchronize); mainLayout.setComponentAlignment(buttonSynchronize, new Alignment(24)); return mainLayout; }
/** * Gets the specified property's data type. "Name" is a <code>String</code>, * "Size" is a <code>Long</code>, "Last Modified" is a <code>Date</code>. If * propertyId is not one of those, <code>null</code> is returned. * * @param propertyId * the ID of the property whose type is requested. * @return data type of the requested property, or <code>null</code> */ @Override public Class<?> getType(Object propertyId) { if (propertyId.equals(PROPERTY_NAME)) { return String.class; } if (propertyId.equals(PROPERTY_ICON)) { return Resource.class; } if (propertyId.equals(PROPERTY_SIZE)) { return Long.class; } if (propertyId.equals(PROPERTY_LASTMODIFIED)) { return Date.class; } if (propertyId.equals(PROPERTY_VERSION)) { return String.class; } if (propertyId.equals(PROPERTY_STATUS)) { return TextArea.class; } if (propertyId.equals(PROPERTY_DATA)) { return Object.class; } return null; }
private static TextArea createTargetFilterQuery() { final TextArea filterField = new TextAreaBuilder().style("text-area-style") .id(UIComponentIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD) .maxLengthAllowed(SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH).buildTextComponent(); filterField.setId(UIComponentIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD); filterField.setNullRepresentation(""); filterField.setEnabled(false); filterField.setSizeUndefined(); return filterField; }
private TextArea createDescription() { final TextArea descriptionField = new TextAreaBuilder().style("text-area-style") .prompt(i18n.getMessage("textfield.description")).id(UIComponentIdProvider.ROLLOUT_DESCRIPTION_ID) .buildTextComponent(); descriptionField.setNullRepresentation(""); descriptionField.setSizeUndefined(); return descriptionField; }
private TextArea createTargetFilterQuery() { final TextArea filterField = new TextAreaBuilder().style("text-area-style") .id(UIComponentIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD) .maxLengthAllowed(SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH).buildTextComponent(); filterField.setNullRepresentation(""); filterField.setEnabled(false); filterField.setSizeUndefined(); return filterField; }
/** * Set tag name and desc field border color based on chosen color. * * @param tagName * @param tagDesc * @param taregtTagColor */ private void createDynamicStyleForComponents(final TextField tagName, final TextField typeKey, final TextArea typeDesc, final String typeTagColor) { tagName.removeStyleName(SPUIDefinitions.TYPE_NAME); typeKey.removeStyleName(SPUIDefinitions.TYPE_KEY); typeDesc.removeStyleName(SPUIDefinitions.TYPE_DESC); getDynamicStyles(typeTagColor); tagName.addStyleName(TYPE_NAME_DYNAMIC_STYLE); typeKey.addStyleName(TYPE_NAME_DYNAMIC_STYLE); typeDesc.addStyleName(TYPE_DESC_DYNAMIC_STYLE); }
/** * Set tag name and desc field border color based on chosen color. * * @param tagName * @param tagDesc * @param taregtTagColor */ protected void createDynamicStyleForComponents(final TextField tagName, final TextArea tagDesc, final String taregtTagColor) { tagName.removeStyleName(SPUIDefinitions.TAG_NAME); tagDesc.removeStyleName(SPUIDefinitions.TAG_DESC); getTargetDynamicStyles(taregtTagColor); tagName.addStyleName(TAG_NAME_DYNAMIC_STYLE); tagDesc.addStyleName(TAG_DESC_DYNAMIC_STYLE); }
private TextArea getDescriptionTextArea() { final TextArea description = new TextAreaBuilder().caption(i18n.getMessage("textfield.description")) .style("text-area-style").prompt(i18n.getMessage("textfield.description")).immediate(true) .id(UIComponentIdProvider.BULK_UPLOAD_DESC).buildTextComponent(); description.setNullRepresentation(""); description.setWidth("100%"); return description; }
private TextArea createValueTextField() { valueTextArea = new TextAreaBuilder().caption(i18n.getMessage("textfield.value")).required(true) .prompt(i18n.getMessage("textfield.value")).immediate(true).id(UIComponentIdProvider.METADATA_VALUE_ID) .maxLengthAllowed(MetaData.VALUE_MAX_SIZE).buildTextComponent(); valueTextArea.setNullRepresentation(""); valueTextArea.setSizeFull(); valueTextArea.setHeight(100, Unit.PERCENTAGE); valueTextArea.addTextChangeListener(this::onValueChange); valueTextArea.setTextChangeEventMode(TextChangeEventMode.EAGER); return valueTextArea; }
/** * Creates the description. * * @return the text area */ private static TextArea createDescription() { final TextArea totalCommitteeRankinglistLabel = new TextArea(COMMITTEE_RANKING_BY_TOPIC, COMMITTEE_RANKING_BY_TOPIC_DESCRIPTION); totalCommitteeRankinglistLabel.setSizeFull(); totalCommitteeRankinglistLabel.setStyleName("Level2Header"); return totalCommitteeRankinglistLabel; }
/** * Creates the description. * * @return the text area */ private static TextArea createDescription() { final TextArea totalCommitteeRankinglistLabel = new TextArea(MINISTRY_RANKING_BY_TOPIC, MINISTRY_RANKING_BY_TOPIC_DESCRIPTION); totalCommitteeRankinglistLabel.setSizeFull(); totalCommitteeRankinglistLabel.setStyleName("Level2Header"); return totalCommitteeRankinglistLabel; }
public OutcomeOfUserStory(final AbstractPrototypeComponent parent) { super(parent, new VerticalLayout()); this.txta4Result = new TextArea("Ouput"); this.fieldSet = new HashSet<>(2); this.fieldSet.add(this.txta4Result); defineWithin(this.layout); }
protected void initForm() { form = new Form(); form.setValidationVisibleOnCommit(true); form.setImmediate(true); addComponent(form); // name nameField = new TextField(i18nManager.getMessage(Messages.TASK_NAME)); nameField.focus(); nameField.setRequired(true); nameField.setRequiredError(i18nManager.getMessage(Messages.TASK_NAME_REQUIRED)); form.addField("name", nameField); // description descriptionArea = new TextArea(i18nManager.getMessage(Messages.TASK_DESCRIPTION)); descriptionArea.setColumns(25); form.addField("description", descriptionArea); // duedate dueDateField = new DateField(i18nManager.getMessage(Messages.TASK_DUEDATE)); dueDateField.setResolution(DateField.RESOLUTION_DAY); form.addField("duedate", dueDateField); // priority priorityComboBox = new PriorityComboBox(i18nManager); form.addField("priority", priorityComboBox); }
private void createOldWayCopyToClipboard() { Label label = new Label( "This variant will be removed, see <a target=\"_blank\" href=\"https://github.com/vaadin4qbanos/vaadin-jsclipboard-addon/blob/master/README.md\">README</a><br>" + "This variant was done using the library <a href='https://clipboardjs.com/' >clipboard.js</a> as a Component"); label.setContentMode(ContentMode.HTML); final TextArea anotherArea = new TextArea(); anotherArea.setId("clipboardTarget"); anotherArea.setValue("Another example to copy to clipboard"); ClipboardButton clipboardButton = new ClipboardButton("clipboardTarget"); clipboardButton.addSuccessListener(() -> { Notification.show("Copy to clipboard successful"); }); clipboardButton.addErrorListener(() -> { Notification.show("Copy to clipboard unsuccessful", Notification.Type.ERROR_MESSAGE); }); Button source = new Button(VaadinIcons.CODE); source.addClickListener((Button.ClickEvent event) -> { Window win = createOldWaySourceWindow(); win.setModal(true); UI.getCurrent().addWindow(win); }); VerticalLayout wrapper = new VerticalLayout(); wrapper.setSpacing(true); wrapper.setDefaultComponentAlignment(Alignment.TOP_CENTER); wrapper.setWidth("100%"); wrapper.addComponents(new HorizontalLayout(label), anotherArea, clipboardButton, source); addComponent(wrapper); }
@Override public Component getTargetComponent() { final TextArea textArea = new TextArea(); textArea.setSizeFull(); textArea.setValue("Copy to clipboard textarea value...."); textArea.setId("tocopie-textarea"); return textArea; }
public ErrorWindow(String intro, String message) { super("Error"); setWidth(600f, Unit.PIXELS); setHeight(300f, Unit.PIXELS); content.setMargin(true); HorizontalLayout layout = new HorizontalLayout(); Label icon = new Label(); icon.setIcon(new ThemeResource("images/error.png")); icon.setWidth(70f, Unit.PIXELS); layout.addComponent(icon); Label labelIntro = new Label(intro, ContentMode.HTML); labelIntro.setStyleName("large"); labelIntro.setWidth(530f, Unit.PIXELS); layout.addComponent(labelIntro); addComponent(layout); TextArea textField = new TextArea(); textField.setSizeFull(); textField.setWordwrap(false); textField.setValue(message); addComponent(textField); content.setExpandRatio(textField, 1.0f); addComponent(buildButtonFooter(buildCloseButton())); }