List of usage examples for com.vaadin.ui VerticalLayout setWidth
@Override public void setWidth(String width)
From source file:org.processbase.ui.core.template.HumanTaskWindow.java
License:Open Source License
private void preparePanel() { VerticalLayout vl = new VerticalLayout(); vl.setWidth("100%"); vl.setMargin(true, true, true, true); vl.setSpacing(false);/*from w ww . ja va 2 s . c o m*/ vl.addComponent(taskPanel); taskPanel.setSizeUndefined(); vl.setComponentAlignment(taskPanel, Alignment.MIDDLE_CENTER); String tabCaption = taskInstance != null ? messages.getString("taskDetails") : (processDefinition.getLabel() != null ? processDefinition.getLabel() : processDefinition.getName()); if (taskInstance != null) { tabSheet.setSizeFull(); tabSheet.setStyleName("minimal"); layout.addComponent(tabSheet); layout.setExpandRatio(tabSheet, 1.0f); tabSheet.addTab(vl, tabCaption, new ThemeResource("icons/document-txt.png")); } else { // vl.setSizeUndefined(); mainLayout.setSizeUndefined(); mainLayout.setWidth("100%"); mainLayout.addComponent(vl); mainLayout.setExpandRatio(vl, 1.0f); } enabletabPanel(); }
From source file:org.vaadin.addon.borderlayout.BorderlayoutUI.java
private Component getSimpleExamle() { VerticalLayout vlo = new VerticalLayout(); vlo.setHeight("100%"); vlo.setWidth("100%"); vlo.setSpacing(true);// ww w . java 2 s .com vlo.addComponent(getTestButtons()); for (int i = 0; i < components.length; i++) { components[i] = new TextArea(); ((TextArea) components[i]).setValue(texts[i]); components[i].setSizeFull(); } bl = new BorderLayout(); vlo.addComponent(bl); vlo.setExpandRatio(bl, 1); bl.addComponent(components[0], BorderLayout.Constraint.NORTH); bl.addComponent(components[1], BorderLayout.Constraint.SOUTH); bl.addComponent(components[2], BorderLayout.Constraint.CENTER); bl.addComponent(components[3], BorderLayout.Constraint.EAST); bl.addComponent(components[4], BorderLayout.Constraint.WEST); return vlo; }
From source file:org.vaadin.addons.locationtextfield.LocationUpdateApplication.java
License:Apache License
public void init() { Window mainWindow = new Window("Location update"); VerticalLayout vl = new VerticalLayout(); vl.setWidth("500px"); vl.setHeight("250px"); vl.setMargin(true);/*from w w w . ja v a2s. c o m*/ final LocationTextField ltf = new LocationTextField(OpenStreetMapGeocoder.getInstance(), "Address: "); ltf.setWidth("100%"); vl.addComponent(ltf); final TextField lat = new TextField("Latitude: "); final TextField lon = new TextField("Longitude: "); vl.addComponent(lat); vl.addComponent(lon); ltf.addListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { GeocodedLocation loc = ltf.getValue(); if (loc != null) { lat.setValue("" + loc.getLat()); lon.setValue("" + loc.getLon()); } else { lat.setValue(""); lon.setValue(""); } } }); mainWindow.setContent(vl); setMainWindow(mainWindow); }
From source file:org.vaadin.alump.fancylayouts.demo.CssLayoutDemo.java
License:Apache License
private void addCssLayoutContent(final FancyCssLayout layout) { final HorizontalLayout hLayout = new HorizontalLayout(); hLayout.addStyleName("demo-removable-layout"); if (boxMode) { hLayout.addStyleName("demo-removable-two"); }/*from ww w.ja v a 2s .c o m*/ hLayout.setSpacing(true); hLayout.setWidth("100%"); Button remove = new Button(""); remove.addStyleName("remove-button"); remove.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { layout.fancyRemoveComponent(hLayout); } }); hLayout.addComponent(remove); hLayout.setComponentAlignment(remove, Alignment.MIDDLE_CENTER); VerticalLayout vLayout = new VerticalLayout(); vLayout.setWidth("100%"); hLayout.addComponent(vLayout); hLayout.setExpandRatio(vLayout, 1.0f); Label label = new Label("Entry #" + (++layoutCounter)); label.addStyleName("demo-big-label"); vLayout.addComponent(label); Label label2 = new Label("Lorem ipsum, foo bar?"); label2.addStyleName("demo-small-label-" + String.valueOf(layoutCounter % 4)); vLayout.addComponent(label2); if (addCssMiddle) { layout.addComponent(hLayout, layout.getComponentCount() / 2); } else { layout.addComponent(hLayout); } }
From source file:org.vaadin.alump.fancylayouts.demo.FancyLayoutsUI.java
License:Apache License
private ComponentContainer buildWelcome() { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*w w w . j av a2s. c o m*/ layout.setSpacing(true); layout.setWidth("100%"); Label header = new Label("This is online demo for FancyLayouts Vaadin AddOn."); header.addStyleName("demo-header"); layout.addComponent(header); StringBuilder sb = new StringBuilder(); sb.append( "FancyLayouts adds transitions to UI when you replace content with new. This allows you to have fancier UI in your vaadin based application."); sb.append( " Currently package contains Image widget that can be used to present multiple images in one component slot. And Panel widget which is useful"); sb.append(" if you have to replace content inside your UI often."); Label desc = new Label(sb.toString()); desc.addStyleName("demo-desc"); layout.addComponent(desc); layout.setExpandRatio(desc, 1.0f); Link link = new Link("Source code of this demo application", new ExternalResource( "https://github.com/alump/FancyLayouts/blob/master/fancylayouts-demo/src/main/java/org/vaadin/alump/fancylayouts/demo/FancyLayoutsUI.java")); layout.addComponent(link); Button sourceLink = new Button(); sourceLink.addStyleName(BaseTheme.BUTTON_LINK); return layout; }
From source file:org.vaadin.alump.fancylayouts.demo.PanelDemo.java
License:Apache License
/** * Sample content for panel// www.ja v a 2s. c o m * * @return */ private ComponentContainer createPanelContentA() { VerticalLayout layout = new VerticalLayout(); layout.setWidth("100%"); layout.setMargin(true); layout.setSpacing(true); Label label = new Label(LOREM_STR); layout.addComponent(label); Embedded image = new Embedded(); image.setSource(new ExternalResource("http://misc.siika.fi/fancy-demo1.jpg")); image.setWidth("500px"); image.setHeight("281px"); layout.addComponent(image); return layout; }
From source file:org.vaadin.alump.fancylayouts.demo.PanelDemo.java
License:Apache License
/** * Sample content with more stuff//from w w w. j av a 2 s .com * * @return */ private ComponentContainer createPanelContentB() { VerticalLayout layout = new VerticalLayout(); layout.setWidth("100%"); layout.setMargin(true); layout.setSpacing(true); Label label = new Label(BECON_STR); layout.addComponent(label); Embedded image = new Embedded(); image.setSource(new ExternalResource("http://misc.siika.fi/kaljanhimo.jpg")); image.setWidth("300px"); image.setHeight("187px"); layout.addComponent(image); layout.setComponentAlignment(image, Alignment.MIDDLE_CENTER); Label label2 = new Label(BECON_STR); layout.addComponent(label2); return layout; }
From source file:org.vaadin.alump.masonry.demo.MainMenuView.java
License:Open Source License
public MainMenuView() { setWidth("100%"); setMargin(true);/*from w w w . j a v a 2 s . co m*/ setSpacing(true); VerticalLayout infoLayout = new VerticalLayout(); infoLayout.setWidth("100%"); addComponent(infoLayout); Label label = new Label("Masonry addon adds cascading grid layout to Vaadin."); infoLayout.addComponent(label); Link link = new Link("This addon is based on David DeSandro's Masonry JavaScript library (MIT license).", new ExternalResource("http://masonry.desandro.com/")); infoLayout.addComponent(link); link = new Link("Source code and issue tracker, of this addon, are available in GitHub.", new ExternalResource("https://github.com/alump/Masonry")); infoLayout.addComponent(link); Button basicTests = new Button("Basic Demo", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().getNavigator().navigateTo(BasicTestsView.VIEW_NAME); } }); addComponent(basicTests); Button dndTests = new Button("Drag and Drop Reordering Demo", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().getNavigator().navigateTo(DnDTestsView.VIEW_NAME); } }); addComponent(dndTests); Button sizerTests = new Button("Dynamic styles Grid Size Demo", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().getNavigator().navigateTo(GridSizerTestsView.VIEW_NAME); } }); addComponent(sizerTests); }
From source file:org.vaadin.tori.component.DebugControlPanel.java
License:Apache License
private Component createControlPanel(final ContextData data) { this.data = data; final VerticalLayout layout = new VerticalLayout(); layout.setStyleName(Reindeer.PANEL_LIGHT); layout.setWidth("300px"); layout.setSpacing(true);//w w w . j ava 2s . c o m final Set<Method> setters = getSettersByReflection(authorizationService); final List<Method> orderedSetters = new ArrayList<Method>(setters); Collections.sort(orderedSetters, new Comparator<Method>() { @Override public int compare(final Method o1, final Method o2) { return o1.getName().compareToIgnoreCase(o2.getName()); } }); try { for (final Method setter : orderedSetters) { if (isForPosts(setter)) { layout.addComponent(createPostControl(setter, data.getPosts())); } else { layout.addComponent(createRegularControl(setter)); } } } catch (final Exception e) { e.printStackTrace(); layout.addComponent(new Label(e.toString())); } return layout; }
From source file:org.vaadin.tori.view.listing.category.EditCategoryForm.java
License:Apache License
public EditCategoryForm(final EditCategoryListener listener, final CategoryData categoryToEdit) { this.categoryToEdit = categoryToEdit; setData(categoryToEdit);/*from w w w . j av a 2 s . c o m*/ final VerticalLayout newCategoryLayout = new VerticalLayout(); newCategoryLayout.setSpacing(true); newCategoryLayout.setMargin(true); newCategoryLayout.setWidth("100%"); nameField = new TextField(); nameField.setInputPrompt("Category name"); nameField.setWidth("100%"); if (categoryToEdit != null) { nameField.setValue(categoryToEdit.getName()); } newCategoryLayout.addComponent(nameField); descriptionField = new TextArea(); descriptionField.setInputPrompt("Description"); descriptionField.setRows(3); descriptionField.setWidth("100%"); if (categoryToEdit != null) { descriptionField.setValue(categoryToEdit.getDescription()); } newCategoryLayout.addComponent(descriptionField); final Button saveButton = new Button((categoryToEdit == null ? "Create Category" : "Save"), new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { listener.commit(nameField.getValue(), descriptionField.getValue()); resetForm(); } }); final Button cancelButton = ComponentUtil.getSecondaryButton(("Cancel"), new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { listener.cancel(); resetForm(); } }); HorizontalLayout buttonsLayout = new HorizontalLayout(cancelButton, saveButton); buttonsLayout.setWidth(100.0f, Unit.PERCENTAGE); buttonsLayout.setSpacing(true); buttonsLayout.setExpandRatio(cancelButton, 1.0f); buttonsLayout.setComponentAlignment(cancelButton, Alignment.BOTTOM_RIGHT); newCategoryLayout.addComponent(buttonsLayout); setWidth("300px"); setCompositionRoot(newCategoryLayout); }