List of usage examples for com.vaadin.ui VerticalLayout setExpandRatio
public void setExpandRatio(Component component, float ratio)
This method is used to control how excess space in layout is distributed among components.
From source file:org.lunifera.example.vaadin.osgi.jpacontainer.AddressBookMainView.java
License:Apache License
@SuppressWarnings("deprecation") private void buildMainArea() { VerticalLayout verticalLayout = new VerticalLayout(); setSecondComponent(verticalLayout);//from w w w. ja va 2s . c o m personTable = new Table(null, persons); personTable.setSelectable(true); personTable.setImmediate(true); personTable.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { setModificationsEnabled(event.getProperty().getValue() != null); } private void setModificationsEnabled(boolean b) { deleteButton.setEnabled(b); editButton.setEnabled(b); } }); personTable.setSizeFull(); // personTable.setSelectable(true); personTable.addListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { personTable.select(event.getItemId()); } } }); personTable.setVisibleColumns( new Object[] { "firstName", "lastName", "department", "phoneNumber", "street", "city", "zipCode" }); HorizontalLayout toolbar = new HorizontalLayout(); newButton = new Button("Add"); newButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { final BeanItem<Person> newPersonItem = new BeanItem<Person>(new Person()); PersonEditor personEditor = new PersonEditor(newPersonItem); personEditor.addListener(new EditorSavedListener() { @Override public void editorSaved(EditorSavedEvent event) { persons.addEntity(newPersonItem.getBean()); } }); UI.getCurrent().addWindow(personEditor); } }); deleteButton = new Button("Delete"); deleteButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { persons.removeItem(personTable.getValue()); } }); deleteButton.setEnabled(false); editButton = new Button("Edit"); editButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().addWindow(new PersonEditor(personTable.getItem(personTable.getValue()))); } }); editButton.setEnabled(false); searchField = new TextField(); searchField.setInputPrompt("Search by name"); searchField.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { textFilter = event.getText(); updateFilters(); } }); toolbar.addComponent(newButton); toolbar.addComponent(deleteButton); toolbar.addComponent(editButton); toolbar.addComponent(searchField); toolbar.setWidth("100%"); toolbar.setExpandRatio(searchField, 1); toolbar.setComponentAlignment(searchField, Alignment.TOP_RIGHT); verticalLayout.addComponent(toolbar); verticalLayout.addComponent(personTable); verticalLayout.setExpandRatio(personTable, 1); verticalLayout.setSizeFull(); }
From source file:org.lunifera.examples.kwiee.erp.module.core.presentation.web.vaadin.ui.KwieeUINavigator.java
License:Open Source License
@SuppressWarnings("serial") protected void createTasksTable() { // create layout VerticalLayout tableArea = new VerticalLayout(); tableArea.setSizeFull();//from w w w .j a va 2 s . com tabSheet.addTab(tableArea, "Tasks"); // create table -> expand 1.0 taskTable = new Table(); tableArea.addComponent(taskTable); tableArea.setExpandRatio(taskTable, 1.0f); taskTable.setSizeFull(); taskTable.setImmediate(true); taskTable.setBuffered(false); taskTable.setSelectable(true); taskTable.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { showTask((Task) event.getProperty().getValue()); } }); refreshTasks(); // create button -> 28px HorizontalLayout buttonBar = new HorizontalLayout(); buttonBar.setSizeFull(); buttonBar.setMargin(true); buttonBar.setSpacing(true); buttonBar.setHeight("48px"); tableArea.addComponent(buttonBar); refreshTasksButton = new Button("Refresh"); buttonBar.addComponent(refreshTasksButton); buttonBar.setComponentAlignment(refreshTasksButton, Alignment.MIDDLE_LEFT); refreshTasksButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { refreshTasks(); } }); }
From source file:org.opencms.ui.editors.messagebundle.CmsMessageBundleEditor.java
License:Open Source License
/** * Creates the main component of the editor with all sub-components. * @return the completely filled main component of the editor. * @throws IOException thrown if setting the table's content data source fails. * @throws CmsException thrown if setting the table's content data source fails. *//*from ww w . j ava2 s . co m*/ private Component createMainComponent() throws IOException, CmsException { VerticalLayout mainComponent = new VerticalLayout(); mainComponent.setSizeFull(); mainComponent.addStyleName("o-message-bundle-editor"); m_table = createTable(); Panel navigator = new Panel(); navigator.setSizeFull(); navigator.setContent(m_table); navigator.addActionHandler(new CmsMessageBundleEditorTypes.TableKeyboardHandler(m_table)); navigator.addStyleName("v-panel-borderless"); mainComponent.addComponent(m_options.getOptionsComponent()); mainComponent.addComponent(navigator); mainComponent.setExpandRatio(navigator, 1f); m_options.updateShownOptions(m_model.hasMasterMode(), m_model.canAddKeys()); return mainComponent; }
From source file:org.opencms.ui.login.CmsLoginUI.java
License:Open Source License
/** * Initializes the login view.<p>/*from w w w .j a va 2 s . c om*/ * * @param preselectedOu a potential preselected OU */ public void showLoginView(String preselectedOu) { VerticalLayout content = new VerticalLayout(); content.setSizeFull(); m_targetOpener = new CmsLoginTargetOpener(A_CmsUI.get()); //content.setExpandRatio(m_targetOpener, 0f); content.addComponent(m_loginForm); content.setComponentAlignment(m_loginForm, Alignment.MIDDLE_CENTER); content.setExpandRatio(m_loginForm, 1); setContent(content); if (preselectedOu == null) { preselectedOu = "/"; } m_loginForm.selectOrgUnit(preselectedOu); }
From source file:org.openeos.services.ui.vaadin.internal.DefaultVaadinERPWindowFactory.java
License:Apache License
@Override public Component createWindowComponent(IWindowDefinition window, final UIApplication<IUnoVaadinApplication> application) { final VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeFull();/* w ww.ja va2s . c om*/ verticalLayout.setMargin(false); final VaadinWindow vaadinWindow = createWindowImpl(window, application); Component toolbar = createToolBar(vaadinWindow); Component entityActionPanel = createEntityActionPanel(vaadinWindow, application); if (entityActionPanel != null) { verticalLayout.addComponent(toolbar); HorizontalLayout horizontal = new HorizontalLayout(); horizontal.addComponent(vaadinWindow.getComponent()); horizontal.addComponent(entityActionPanel); horizontal.setSizeFull(); horizontal.setExpandRatio(vaadinWindow.getComponent(), 1.0f); verticalLayout.addComponent(horizontal); verticalLayout.setExpandRatio(toolbar, 0); verticalLayout.setExpandRatio(horizontal, 1); } else { verticalLayout.addComponent(toolbar); verticalLayout.addComponent(vaadinWindow.getComponent()); verticalLayout.setExpandRatio(toolbar, 0); verticalLayout.setExpandRatio(vaadinWindow.getComponent(), 1); } application.getConcreteApplication().addCloseTabListener(new CloseTabListener() { @Override public boolean closeTab(final TabSheet tabSheet, final Component c) { if (c == verticalLayout && vaadinWindow.getActiveTab().isModified()) { application.showConfirmation("The changes will be lost, are you sure?", new ConfirmationCallback() { @Override public void onCloseConfirmation(boolean accepted) { if (accepted) { tabSheet.removeComponent(c); removeListener(); } } }); return true; } return false; } private void removeListener() { application.getConcreteApplication().removeCloseTabListener(this); } }); return verticalLayout; }
From source file:org.openeos.usertask.ui.internal.vaadin.TasksWindow.java
License:Apache License
private void createMainComponent() { VerticalLayout main = new VerticalLayout(); main.setMargin(false);// w w w . jav a 2 s. c o m main.setSizeFull(); main.addComponent(createToolbar()); mainSplitPanel = new HorizontalSplitPanel(); mainSplitPanel.setMargin(false); mainSplitPanel.setMaxSplitPosition(80f, HorizontalSplitPanel.UNITS_PERCENTAGE); mainSplitPanel.setMinSplitPosition(20f, HorizontalSplitPanel.UNITS_PERCENTAGE); mainSplitPanel.setSizeFull(); mainSplitPanel.setSplitPosition(30f, HorizontalSplitPanel.UNITS_PERCENTAGE); taskTable = createTable(); mainSplitPanel.setFirstComponent(taskTable); displayEmptyTask(); main.addComponent(mainSplitPanel); main.setExpandRatio(mainSplitPanel, 1.0f); mainComponent = main; }
From source file:org.opennms.features.jmxconfiggenerator.webui.JmxConfigGeneratorApplication.java
License:Open Source License
/** * Creates the main window and adds the header, main and button panels to * it.//from w w w. j ava2s . co m */ private void initMainWindow() { Window window = new Window("JmxConfigGenerator GUI Tool"); VerticalLayout layout = new VerticalLayout(); layout.addComponent(headerPanel); layout.addComponent(contentPanel); // content Panel should use most of the space :) layout.setExpandRatio(contentPanel, 1); window.setContent(layout); window.getContent().setSizeFull(); window.setSizeFull(); addWindow(window); }
From source file:org.opennms.features.jmxconfiggenerator.webui.ui.ConfigResultView.java
License:Open Source License
public ConfigResultView(JmxConfigGeneratorApplication app) { this.app = app; setSizeFull();/*from w w w. ja v a2s. c om*/ VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.addComponent(tabSheet); mainLayout.addComponent(buttonPanel); tabSheet.setSizeFull(); // TODO set tab name differently (e.g. SNMP Graph properties snippet) tabContentMap.put(OutputDataKey.JmxDataCollectionConfig, new TabContent(OutputDataKey.JmxDataCollectionConfig)); tabContentMap.put(OutputDataKey.SnmpGraphProperties, new TabContent(OutputDataKey.SnmpGraphProperties)); tabContentMap.put(OutputDataKey.CollectdConfigSnippet, new TabContent(OutputDataKey.CollectdConfigSnippet)); // add all tabs for (TabContent eachContent : tabContentMap.values()) tabSheet.addTab(eachContent, eachContent.getCaption()); tabSheet.setSelectedTab(0); // select first component! buttonPanel.getNext().setVisible(false); // TODO MVR enable button again and allow to download buttonPanel.getNext().setCaption("download all"); buttonPanel.getNext().setIcon(IconProvider.getIcon(IconProvider.BUTTON_SAVE)); mainLayout.setExpandRatio(tabSheet, 1); setCompositionRoot(mainLayout); }
From source file:org.opennms.features.jmxconfiggenerator.webui.ui.mbeans.MBeansView.java
License:Open Source License
private Layout initContentPanel(NameEditForm form, MBeansContentTabSheet tabSheet) { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();/*from w w w .j a va2 s . c om*/ layout.setSpacing(false); layout.addComponent(form); layout.addComponent(tabSheet); layout.setExpandRatio(tabSheet, 1); return layout; }
From source file:org.opennms.features.pluginmgr.vaadin.pluginmanager.ErrorMessageWindow.java
License:Apache License
public ErrorMessageWindow(SystemMessages systemMessages) { super("Full Log Message"); // Set window caption center();/*from ww w. j a v a 2 s . c o m*/ setHeight("75%"); setWidth("75%"); // Some basic content for the window VerticalLayout content = new VerticalLayout(); content.setSizeFull(); TextArea ta = new TextArea(); ta.setWordwrap(true); ta.setImmediate(true); ta.setWidth("100%"); ta.setHeight("100%"); content.addComponent(ta); content.setExpandRatio(ta, 1.0f); if (systemMessages != null) { ta.setValue(systemMessages.getLongMessage()); } else { ta.setValue("Error: systemMessages should not be null"); LOG.error("Error: systemMessages should not be null"); } ta.setReadOnly(false); content.setMargin(true); setContent(content); // Disable the close button setClosable(false); // Trivial logic for closing the sub-window Button ok = new Button("OK"); ok.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { close(); // Close the sub-window } }); content.addComponent(ok); }