List of usage examples for com.vaadin.ui HorizontalSplitPanel setSecondComponent
public void setSecondComponent(Component c)
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 . java 2 s . co 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:com.cavisson.gui.dashboard.components.charts.Impl.ResizeInsideVaadinComponent.java
@Override protected Component getChart() { VerticalSplitPanel verticalSplitPanel = new VerticalSplitPanel(); HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel(); horizontalSplitPanel.setSecondComponent(verticalSplitPanel); verticalSplitPanel.setFirstComponent(createChart()); VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(true);// ww w.j a va 2s. c o m verticalLayout.setSpacing(true); verticalLayout.addComponent( new Label("Relatively sized components resize themselves automatically when in Vaadin component.")); Button button = new Button("Open in a window"); button.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Window window = new Window("Chart windodw"); window.setContent(createChart()); window.setWidth("50%"); window.setHeight("50%"); getUI().addWindow(window); } }); verticalLayout.addComponent(button); horizontalSplitPanel.setFirstComponent(verticalLayout); return horizontalSplitPanel; }
From source file:com.cavisson.gui.dashboard.components.controls.SplitPanels.java
License:Apache License
public SplitPanels() { setMargin(true);// ww w . j a v a 2 s . c o m Label h1 = new Label("Split Panels"); h1.addStyleName("h1"); addComponent(h1); addComponent(new Label( "Outlines are just to show the areas of the SplitPanels. They are not part of the actual component style.")); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); row.setMargin(new MarginInfo(true, false, false, false)); addComponent(row); HorizontalSplitPanel sp = new HorizontalSplitPanel(); sp.setCaption("Default style"); sp.setWidth("400px"); sp.setHeight(null); sp.setFirstComponent(getContent()); sp.setSecondComponent(getContent()); row.addComponent(sp); VerticalSplitPanel sp2 = new VerticalSplitPanel(); sp2.setCaption("Default style"); sp2.setWidth("300px"); sp2.setHeight("200px"); sp2.setFirstComponent(getContent()); sp2.setSecondComponent(getContent()); row.addComponent(sp2); sp = new HorizontalSplitPanel(); sp.setCaption("Large style"); sp.setWidth("300px"); sp.setHeight("200px"); sp.addStyleName("large"); sp.setFirstComponent(getContent()); sp.setSecondComponent(getContent()); row.addComponent(sp); sp2 = new VerticalSplitPanel(); sp2.setCaption("Large style"); sp2.setWidth("300px"); sp2.setHeight("200px"); sp2.addStyleName("large"); sp2.setFirstComponent(getContent()); sp2.setSecondComponent(getContent()); row.addComponent(sp2); }
From source file:com.esspl.datagen.ui.ExplorerView.java
License:Open Source License
public ExplorerView(final DataGenApplication dataApp, DatabaseSessionManager databaseSessionManager) { log.debug("ExplorerView - constructor start"); dataGenApplication = dataApp;/* w w w .ja v a 2 s.c o m*/ setCaption("Tables"); setSizeFull(); final HorizontalSplitPanel sp = new HorizontalSplitPanel(); sp.setSizeFull(); sp.setLocked(true); TableSelectorView tableSelectorView = new TableSelectorView(databaseSessionManager, dataGenApplication); tableSelectorView.setDetailsListener(new DetailsListener() { @Override public void showDetails(Component component) { component.setSizeFull(); sp.setSecondComponent(component); } }); sp.setFirstComponent(tableSelectorView); sp.setSplitPosition(210, UNITS_PIXELS); setCompositionRoot(sp); }
From source file:com.garyclayburg.vconsole.VConsole.java
License:Open Source License
protected void init(VaadinRequest vaadinRequest) { final Refresher refresher = new Refresher(); refresher.addListener(new Refresher.RefreshListener() { @Override//from www .j av a 2 s .co m public void refresh(Refresher refresher) { // log.debug("refreshing UI..."); } }); addExtension(refresher); addStyleName("dashboard-view"); final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); setContent(layout); searchStatus = new Label("0 users matching: "); TextField searchField = new TextField(); searchField.setInputPrompt("first or last name"); searchField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.LAZY); searchField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { String searchText = event.getText(); log.debug("search: {}", searchText); QUser qUser = new QUser("user"); long startSearch = System.nanoTime(); if (searchText.length() > 2) { Iterable<User> searchedUsers = autoUserRepo.findAll(qUser.firstname .containsIgnoreCase(searchText).or(qUser.lastname.containsIgnoreCase(searchText))); long endSearch = System.nanoTime(); log.info("Finshed searching for \"{}\" in {} secs", searchText, ((endSearch - startSearch) / 1000000000.0)); searchStatus.setValue("? users matching: " + searchText); updateUserList(searchedUsers, searchText); } else if (searchText.equals("*")) { Iterable<User> searchedUsers = autoUserRepo.findAll(); long endSearch = System.nanoTime(); log.info("Searched for \"{}\" in {} secs", searchText, ((endSearch - startSearch) / 1000000000.0)); searchStatus.setValue("? users matching: " + searchText); updateUserList(searchedUsers, searchText); } else { log.debug("not enough chars"); searchStatus.setValue("* for all users..."); } } }); createExceptionWindow("no errors yet..."); final User finalFirstUser = firstUser; policyChangeController.addChangeListener(new PolicyChangeListener() { @Override public void policyChanged() { log.info("policy is changing"); BeanContainer beanContainer = (BeanContainer) userTable.getContainerDataSource(); List itemIds = beanContainer.getItemIds(); boolean refreshedSelected = false; for (Object itemId : itemIds) { String id = (String) itemId; BeanItem item = beanContainer.getItem(itemId); log.debug("refreshing user id: " + id); User user = (User) item.getBean(); log.debug("refreshing user: " + user.getFirstname()); if (userTable.isSelected(itemId)) { refreshUserValues(user); refreshedSelected = true; } } log.debug("forcing table update"); updateRightClickItems(); log.debug("forcing table update complete"); if (!refreshedSelected && finalFirstUser != null) { refreshUserValues(finalFirstUser); } int numErrors = populatePolicyExceptionList(); // this will catch runtime errors not caught during groovy compile if (numErrors == 0) { showPolicyUpdated(); } } @Override public void policyException(Throwable e) { populatePolicyExceptionList(); //cannot compile operator supplied groovy? } }); attributeTable = new Table(); attributeTable.setSizeFull(); attributeTable.setSelectable(true); attributeTable.setMultiSelect(false); attributeTable.setImmediate(true); attributesBeanContainer = new BeanContainer<>(GeneratedAttributesBean.class); attributesBeanContainer.setBeanIdProperty("attributeName"); attributeTable.setContainerDataSource(attributesBeanContainer); BeanContainer<String, User> userBeanContainer = new BeanContainer<>(User.class); userBeanContainer.setBeanIdProperty("id"); userTable = createUserTable(userBeanContainer); userTable.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { User selectedUser = (User) ((BeanItem) event.getItem()).getBean(); refreshUserValues(selectedUser); populatePolicyExceptionList(); // maybe this user clicked on causes runtime exception in groovy? } }); HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); splitPanel.setSizeFull(); splitPanel.setSplitPosition(150, Unit.PIXELS); splitPanel.setFirstComponent(userTable); splitPanel.setSecondComponent(attributeTable); // MenuBar menuBar = createMenu(); // layout.addComponent(menuBar); HorizontalLayout top = createTop(); populatePolicyExceptionList(); //initial check for groovy errors layout.addComponent(top); layout.addComponent(searchField); layout.addComponent(searchStatus); layout.addComponent(splitPanel); populateItems(firstUser, attributesBeanContainer); }
From source file:com.klwork.explorer.project.PublicProjectListPage.java
License:Apache License
private void initRight(HorizontalSplitPanel split2) { split2.setSecondComponent(new OutProjectListRight()); }
From source file:com.m4gik.views.MainView.java
/** * @param split//from w w w .j av a 2s . co m */ private void addPanelRight(final HorizontalSplitPanel split) { right.setSizeFull(); split.setSecondComponent(right); split.setLocked(true); right.addTab(buildWelcomeScreen(), "Welcome"); right.addTab(buildMusic(playerLayout), "Music Player"); right.addTab(buildLicenseScreen(), "License"); right.addListener(new Listener() { private static final long serialVersionUID = 3585077764011982717L; @Override public void componentEvent(Event event) { if (right.getSelectedTab() == music) { split.setSplitPosition(20, Sizeable.Unit.PERCENTAGE); split.setLocked(false); } else { split.setSplitPosition(1, Sizeable.Unit.PIXELS); split.setLocked(true); } } }); }
From source file:com.mcparland.john.AdjustableLayout.java
License:Apache License
/** * Create the editor panel./*ww w. j a va2 s . c o m*/ * * @return the editor panel. */ private Component createEditorPanel() { SafeHtml safeHtml = SafeHtmlUtils.fromSafeConstant("<b>Help</b> <br />" + LIPSUM); HorizontalSplitPanel editorPanel = new HorizontalSplitPanel(); RichTextArea editor = new RichTextArea(); editor.setSizeFull(); editor.setValue(LIPSUM); editorPanel.setFirstComponent(editor); editorPanel.setSecondComponent(new Label(safeHtml.asString(), ContentMode.HTML)); editorPanel.setSplitPosition(80, Unit.PERCENTAGE); return editorPanel; }
From source file:com.mcparland.john.ContactViewer.java
License:Apache License
/** * @param contacts/* www .j av a2 s . co m*/ */ public ContactViewer(BeanItemContainer<Contact> contacts) { final HorizontalSplitPanel panel = new HorizontalSplitPanel(); setCompositionRoot(panel); final ListSelect contactSelect = new ListSelect(); contactSelect.setSizeFull(); contactSelect.setImmediate(true); contactSelect.setContainerDataSource(contacts); contactSelect.setItemCaptionPropertyId("fullName"); // Listen for selections contactSelect.addValueChangeListener(new ValueChangeListener() { /* * (non-Javadoc) * * @see * com.vaadin.data.Property.ValueChangeListener#valueChange(com. * vaadin.data.Property.ValueChangeEvent) */ @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { final Contact contact = (Contact) event.getProperty().getValue(); panel.setSecondComponent(createInfoLabel(contact)); contactSelect.focus(); } }); panel.setFirstComponent(contactSelect); }
From source file:com.ocs.dynamo.ui.composite.layout.BaseSplitLayout.java
License:Apache License
/** * Builds the component//from ww w.j av a 2 s . c o m */ @Override public void build() { mainLayout = new DefaultVerticalLayout(true, true); HorizontalSplitPanel splitter = null; VerticalLayout splitterLayout = null; detailLayout = new DefaultVerticalLayout(); emptyDetailView(); // optional header headerLayout = constructHeaderLayout(); if (headerLayout != null) { mainLayout.addComponent(headerLayout); } // construct option quick search field quickSearchField = constructSearchField(); // additional quick search field if (!isHorizontalMode()) { if (quickSearchField != null) { mainLayout.addComponent(quickSearchField); } } // table init getTableWrapper().getTable().setPageLength(getPageLength()); getTableWrapper().getTable().setSortEnabled(isSortEnabled()); constructTableDividers(); // extra splitter (for horizontal mode) if (isHorizontalMode()) { splitter = new HorizontalSplitPanel(); mainLayout.addComponent(splitter); splitterLayout = new DefaultVerticalLayout(false, true); if (quickSearchField != null) { splitterLayout.addComponent(quickSearchField); } splitterLayout.addComponent(getTableWrapper()); splitter.setFirstComponent(splitterLayout); } else { mainLayout.addComponent(getTableWrapper()); } if (isHorizontalMode()) { splitterLayout.addComponent(getButtonBar()); } else { mainLayout.addComponent(getButtonBar()); } // create a panel to hold the edit form Panel editPanel = new Panel(); editPanel.setContent(detailLayout); if (isHorizontalMode()) { // create the layout that is the right part of the splitter VerticalLayout extra = new DefaultVerticalLayout(true, false); extra.addComponent(editPanel); splitter.setSecondComponent(extra); } else { mainLayout.addComponent(editPanel); } addButton = constructAddButton(); if (addButton != null) { getButtonBar().addComponent(addButton); } removeButton = constructRemoveButton(); if (removeButton != null) { registerButton(removeButton); getButtonBar().addComponent(removeButton); } // allow the user to define extra buttons postProcessButtonBar(getButtonBar()); postProcessLayout(mainLayout); checkButtonState(null); setCompositionRoot(mainLayout); }