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:jp.primecloud.auto.ui.ServicePanel.java
License:Open Source License
@Override public void attach() { setSizeFull();//from w w w . j av a2s. c om addStyleName(Reindeer.PANEL_LIGHT); VerticalLayout layout = (VerticalLayout) getContent(); layout.setSizeFull(); layout.addStyleName("service-tab"); layout.setSpacing(false); layout.setMargin(false); // ? SplitPanel splitPanel = new SplitPanel(); splitPanel.setOrientation(SplitPanel.ORIENTATION_VERTICAL); splitPanel.setSplitPosition(40); splitPanel.setSizeFull(); layout.addComponent(splitPanel); layout.setExpandRatio(splitPanel, 10); // ? VerticalLayout upperLayout = new VerticalLayout(); upperLayout.setSizeFull(); upperLayout.setSpacing(false); upperLayout.setMargin(false); serviceButtonsTop = new ServiceButtonsTop(sender); upperLayout.addComponent(serviceButtonsTop); serviceTable = new ServiceTable(sender); serviceTable.setContainerDataSource(new ComponentDtoContainer()); upperLayout.addComponent(serviceTable); serviceTable.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { tableRowSelected(event); } }); serviceButtonsBottom = new ServiceButtonsBottom(sender); upperLayout.addComponent(serviceButtonsBottom); upperLayout.setExpandRatio(serviceTable, 10); splitPanel.addComponent(upperLayout); // ? serviceDesc = new ServiceDesc(sender); splitPanel.addComponent(serviceDesc); }
From source file:kn.uni.gis.ui.GameApplication.java
License:Apache License
@Override public void init() { window = new Window("Fox and Hunter - Der Kohl sei mit euch!"); setMainWindow(window);//from www .j a v a 2s . c o m VerticalLayout verticalLayout = new VerticalLayout(); map = getMap(); window.setContent(verticalLayout); verticalLayout.setSizeFull(); verticalLayout.addComponent(map); verticalLayout.setExpandRatio(map, 1); window.addWindow(createGameWindow()); window.addWindow(createDownloadWindow()); pi.setIndeterminate(true); pi.setPollingInterval(1000 / FPS); pi.setVisible(false); }
From source file:management.limbr.ui.VaadinUI.java
License:Open Source License
@Override protected void init(VaadinRequest request) { final VerticalLayout root = new VerticalLayout(); root.setSizeFull();//from w w w . j a v a 2s .c o m root.setMargin(true); root.setSpacing(true); setContent(root); Image logo = new Image(null, new ExternalResource("images/logo1.png")); logo.setHeight(1.2f, Unit.EM); logo.setWidthUndefined(); CssLayout navBar = new CssLayout(); navBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); navBar.addComponent(logo); navBar.addComponent(createNavButton("Users", UsersViewImpl.VIEW_NAME)); root.addComponent(navBar); final Panel viewContainer = new Panel(); viewContainer.setSizeFull(); root.addComponent(viewContainer); root.setExpandRatio(viewContainer, 1.0f); Navigator navigator = new Navigator(this, viewContainer); navigator.addProvider(viewProvider); }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private void initView() { setCompositionRoot(root);/*w w w . j a va2 s . c o m*/ root.setSizeFull(); root.setSplitPosition(15); root.setStyleName("small previews"); previewArea.setWidth("100%"); previewTabs = new VerticalLayout(); previewTabs.setSizeFull(); previewTabs.setHeight(null); compoundTabs = new VerticalLayout(); compoundTabs.setSizeFull(); compoundTabs.setHeight(null); bennuStylesTabs = new VerticalLayout(); bennuStylesTabs.setSizeFull(); bennuStylesTabs.setHeight(null); VerticalLayout menu = new VerticalLayout(); menu.setSizeFull(); menu.setStyleName("sidebar-menu"); Button syncThemes = new Button("Sync Themes", new ClickListener() { @Override public void buttonClick(ClickEvent event) { syncThemes(); } }); menu.addComponent(syncThemes); menu.addComponent(new Label("Single Components")); menu.addComponent(previewTabs); menu.addComponent(new Label("Compound Styles")); menu.addComponent(compoundTabs); menu.addComponent(new Label("Bennu Styles")); menu.addComponent(bennuStylesTabs); root.setFirstComponent(menu); CssLayout toolbar = new CssLayout(); toolbar.setWidth("100%"); toolbar.setStyleName("toolbar"); toolbar.addComponent(editorToggle); final Window downloadWindow = new Window("Download Theme"); GridLayout l = new GridLayout(3, 2); l.setSizeUndefined(); l.setMargin(true); l.setSpacing(true); downloadWindow.setContent(l); downloadWindow.setModal(true); downloadWindow.setResizable(false); downloadWindow.setCloseShortcut(KeyCode.ESCAPE, null); downloadWindow.addStyleName("opaque"); Label caption = new Label("Theme Name"); l.addComponent(caption); l.setComponentAlignment(caption, Alignment.MIDDLE_CENTER); final TextField name = new TextField(); name.setValue("my-chameleon"); name.addValidator(new RegexpValidator("[a-zA-Z0-9\\-_\\.]+", "Only alpha-numeric characters allowed")); name.setRequired(true); name.setRequiredError("Please give a name for the theme"); downloadWindow.addComponent(name); Label info = new Label( "This is the name you will use to set the theme in your application code, i.e. <code>setTheme(\"my-cameleon\")</code>.", Label.CONTENT_XHTML); info.addStyleName("tiny"); info.setWidth("200px"); l.addComponent(info, 1, 1, 2, 1); Button download = new Button(null, new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { getApplication().getMainWindow().addWindow(downloadWindow); name.focus(); } }); download.setDescription("Donwload the current theme"); download.setIcon(new ThemeResource("download.png")); download.setStyleName("icon-only"); toolbar.addComponent(download); menu.addComponent(toolbar); menu.setExpandRatio(toolbar, 1); menu.setComponentAlignment(toolbar, Alignment.BOTTOM_CENTER); }
From source file:net.javaforge.netty.vaadin.AddressbookUI.java
License:Apache License
private void initLayout() { /* Root of the user interface component tree is set */ HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); setContent(splitPanel);/*w ww . j a v a2 s .co m*/ /* Build the component tree */ VerticalLayout leftLayout = new VerticalLayout(); splitPanel.addComponent(leftLayout); splitPanel.addComponent(editorLayout); leftLayout.addComponent(contactList); HorizontalLayout bottomLeftLayout = new HorizontalLayout(); leftLayout.addComponent(bottomLeftLayout); bottomLeftLayout.addComponent(searchField); bottomLeftLayout.addComponent(addNewContactButton); /* Set the contents in the left of the split panel to use all the space */ leftLayout.setSizeFull(); /* * On the left side, expand the size of the contactList so that it uses * all the space left after from bottomLeftLayout */ leftLayout.setExpandRatio(contactList, 1); contactList.setSizeFull(); /* * In the bottomLeftLayout, searchField takes all the width there is * after adding addNewContactButton. The height of the layout is defined * by the tallest component. */ bottomLeftLayout.setWidth("100%"); searchField.setWidth("100%"); bottomLeftLayout.setExpandRatio(searchField, 1); /* Put a little margin around the fields in the right side editor */ editorLayout.setMargin(true); editorLayout.setVisible(false); }
From source file:nl.arnovanoort.vaadintest6.MyVaadinApplication.java
License:Apache License
private VerticalLayout createMainLayout() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();//from w w w.j ava 2 s . c o m layout.addComponent(createToolbar()); layout.addComponent(horizontalSplit); /* Allocate all available extra space to the horizontal split panel */ layout.setExpandRatio(horizontalSplit, 1); return layout; }
From source file:nl.kpmg.lcm.ui.Application.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { getPage().setTitle("Local Catalog Manager"); final VerticalLayout root = new VerticalLayout(); root.setSizeFull();//from w ww .java 2s.com root.setMargin(true); root.setSpacing(true); setContent(root); final CssLayout navigationBar = new CssLayout(); navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); Label logo = new Label("LCM"); logo.addStyleName("logo"); logo.setWidthUndefined(); navigationBar.addComponent(logo); navigationBar.addComponent(createNavigationButton("Metadata", MetadataOverviewViewImpl.VIEW_NAME)); navigationBar.addComponent(createNotImplementedButton("Analytics")); navigationBar.addComponent(createNavigationButton("Transfer", TransferViewImpl.VIEW_NAME)); navigationBar.addComponent(createNavigationButton("Administration", AdministrationViewImpl.VIEW_NAME)); navigationBar.addComponent(createLogoutButton("Logout")); root.addComponent(navigationBar); final Panel viewContainer = new Panel(); viewContainer.setSizeFull(); root.addComponent(viewContainer); root.setExpandRatio(viewContainer, 1.0f); navigator = new Navigator(this, viewContainer); navigator.addProvider(viewProvider); navigator.navigateTo("login"); }
From source file:nl.kpmg.lcm.ui.view.MetadataOverviewViewImpl.java
License:Apache License
/** * Builds the interface./*from ww w . j ava 2 s .c o m*/ */ @PostConstruct public final void init() { final VerticalLayout root = new VerticalLayout(); createButton.addClickListener(this); refreshButton.addClickListener(this); HorizontalLayout menubar = new HorizontalLayout(); createButton.addStyleName("margin-10"); refreshButton.addStyleName("margin-10"); menubar.addComponent(createButton); menubar.addComponent(refreshButton); table.addContainerProperty("Name", String.class, null); table.addContainerProperty("Location", ArrayList.class, null); table.addContainerProperty("Actions", HorizontalLayout.class, null); table.setWidth("100%"); table.setHeight("100%"); root.addComponent(menubar); root.addComponent(table); root.setSpacing(true); root.setMargin(true); root.setWidth("100%"); root.setExpandRatio(table, 1f); addComponent(root); }
From source file:org.accelerators.activiti.admin.ui.GroupTab.java
License:Open Source License
public GroupTab(AdminApp application) { // Set application reference this.app = application; // Set tab name setCaption(app.getMessage(Messages.Groups)); // Add main layout VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*w w w. ja v a2s . c o m*/ layout.setSpacing(true); layout.setSizeFull(); // Add toolbar layout GridLayout toolbar = new GridLayout(2, 1); toolbar.setWidth("100%"); layout.addComponent(toolbar); // Add create button create = new Button(app.getMessage(Messages.Create), (ClickListener) this); create.setDescription(app.getMessage(Messages.CreateGroup)); create.setIcon(new ThemeResource("../runo/icons/16/ok.png")); toolbar.addComponent(create, 0, 0); toolbar.setComponentAlignment(create, Alignment.TOP_LEFT); // Add refresh button refresh = new Button(app.getMessage(Messages.Refresh), (ClickListener) this); refresh.setDescription(app.getMessage(Messages.RefreshTable)); refresh.setIcon(new ThemeResource("../runo/icons/16/reload.png")); toolbar.addComponent(refresh, 1, 0); toolbar.setComponentAlignment(refresh, Alignment.TOP_RIGHT); // Add table table = new GroupTable(app); table.setSizeFull(); layout.addComponent(table); // Set table to expand layout.setExpandRatio(table, 1.0f); // Root setCompositionRoot(layout); }
From source file:org.accelerators.activiti.admin.ui.UserTab.java
License:Open Source License
public UserTab(AdminApp application) { // Set application reference this.app = application; // Set tab name setCaption(app.getMessage(Messages.Users)); // Add main layout VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*from ww w . j a v a 2 s . co m*/ layout.setSpacing(true); layout.setSizeFull(); // Add toolbar layout GridLayout toolbar = new GridLayout(2, 1); toolbar.setWidth("100%"); layout.addComponent(toolbar); // Add create button create = new Button(app.getMessage(Messages.Create), (ClickListener) this); create.setDescription(app.getMessage(Messages.CreateUser)); create.setIcon(new ThemeResource("../runo/icons/16/ok.png")); toolbar.addComponent(create, 0, 0); toolbar.setComponentAlignment(create, Alignment.TOP_LEFT); // Add refresh button refresh = new Button(app.getMessage(Messages.Refresh), (ClickListener) this); refresh.setDescription(app.getMessage(Messages.RefreshTable)); refresh.setIcon(new ThemeResource("../runo/icons/16/reload.png")); toolbar.addComponent(refresh, 1, 0); toolbar.setComponentAlignment(refresh, Alignment.TOP_RIGHT); // Add table table = new UserTable(app); table.setSizeFull(); layout.addComponent(table); // Set table to expand layout.setExpandRatio(table, 1.0f); // Root setCompositionRoot(layout); }