List of usage examples for com.vaadin.ui VerticalLayout setSizeFull
@Override public void setSizeFull()
From source file:org.vaadin.webinars.springandvaadin.aspectj.ui.AspectJManagedUI.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setSpacing(true);// w w w.ja v a 2 s . c om layout.setMargin(true); author = new TextField("Author"); author.setImmediate(true); layout.addComponent(author); viewContainer = new Panel(); viewContainer.setSizeFull(); layout.addComponent(viewContainer); layout.setExpandRatio(viewContainer, 1f); setContent(layout); Navigator navigator = new Navigator(this, viewContainer); navigator.addView("rooms", new RoomsView()); navigator.addView("chat", ChatView.class); if (navigator.getState().isEmpty()) { navigator.navigateTo("rooms"); } setPollInterval(800); }
From source file:org.vaadin.webinars.springandvaadin.bootexample.ContactRepository.java
License:Apache License
@Override protected void init(VaadinRequest request) { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true);//from ww w.j av a 2 s.c o m layout.setSpacing(true); setContent(layout); Label title = new Label("Contacts"); title.addStyleName(Reindeer.LABEL_H1); layout.addComponent(title); contactsContainer = new BeanItemContainer<>(Contact.class); contactsTable = new Table(); contactsTable.setSizeFull(); contactsTable.setContainerDataSource(contactsContainer); contactsTable.setVisibleColumns("firstName", "lastName", "email"); layout.addComponent(contactsTable); layout.setExpandRatio(contactsTable, 1f); HorizontalLayout toolbar = new HorizontalLayout(); toolbar.setSpacing(true); layout.addComponent(toolbar); refresh = new Button("Refresh", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { refresh(); } }); toolbar.addComponent(refresh); add = new Button("Add...", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { addWindow(new NewContactWindow()); } }); toolbar.addComponent(add); refresh(); }
From source file:org.yozons.vaadin.ckeditor.CKEditorForVaadin7UI.java
License:Open Source License
@Override protected void init(VaadinRequest request) { getPage().setTitle("CKEditor for Vaadin 7"); final VerticalLayout layout = new VerticalLayout(); layout.setWidth(100, Unit.PERCENTAGE); layout.setMargin(true);/*from w w w . j av a2 s . co m*/ layout.setSpacing(true); setContent(layout); layout.addComponent(new Button("Hit server")); final String editor1InitialValue = "<p>CKEditor for Vaadin 7 is an entirely new JavaScriptComponent add-on.</p>"; CKEditorConfig config1 = new CKEditorConfig(); config1.useCompactTags(); config1.disableElementsPath(); config1.setResizeDir(CKEditorConfig.RESIZE_DIR.HORIZONTAL); config1.disableSpellChecker(); final CKEditor editor1 = new CKEditor(config1, editor1InitialValue); layout.addComponent(editor1); editor1.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(String newValue) { if (!newValue.equals(editor1.getValue())) Notification.show("ERROR - Event value does not match editor #1's current value"); else Notification.show("ValueChangeListener CKEditor v" + editor1.getVersion() + "/" + getVersion() + " - #1 contents: " + newValue); editor1.focus(); } }); Button testButton = new Button("Reset editor #1"); testButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (!editor1.isReadOnly()) { editor1.setValue(editor1InitialValue); Notification.show("Reset CKEditor v" + editor1.getVersion() + "/" + getVersion() + " - #1 contents: " + editor1.getValue()); } } }); layout.addComponent(testButton); Button toggleReadOnlyButton1 = new Button("Toggle read-only editor #1"); toggleReadOnlyButton1.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { editor1.setReadOnly(!editor1.isReadOnly()); } }); layout.addComponent(toggleReadOnlyButton1); Button toggleViewWithoutEditorButton1 = new Button("Toggle view-without-editor #1"); toggleViewWithoutEditorButton1.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { editor1.setViewWithoutEditor(!editor1.isViewWithoutEditor()); } }); layout.addComponent(toggleViewWithoutEditorButton1); // Now add in a second editor.... final String editor2InitialValue = "<p>Here is editor #2.</p><h1>Hope you find this useful in your Vaadin 7 projects.</h1>"; CKEditorConfig config2 = new CKEditorConfig(); config2.addCustomToolbarLine( "{ items : ['Source','Styles','Bold','VaadinSave','-','Undo','Redo','-','NumberedList','BulletedList'] }"); config2.enableVaadinSavePlugin(); config2.addToRemovePlugins("scayt"); final CKEditor editor2 = new CKEditor(config2); editor2.setWidth(600, Unit.PIXELS); layout.addComponent(editor2); editor2.setValue(editor2InitialValue); editor2.addValueChangeListener(new ValueChangeListener() { public void valueChange(String newValue) { if (!newValue.equals(editor2.getValue())) Notification.show("ERROR - Event value does not match editor #2's current value"); else Notification.show("ValueChangeListener CKEditor v" + editor2.getVersion() + "/" + getVersion() + " - #2 contents: " + newValue); } }); Button resetTextButton2 = new Button("Reset editor #2"); resetTextButton2.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (!editor2.isReadOnly()) { editor2.setValue(editor2InitialValue); Notification.show("Reset CKEditor v" + editor1.getVersion() + "/" + getVersion() + " - #2 contents: " + editor2.getValue()); } } }); layout.addComponent(resetTextButton2); Button toggleReadOnlyButton2 = new Button("Toggle read-only editor #2"); toggleReadOnlyButton2.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { editor2.setReadOnly(!editor2.isReadOnly()); } }); layout.addComponent(toggleReadOnlyButton2); Button toggleViewWithoutEditorButton2 = new Button("Toggle view-without-editor #2"); toggleViewWithoutEditorButton2.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { editor2.setViewWithoutEditor(!editor2.isViewWithoutEditor()); } }); layout.addComponent(toggleViewWithoutEditorButton2); // Now some extra tests for modal windows, etc. layout.addComponent(new Button("Open Modal Subwindow", new ClickListener() { @Override public void buttonClick(ClickEvent event) { Window sub = new Window("Subwindow modal"); VerticalLayout subLayout = new VerticalLayout(); sub.setContent(subLayout); CKEditorConfig config = new CKEditorConfig(); config.useCompactTags(); config.disableElementsPath(); config.disableSpellChecker(); config.enableVaadinSavePlugin(); // set BaseFloatZIndex 1000 higher than CKEditor's default of 10000; probably a result of an editor opening // in a window that's on top of the main two editors of this demo app config.setBaseFloatZIndex(11000); config.setHeight("150px"); final CKEditor ckEditor = new CKEditor(config); ckEditor.addValueChangeListener(new ValueChangeListener() { public void valueChange(String newValue) { Notification.show("CKEditor v" + ckEditor.getVersion() + "/" + getVersion() + " - POPUP MODAL contents: " + newValue); } }); ckEditor.focus(); subLayout.addComponent(ckEditor); sub.setWidth("80%"); sub.setModal(true); sub.center(); event.getButton().getUI().addWindow(sub); } })); layout.addComponent(new Button("Open Non-Modal Subwindow with 100% Height", new ClickListener() { @Override public void buttonClick(ClickEvent event) { Window sub = new Window("Subwindow non-modal 100% height"); VerticalLayout subLayout = new VerticalLayout(); sub.setContent(subLayout); sub.setWidth("80%"); sub.setHeight("500px"); subLayout.setSizeFull(); CKEditorConfig config = new CKEditorConfig(); config.useCompactTags(); config.disableElementsPath(); config.disableSpellChecker(); config.enableVaadinSavePlugin(); // set BaseFloatZIndex 1000 higher than CKEditor's default of 10000; probably a result of an editor opening // in a window that's on top of the main two editors of this demo app config.setBaseFloatZIndex(11000); config.setStartupFocus(true); final CKEditor ckEditor = new CKEditor(config); ckEditor.setHeight("100%"); ckEditor.addValueChangeListener(new ValueChangeListener() { public void valueChange(String newValue) { Notification.show("CKEditor v" + ckEditor.getVersion() + "/" + getVersion() + " - POPUP NON-MODAL 100% HEIGHT contents: " + ckEditor.getValue()); } }); subLayout.addComponent(ckEditor); subLayout.setExpandRatio(ckEditor, 1.0f); final TextField textField = new TextField("TextField"); textField.setImmediate(true); textField.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { Notification.show("TextField - POPUP NON-MODAL 100% HEIGHT contents: " + event.getProperty().getValue().toString()); } }); subLayout.addComponent(textField); sub.center(); event.getButton().getUI().addWindow(sub); } })); }
From source file:pl.alburnus.testcaseapp.AddressBookMainView.java
License:Apache License
private void buildMainArea() { VerticalLayout verticalLayout = new VerticalLayout(); setSecondComponent(verticalLayout);//from w ww .j a v a 2 s. co m personTable = new Table(null, persons);//Biding Person tabel z JPAContainer 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()); } } }); */ //OK 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) { //Tworzony jest nowy obiekt opakowany w BeanItem, ktory umozliwa jego polaczenie z FORM 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); //Dodanie okienka do dodania adresu } }); 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:pl.altkom.ecommerce.vaadin.view.ProductListView.java
private void initLayout() { HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); addComponent(splitPanel);/*from www . j a v a2 s. c o m*/ 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); leftLayout.setSizeFull(); leftLayout.setExpandRatio(contactList, 1); contactList.setSizeFull(); bottomLeftLayout.setWidth("100%"); searchField.setWidth("100%"); bottomLeftLayout.setExpandRatio(searchField, 1); editorLayout.setMargin(true); editorLayout.setVisible(false); }
From source file:pl.exsio.ca.module.terrain.evidence.QuickNotifyWindow.java
License:Open Source License
@Override protected void doInit() { this.setHeight("240px"); this.setWidth("280px"); final DateField date = this.getDateField(); final ComboBox event = this.getEventField(); this.filterEvents(event, date.getValue()); this.handleDateSelection(date, event); Button save = getSaveButton(date, event); Button cancel = getCancelButton(); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); HorizontalLayout controls = new HorizontalLayout(); controls.addComponent(save);//from w ww . j ava 2 s .c o m controls.addComponent(cancel); controls.setMargin(true); controls.setSpacing(true); layout.setSpacing(true); layout.addComponent(date); layout.addComponent(event); layout.setMargin(true); layout.addComponent(controls); this.setModal(true); this.setResizable(false); this.setDraggable(false); this.setContent(layout); }
From source file:pl.exsio.frameset.vaadin.ui.support.component.data.form.TabbedForm.java
License:Open Source License
private void initTabs() { int tabIndex = 0; for (String tabName : this.config.keySet()) { VerticalLayout outerLayout = new VerticalLayout() { {// w w w . j a v a 2 s . co m FormLayout tabLayout = new FormLayout(); tabLayout.setMargin(true); tabLayout.setSizeFull(); addComponent(tabLayout); } }; outerLayout.setMargin(true); outerLayout.setSizeFull(); Tab tab = this.tabs.addTab(outerLayout, tabName); tab.setCaption(t(tabName)); this.tabsMap.put(tabName, tabIndex); tabIndex++; for (String property : this.config.get(tabName)) { this.propertiesMap.put(property, tabName); } } }
From source file:pl.exsio.plupload.examples.AbstractExample.java
License:Open Source License
private VerticalLayout getActionPane() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setHeightUndefined();// w ww . j a va2 s.c o m this.decorateActionPane(layout); return layout; }
From source file:pl.exsio.plupload.examples.AbstractExample.java
License:Open Source License
private VerticalLayout getCodePane() { VerticalLayout layout = new VerticalLayout(); final CodeMirror code = new CodeMirror(); this.decorateCodePane(code); code.setLanguage(CodeMirrorLanguage.JAVA); layout.addComponent(code);//from w ww .j a v a2 s . co m layout.setSizeFull(); code.setTheme(CodeMirrorTheme.ECLIPSE); code.setSizeFull(); // code.setHeight("500px"); Page.getCurrent().addBrowserWindowResizeListener(new Page.BrowserWindowResizeListener() { @Override public void browserWindowResized(Page.BrowserWindowResizeEvent event) { code.setHeight((event.getHeight() - 120) + "px"); code.setWidth((event.getWidth() - 550) + "px"); } }); code.setHeight((Page.getCurrent().getBrowserWindowHeight() - 120) + "px"); code.setWidth((Page.getCurrent().getBrowserWindowWidth() - 550) + "px"); return layout; }