List of usage examples for com.vaadin.ui VerticalLayout VerticalLayout
public VerticalLayout()
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.GlycanBuilder.java
License:Open Source License
public GlycanBuilder(ApplicationMenu appMenu) { mainLayout = new VerticalLayout(); mainLayout.setSizeFull();//from ww w .j a va2s .co m theAppMenu = appMenu; theAppMenu.setModified(); theCanvas = new VaadinGlycanCanvas(); theCanvas.setSizeFull(); theCanvas.enableMouseSelectionRectangle(true); theCanvas.theCanvas.addResidueHistoryListener(this); if (appMenu == menu) { mainLayout.addComponent(menu); } initToolBars(); mainLayout.addComponent(theCanvas); mainLayout.setExpandRatio(theCanvas, 1); theCanvas.theCanvas.addNotationListener(new NotationChangedListener() { @Override public void notationChanged(String notation) { theCanvas.menuItemsWithResidueSelectionDependency.removeAll(structureItem.getChildren()); theResidueCanvas.theCanvas.setNotation(notation); theAppMenu.getMenuBar().removeItem(structureItem); menuItems.remove(structureItem); initStructureMenu(); theResidueCanvas.theCanvas.fireUpdatedSelection(); } }); theCanvas.setBackgroundColor("#CCF"); theCanvas.setName("glycanCanvas"); theCanvas.addExportListener(new ExportListener() { @Override public void exportRequest(String fullCommand) { try { if (fullCommand.contains("~")) { String cols[] = fullCommand.split("~"); String command = cols[0]; if (command.equals("export")) { if (cols.length != 2) { theCanvas.respondToExportRequest("Export command without type"); } else { String type = cols[1]; String sequence = null; if (type.equals("glycoct_condensed")) { sequence = theCanvas.theCanvas.theDoc.toGlycoCTCondensed(); } else if (type.equals("glycoct")) { sequence = theCanvas.theCanvas.theDoc.toGlycoCT(); } else { sequence = theCanvas.theCanvas.theDoc .toString(GlycanParserFactory.getParser(type)); } if (sequence != null) { theCanvas.respondToExportRequest(sequence); } else { theCanvas.respondToExportRequest("sequence is null"); } } } else if (command.equals("import")) { if (cols.length != 3) { theCanvas.respondToExportRequest("Import command without format and or value"); } else { String type = cols[1]; String value = cols[2].replaceAll("<br/>", "\n"); //for debugger if (!theCanvas.theCanvas.theDoc.importFromString(value, type)) { theCanvas.respondToExportRequest("ERROR:" + LogUtils.getLastError()); LogUtils.clearLastError(); } } } else { theCanvas.respondToExportRequest("ERROR:Unable to extract command"); } } else { theCanvas.respondToExportRequest("ERROR:Unable to extract command"); } } catch (Exception ex) { theCanvas.respondToExportRequest("ERROR:An exception as occurred"); } } }); initFileMenu(); initViewMenu(); initStructureMenu(); theCanvas.setMinimumSize(1, 1); theResidueCanvas.setMinimumSize(1, 25); }
From source file:ac.uk.icl.dell.vaadin.navigator7.common.FluidAppLevelWindow.java
License:Open Source License
@Override protected Layout createMainLayout() { return new VerticalLayout(); }
From source file:ac.uk.icl.dell.vaadin.navigator7.common.HeaderFooterFluidAppLevelWindow.java
License:Open Source License
@Override protected ComponentContainer createComponents() { VerticalLayout mainContainer = (VerticalLayout) getContent(); //set in FluidAppLevelWindow::attach via createMainLayout mainContainer.setSizeFull();/*w w w .j a v a 2s. c om*/ header = createHeader(); header.setWidth("100%"); mainContainer.addComponent(header); footer = createFooter(); footer.setWidth("100%"); VerticalLayout pageBand = new VerticalLayout(); pageBand.setSizeFull(); mainContainer.addComponent(pageBand); mainContainer.setExpandRatio(pageBand, 1); mainContainer.addComponent(footer); return pageBand; }
From source file:ac.uk.icl.dell.vaadin.navigator7.pages.GlycanBuilderPage.java
License:Open Source License
public GlycanBuilderPage() { layout = new VerticalLayout(); layout.setSizeFull();/*w w w . j a v a 2 s . c o m*/ IGGAppLevelWindow window = (IGGAppLevelWindow) IGGApplication.getCurrentNavigableAppLevelWindow(); theGlycanBuilder = new GlycanBuilder(window.getApplicationMenu()); }
From source file:annis.gui.AboutWindow.java
License:Apache License
public AboutWindow() { setSizeFull();//from ww w.j av a 2 s . c om 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 w w. j a v a 2 s. co 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.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 www . ja va2 s.c o 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.components.ExceptionDialog.java
License:Apache License
public ExceptionDialog(Throwable ex, String caption) { this.cause = ex; Preconditions.checkNotNull(ex);//w w w . ja v a 2s.c om layout = new VerticalLayout(); setContent(layout); layout.setWidth("100%"); layout.setHeight("-1"); if (caption == null) { setCaption("Unexpected error"); } else { setCaption(caption); } Label lblInfo = new Label("An unexpected error occured.<br />The error message was:", ContentMode.HTML); lblInfo.setHeight("-1px"); lblInfo.setWidth("100%"); layout.addComponent(lblInfo); lblInfo.addStyleName("exception-message-caption"); String message = ex.getMessage(); if (message == null || message.isEmpty()) { message = "<no message>"; } Label lblMessage = new Label(message); lblMessage.addStyleName("exception-message-content"); lblMessage.setHeight("-1px"); lblMessage.setWidth("100%"); layout.addComponent(lblMessage); actionsLayout = new HorizontalLayout(); actionsLayout.addStyleName("exception-dlg-details"); actionsLayout.setWidth("100%"); actionsLayout.setHeight("-1px"); layout.addComponent(actionsLayout); btDetails = new Button("Show Details", this); btDetails.setStyleName(BaseTheme.BUTTON_LINK); actionsLayout.addComponent(btDetails); btReportBug = new Button("Report Problem", this); btReportBug.setStyleName(BaseTheme.BUTTON_LINK); btReportBug.setVisible(false); btReportBug.setIcon(FontAwesome.ENVELOPE_O); UI ui = UI.getCurrent(); if (ui instanceof AnnisUI) { btReportBug.setVisible(((AnnisUI) ui).canReportBugs()); } actionsLayout.addComponent(btReportBug); actionsLayout.setComponentAlignment(btDetails, Alignment.TOP_LEFT); actionsLayout.setComponentAlignment(btReportBug, Alignment.TOP_RIGHT); lblStacktrace = new Label(Helper.convertExceptionToMessage(ex), ContentMode.PREFORMATTED); detailsPanel = new Panel(lblStacktrace); detailsPanel.setWidth("100%"); detailsPanel.setHeight("300px"); detailsPanel.setVisible(false); lblStacktrace.setSizeUndefined(); lblStacktrace.setVisible(true); layout.addComponent(detailsPanel); btClose = new Button("OK", this); layout.addComponent(btClose); layout.setComponentAlignment(btClose, Alignment.BOTTOM_CENTER); layout.setExpandRatio(detailsPanel, 0.0f); layout.setExpandRatio(actionsLayout, 1.0f); }
From source file:annis.gui.controlpanel.QueryPanel.java
License:Apache License
public QueryPanel(final AnnisUI ui) { super(4, 5);/*from ww w .j ava 2s. 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.CorpusBrowserPanel.java
License:Apache License
/** * Places a label with the text "(No <caption>)" in the centered middle of the accordion * tab.// w ww . j a va 2 s . c o m * * @param accordion the target accordion * @param caption is set as caption of the accordion tab */ private void placeEmptyLabel(Accordion accordion, String caption) { VerticalLayout v = new VerticalLayout(); v.setSizeFull(); Label l = new Label("(No " + caption + ")"); v.addComponent(l); l.setSizeUndefined(); v.setComponentAlignment(l, Alignment.MIDDLE_CENTER); accordion.addTab(v, caption, null); l.setSizeUndefined(); }