List of usage examples for com.vaadin.ui HorizontalSplitPanel setSplitPosition
public void setSplitPosition(float pos, boolean reverse)
From source file:org.opennms.features.vaadin.mibcompiler.MibCompilerApplication.java
License:Open Source License
@Override public void init(VaadinRequest request) { if (eventProxy == null) throw new RuntimeException("eventProxy cannot be null."); if (eventConfDao == null) throw new RuntimeException("eventConfDao cannot be null."); if (dataCollectionDao == null) throw new RuntimeException("dataCollectionDao cannot be null."); final HorizontalSplitPanel mainPanel = new HorizontalSplitPanel(); final MibConsolePanel mibConsole = new MibConsolePanel(); final MibCompilerPanel mibPanel = new MibCompilerPanel(dataCollectionDao, eventConfDao, eventProxy, mibParser, mibConsole);/*from www .j a v a 2 s .co m*/ mainPanel.setSizeFull(); mainPanel.setSplitPosition(25, Unit.PERCENTAGE); mainPanel.addComponent(mibPanel); mainPanel.addComponent(mibConsole); setContent(mainPanel); }
From source file:org.ripla.web.controllers.RiplaBody.java
License:Open Source License
/** * Arranges the body window's views (i.e. <code>header</code>, * <code>footer</code>, <code>toolbar</code>, <code>menubar</code>, * <code>sidebar</code>, <code>content</code>).<br /> * Subclasses may override for a different arrangement of the views. *//*from w w w .j a v a2 s. c o m*/ protected void initializeLayout() { Page.getCurrent().setTitle(application.getAppName()); if (skin.hasHeader()) { final Component lHeader = skin.getHeader(application.getAppName()); layout.addComponent(lHeader); layout.setExpandRatio(lHeader, 0); } if (skin.hasToolBar()) { final Component lToolbar = createToolbar(skin.getToolbarSeparator()); layout.addComponent(lToolbar); } if (skin.hasMenuBar()) { final Component lMenubar = createMenubar(skin.getMenuBarMedium(), skin.getMenuBar(), skin.getSubMenuIcon()); layout.addComponent(lMenubar); } final HorizontalSplitPanel lPanel = new HorizontalSplitPanel(); layout.addComponent(lPanel); layout.setExpandRatio(lPanel, 1); lPanel.setSplitPosition(10, Unit.PERCENTAGE); // lPanel.setHeight(SIZE_UNDEFINED, Unit.PIXELS); lPanel.setStyleName("ripla-split"); //$NON-NLS-1$ sidebar = new VerticalLayout(); sidebar.setStyleName("ripla-sidebar"); sidebar.setSizeFull(); lPanel.setFirstComponent(sidebar); content = new VerticalLayout(); content.setStyleName("ripla-content"); lPanel.setSecondComponent(content); content.setMargin(true); lPanel.setSizeFull(); layout.setSizeFull(); }
From source file:org.s23m.cell.editor.semanticdomain.Editor.java
License:Mozilla Public License
@Override public void init() { EditorController.getInstance().setEditor(this); mainWindow = new Window("Gmodel"); //mainWindow.addComponent(pusher); setMainWindow(mainWindow);// w ww. j a va2s. co m setTheme(THEME_NAME); initializeGmodelKernel(); final HorizontalSplitPanel splitter = new HorizontalSplitPanel(); splitter.setSplitPosition(DEFAULT_L_WIDTH, Sizeable.UNITS_PIXELS); mainWindow.setContent(splitter); containmentTreePanel = new ContainmentTreePanel(this); multitabPanel = new MultitabPanel(this); //((VerticalLayout)multitabPanel.getConsole().getParent()).addComponent(pusher); splitter.addComponent(containmentTreePanel); splitter.addComponent(multitabPanel); }
From source file:org.sensorhub.ui.AdminUI.java
License:Mozilla Public License
@Override protected void init(VaadinRequest request) { String configClass = null;/*from ww w .ja v a 2 s . c om*/ moduleConfigLists.clear(); // retrieve module config try { Properties initParams = request.getService().getDeploymentConfiguration().getInitParameters(); String moduleID = initParams.getProperty(AdminUIModule.SERVLET_PARAM_MODULE_ID); uiConfig = (AdminUIConfig) SensorHub.getInstance().getModuleRegistry().getModuleById(moduleID) .getConfiguration(); } catch (Exception e) { throw new RuntimeException("Cannot get UI module configuration", e); } try { // load default form builders customForms.put(HttpServerConfig.class.getCanonicalName(), HttpServerConfigForm.class); customForms.put(StreamStorageConfig.class.getCanonicalName(), GenericStorageConfigForm.class); customForms.put(CommConfig.class.getCanonicalName(), CommConfigForm.class); customForms.put(SOSConfigForm.SOS_PACKAGE + "SOSServiceConfig", SOSConfigForm.class); customForms.put(SOSConfigForm.SOS_PACKAGE + "SOSProviderConfig", SOSConfigForm.class); // load custom form builders defined in config for (CustomUIConfig customForm : uiConfig.customForms) { configClass = customForm.configClass; Class<?> clazz = Class.forName(customForm.uiClass); customForms.put(configClass, (Class<IModuleConfigForm>) clazz); log.debug("Loaded custom form for " + configClass); } } catch (Exception e) { log.error("Error while instantiating form builder for config class " + configClass, e); } try { // load default panel builders customPanels.put(SensorConfig.class.getCanonicalName(), SensorAdminPanel.class); customPanels.put(StorageConfig.class.getCanonicalName(), StorageAdminPanel.class); // load custom panel builders defined in config for (CustomUIConfig customPanel : uiConfig.customPanels) { configClass = customPanel.configClass; Class<?> clazz = Class.forName(customPanel.uiClass); customPanels.put(configClass, (Class<IModuleAdminPanel<?>>) clazz); log.debug("Loaded custom panel for " + configClass); } } catch (Exception e) { log.error("Error while instantiating panel builder for config class " + configClass, e); } // register new field converter for interger numbers @SuppressWarnings("serial") ConverterFactory converterFactory = new DefaultConverterFactory() { @Override protected <PRESENTATION, MODEL> Converter<PRESENTATION, MODEL> findConverter( Class<PRESENTATION> presentationType, Class<MODEL> modelType) { // Handle String <-> Integer/Short/Long if (presentationType == String.class && (modelType == Long.class || modelType == Integer.class || modelType == Short.class)) { return (Converter<PRESENTATION, MODEL>) new StringToIntegerConverter() { @Override protected NumberFormat getFormat(Locale locale) { NumberFormat format = super.getFormat(Locale.US); format.setGroupingUsed(false); return format; } }; } // Let default factory handle the rest return super.findConverter(presentationType, modelType); } }; VaadinSession.getCurrent().setConverterFactory(converterFactory); // init main panels HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); splitPanel.setMinSplitPosition(300.0f, Unit.PIXELS); splitPanel.setMaxSplitPosition(30.0f, Unit.PERCENTAGE); splitPanel.setSplitPosition(350.0f, Unit.PIXELS); setContent(splitPanel); // build left pane VerticalLayout leftPane = new VerticalLayout(); leftPane.setSizeFull(); // header image and title Component header = buildHeader(); leftPane.addComponent(header); leftPane.setExpandRatio(header, 0); // toolbar Component toolbar = buildToolbar(); leftPane.addComponent(toolbar); leftPane.setExpandRatio(toolbar, 0); // accordion with several sections Accordion stack = new Accordion(); stack.setSizeFull(); VerticalLayout layout; Tab tab; layout = new VerticalLayout(); tab = stack.addTab(layout, "Sensors"); tab.setIcon(ACC_TAB_ICON); buildModuleList(layout, SensorConfig.class); layout = new VerticalLayout(); tab = stack.addTab(layout, "Storage"); tab.setIcon(ACC_TAB_ICON); buildModuleList(layout, StorageConfig.class); layout = new VerticalLayout(); tab = stack.addTab(layout, "Processing"); tab.setIcon(ACC_TAB_ICON); buildModuleList(layout, ProcessConfig.class); layout = new VerticalLayout(); tab = stack.addTab(layout, "Services"); tab.setIcon(ACC_TAB_ICON); buildModuleList(layout, ServiceConfig.class); layout = new VerticalLayout(); tab = stack.addTab(layout, "Clients"); tab.setIcon(ACC_TAB_ICON); buildModuleList(layout, ClientConfig.class); layout = new VerticalLayout(); tab = stack.addTab(layout, "Network"); tab.setIcon(ACC_TAB_ICON); buildNetworkConfig(layout); leftPane.addComponent(stack); leftPane.setExpandRatio(stack, 1); splitPanel.addComponent(leftPane); // init config area configArea = new VerticalLayout(); configArea.setMargin(true); splitPanel.addComponent(configArea); }
From source file:org.vaadin.addons.filterbuilder.FilterBuilderUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle("FilterBuilder demo"); HorizontalSplitPanel content = new HorizontalSplitPanel(); content.setSizeFull();// w w w .ja va2 s . com // Left pane leftPane = new VerticalLayout(); { leftPane.setSizeFull(); leftPane.setMargin(true); leftPane.setSpacing(true); filterField = new TextField(); filterField.setInputPrompt("Write your filter here"); filterField.setIcon(FontAwesome.SEARCH); filterField.addStyleName("filter-field inline-icon"); filterField.setWidth(100, Unit.PERCENTAGE); filterField.setTextChangeEventMode(TextField.TextChangeEventMode.LAZY); filterField.setTextChangeTimeout(1000); filterField.addTextChangeListener(this); leftPane.addComponent(filterField); filterLabel = new Label(); filterLabel.setWidth(100, Unit.PERCENTAGE); try { dataSource = new BeanItemContainer<>(TestCaseBean.class, TestCaseBean.loadMockData()); dataSource.removeContainerProperty("address"); dataSource.addNestedContainerProperty("address.country"); dataSource.addNestedContainerProperty("address.city"); dataSource.addNestedContainerProperty("address.street"); dataSource.addNestedContainerProperty("address.address"); } catch (Exception e) { logger.error("Could not load mock data"); } table = new Table(null, dataSource); table.setSizeFull(); table.setVisibleColumns("id", "firstName", "lastName", "jobTitle", "dob", "salary", "address.country", "address.city", "address.street", "address.address", "unemployed"); table.setSelectable(true); leftPane.addComponent(table); leftPane.setExpandRatio(table, 1); } content.setFirstComponent(leftPane); // Right pane rightPane = new TabSheet(); { rightPane.setSizeFull(); VerticalLayout lastUsedFiltersPane = new VerticalLayout(); lastUsedFiltersPane.setSizeFull(); lastUsedFiltersPane.setMargin(true); lastUsedFiltersPane.setSpacing(true); lastUsedFilters = new IndexedContainer(); lastUsedFilters.addContainerProperty("filter", String.class, null); lastUsedFiltersTable = new Table(); lastUsedFiltersTable.setSizeFull(); lastUsedFiltersTable.setContainerDataSource(lastUsedFilters); lastUsedFiltersTable.setSortEnabled(false); lastUsedFiltersTable.setSelectable(true); lastUsedFiltersTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); lastUsedFiltersTable.addItemClickListener(this); final Button removeFilterButton = new Button("Remove", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (lastUsedFiltersTable.getValue() != null) { lastUsedFilters.removeItem(lastUsedFiltersTable.getValue()); lastUsedFiltersTable.setValue(null); } } }); removeFilterButton.setEnabled(false); lastUsedFiltersTable.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { removeFilterButton.setEnabled(lastUsedFiltersTable.getValue() != null); } }); lastUsedFiltersPane.addComponents(lastUsedFiltersTable, removeFilterButton); lastUsedFiltersPane.setExpandRatio(lastUsedFiltersTable, 1); rightPane.addTab(lastUsedFiltersPane).setCaption("Last used filters"); VerticalLayout dateFormatsPane = new VerticalLayout(); dateFormatsPane.setMargin(true); dateFormats = new IndexedContainer(); dateFormats.addContainerProperty("format", String.class, null); for (SimpleDateFormat dateFormat : FilterBuilder.DATE_FORMATS) { final Item item = dateFormats.addItem(dateFormat.toPattern()); item.getItemProperty("format").setValue(dateFormat.toPattern()); } dateFormatsTable = new Table(); dateFormatsTable.setWidth(100, Unit.PERCENTAGE); dateFormatsTable.setContainerDataSource(dateFormats); dateFormatsTable.setSortEnabled(false); dateFormatsTable.setSelectable(true); dateFormatsTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); dateFormatsPane.addComponent(dateFormatsTable); rightPane.addTab(dateFormatsPane).setCaption("Known date formats"); } VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); content.setSecondComponent(rightPane); content.setSplitPosition(80, Unit.PERCENTAGE); setContent(content); logger.debug("UI initialized"); }
From source file:org.vaadin.spring.samples.sidebar.SideBarUI.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { getPage().setTitle("Vaadin4Spring Side Bar Sample"); final HorizontalSplitPanel rootLayout = new HorizontalSplitPanel(); rootLayout.setStyleName(Reindeer.SPLITPANEL_SMALL); rootLayout.setSizeFull();/*from w ww.j ava 2 s. co m*/ setContent(rootLayout); final Navigator navigator = new Navigator(this, new ViewDisplay() { @Override public void showView(View view) { System.out.println("Showing view " + view); rootLayout.setSecondComponent((com.vaadin.ui.Component) view); } }); navigator.setErrorView(new ErrorView()); navigator.addProvider(viewProvider); setNavigator(navigator); rootLayout.setFirstComponent(sideBar); rootLayout.setSplitPosition(150, Unit.PIXELS); }
From source file:pt.yellowduck.ramboia.RamboiaApplication.java
License:Open Source License
private void buildMainLayout() { VerticalSplitPanel vSplit = new VerticalSplitPanel(); vSplit.setSplitPosition(15, Sizeable.UNITS_PERCENTAGE); vSplit.setSizeFull();//w ww .ja v a 2 s . c o m HorizontalSplitPanel hSplit_top = new HorizontalSplitPanel(); hSplit_top.setSizeFull(); hSplit_top.setSplitPosition(50, Sizeable.UNITS_PERCENTAGE); hSplit_top.setFirstComponent(viewPlayer); hSplit_top.setSecondComponent(viewUpload); hSplit_top.setLocked(true); vSplit.setFirstComponent(hSplit_top); HorizontalSplitPanel hSplit_bottom = new HorizontalSplitPanel(); hSplit_bottom.setSizeFull(); hSplit_bottom.setSplitPosition(75, Sizeable.UNITS_PERCENTAGE); hSplit_bottom.setFirstComponent(viewLibrary); hSplit_bottom.setSecondComponent(viewPlaylist); hSplit_bottom.setLocked(true); vSplit.setSecondComponent(hSplit_bottom); mainWindow.setContent(vSplit); }