List of usage examples for com.vaadin.ui HorizontalSplitPanel HorizontalSplitPanel
public HorizontalSplitPanel()
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 a va2 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);/*from www. j a va 2 s.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 . jav a2 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.cms.ui.CommonUI.java
public CommonUI(String leftCaption, String rightCaption) { // Style // Page.Styles styles = Page.getCurrent().getStyles(); // styles.add("*{font-family: tahoma; font-size: 13px;}"); // styles.add(".custom-feildset{border: 1px solid #ccc;}"); // styles.add(".v-caption-custom-feildset{position: relative}"); // styles.add(".v-caption-custom-feildset span{display: block; margin-top: -8px; position: absolute; z-index: 1000 !important; background: #fff;}"); // styles.add(".v-textfield-dashing{background: #99EE6B;}"); mainLayout = new HorizontalSplitPanel(); mainLayout.setSizeFull();/*ww w. j a v a2s . co m*/ mainLayout.setStyleName("v-scrollable"); setStyleName("v-scrollable"); setWidth("100.0%"); setHeight("100%"); panelLeft = new Panel(); panelRight = new Panel(); panelLeft.setImmediate(true); mainLayout.setImmediate(true); panelRight.setImmediate(true); leftLayout = new VerticalLayout(); rightLayout = new VerticalLayout(); // set margin leftLayout.setMargin(true); rightLayout.setMargin(true); // set caption panelLeft.setCaption(leftCaption); panelRight.setCaption(rightCaption); panelLeft.setContent(leftLayout); panelRight.setContent(rightLayout); panelLeft.setSizeFull(); panelRight.setSizeFull(); leftLayout.setWidth("100%"); leftLayout.setHeight("-1px"); rightLayout.setWidth("100%"); rightLayout.setHeight("-1px"); // panelLeft.setHeight("1200px"); // panelRight.setHeight("1200px"); mainLayout.setFirstComponent(panelLeft); mainLayout.setSecondComponent(panelRight); setCompositionRoot(mainLayout); }
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;// ww w.j a v a 2 s.c om 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.esspl.datagen.ui.SettingsView.java
License:Open Source License
private Component createWorkArea() { HorizontalSplitPanel split = new HorizontalSplitPanel(); split.setSizeFull();//from www.ja va2 s .co m split.setSplitPosition(30); List<ConnectionProfile> profiles = SettingsManager.get().getConfiguration().getProfiles(); list = new ListSelect(null, new BeanItemContainer<ConnectionProfile>(ConnectionProfile.class, profiles)); list.setSizeFull(); list.setNullSelectionAllowed(false); list.setImmediate(true); if (!profiles.isEmpty()) { list.select(profiles.get(0)); } list.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { refreshDetails(); } }); panel = new Panel(); panel.setSizeFull(); split.addComponent(list); split.addComponent(panel); return split; }
From source file:com.freebox.engeneering.application.web.common.ApplicationLayout.java
License:Apache License
/** * Initializes view layout when system enters 'initView' action state. *// ww w .j a va 2 s. co m * @param event - state event. */ public void initView(@SuppressWarnings("rawtypes") StateEvent event) { final HorizontalLayout content = new HorizontalLayout(); content.setSizeFull(); content.setStyleName("main-view"); final HorizontalSplitPanel leftSplitPanel = new HorizontalSplitPanel(); leftSplitPanel.setSplitPosition(20, Sizeable.Unit.PERCENTAGE); final ComponentContainer leftSideBar = createPlaceholder(StateLayout.LEFT_SIDE_BAR); leftSideBar.setSizeFull(); content.addComponent(leftSideBar, 0); final VerticalLayout verticalLayoutContent = new VerticalLayout(); verticalLayoutContent.setStyleName("freebox-view"); verticalLayoutContent.addComponent(createPlaceholder(StateLayout.HEADER)); verticalLayoutContent.setSpacing(true); final ComponentContainer layoutContent = createPlaceholder(StateLayout.CONTENT); layoutContent.setSizeFull(); verticalLayoutContent.addComponent(layoutContent); verticalLayoutContent.setSizeFull(); //verticalLayoutContent.addComponent(createPlaceholder(StateLayout.FOOTER)); verticalLayoutContent.setExpandRatio(layoutContent, 8f); content.addComponent(verticalLayoutContent, 1); content.setExpandRatio(leftSideBar, 1.0f); content.setExpandRatio(verticalLayoutContent, 9f); setView(content); }
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// w w w .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.invient.vaadin.InvientChartsDemoWin.java
License:Apache License
public InvientChartsDemoWin() { VerticalLayout mainLayout = new VerticalLayout(); setContent(mainLayout);/*from ww w.ja v a2 s . c o m*/ setSizeFull(); mainLayout.setSizeFull(); setCaption("Invient Charts"); HorizontalLayout infoBar = new HorizontalLayout(); mainLayout.addComponent(infoBar); infoBar.setHeight("50px"); infoBar.setWidth("100%"); Label lblAppTitle = new Label("Demo Gallery for Invient Charts"); lblAppTitle.setSizeFull(); lblAppTitle.setStyleName("v-label-app-title"); infoBar.addComponent(lblAppTitle); mainSplit = new HorizontalSplitPanel(); mainSplit.setSizeFull(); mainLayout.addComponent(mainSplit); mainLayout.setExpandRatio(mainSplit, 1); leftLayout = new VerticalLayout(); leftLayout.setSpacing(true); mainSplit.setFirstComponent(leftLayout); rightLayout = new VerticalLayout(); rightLayout.setSpacing(true); rightLayout.setMargin(true); mainSplit.setSecondComponent(rightLayout); mainSplit.setSplitPosition(200, Sizeable.UNITS_PIXELS); navTree = createChartsTree(); leftLayout.addComponent(navTree); eventLog.setReadOnly(true); eventLog.setStyleName("v-textarea-chart-events-log"); eventLog.setSizeFull(); eventLog.setHeight("200px"); setTheme("chartdemo"); }
From source file:com.lizardtech.expresszip.vaadin.ExpressZipWindow.java
License:Apache License
@Override public void attach() { super.attach(); // Setup the map in the findLayers pane splDivider = new HorizontalSplitPanel(); mainLayout = new VerticalLayout(); left = new VerticalLayout(); right = new VerticalLayout(); exportProps = new ExportProps(); mapModel = new MapModel(); // Views/*from ww w. j av a2 s. c om*/ findLayers = new FindLayersViewComponent(); modifyLayers = new SetupMapViewComponent(); exportOptions = new ExportOptionsViewComponent(exportProps); mapToolbar = new MapToolbarViewComponent(); mapComponent = new OpenLayersMapViewComponent(); // Models setupMapModel = new SetupMapModel(this); // Presenters findLayersPresenter = new FindLayersPresenter(findLayers, mapComponent, mapModel); setupMapPresenter = new SetupMapPresenter(getSetupMapModel(), modifyLayers, mapComponent, mapModel); exportOptionsPresenter = new ExportOptionsPresenter(exportOptions); exportOptions.addListener(setupMapPresenter); refresher = new Refresher(); addComponent(refresher); setCaption("ExpressZip"); setSizeFull(); splDivider.setSplitPosition(351, UNITS_PIXELS); mainLayout.setSizeFull(); mainLayout.addComponent(mapToolbar); mainLayout.addComponent(splDivider); mainLayout.setExpandRatio(splDivider, 1f); splDivider.setSizeFull(); splDivider.addComponent(left); splDivider.addComponent(right); setContent(mainLayout); right.setSpacing(true); right.setSizeFull(); left.setSizeFull(); left.addComponent(findLayers); setTheme("ExpressZip"); // http://docs.geotools.org/latest/userguide/library/referencing/order.html System.setProperty("org.geotools.referencing.forceXY", "true"); right.addComponent(mapComponent); right.setExpandRatio(mapComponent, 1f); try { findLayersPresenter.paneEntered(); } catch (Exception e) { logger.error("Failed setting up map", e); showNotification("Setting Up Map Failed", "Check logs on server", Notification.TYPE_ERROR_MESSAGE); } }