List of usage examples for com.vaadin.ui Alignment MIDDLE_CENTER
Alignment MIDDLE_CENTER
To view the source code for com.vaadin.ui Alignment MIDDLE_CENTER.
Click Source Link
From source file:annis.gui.controlpanel.CorpusListPanel.java
License:Apache License
public void initCorpusBrowser(String topLevelCorpusName, final Button l) { AnnisCorpus c = ui.getQueryState().getAvailableCorpora().getItem(topLevelCorpusName).getBean(); MetaDataPanel meta = new MetaDataPanel(c.getName()); CorpusBrowserPanel browse = new CorpusBrowserPanel(c, ui.getQueryController()); GridLayout infoLayout = new GridLayout(2, 2); infoLayout.setSizeFull();// w w w . j a v a2 s . co m String corpusURL = Helper.generateCorpusLink(Sets.newHashSet(topLevelCorpusName)); Label lblLink = new Label("Link to corpus: <a href=\"" + corpusURL + "\">" + corpusURL + "</a>", ContentMode.HTML); lblLink.setHeight("-1px"); lblLink.setWidth("-1px"); infoLayout.addComponent(meta, 0, 0); infoLayout.addComponent(browse, 1, 0); infoLayout.addComponent(lblLink, 0, 1, 1, 1); infoLayout.setRowExpandRatio(0, 1.0f); infoLayout.setColumnExpandRatio(0, 0.5f); infoLayout.setColumnExpandRatio(1, 0.5f); infoLayout.setComponentAlignment(lblLink, Alignment.MIDDLE_CENTER); Window window = new Window("Corpus information for " + c.getName() + " (ID: " + c.getId() + ")", infoLayout); window.setWidth(70, UNITS_EM); window.setHeight(45, UNITS_EM); window.setResizable(true); window.setModal(false); window.setResizeLazy(true); window.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent e) { l.setEnabled(true); } }); UI.getCurrent().addWindow(window); window.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./*from w w w .jav a2 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(); }
From source file:annis.gui.docbrowser.DocBrowserController.java
License:Apache License
public void openDocVis(String corpus, String doc, Visualizer visConfig, Button btn) { final String canonicalTitle = corpus + " > " + doc + " - " + "Visualizer: " + visConfig.getDisplayName(); final String tabCaption = StringUtils.substring(canonicalTitle, 0, 15) + "..."; if (visibleVisHolder.containsKey(canonicalTitle)) { Panel visHolder = visibleVisHolder.get(canonicalTitle); ui.getSearchView().getTabSheet().setSelectedTab(visHolder); return;//ww w .j ava 2 s . c o m } Panel visHolder = new Panel(); visHolder.setSizeFull(); visHolder.addDetachListener(new ClientConnector.DetachListener() { @Override public void detach(ClientConnector.DetachEvent event) { visibleVisHolder.remove(canonicalTitle); } }); // first set loading indicator ProgressBar progressBar = new ProgressBar(1.0f); progressBar.setIndeterminate(true); progressBar.setSizeFull(); VerticalLayout layoutProgress = new VerticalLayout(progressBar); layoutProgress.setSizeFull(); layoutProgress.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER); visHolder.setContent(layoutProgress); Tab visTab = ui.getSearchView().getTabSheet().addTab(visHolder, tabCaption); visTab.setDescription(canonicalTitle); visTab.setIcon(EYE_ICON); visTab.setClosable(true); ui.getSearchView().getTabSheet().setSelectedTab(visTab); // register visible visHolder this.visibleVisHolder.put(canonicalTitle, visHolder); Background.run(new DocVisualizerFetcher(corpus, doc, canonicalTitle, visConfig.getType(), visHolder, visConfig, btn, UI.getCurrent())); }
From source file:annis.gui.docbrowser.DocBrowserPanel.java
License:Apache License
@Override public void attach() { super.attach(); // start fetching table only if not done yet. if (table == null) { layout.addComponent(progress);//from www . jav a 2 s . com layout.setComponentAlignment(progress, Alignment.MIDDLE_CENTER); Background.run(new LoadingDocs()); } }
From source file:annis.gui.HelpUsWindow.java
License:Apache License
public HelpUsWindow() { setSizeFull();// w w w . j a va 2 s . c o m layout = new VerticalLayout(); setContent(layout); layout.setSizeFull(); layout.setMargin(new MarginInfo(false, false, true, false)); HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setSizeFull(); hLayout.setMargin(false); VerticalLayout labelLayout = new VerticalLayout(); labelLayout.setMargin(true); labelLayout.setSizeFull(); Label lblOpenSource = new Label(); lblOpenSource.setValue("<h1>ANNIS is <a href=\"http://opensource.org/osd\">Open Source</a> " + "software.</h1>" + "<p>This means you are free to download the source code and add new " + "features or make other adjustments to ANNIS on your own.<p/>" + "Here are some examples how you can help ANNIS:" + "<ul>" + "<li>Fix or report problems (bugs) you encounter when using the ANNIS software.</li>" + "<li>Add new features.</li>" + "<li>Enhance the documentation</li>" + "</ul>" + "<p>Feel free to visit our GitHub page for more information: <a href=\"https://github.com/korpling/ANNIS\" target=\"_blank\">https://github.com/korpling/ANNIS</a></p>"); lblOpenSource.setContentMode(ContentMode.HTML); lblOpenSource.setStyleName("opensource"); lblOpenSource.setWidth("100%"); lblOpenSource.setHeight("-1px"); labelLayout.addComponent(lblOpenSource); 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(labelLayout); hLayout.addComponent(lnkFork); hLayout.setComponentAlignment(labelLayout, Alignment.TOP_LEFT); hLayout.setComponentAlignment(lnkFork, Alignment.TOP_RIGHT); hLayout.setExpandRatio(labelLayout, 1.0f); layout.addComponent(hLayout); final HelpUsWindow finalThis = this; btClose = new Button("Close"); btClose.addClickListener(new OkClickListener(finalThis)); layout.addComponent(btClose); layout.setComponentAlignment(hLayout, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER); layout.setExpandRatio(hLayout, 1.0f); }
From source file:annis.gui.MainToolbar.java
License:Apache License
public MainToolbar() { String bugmail = (String) VaadinSession.getCurrent().getAttribute(BUG_MAIL_KEY); if (bugmail != null && !bugmail.isEmpty() && !bugmail.startsWith("${") && new EmailValidator("").isValid(bugmail)) { this.bugEMailAddress = bugmail; } else {//from w w w . j a v a 2 s . c o m this.bugEMailAddress = null; } UI ui = UI.getCurrent(); if (ui instanceof CommonUI) { ((CommonUI) ui).getSettings().addedLoadedListener(MainToolbar.this); } setWidth("100%"); setHeight("-1px"); addStyleName("toolbar"); addStyleName("border-layout"); btAboutAnnis = new Button("About ANNIS"); btAboutAnnis.addStyleName(ValoTheme.BUTTON_SMALL); btAboutAnnis.setIcon(new ThemeResource("images/annis_16.png")); btAboutAnnis.addClickListener(new AboutClickListener()); btSidebar = new Button(); btSidebar.setDisableOnClick(true); btSidebar.addStyleName(ValoTheme.BUTTON_SMALL); btSidebar.setDescription("Show and hide search sidebar"); btSidebar.setIconAlternateText(btSidebar.getDescription()); btBugReport = new Button("Report Problem"); btBugReport.addStyleName(ValoTheme.BUTTON_SMALL); btBugReport.setDisableOnClick(true); btBugReport.setIcon(FontAwesome.ENVELOPE_O); btBugReport.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { reportBug(); } }); btBugReport.setVisible(this.bugEMailAddress != null); btNavigate = new Button(); btNavigate.setVisible(false); btNavigate.setDisableOnClick(true); btNavigate.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { btNavigate.setEnabled(true); if (navigationTarget != null) { UI.getCurrent().getNavigator().navigateTo(navigationTarget.state); } } }); lblUserName = new Label("not logged in"); lblUserName.setWidth("-1px"); lblUserName.setHeight("-1px"); lblUserName.addStyleName("right-aligned-text"); btLogin = new Button("Login", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { showLoginWindow(false); } }); btLogout = new Button("Logout", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // logout Helper.setUser(null); for (LoginListener l : loginListeners) { l.onLogout(); } Notification.show("Logged out", Notification.Type.TRAY_NOTIFICATION); updateUserInformation(); } }); btLogin.setSizeUndefined(); btLogin.setStyleName(ValoTheme.BUTTON_SMALL); btLogin.setIcon(FontAwesome.USER); btLogout.setSizeUndefined(); btLogout.setStyleName(ValoTheme.BUTTON_SMALL); btLogout.setIcon(FontAwesome.USER); btOpenSource = new Button("Help us to make ANNIS better!"); btOpenSource.setStyleName(BaseTheme.BUTTON_LINK); btOpenSource.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window w = new HelpUsWindow(); w.setCaption("Help us to make ANNIS better!"); w.setModal(true); w.setResizable(true); w.setWidth("600px"); w.setHeight("500px"); UI.getCurrent().addWindow(w); w.center(); } }); addComponent(btSidebar); setComponentAlignment(btSidebar, Alignment.MIDDLE_LEFT); addComponent(btAboutAnnis); addComponent(btBugReport); addComponent(btNavigate); addComponent(btOpenSource); setSpacing(true); setComponentAlignment(btAboutAnnis, Alignment.MIDDLE_LEFT); setComponentAlignment(btBugReport, Alignment.MIDDLE_LEFT); setComponentAlignment(btNavigate, Alignment.MIDDLE_LEFT); setComponentAlignment(btOpenSource, Alignment.MIDDLE_CENTER); setExpandRatio(btOpenSource, 1.0f); addLoginButton(); btSidebar.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { btSidebar.setEnabled(true); // decide new state switch (sidebarState) { case VISIBLE: if (event.isCtrlKey()) { sidebarState = SidebarState.AUTO_VISIBLE; } else { sidebarState = SidebarState.HIDDEN; } break; case HIDDEN: if (event.isCtrlKey()) { sidebarState = SidebarState.AUTO_HIDDEN; } else { sidebarState = SidebarState.VISIBLE; } break; case AUTO_VISIBLE: if (event.isCtrlKey()) { sidebarState = SidebarState.VISIBLE; } else { sidebarState = SidebarState.AUTO_HIDDEN; } break; case AUTO_HIDDEN: if (event.isCtrlKey()) { sidebarState = SidebarState.HIDDEN; } else { sidebarState = SidebarState.AUTO_VISIBLE; } break; } updateSidebarState(); } }); screenshotExtension = new ScreenshotMaker(this); JavaScript.getCurrent().addFunction("annis.gui.logincallback", new LoginCloseCallback()); updateSidebarState(); MainToolbar.this.updateUserInformation(); }
From source file:annis.gui.MetaDataPanel.java
License:Apache License
/** * Places a label in the middle center of the corpus browser panel. *//*from www. j a va2 s . c om*/ private void addEmptyLabel() { if (emptyLabel == null) { emptyLabel = new Label("none"); } if (corpusAnnotationTable != null) { layout.removeComponent(corpusAnnotationTable); } layout.addComponent(emptyLabel); // this has only an effect after adding the component to a parent. Bug by vaadin? emptyLabel.setSizeUndefined(); layout.setComponentAlignment(emptyLabel, Alignment.MIDDLE_CENTER); layout.setExpandRatio(emptyLabel, 1.0f); }
From source file:annis.gui.paging.PagingComponent.java
License:Apache License
public PagingComponent(int count, int pageSize) { if (pageSize <= 0) { pageSize = 1;/* w ww. ja va 2s . c o m*/ } if (count < 0) { count = 0; } currentPage = 1; this.count = new AtomicInteger(pageSize); this.pageSize = pageSize; setWidth("100%"); setHeight("-1px"); addStyleName("toolbar"); callbacks = new HashSet<>(); layout = new HorizontalLayout(); layout.setSpacing(true); layout.setMargin(new MarginInfo(false, true, false, true)); setContent(layout); addStyleName(ChameleonTheme.PANEL_LIGHT); lblInfo = new Label(); lblInfo.setContentMode(ContentMode.HTML); lblInfo.addStyleName("right-aligned-text"); btShareQuery = new Button(FontAwesome.SHARE_ALT); btShareQuery.setDescription("Share query reference link"); btShareQuery.addStyleName(ValoTheme.BUTTON_BORDERLESS); layout.setWidth("100%"); layout.setHeight("-1px"); btFirst = new Button(); btFirst.setIcon(FIRST); btFirst.setDescription("jump to first page"); btFirst.addClickListener((Button.ClickListener) this); btFirst.addStyleName(ChameleonTheme.BUTTON_ICON_ONLY); btFirst.addStyleName(ChameleonTheme.BUTTON_SMALL); btFirst.setDisableOnClick(true); btLast = new Button(); btLast.setIcon(LAST); btLast.setDescription("jump to last page"); btLast.addClickListener((Button.ClickListener) this); btLast.addStyleName(ChameleonTheme.BUTTON_ICON_ONLY); btLast.addStyleName(ChameleonTheme.BUTTON_SMALL); btLast.setDisableOnClick(true); btNext = new Button(); btNext.setIcon(RIGHT_ARROW); btNext.setDescription("jump to next page"); btNext.addClickListener((Button.ClickListener) this); btNext.addStyleName(ChameleonTheme.BUTTON_ICON_ONLY); btNext.addStyleName(ChameleonTheme.BUTTON_SMALL); btNext.setDisableOnClick(true); btPrevious = new Button(); btPrevious.setIcon(LEFT_ARROW); btPrevious.setDescription("jump to previous page"); btPrevious.addClickListener((Button.ClickListener) this); btPrevious.addStyleName(ChameleonTheme.BUTTON_ICON_ONLY); btPrevious.addStyleName(ChameleonTheme.BUTTON_SMALL); btPrevious.setDisableOnClick(true); txtPage = new TextField(); txtPage.setDescription("current page"); txtPage.setHeight("-1px"); txtPage.setWidth(5.f, UNITS_EM); Validator pageValidator = new PageValidator("must be an integer greater than zero"); txtPage.addValidator(pageValidator); addActionHandler(new EnterHandler(txtPage)); lblMaxPages = new Label(); lblMaxPages.setDescription("maximal pages"); lblMaxPages.setSizeUndefined(); lblStatus = new Label(); lblStatus.setSizeUndefined(); layout.addComponent(btFirst); layout.addComponent(btPrevious); layout.addComponent(txtPage); layout.addComponent(lblMaxPages); layout.addComponent(btNext); layout.addComponent(btLast); layout.addComponent(lblStatus); layout.addComponent(lblInfo); layout.addComponent(btShareQuery); layout.setComponentAlignment(btFirst, Alignment.MIDDLE_LEFT); layout.setComponentAlignment(btPrevious, Alignment.MIDDLE_LEFT); layout.setComponentAlignment(lblStatus, Alignment.MIDDLE_LEFT); layout.setComponentAlignment(lblMaxPages, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(txtPage, Alignment.MIDDLE_RIGHT); layout.setComponentAlignment(btNext, Alignment.MIDDLE_RIGHT); layout.setComponentAlignment(btLast, Alignment.MIDDLE_RIGHT); layout.setExpandRatio(lblStatus, 1.0f); layout.setComponentAlignment(lblInfo, Alignment.MIDDLE_RIGHT); layout.setExpandRatio(lblInfo, 10.0f); update(false); }
From source file:annis.gui.SearchUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { super.init(request); this.instanceConfig = getInstanceConfig(request); getPage().setTitle(instanceConfig.getInstanceDisplayName() + " (ANNIS Corpus Search)"); queryController = new QueryController(this); refresh = new Refresher(); // deactivate refresher by default refresh.setRefreshInterval(-1);/*from ww w. j av a 2 s. c o m*/ refresh.addListener(queryController); addExtension(refresh); // always get the resize events directly setImmediate(true); VerticalLayout mainLayout = new VerticalLayout(); setContent(mainLayout); mainLayout.setSizeFull(); mainLayout.setMargin(false); final ScreenshotMaker screenshot = new ScreenshotMaker(this); addExtension(screenshot); css = new CSSInject(this); HorizontalLayout layoutToolbar = new HorizontalLayout(); layoutToolbar.setWidth("100%"); layoutToolbar.setHeight("-1px"); mainLayout.addComponent(layoutToolbar); layoutToolbar.addStyleName("toolbar"); layoutToolbar.addStyleName("border-layout"); Button btAboutAnnis = new Button("About ANNIS"); btAboutAnnis.addStyleName(ChameleonTheme.BUTTON_SMALL); btAboutAnnis.setIcon(new ThemeResource("info.gif")); btAboutAnnis.addClickListener(new AboutClickListener()); btBugReport = new Button("Report Bug"); btBugReport.addStyleName(ChameleonTheme.BUTTON_SMALL); btBugReport.setDisableOnClick(true); btBugReport.setIcon(new ThemeResource("../runo/icons/16/email.png")); btBugReport.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { screenshot.makeScreenshot(); btBugReport.setCaption("bug report is initialized..."); } }); String bugmail = (String) VaadinSession.getCurrent().getAttribute("bug-e-mail"); if (bugmail != null && !bugmail.isEmpty() && !bugmail.startsWith("${") && new EmailValidator("").isValid(bugmail)) { this.bugEMailAddress = bugmail; } btBugReport.setVisible(this.bugEMailAddress != null); lblUserName = new Label("not logged in"); lblUserName.setWidth("-1px"); lblUserName.setHeight("-1px"); lblUserName.addStyleName("right-aligned-text"); btLoginLogout = new Button("Login", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (isLoggedIn()) { // logout Helper.setUser(null); Notification.show("Logged out", Notification.Type.TRAY_NOTIFICATION); updateUserInformation(); } else { showLoginWindow(); } } }); btLoginLogout.setSizeUndefined(); btLoginLogout.setStyleName(ChameleonTheme.BUTTON_SMALL); btLoginLogout.setIcon(new ThemeResource("../runo/icons/16/user.png")); Button btOpenSource = new Button("Help us to make ANNIS better!"); btOpenSource.setStyleName(BaseTheme.BUTTON_LINK); btOpenSource.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Window w = new HelpUsWindow(); w.setCaption("Help us to make ANNIS better!"); w.setModal(true); w.setResizable(true); w.setWidth("600px"); w.setHeight("500px"); addWindow(w); w.center(); } }); layoutToolbar.addComponent(btAboutAnnis); layoutToolbar.addComponent(btBugReport); layoutToolbar.addComponent(btOpenSource); layoutToolbar.addComponent(lblUserName); layoutToolbar.addComponent(btLoginLogout); layoutToolbar.setSpacing(true); layoutToolbar.setComponentAlignment(btAboutAnnis, Alignment.MIDDLE_LEFT); layoutToolbar.setComponentAlignment(btBugReport, Alignment.MIDDLE_LEFT); layoutToolbar.setComponentAlignment(btOpenSource, Alignment.MIDDLE_CENTER); layoutToolbar.setComponentAlignment(lblUserName, Alignment.MIDDLE_RIGHT); layoutToolbar.setComponentAlignment(btLoginLogout, Alignment.MIDDLE_RIGHT); layoutToolbar.setExpandRatio(btOpenSource, 1.0f); //HorizontalLayout hLayout = new HorizontalLayout(); final HorizontalSplitPanel hSplit = new HorizontalSplitPanel(); hSplit.setSizeFull(); mainLayout.addComponent(hSplit); mainLayout.setExpandRatio(hSplit, 1.0f); AutoGeneratedQueries autoGenQueries = new AutoGeneratedQueries("example queries", this); controlPanel = new ControlPanel(queryController, instanceConfig, autoGenQueries); controlPanel.setWidth(100f, Layout.Unit.PERCENTAGE); controlPanel.setHeight(100f, Layout.Unit.PERCENTAGE); hSplit.setFirstComponent(controlPanel); tutorial = new TutorialPanel(); tutorial.setHeight("99%"); mainTab = new TabSheet(); mainTab.setSizeFull(); mainTab.addTab(autoGenQueries, "example queries"); mainTab.addTab(tutorial, "Tutorial"); queryBuilder = new QueryBuilderChooser(queryController, this, instanceConfig); mainTab.addTab(queryBuilder, "Query Builder"); hSplit.setSecondComponent(mainTab); hSplit.setSplitPosition(CONTROL_PANEL_WIDTH, Unit.PIXELS); hSplit.addSplitterClickListener(new AbstractSplitPanel.SplitterClickListener() { @Override public void splitterClick(AbstractSplitPanel.SplitterClickEvent event) { if (event.isDoubleClick()) { if (hSplit.getSplitPosition() == CONTROL_PANEL_WIDTH) { // make small hSplit.setSplitPosition(0.0f, Unit.PIXELS); } else { // reset to default width hSplit.setSplitPosition(CONTROL_PANEL_WIDTH, Unit.PIXELS); } } } }); // hLayout.setExpandRatio(mainTab, 1.0f); addAction(new ShortcutListener("^Query builder") { @Override public void handleAction(Object sender, Object target) { mainTab.setSelectedTab(queryBuilder); } }); addAction(new ShortcutListener("Tutor^eial") { @Override public void handleAction(Object sender, Object target) { mainTab.setSelectedTab(tutorial); } }); getPage().addUriFragmentChangedListener(this); getSession().addRequestHandler(new RequestHandler() { @Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { checkCitation(request); if (request.getPathInfo() != null && request.getPathInfo().startsWith("/vis-iframe-res/")) { String uuidString = StringUtils.removeStart(request.getPathInfo(), "/vis-iframe-res/"); UUID uuid = UUID.fromString(uuidString); IFrameResourceMap map = VaadinSession.getCurrent().getAttribute(IFrameResourceMap.class); if (map == null) { response.setStatus(404); } else { IFrameResource res = map.get(uuid); if (res != null) { response.setStatus(200); response.setContentType(res.getMimeType()); response.getOutputStream().write(res.getData()); } } return true; } return false; } }); getSession().setAttribute(MediaController.class, new MediaControllerImpl()); getSession().setAttribute(PDFController.class, new PDFControllerImpl()); loadInstanceFonts(); checkCitation(request); lastQueriedFragment = ""; evaluateFragment(getPage().getUriFragment()); updateUserInformation(); }
From source file:annis.gui.ShareSingleMatchGenerator.java
License:Apache License
public ShareSingleMatchGenerator(List<ResolverEntry> visualizers, Match match, PagedResultQuery query, String segmentation, PluginSystem ps) { this.match = match; this.query = query; this.segmentation = segmentation; this.ps = ps; setResizeLazy(true);/*from w ww . j a va 2 s. com*/ directURL = new ObjectProperty<>(""); iframeCode = new ObjectProperty<>(""); visContainer = new BeanItemContainer<>(ResolverEntry.class); visContainer.addAll(visualizers); txtDirectURL = new TextArea(directURL); txtDirectURL.setCaption("Link for publications"); txtDirectURL.setWidth("100%"); txtDirectURL.setHeight("-1px"); txtDirectURL.addStyleName(ValoTheme.TEXTFIELD_LARGE); txtDirectURL.addStyleName("shared-text"); txtDirectURL.setWordwrap(true); txtDirectURL.setReadOnly(true); txtIFrameCode = new TextArea(iframeCode); txtIFrameCode.setCaption("Code for embedding visualization into web page"); txtIFrameCode.setWidth("100%"); txtIFrameCode.setHeight("-1px"); txtIFrameCode.addStyleName(ValoTheme.TEXTFIELD_LARGE); txtIFrameCode.addStyleName("shared-text"); txtIFrameCode.setWordwrap(true); txtIFrameCode.setReadOnly(true); preview = new BrowserFrame(); preview.setCaption("Preview"); preview.addStyleName("shared-text"); preview.setSizeFull(); generatedLinks = new VerticalLayout(txtDirectURL, txtIFrameCode, preview); generatedLinks.setComponentAlignment(txtDirectURL, Alignment.TOP_LEFT); generatedLinks.setComponentAlignment(txtIFrameCode, Alignment.TOP_LEFT); generatedLinks.setExpandRatio(preview, 1.0f); visSelector = new Grid(visContainer); visSelector.setCaption("Select visualization"); visSelector.setHeight("100%"); visSelector.setColumns("displayName"); visSelector.setSelectionMode(Grid.SelectionMode.SINGLE); visSelector.addSelectionListener(ShareSingleMatchGenerator.this); visSelector.select(visContainer.getIdByIndex(0)); visSelector.setWidth("300px"); visSelector.getColumn("displayName").setSortable(false); generatedLinks.setSizeFull(); Label infoText = new Label( "<p style=\"font-size: 18px\" >" + "<strong>Share your match:</strong> " + "1. Choose the visualization to share. 2. Copy the generated link or code. " + "3. Share this link with your peers or include the code in your website. " + "</p>", ContentMode.HTML); HorizontalLayout hLayout = new HorizontalLayout(visSelector, generatedLinks); hLayout.setSizeFull(); hLayout.setSpacing(true); hLayout.setExpandRatio(generatedLinks, 1.0f); Button btClose = new Button("Close"); btClose.setSizeUndefined(); btClose.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { getUI().removeWindow(ShareSingleMatchGenerator.this); } }); layout = new VerticalLayout(infoText, hLayout, btClose); layout.setSizeFull(); layout.setExpandRatio(hLayout, 1.0f); layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER); setContent(layout); }