List of usage examples for com.vaadin.ui VerticalLayout setWidth
@Override public void setWidth(float width, Unit unit)
From source file:pt.ist.vaadinframework.ui.ApplicationWindow.java
License:Open Source License
public ApplicationWindow(String theme, Property applicationTitle, Property applicationSubtitle, Property copyright) {//from w w w . j a v a 2s . c o m setTheme(theme); this.applicationTitle = applicationTitle; this.applicationSubtitle = applicationSubtitle; this.copyright = copyright; VerticalLayout main = new VerticalLayout(); main.setWidth(90, UNITS_PERCENTAGE); main.setHeight(98, UNITS_PERCENTAGE); main.addStyleName("application-container"); VerticalLayout header = new VerticalLayout(); header.setMargin(true, true, false, true); header.setSpacing(true); main.addComponent(header); HorizontalLayout iconAndTitle = new HorizontalLayout(); iconAndTitle.setSizeFull(); iconAndTitle.setSpacing(true); header.addComponent(iconAndTitle); Embedded logo = new Embedded(null, new ThemeResource("../runo/icons/64/globe.png")); iconAndTitle.addComponent(logo); iconAndTitle.setComponentAlignment(logo, Alignment.MIDDLE_LEFT); VerticalLayout titles = new VerticalLayout(); titles.setSpacing(true); iconAndTitle.addComponent(titles); iconAndTitle.setExpandRatio(titles, 0.8f); Label title = new Label(applicationTitle); title.addStyleName("application-title"); titles.addComponent(title); Label subtitle = new Label(applicationSubtitle); subtitle.addStyleName("application-subtitle"); titles.addComponent(subtitle); HorizontalLayout controls = new HorizontalLayout(); controls.setSpacing(true); iconAndTitle.addComponent(controls); iconAndTitle.setComponentAlignment(controls, Alignment.TOP_RIGHT); Label user = new Label("ist148357"); controls.addComponent(user); Link logout = new Link("logout", new ExternalResource("#")); controls.addComponent(logout); MenuBar menu = new MenuBar(); menu.addStyleName("application-menu"); header.addComponent(menu); MenuItem hello = menu.addItem("hello", null); hello.addItem("sdgjk", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getWindow().showNotification("skjhfgksjdfhglksdjh"); } }); MenuItem hello1 = menu.addItem("hello", null); hello1.addItem("sdgjk", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getWindow().showNotification("skjhfgksjdfhglksdjh"); } }); MenuItem hello2 = menu.addItem("hello", null); hello2.addItem("sdgjk", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getWindow().showNotification("skjhfgksjdfhglksdjh"); } }); body = new VerticalLayout(); body.setSizeFull(); body.setMargin(true); body.addStyleName("application-body"); main.addComponent(body); main.setExpandRatio(body, 1f); body.addComponent(createDefaultPageBody()); VerticalLayout footer = new VerticalLayout(); main.addComponent(footer); main.setComponentAlignment(footer, Alignment.MIDDLE_CENTER); Label copyrightLabel = new Label(copyright); copyrightLabel.setSizeUndefined(); copyrightLabel.addStyleName("application-footer"); footer.addComponent(copyrightLabel); footer.setComponentAlignment(copyrightLabel, Alignment.MIDDLE_CENTER); VerticalLayout outer = (VerticalLayout) getContent(); outer.setSizeFull(); outer.addComponent(main); outer.setComponentAlignment(main, Alignment.MIDDLE_CENTER); }
From source file:ru.codeinside.gses.webui.components.ProcessDefinitionShowUi.java
License:Mozilla Public License
private Component buildMainLayout() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();/*w w w . ja v a 2s . c o m*/ layout.setSpacing(true); layout.setMargin(true); Label label = new Label(); String name = getProcessDefinitionById(processDefinitionId).getName(); label.setCaption(name); label.setStyleName(Reindeer.LABEL_H2); Button showScheme = new Button(""); showScheme.addListener(new Button.ClickListener() { private static final long serialVersionUID = -5911713385519847639L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { VerticalLayout imageLayout = new VerticalLayout(); Button back = new Button("?"); back.addListener(new Button.ClickListener() { private static final long serialVersionUID = 4154712522487297925L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { changer.back(); } }); imageLayout.addComponent(back); imageLayout.setMargin(true); imageLayout.setSpacing(true); imageLayout.setWidth(1100, Sizeable.UNITS_PIXELS); imageLayout.setHeight(600, Sizeable.UNITS_PIXELS); final Panel panel = new Panel(); panel.getContent().setSizeUndefined(); TaskGraph tg = new TaskGraph(processDefinitionId, null); panel.addComponent(tg); panel.setSizeFull(); panel.setScrollable(true); imageLayout.addComponent(panel); imageLayout.setExpandRatio(back, 0.01f); imageLayout.setExpandRatio(panel, 0.99f); changer.change(imageLayout); } }); layout.addComponent(showScheme); Table table = new Table(); table.setSizeFull(); table.setImmediate(true); table.setSelectable(true); table.setSortDisabled(true); table.setPageLength(0); table.setSelectable(false); table.addContainerProperty("id", String.class, null); table.addContainerProperty("name", String.class, null); table.addContainerProperty("accessPermissions", Component.class, null); table.addContainerProperty("formProperties", Component.class, null); table.addContainerProperty("other", String.class, null); table.setColumnHeaders(new String[] { " ?", "?", /*" ?",*/ " ?", "? ", "? " }); table.setColumnExpandRatio("id", 0.1f); table.setColumnExpandRatio("name", 0.1f); table.setColumnExpandRatio("accessPermissions", 0.1f); table.setColumnExpandRatio("formProperties", 0.4f); table.setColumnExpandRatio("other", 0.2f); fillTable(table); layout.addComponent(label); layout.setExpandRatio(label, 1); layout.addComponent(table); layout.setExpandRatio(table, 40); return layout; }