List of usage examples for com.vaadin.ui TextArea TextArea
public TextArea()
From source file:annis.gui.AboutWindow.java
License:Apache License
public AboutWindow() { setSizeFull();//from w w w. jav a 2s . c o m layout = new VerticalLayout(); setContent(layout); layout.setSizeFull(); layout.setMargin(true); HorizontalLayout hLayout = new HorizontalLayout(); Embedded logoAnnis = new Embedded(); logoAnnis.setSource(new ThemeResource("images/annis-logo-128.png")); logoAnnis.setType(Embedded.TYPE_IMAGE); hLayout.addComponent(logoAnnis); Embedded logoSfb = new Embedded(); logoSfb.setSource(new ThemeResource("images/sfb-logo.jpg")); logoSfb.setType(Embedded.TYPE_IMAGE); hLayout.addComponent(logoSfb); Link lnkFork = new Link(); lnkFork.setResource(new ExternalResource("https://github.com/korpling/ANNIS")); lnkFork.setIcon( new ExternalResource("https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png")); lnkFork.setTargetName("_blank"); hLayout.addComponent(lnkFork); hLayout.setComponentAlignment(logoAnnis, Alignment.MIDDLE_LEFT); hLayout.setComponentAlignment(logoSfb, Alignment.MIDDLE_RIGHT); hLayout.setComponentAlignment(lnkFork, Alignment.TOP_RIGHT); layout.addComponent(hLayout); layout.addComponent(new Label( "ANNIS is a project of the " + "<a href=\"http://www.sfb632.uni-potsdam.de/\">SFB632</a>.", Label.CONTENT_XHTML)); layout.addComponent(new Label("Homepage: " + "<a href=\"http://corpus-tools.org/annis/\">" + "http://corpus-tools.org/annis/</a>.", Label.CONTENT_XHTML)); layout.addComponent(new Label("Version: " + VersionInfo.getVersion())); layout.addComponent(new Label("Vaadin-Version: " + Version.getFullVersion())); TextArea txtThirdParty = new TextArea(); txtThirdParty.setSizeFull(); StringBuilder sb = new StringBuilder(); sb.append("The ANNIS team wants to thank these third party software that " + "made the ANNIS GUI possible:\n"); File thirdPartyFolder = new File(VaadinService.getCurrent().getBaseDirectory(), "THIRD-PARTY"); if (thirdPartyFolder.isDirectory()) { for (File c : thirdPartyFolder.listFiles((FileFilter) new WildcardFileFilter("*.txt"))) { if (c.isFile()) { try { sb.append(FileUtils.readFileToString(c)).append("\n"); } catch (IOException ex) { log.error("Could not read file", ex); } } } } txtThirdParty.setValue(sb.toString()); txtThirdParty.setReadOnly(true); txtThirdParty.addStyleName("shared-text"); txtThirdParty.setWordwrap(false); layout.addComponent(txtThirdParty); btClose = new Button("Close"); final AboutWindow finalThis = this; btClose.addClickListener(new OkClickListener(finalThis)); layout.addComponent(btClose); layout.setComponentAlignment(hLayout, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER); layout.setExpandRatio(txtThirdParty, 1.0f); }
From source file:annis.gui.admin.ImportPanel.java
License:Apache License
public ImportPanel() { setSizeFull();/*from w ww . j ava 2 s .c o m*/ layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeight("100%"); layout.setMargin(true); setContent(layout); FormLayout form = new FormLayout(); layout.addComponent(form); cbOverwrite = new CheckBox("Overwrite existing corpus"); form.addComponent(cbOverwrite); txtMail = new TextField("e-mail address for status updates"); txtMail.addValidator(new EmailValidator("Must be a valid e-mail address")); form.addComponent(txtMail); txtAlias = new TextField("alias name"); form.addComponent(txtAlias); HorizontalLayout actionBar = new HorizontalLayout(); actionBar.setSpacing(true); actionBar.setWidth("100%"); upload = new Upload("", this); upload.setButtonCaption("Upload ZIP file with relANNIS corpus and start import"); upload.setImmediate(true); upload.addStartedListener(this); upload.addFinishedListener(this); upload.setEnabled(true); actionBar.addComponent(upload); progress = new ProgressBar(); progress.setIndeterminate(true); progress.setVisible(false); actionBar.addComponent(progress); lblProgress = new Label(); lblProgress.setWidth("100%"); actionBar.addComponent(lblProgress); actionBar.setExpandRatio(lblProgress, 1.0f); actionBar.setComponentAlignment(lblProgress, Alignment.MIDDLE_LEFT); actionBar.setComponentAlignment(upload, Alignment.MIDDLE_LEFT); actionBar.setComponentAlignment(progress, Alignment.MIDDLE_LEFT); layout.addComponent(actionBar); btDetailedLog = new Button(); btDetailedLog.setStyleName(BaseTheme.BUTTON_LINK); btDetailedLog.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { setLogVisible(!isLogVisible()); } }); layout.addComponent(btDetailedLog); txtMessages = new TextArea(); txtMessages.setSizeFull(); txtMessages.setValue(""); txtMessages.setReadOnly(true); layout.addComponent(txtMessages); layout.setExpandRatio(txtMessages, 1.0f); setLogVisible(false); appendMessage("Ready."); }
From source file:annis.gui.admin.PopupTwinColumnSelectMultiline.java
License:Apache License
@Override protected AbstractTextField createTextField() { TextArea text = new TextArea(); text.setRows(5); return text; }
From source file:annis.gui.CitationWindow.java
License:Apache License
public CitationWindow(String query, Set<String> corpora, int contextLeft, int contextRight) { super("Citation"); VerticalLayout wLayout = new VerticalLayout(); setContent(wLayout);/*from w ww .j a v a2 s. co m*/ wLayout.setSizeFull(); String url = Helper.generateCitation(query, corpora, contextLeft, contextRight, null, 0, 10); TextArea txtCitation = new TextArea(); txtCitation.setWidth("100%"); txtCitation.setHeight("100%"); txtCitation.addStyleName(ChameleonTheme.TEXTFIELD_BIG); txtCitation.addStyleName("citation"); txtCitation.setValue(url); txtCitation.setWordwrap(true); txtCitation.setReadOnly(true); wLayout.addComponent(txtCitation); Button btOk = new Button("OK"); btOk.addListener((Button.ClickListener) this); btOk.setSizeUndefined(); wLayout.addComponent(btOk); wLayout.setExpandRatio(txtCitation, 1.0f); wLayout.setComponentAlignment(btOk, Alignment.BOTTOM_CENTER); setWidth("400px"); setHeight("200px"); }
From source file:annis.gui.controlpanel.QueryPanel.java
License:Apache License
public QueryPanel(final AnnisUI ui) { super(4, 5);/*from w w w . ja v a2s. co m*/ this.ui = ui; this.lastPublicStatus = "Welcome to ANNIS! " + "A tutorial is available on the right side."; this.state = ui.getQueryState(); setSpacing(true); setMargin(false); setRowExpandRatio(0, 1.0f); setColumnExpandRatio(0, 0.0f); setColumnExpandRatio(1, 0.1f); setColumnExpandRatio(2, 0.0f); setColumnExpandRatio(3, 0.0f); txtQuery = new AqlCodeEditor(); txtQuery.setPropertyDataSource(state.getAql()); txtQuery.setInputPrompt("Please enter AQL query"); txtQuery.addStyleName("query"); if (ui.getInstanceFont() == null) { txtQuery.addStyleName("default-query-font"); txtQuery.setTextareaStyle("default-query-font"); } else { txtQuery.addStyleName(Helper.CORPUS_FONT); txtQuery.setTextareaStyle(Helper.CORPUS_FONT); } txtQuery.addStyleName("keyboardInput"); txtQuery.setWidth("100%"); txtQuery.setHeight(15f, Unit.EM); txtQuery.setTextChangeTimeout(500); final VirtualKeyboardCodeEditor virtualKeyboard; if (ui.getInstanceConfig().getKeyboardLayout() == null) { virtualKeyboard = null; } else { virtualKeyboard = new VirtualKeyboardCodeEditor(); virtualKeyboard.setKeyboardLayout(ui.getInstanceConfig().getKeyboardLayout()); virtualKeyboard.extend(txtQuery); } txtStatus = new TextArea(); txtStatus.setValue(this.lastPublicStatus); txtStatus.setWidth("100%"); txtStatus.setHeight(4.0f, Unit.EM); txtStatus.addStyleName("border-layout"); txtStatus.setReadOnly(true); piCount = new ProgressBar(); piCount.setIndeterminate(true); piCount.setEnabled(false); piCount.setVisible(false); btShowResult = new Button("Search"); btShowResult.setIcon(FontAwesome.SEARCH); btShowResult.setWidth("100%"); btShowResult.addClickListener(new ShowResultClickListener()); btShowResult.setDescription("<strong>Show Result</strong><br />Ctrl + Enter"); btShowResult.setClickShortcut(KeyCode.ENTER, ModifierKey.CTRL); btShowResult.setDisableOnClick(true); VerticalLayout historyListLayout = new VerticalLayout(); historyListLayout.setSizeUndefined(); lstHistory = new ListSelect(); lstHistory.setWidth("200px"); lstHistory.setNullSelectionAllowed(false); lstHistory.setValue(null); lstHistory.addValueChangeListener((ValueChangeListener) this); lstHistory.setImmediate(true); lstHistory.setContainerDataSource(historyContainer); lstHistory.setItemCaptionPropertyId("query"); lstHistory.addStyleName(Helper.CORPUS_FONT); Button btShowMoreHistory = new Button("Show more details", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (historyWindow == null) { historyWindow = new Window("History"); historyWindow.setModal(false); historyWindow.setWidth("400px"); historyWindow.setHeight("250px"); } historyWindow.setContent(new HistoryPanel(state.getHistory(), ui.getQueryController())); if (UI.getCurrent().getWindows().contains(historyWindow)) { historyWindow.bringToFront(); } else { UI.getCurrent().addWindow(historyWindow); } } }); btShowMoreHistory.setWidth("100%"); historyListLayout.addComponent(lstHistory); historyListLayout.addComponent(btShowMoreHistory); historyListLayout.setExpandRatio(lstHistory, 1.0f); historyListLayout.setExpandRatio(btShowMoreHistory, 0.0f); btHistory = new PopupButton("History"); btHistory.setContent(historyListLayout); btHistory.setDescription("<strong>Show History</strong><br />" + "Either use the short overview (arrow down) or click on the button " + "for the extended view."); Button btShowKeyboard = null; if (virtualKeyboard != null) { btShowKeyboard = new Button(); btShowKeyboard.setWidth("100%"); btShowKeyboard.setDescription("Click to show a virtual keyboard"); btShowKeyboard.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btShowKeyboard.addStyleName(ValoTheme.BUTTON_SMALL); btShowKeyboard.setIcon(new ClassResource(VirtualKeyboardCodeEditor.class, "keyboard.png")); btShowKeyboard.addClickListener(new ShowKeyboardClickListener(virtualKeyboard)); } Button btShowQueryBuilder = new Button("Query<br />Builder"); btShowQueryBuilder.setHtmlContentAllowed(true); btShowQueryBuilder.addStyleName(ValoTheme.BUTTON_SMALL); btShowQueryBuilder.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); btShowQueryBuilder.setIcon(new ThemeResource("images/tango-icons/32x32/document-properties.png")); btShowQueryBuilder.addClickListener(new ShowQueryBuilderClickListener(ui)); VerticalLayout moreActionsLayout = new VerticalLayout(); moreActionsLayout.setWidth("250px"); btMoreActions = new PopupButton("More"); btMoreActions.setContent(moreActionsLayout); // btShowResultNewTab = new Button("Search (open in new tab)"); // btShowResultNewTab.setWidth("100%"); // btShowResultNewTab.addClickListener(new ShowResultInNewTabClickListener()); // btShowResultNewTab.setDescription("<strong>Show Result and open result in new tab</strong><br />Ctrl + Shift + Enter"); // btShowResultNewTab.setDisableOnClick(true); // btShowResultNewTab.setClickShortcut(KeyCode.ENTER, ModifierKey.CTRL, ModifierKey.SHIFT); // moreActionsLayout.addComponent(btShowResultNewTab); Button btShowExport = new Button("Export", new ShowExportClickListener(ui)); btShowExport.setIcon(FontAwesome.DOWNLOAD); btShowExport.setWidth("100%"); moreActionsLayout.addComponent(btShowExport); Button btShowFrequency = new Button("Frequency Analysis", new ShowFrequencyClickListener(ui)); btShowFrequency.setIcon(FontAwesome.BAR_CHART_O); btShowFrequency.setWidth("100%"); moreActionsLayout.addComponent(btShowFrequency); /* * We use the grid layout for a better rendering efficiency, but this comes * with the cost of some complexity when defining the positions of the * elements in the layout. * * This grid hopefully helps a little bit in understanding the "magic" * numbers better. * * Q: Query text field * QB: Button to toggle query builder // TODO * KEY: Button to show virtual keyboard * SEA: "Search" button * MOR: "More actions" button * HIST: "History" button * STAT: Text field with the real status * PROG: indefinite progress bar (spinning circle) * * \ 0 | 1 | 2 | 3 * --+-----+---+---+---+----- * 0 | Q | Q | Q | QB * --+-----+-----+-----+----- * 1 | Q | Q | Q | KEY * --+-----+-----+-----+----- * 2 | SEA | MOR | HIST| * --+-----+-----+-----+----- * 3 | STAT| STAT| STAT| PROG */ addComponent(txtQuery, 0, 0, 2, 1); addComponent(txtStatus, 0, 3, 2, 3); addComponent(btShowResult, 0, 2); addComponent(btMoreActions, 1, 2); addComponent(btHistory, 2, 2); addComponent(piCount, 3, 3); addComponent(btShowQueryBuilder, 3, 0); if (btShowKeyboard != null) { addComponent(btShowKeyboard, 3, 1); } // alignment setRowExpandRatio(0, 0.0f); setRowExpandRatio(1, 1.0f); setColumnExpandRatio(0, 1.0f); setColumnExpandRatio(1, 0.0f); setColumnExpandRatio(2, 0.0f); setColumnExpandRatio(3, 0.0f); //setComponentAlignment(btShowQueryBuilder, Alignment.BOTTOM_CENTER); }
From source file:annis.gui.ShareQueryReferenceWindow.java
License:Apache License
public ShareQueryReferenceWindow(DisplayedResultQuery query, boolean shorten) { super("Query reference link"); VerticalLayout wLayout = new VerticalLayout(); setContent(wLayout);/*from w w w. j a v a 2s. c o m*/ wLayout.setSizeFull(); wLayout.setMargin(true); Label lblInfo = new Label( "<p style=\"font-size: 18px\" >" + "<strong>Share your query:</strong> " + "1. Copy the generated link 2. Share this link with your peers. " + "</p>", ContentMode.HTML); wLayout.addComponent(lblInfo); wLayout.setExpandRatio(lblInfo, 0.0f); String shortURL = "ERROR"; if (query != null) { URI url = Helper.generateCitation(query.getQuery(), query.getCorpora(), query.getLeftContext(), query.getRightContext(), query.getSegmentation(), query.getBaseText(), query.getOffset(), query.getLimit(), query.getOrder(), query.getSelectedMatches()); if (shorten) { shortURL = Helper.shortenURL(url); } else { shortURL = url.toASCIIString(); } } TextArea txtCitation = new TextArea(); txtCitation.setWidth("100%"); txtCitation.setHeight("100%"); txtCitation.addStyleName(ValoTheme.TEXTFIELD_LARGE); txtCitation.addStyleName("shared-text"); txtCitation.setValue(shortURL); txtCitation.setWordwrap(true); txtCitation.setReadOnly(true); wLayout.addComponent(txtCitation); Button btClose = new Button("Close"); btClose.addClickListener((Button.ClickListener) this); btClose.setSizeUndefined(); wLayout.addComponent(btClose); wLayout.setExpandRatio(txtCitation, 1.0f); wLayout.setComponentAlignment(btClose, Alignment.BOTTOM_CENTER); setWidth("400px"); setHeight("300px"); }
From source file:annis.visualizers.htmlvis.HTMLVis.java
License:Apache License
@Override public Panel createComponent(VisualizerInput vi, VisualizationToggle vt) { Panel scrollPanel = new Panel(); scrollPanel.setSizeFull();// w w w .j a v a 2 s. c o m Label lblResult = new Label("ERROR", ContentMode.HTML); lblResult.setSizeUndefined(); List<String> corpusPath = CommonHelper.getCorpusPath(vi.getDocument().getGraph(), vi.getDocument()); String corpusName = corpusPath.get(corpusPath.size() - 1); corpusName = urlPathEscape.escape(corpusName); String wrapperClassName = "annis-wrapped-htmlvis-" + corpusName.replaceAll("[^0-9A-Za-z-]", "_"); scrollPanel.addStyleName(wrapperClassName); String visConfigName = vi.getMappings().getProperty("config"); String hitMarkConfig = vi.getMappings().getProperty("hitmark", "true"); hitMark = Boolean.parseBoolean(hitMarkConfig); mc = vi.getMarkedAndCovered(); VisualizationDefinition[] definitions = parseDefinitions(corpusName, vi.getMappings()); if (definitions != null) { lblResult.setValue(createHTML(vi.getSResult().getDocumentGraph(), definitions)); String labelClass = vi.getMappings().getProperty("class", "htmlvis"); lblResult.addStyleName(labelClass); InputStream inStreamCSSRaw = null; if (visConfigName == null) { inStreamCSSRaw = HTMLVis.class.getResourceAsStream("htmlvis.css"); } else { WebResource resBinary = Helper.getAnnisWebResource().path("query/corpora/").path(corpusName) .path(corpusName).path("binary").path(visConfigName + ".css"); ClientResponse response = resBinary.get(ClientResponse.class); if (response.getStatus() == ClientResponse.Status.OK.getStatusCode()) { inStreamCSSRaw = response.getEntityInputStream(); } } if (inStreamCSSRaw != null) { try (InputStream inStreamCSS = inStreamCSSRaw) { String cssContent = IOUtils.toString(inStreamCSS); UI currentUI = UI.getCurrent(); if (currentUI instanceof AnnisBaseUI) { // do not add identical CSS files ((AnnisBaseUI) currentUI).injectUniqueCSS(cssContent, wrapperClassName); } } catch (IOException ex) { log.error("Could not parse the HTML visualizer CSS file", ex); Notification.show("Could not parse the HTML visualizer CSS file", ex.getMessage(), Notification.Type.ERROR_MESSAGE); } } } if (vi.getMappings().containsKey("debug")) { TextArea txtDebug = new TextArea(); txtDebug.setValue(lblResult.getValue()); txtDebug.setReadOnly(true); txtDebug.setWidth("100%"); Label sep = new Label("<hr/>", ContentMode.HTML); VerticalLayout layout = new VerticalLayout(txtDebug, sep, lblResult); layout.setSizeUndefined(); scrollPanel.setContent(layout); } else { scrollPanel.setContent(lblResult); } return scrollPanel; }
From source file:br.com.anteros.mobileserver.app.form.TableForm.java
License:Apache License
private void createFields() { fldId = new TextField(); fldId.setCaption("Id"); fldId.setWidth("100px"); fldId.setStyleName("small"); fldName = new TextField(); fldName.setCaption("Nome da tabela"); fldName.setWidth("200px"); fldName.setRequired(true);//from w ww . ja v a 2 s. c o m fldName.setRequiredError("Informe o nome da tabela."); fldName.setStyleName("small"); fldDescription = new TextField(); fldDescription.setCaption("Descrio da tabela"); fldDescription.setWidth("500px"); fldDescription.setRequired(true); fldDescription.setRequiredError("Informe a descrio da tabela."); fldDescription.setStyleName("small"); fldTableNameMobile = new TextField(); fldTableNameMobile.setCaption("Tabela na aplicao mvel"); fldTableNameMobile.setWidth("100px"); fldTableNameMobile.setStyleName("small"); fldTableNameMobile.setRequired(true); fldTableNameMobile.setRequiredError("Informe o nome da tabela na aplicao mvel."); fldTableSQL = new TextArea(); fldTableSQL.setCaption("SQL"); fldTableSQL.setWidth("100%"); fldTableSQL.setHeight("150px"); fldTableSQL.setStyleName("small"); fldTableSQL.setRequired(true); fldTableSQL.setRequiredError("Informe o SQL para seleo dos dados."); tableForm.addField("fldId", fldId); tableForm.addField("fldName", fldName); tableForm.addField("fldDescription", fldDescription); tableForm.addField("fldTableNameMobile", fldTableNameMobile); tableForm.addField("fldTableSQL", fldTableSQL); }
From source file:br.gov.frameworkdemoiselle.vaadin.util.FieldFactory.java
License:Open Source License
/** * Produces a TextArea field./*from w w w . j a v a 2 s. c o m*/ * * @param inputPrompt * Field's prompt message. * @param caption * Field's caption. * @param rows * How much rows. * @param columns * How much columns. * @return Produced field. */ public static TextArea createTextArea(String inputPrompt, String caption, int rows, int columns) { ResourceBundle bundle = Beans.getReference(ResourceBundle.class); TextArea field = new TextArea(); field.setNullRepresentation(""); field.setRows(rows); field.setColumns(columns); setBasicProperties(field, caption); if (Strings.isResourceBundleKeyFormat(inputPrompt)) { field.setInputPrompt(bundle.getString(Strings.removeBraces(inputPrompt))); } else { field.setInputPrompt(inputPrompt); } return field; }
From source file:co.edu.icesi.academ.client.perfiles.administrador.PanelCrearPrograma.java
License:Open Source License
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);//from w w w.j av a 2 s. c o m mainLayout.setWidth("440px"); mainLayout.setHeight("300px"); // top-level component properties setWidth("440px"); setHeight("300px"); // btn_guardar btn_guardar = new Button(); btn_guardar.setCaption("Guardar"); btn_guardar.setImmediate(true); btn_guardar.setWidth("320px"); btn_guardar.setHeight("-1px"); mainLayout.addComponent(btn_guardar, "top:240.0px;left:60.0px;"); // txt_nombre txt_nombre = new TextField(); txt_nombre.setCaption("Nombre"); txt_nombre.setImmediate(false); txt_nombre.setWidth("320px"); txt_nombre.setHeight("-1px"); mainLayout.addComponent(txt_nombre, "top:40.0px;left:60.0px;"); // txt_descripcion txt_descripcion = new TextArea(); txt_descripcion.setCaption("Descripcin"); txt_descripcion.setImmediate(false); txt_descripcion.setWidth("320px"); txt_descripcion.setHeight("108px"); mainLayout.addComponent(txt_descripcion, "top:120.0px;right:60.0px;"); // txtCodigo txtCodigo = new TextField(); txtCodigo.setCaption("Cdigo"); txtCodigo.setImmediate(false); txtCodigo.setWidth("320px"); txtCodigo.setHeight("-1px"); mainLayout.addComponent(txtCodigo, "top:80.0px;left:60.0px;"); return mainLayout; }