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:com.rdonasco.security.group.views.GroupListPanelView.java
License:Apache License
@Override public void initWidget() throws WidgetInitalizeException { setCaption(I18NResource.localize("Groups")); setStyleName(SecurityDefaultTheme.CSS_PANEL_BUBBLE); VerticalLayout content = (VerticalLayout) getContent(); content.setMargin(true);//from w ww .ja v a2 s . co m content.setHeight(600, UNITS_PIXELS); content.removeAllComponents(); getGroupListTable().setSizeFull(); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setWidth(100F, UNITS_PERCENTAGE); buttonLayout.addComponent(getAddGroupButton()); buttonLayout.addComponent(getRefreshButton()); buttonLayout.setExpandRatio(getAddGroupButton(), 1); content.addComponent(buttonLayout); content.addComponent(getGroupListTable()); content.setExpandRatio(getGroupListTable(), 1); content.setSpacing(true); }
From source file:com.rdonasco.security.role.views.RoleListPanelView.java
License:Apache License
@Override public void initWidget() throws WidgetInitalizeException { setCaption(I18NResource.localize("Roles")); setStyleName(SecurityDefaultTheme.CSS_PANEL_BUBBLE); VerticalLayout content = (VerticalLayout) getContent(); content.setMargin(true);/* ww w . j a va 2 s . c om*/ content.setHeight(600, UNITS_PIXELS); content.removeAllComponents(); getRoleListTable().setSizeFull(); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setWidth(100F, UNITS_PERCENTAGE); buttonLayout.addComponent(addRoleButton); buttonLayout.addComponent(refreshButton); buttonLayout.setExpandRatio(addRoleButton, 1); content.addComponent(buttonLayout); content.addComponent(getRoleListTable()); content.setExpandRatio(getRoleListTable(), 1); content.setSpacing(true); }
From source file:com.rdonasco.security.user.views.UserCapabilitiesView.java
License:Apache License
@Override public void initWidget() throws WidgetInitalizeException { setCaption(I18NResource.localize("User Capabilities")); setStyleName(SecurityDefaultTheme.CSS_PANEL_BUBBLE); getUserCapabilitiesTable().addStyleName(SecurityDefaultTheme.CSS_TABLE_SMALL_STRIPED); getUserCapabilitiesTable().addStyleName(SecurityDefaultTheme.CSS_TABLE_BORDERLESS); VerticalLayout layout = (VerticalLayout) getContent(); layout.setSpacing(true);/*from w w w . ja v a 2s . c om*/ layout.addComponent(getUserCapabilitiesTable()); getUserCapabilitiesTable().setSizeFull(); layout.setExpandRatio(getUserCapabilitiesTable(), 1); }
From source file:com.rdonasco.security.user.views.UserGroupsView.java
License:Apache License
@Override public void initWidget() throws WidgetInitalizeException { setCaption(I18NResource.localize("User Groups")); setStyleName(SecurityDefaultTheme.CSS_PANEL_BUBBLE); getUserGroupsTable().addStyleName(SecurityDefaultTheme.CSS_TABLE_SMALL_STRIPED); getUserGroupsTable().addStyleName(SecurityDefaultTheme.CSS_TABLE_BORDERLESS); VerticalLayout layout = (VerticalLayout) getContent(); layout.setSpacing(true);/*from w w w .ja v a2s. c om*/ layout.addComponent(getUserGroupsTable()); getUserGroupsTable().setSizeFull(); layout.setExpandRatio(getUserGroupsTable(), 1); }
From source file:com.rdonasco.security.user.views.UserListPanelView.java
License:Apache License
@Override public void initWidget() throws WidgetInitalizeException { getAddUserButton().setCaption(I18NResource.localize("Add new user")); getAddUserButton().setIcon(new ThemeResource(SecurityDefaultTheme.ICON_16x16_ADD)); getAddUserButton().setWidth(100, UNITS_PERCENTAGE); getAddUserButton().addStyleName(SecurityDefaultTheme.CSS_SMALL); getRefreshButton().setCaption("Refresh"); getRefreshButton().setIcon(new ThemeResource(SecurityDefaultTheme.ICON_16x16_REFRESH)); getRefreshButton().addStyleName(SecurityDefaultTheme.CSS_SMALL); VerticalLayout content = ((VerticalLayout) getContent()); content.setMargin(true);/* ww w . ja va 2 s . c o m*/ content.setHeight(600, UNITS_PIXELS); content.removeAllComponents(); if (null != getDataViewListTable()) { getDataViewListTable().setSizeFull(); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setWidth(100F, UNITS_PERCENTAGE); buttonLayout.addComponent(getAddUserButton()); buttonLayout.addComponent(getRefreshButton()); buttonLayout.setExpandRatio(getAddUserButton(), 1); content.addComponent(buttonLayout); content.addComponent(getDataViewListTable()); content.setExpandRatio(getDataViewListTable(), 1); content.setSpacing(true); } }
From source file:com.rdonasco.security.user.views.UserRolesView.java
License:Apache License
@Override public void initWidget() throws WidgetInitalizeException { setCaption(I18NResource.localize("User Roles")); setStyleName(SecurityDefaultTheme.CSS_PANEL_BUBBLE); getUserRolesTable().addStyleName(SecurityDefaultTheme.CSS_TABLE_SMALL_STRIPED); getUserRolesTable().addStyleName(SecurityDefaultTheme.CSS_TABLE_BORDERLESS); VerticalLayout layout = (VerticalLayout) getContent(); layout.setSpacing(true);/* w w w . j a va2 s. com*/ layout.addComponent(getUserRolesTable()); getUserRolesTable().setSizeFull(); layout.setExpandRatio(getUserRolesTable(), 1); }
From source file:com.scipionyx.butterflyeffect.frontend.core.ui.MainUI.java
License:Apache License
/** * //www .j a va 2 s. c om */ @Override protected void init(VaadinRequest request) { // Top Menu final VerticalLayout root = new VerticalLayout(); root.setSizeFull(); root.setMargin(new MarginInfo(false, false, false, false)); root.setSpacing(false); root.addComponent(topFactory.instance()); setContent(root); viewContainer = new Panel(); viewContainer.setStyleName(ValoTheme.PANEL_BORDERLESS); viewContainer.setSizeFull(); root.addComponent(viewContainer); root.setExpandRatio(viewContainer, 1.0f); // Define the access denied view viewProvider.setAccessDeniedViewClass(AccessDeniedView.class); }
From source file:com.selzlein.lojavirtual.vaadin.page.SettingsView.java
License:Open Source License
private void createView() { ui = (LspsUI) getUI();//w w w . j av a 2s . c o m user = ui.getUser().getPerson(); userRights = user.getRights(); setTitle(ui.getMessage(TITLE)); Panel panel = new Panel(); panel.addStyleName("l-border-none"); setContent(panel); VerticalLayout layout = new VerticalLayout(); layout.addStyleName("l-settings"); layout.setSizeFull(); layout.setSpacing(true); layout.setMargin(true); panel.setContent(layout); //user data and settings will be laid out next to each other HorizontalLayout topSection = new HorizontalLayout(); topSection.setSpacing(true); topSection.setWidth("100%"); layout.addComponent(topSection); VerticalLayout userData = createUserDataSection(ui, user); topSection.addComponent(userData); topSection.setExpandRatio(userData, 1); Label spacer = new Label(); spacer.setWidth("20px"); topSection.addComponent(spacer); VerticalLayout settings = createSettingsSection(ui); topSection.addComponent(settings); topSection.setExpandRatio(settings, 1); //substitution section VerticalLayout substitution = createSubstitutionSection(); layout.addComponent(substitution); layout.setExpandRatio(substitution, 2); //buttons HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button saveButton = new Button(ui.getMessage("action.save"), new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (save()) { if (requestReload) { JavaScript.getCurrent().execute("window.location.reload()"); } else { close(); } } } }); saveButton.setData(BUTTON_TYPE_SAVE); buttons.addComponent(saveButton); Button cancelButton = new Button(ui.getMessage("action.cancel"), new ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); buttons.addComponent(cancelButton); layout.addComponent(buttons); }
From source file:com.selzlein.lojavirtual.vaadin.page.SettingsView.java
License:Open Source License
private VerticalLayout createSubstitutionSection() { VerticalLayout substitution = new VerticalLayout(); substitution.addStyleName("l-substitutes"); substitution.setSpacing(true);/* w w w .ja v a 2s . com*/ substitution.setSizeFull(); Label substitutionHeader = new Label("<h2>" + ui.getMessage("settings.substitutionSection") + "</h2>", ContentMode.HTML); substitution.addComponent(substitutionHeader); Label substitutionHelp = new Label(ui.getMessage("settings.substitutionHelp")); substitutionHelp.setStyleName("form-help"); substitution.addComponent(substitutionHelp); this.substitutionActive = new CheckBox(ui.getMessage("settings.substitutionActive")); substitutionActive.addStyleName("ui-spacing"); substitutionActive.setValue(user.isSubstitutionActive()); substitution.addComponent(substitutionActive); //substitutes selectedPersons = user.getDirectSubstitutes(); this.substitutes = new OptionGroup(ui.getMessage("settings.substitutes")); refreshSubstitutes(""); TextField substituteFilter = new TextField(ui.getMessage("action.filter")); substituteFilter.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { substitutes.removeAllItems(); refreshSubstitutes(event.getProperty().getValue().toString()); } }); substitution.addComponent(substituteFilter); Panel substitutesPanel = new Panel(); substitutesPanel.addStyleName("l-border-none"); substitutesPanel.setSizeFull(); substitutesPanel.setContent(substitutes); substitution.addComponent(substitutesPanel); substitution.setExpandRatio(substitutesPanel, 2); return substitution; }
From source file:com.selzlein.lojavirtual.vaadin.page.TodoListView.java
License:Open Source License
@SuppressWarnings("serial") private void createView() { final LspsUI ui = (LspsUI) getUI(); setTitle(ui.getMessage(TITLE));//from w w w .j a v a 2 s .c o m VerticalLayout layout = new VerticalLayout(); setContent(layout); table = new Table(); table.setSizeFull(); table.setSelectable(true); table.setMultiSelectMode(MultiSelectMode.SIMPLE); table.setSortEnabled(false); table.setColumnReorderingAllowed(true); table.setColumnCollapsingAllowed(true); table.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { final Object sel = event.getProperty().getValue(); if (sel instanceof Set) { selection = (Set<Long>) sel; } else if (sel instanceof Long) { selection = Collections.singleton((Long) sel); } else { selection = Collections.emptySet(); } //enable todo actions only if the sel is non-empty actionBtn.setEnabled(selection.size() > 0); } }); table.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (table.isMultiSelect()) { return; //don't do anything if in selection mode } if (event.getButton() != MouseButton.LEFT || event.isDoubleClick()) { return; //ignore right-clicks } final Item item = event.getItem(); final Long todoId = (Long) item.getItemProperty("id").getValue(); try { ((LspsUI) getUI()).openTodo(todoId); } catch (Exception e) { Utils.log(e, "could not open to-do " + todoId, log); final LspsUI ui = (LspsUI) getUI(); ui.showErrorMessage("app.unknownErrorOccurred", e); //todo.openFailed? } } }); table.setContainerDataSource(container); Object[] defaultColumns = new Object[] { "title", "notes", "priority", "authorization", "modelInstanceId", "issuedDate" }; //load table settings String settings = ui.getUser().getSettingString(SETTINGS_KEY, null); if (settings == null) { table.setVisibleColumns(defaultColumns); originalSettings = getColumnSettings(); } else { originalSettings = settings; try { applyTableSettings(settings); } catch (Exception e) { table.setVisibleColumns(defaultColumns); Utils.log(e, "could not load todo list settings", log); } } table.setColumnHeader("title", ui.getMessage("todo.title")); table.setColumnHeader("notes", ui.getMessage("todo.notes")); table.setColumnHeader("priority", ui.getMessage("todo.priority")); table.setColumnHeader("authorization", ui.getMessage("todo.authorizationShort")); table.setColumnHeader("modelInstanceId", ui.getMessage("todo.process")); table.setColumnHeader("issuedDate", ui.getMessage("todo.issued")); table.setColumnAlignment("modelInstanceId", Table.Align.CENTER); if (table.getItemIds().size() > 0) { table.setColumnExpandRatio("title", 2); table.setColumnExpandRatio("notes", 1); } //localize todo titles table.addGeneratedColumn("title", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { @SuppressWarnings("unchecked") BeanItem<Todo> item = (BeanItem<Todo>) source.getItem(itemId); return ui.localizeEngineText(item.getBean().getTitle()); } }); //show icons for authorization table.addGeneratedColumn("authorization", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { @SuppressWarnings("unchecked") BeanItem<Todo> item = (BeanItem<Todo>) source.getItem(itemId); String icon; String text; switch (item.getBean().getAuthorization()) { case INITIAL_PERFORMER: icon = "auth_performer.gif"; text = ui.getMessage("todo.authorizationPerformer"); break; case DELEGATE: icon = "auth_delegate.gif"; text = ui.getMessage("todo.authorizationDelegate"); break; case SUBSTITUTE: icon = "auth_substitute.gif"; text = ui.getMessage("todo.authorizationSubstitute"); break; case NOT_PERMITTED: default: icon = "auth_unknown.gif"; text = ui.getMessage("todo.authorizationUnknown"); break; } Embedded authIcon = new Embedded(null, new ThemeResource("../icons/" + icon)); authIcon.setDescription(text); if (item.getBean().getAllocatedTo() != null) { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); layout.addComponent(authIcon); Embedded lockedIcon = new Embedded(null, new ThemeResource("../icons/lock.gif")); lockedIcon.setDescription( ui.getMessage("todo.lockedBy", item.getBean().getAllocatedToFullName())); layout.addComponent(lockedIcon); return layout; } else { return authIcon; } } }); //format date final SimpleDateFormat df = new SimpleDateFormat(ui.getMessage("app.dateTimeFormat")); table.addGeneratedColumn("issuedDate", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { @SuppressWarnings("unchecked") BeanItem<Todo> item = (BeanItem<Todo>) source.getItem(itemId); return df.format(item.getBean().getIssuedDate()); } }); layout.addComponent(table); layout.setExpandRatio(table, 1); }