List of usage examples for com.vaadin.ui Window Window
public Window(String caption)
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 www . ja va2s.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.addons.serverpush.example.ServerPushDemo.java
License:Apache License
@Override public void init() { Window mainWindow = new Window("ServerPush Application"); setMainWindow(mainWindow);/*from w ww . ja v a2s . com*/ // Add the push component mainWindow.addComponent(this.push); // Add a button for starting background work getMainWindow().addComponent(new Button("Start background thread", new ClickListener() { public void buttonClick(ClickEvent event) { getMainWindow().addComponent(new Label("Waiting for background thread to complete...")); new BackgroundThread().start(); } })); }
From source file:org.vaadin.addons.serverpush.samples.chat.ManualPushChatApplication.java
License:Apache License
public void init() { Window mainWindow = new Window("Chat Application"); setMainWindow(mainWindow);//from w ww .j a v a 2s . com VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); vl.addComponent(this.header); this.comboBox.setWidth("400px"); this.comboBox.addListener(new Container.ItemSetChangeListener() { public void containerItemSetChange(Container.ItemSetChangeEvent event) { push(); } }); this.comboBox.addListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { fireNewTab((User) event.getProperty().getValue(), (User) getUser()); } }); this.comboBox.setItemCaptionPropertyId("username"); this.comboBox.setImmediate(true); vl.addComponent(this.comboBox); this.tabSheet.setSizeFull(); vl.addComponent(this.tabSheet); vl.setExpandRatio(this.tabSheet, 1); mainWindow.setContent(vl); mainWindow.addComponent(this.pusher); mainWindow.addListener(new Window.CloseListener() { public void windowClose(Window.CloseEvent e) { OnlineUsersManager.getInstance().deregisterUser((User) getUser()); } }); fireLoginWindow(); }
From source file:org.vaadin.addons.serverpush.samples.chat.ManualPushChatApplication.java
License:Apache License
private void fireLoginWindow() { final Window window = new Window("Login"); window.setModal(true);//from www.j ava 2s . c om window.setWidth("640px"); window.setHeight("480px"); LoginForm loginForm = new LoginForm(); loginForm.setSizeFull(); loginForm.addListener(new LoginForm.LoginListener() { public void onLogin(LoginForm.LoginEvent event) { doLogin(event); getMainWindow().removeWindow(window); } }); window.setContent(loginForm); getMainWindow().addWindow(window); window.bringToFront(); }
From source file:org.vaadin.addons.serverpush.samples.sales.SalesApplication.java
License:Apache License
public void init() { Window mainWindow = new Window("Sales Application"); setMainWindow(mainWindow);//from w ww . j av a 2 s . c om VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("100%"); final Label label = new Label("<h1>Sales Application</h1><hr/>", Label.CONTENT_XHTML); hl.addComponent(label); hl.addComponent(this.header); hl.setComponentAlignment(this.header, Alignment.MIDDLE_RIGHT); hl.setExpandRatio(label, 1); vl.addComponent(hl); this.table.setSizeFull(); vl.addComponent(this.table); vl.setExpandRatio(this.table, 1); mainWindow.setContent(vl); fireLoginWindow(); }
From source file:org.vaadin.alump.ckeditor.demo.VaadinCKEditorUI.java
License:LGPL
@Override public void init(VaadinRequest request) { //Enable to test effects of other UIDL calls to cursor position //setPollInterval(5000); getPage().setTitle("Vaadin CKEditor UI"); VerticalLayout mainView = new VerticalLayout(); setContent(mainView);//from w w w. j a va 2 s .c o m /* enablePushEvents = new CheckBox("Enable push events"); enablePushEvents.addValueChangeListener(this::enablePushEvents); mainView.addComponents(new HorizontalLayout(enablePushEvents, pushUpdateLabel)); */ /* See http://ckeditor.com/latest/samples/plugins/toolbar/toolbar.html for the official info. * This is the full list as we know it in CKEditor 4.x [ { name: 'document', items : [ 'Source','-','NewPage','Preview','Print','-','Templates' ] }, { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] }, { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] }, { name: 'forms', items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] }, '/', { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] }, { name: 'links', items : [ 'Link','Unlink','Anchor' ] }, { name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe' ] }, '/', { name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] }, { name: 'colors', items : [ 'TextColor','BGColor' ] }, { name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] } ] */ final String editor1InitialValue = "<p>Thanks TinyMCEEditor for getting us started on the CKEditor integration.</p>\n\n<h1>Like TinyMCEEditor said, "Vaadin rocks!"</h1>\n\n<h1>And CKEditor is no slouch either.</h1>\n"; CKEditorConfig config1 = new CKEditorConfig(); config1.useCompactTags(); config1.disableElementsPath(); config1.setResizeDir(CKEditorConfig.RESIZE_DIR.HORIZONTAL); config1.disableSpellChecker(); config1.setHeight("300px"); config1.addToExtraPlugins("exampleplugin"); //final CKEditorTextField ckEditorTextField1 = new CKEditorTextField(config1); final AbstractCKEditorTextField ckEditorTextField1 = new CKEditorPluginExample(config1); ckEditorTextField1.setImmediate(true); ckEditorTextField1.setHeight("440px"); // account for 300px editor plus toolbars mainView.addComponent(ckEditorTextField1); ckEditorTextField1.setValue(editor1InitialValue); ckEditorTextField1.addValueChangeListener(e -> { System.out.println("CKEditor v" + ckEditorTextField1.getVersion() + "/" + getVersion() + " - #1 contents: " + e.getValue()); }); Button resetTextButton1 = new Button("Reset editor #1"); resetTextButton1.addClickListener(event -> { if (!ckEditorTextField1.isReadOnly()) { ckEditorTextField1.setValue(editor1InitialValue); } }); Button toggleReadOnlyButton1 = new Button("Toggle read-only editor #1"); toggleReadOnlyButton1.addClickListener(event -> { ckEditorTextField1.setReadOnly(!ckEditorTextField1.isReadOnly()); }); Button toggleViewWithoutEditorButton1 = new Button("Toggle view-without-editor #1"); toggleViewWithoutEditorButton1.addClickListener(event -> { ckEditorTextField1.setViewWithoutEditor(!ckEditorTextField1.isViewWithoutEditor()); }); Button toggleVisibleButton1 = new Button("Toggle visible editor #1"); toggleVisibleButton1.addClickListener(event -> { ckEditorTextField1.setVisible(!ckEditorTextField1.isVisible()); }); HorizontalLayout buttonsLayout = new HorizontalLayout(resetTextButton1, toggleReadOnlyButton1, toggleViewWithoutEditorButton1, toggleVisibleButton1); buttonsLayout.setSpacing(true); mainView.addComponent(buttonsLayout); mainView.addComponent(createSeparator()); // Now add in a second editor.... final String editor2InitialValue = "<p>Here is editor #2.</p>\n\n<p>Hope you find this useful in your Vaadin projects.</p>\n"; //final CKEditorTextField ckEditorTextField2 = new CKEditorTextField(); final AbstractCKEditorTextField ckEditorTextField2 = new CKEditorTextField(); ckEditorTextField2.setWidth("600px"); mainView.addComponent(ckEditorTextField2); CKEditorConfig config2 = new CKEditorConfig(); config2.addCustomToolbarLine( "{ items : ['Source','Styles','Bold','VaadinSave','-','Undo','Redo','-','NumberedList','BulletedList'] }"); config2.enableCtrlSWithVaadinSavePlugin(); config2.addToRemovePlugins("scayt"); ckEditorTextField2.setConfig(config2); ckEditorTextField2.setValue(editor2InitialValue); ckEditorTextField2.addValueChangeListener(event -> { Notification.show("CKEditor v" + ckEditorTextField2.getVersion() + "/" + getVersion() + " - #2 contents: " + event.getValue()); }); ckEditorTextField2.addVaadinSaveListener(editor -> { Notification.show("CKEditor v" + ckEditorTextField2.getVersion() + "/" + getVersion() + " - #2 VaadinSave button pressed."); }); Button resetTextButton2 = new Button("Reset editor #2"); resetTextButton2.addClickListener(event -> { if (!ckEditorTextField2.isReadOnly()) { ckEditorTextField2.setValue(editor2InitialValue); } }); Button toggleReadOnlyButton2 = new Button("Toggle read-only editor #2"); toggleReadOnlyButton2.addClickListener(event -> { ckEditorTextField2.setReadOnly(!ckEditorTextField2.isReadOnly()); }); Button toggleViewWithoutEditorButton2 = new Button("Toggle view-without-editor #2"); toggleViewWithoutEditorButton2.addClickListener(event -> { ckEditorTextField2.setViewWithoutEditor(!ckEditorTextField2.isViewWithoutEditor()); }); Button toggleVisibleButton2 = new Button("Toggle visible editor #2"); toggleVisibleButton2.addClickListener(event -> { ckEditorTextField2.setVisible(!ckEditorTextField2.isVisible()); }); buttonsLayout = new HorizontalLayout(resetTextButton2, toggleReadOnlyButton2, toggleViewWithoutEditorButton2, toggleVisibleButton2); buttonsLayout.setSpacing(true); mainView.addComponent(buttonsLayout); buttonsLayout = new HorizontalLayout(); buttonsLayout.setSpacing(true); mainView.addComponent(buttonsLayout); buttonsLayout.addComponent(new Button("Open Modal Subwindow", 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 CKEditorTextField ckEditorTextField = new CKEditorTextField(config); ckEditorTextField.addValueChangeListener(event2 -> { Notification.show("CKEditor v" + ckEditorTextField2.getVersion() + "/" + getVersion() + " - POPUP MODAL contents: " + event2.getValue()); }); ckEditorTextField.focus(); subLayout.addComponent(ckEditorTextField); sub.setWidth("80%"); sub.setModal(true); sub.center(); event.getButton().getUI().addWindow(sub); })); buttonsLayout.addComponent(new Button("Open Non-Modal Subwindow with 100% Height", 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); config.setReadOnly(true); final CKEditorTextField ckEditorTextField = new CKEditorTextField(config); ckEditorTextField.setHeight("100%"); ckEditorTextField.addValueChangeListener(event2 -> { Notification.show("CKEditor v" + ckEditorTextField.getVersion() + "/" + getVersion() + " - POPUP NON-MODAL 100% HEIGHT contents: " + event2.getValue()); }); subLayout.addComponent(ckEditorTextField); subLayout.setExpandRatio(ckEditorTextField, 10); final TextField textField = new TextField("TextField"); textField.addValueChangeListener(event2 -> { Notification.show("TextField - POPUP NON-MODAL 100% HEIGHT contents: " + event2.getValue()); }); subLayout.addComponent(textField); sub.center(); event.getButton().getUI().addWindow(sub); })); }
From source file:org.vaadin.arborgraph.demo.DemoApplication.java
License:Open Source License
@SuppressWarnings("serial") @Override/*from w ww .j a v a2 s .c om*/ public void init() { VerticalLayout aboutLayout = new VerticalLayout(); aboutLayout.setSizeFull(); aboutLayout.addComponent(new Label(getBlah(), Label.CONTENT_XHTML)); final ArborGraph graph = new ArborGraph(); graph.setSizeFull(); Button exampleGraphButton = new Button("Show Example", new ClickListener() { public void buttonClick(ClickEvent event) { graph.showGraph(getDemoBranch()); } }); Label orLabel = new Label("<i>or</i>", Label.CONTENT_XHTML); orLabel.setSizeUndefined(); final TextField jsonTextfield = new TextField(); jsonTextfield.setWidth(100, Sizeable.UNITS_PERCENTAGE); jsonTextfield.setNullRepresentation(""); Button jsonBranchButton = new Button("Display Json Branch", new ClickListener() { public void buttonClick(ClickEvent event) { graph.showGraph(jsonTextfield.getValue().toString()); } }); Label helpLabel = getHelpLabel(getBranchExplanation()); HorizontalLayout graphButtonLayout = new HorizontalLayout(); graphButtonLayout.setWidth(100, Sizeable.UNITS_PERCENTAGE); graphButtonLayout.setSpacing(true); graphButtonLayout.setMargin(false, false, true, false); graphButtonLayout.addComponent(exampleGraphButton); graphButtonLayout.addComponent(orLabel); graphButtonLayout.setComponentAlignment(orLabel, Alignment.MIDDLE_CENTER); graphButtonLayout.addComponent(jsonBranchButton); graphButtonLayout.addComponent(helpLabel); graphButtonLayout.setComponentAlignment(helpLabel, Alignment.MIDDLE_CENTER); graphButtonLayout.addComponent(jsonTextfield); graphButtonLayout.setExpandRatio(jsonTextfield, .9f); VerticalLayout graphLayout = new VerticalLayout(); graphLayout.setSizeFull(); graphLayout.setMargin(true, false, false, false); graphLayout.setSpacing(true); graphLayout.addComponent(graphButtonLayout); graphLayout.addComponent(graph); graphLayout.setExpandRatio(graph, .9f); TabSheet tabSheet = new TabSheet(); tabSheet.setStyleName(Reindeer.TABSHEET_MINIMAL); tabSheet.setSizeFull(); tabSheet.addTab(aboutLayout, "About"); tabSheet.addTab(graphLayout, "Graph"); VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.setMargin(true); mainLayout.addComponent(tabSheet); mainLayout.setExpandRatio(tabSheet, .9f); Window mainWindow = new Window("Arbor-Vaadin"); mainWindow.setSizeFull(); mainWindow.setContent(mainLayout); setTheme("arbor"); setMainWindow(mainWindow); }
From source file:org.vaadin.cytographer.CytographerApplication.java
License:LGPL
@Override public void init() { mainWindow = new Window("Vaadingraph Application"); mainWindow.setContent(mainLayout);// w w w. j a v a2 s .c o m mainLayout.setMargin(true); mainLayout.addComponent(new CytographerToolbar(controller)); mainLayout.addComponent(new CytographerActionToolbar(controller, getProperty("sifpath"))); mainLayout.addComponent(hl2); hl2.addComponent(getInfoLabel()); controller.createNewNetworkGraph(); setMainWindow(mainWindow); setTheme("cytographertheme"); }
From source file:org.vaadin.example.MyVaadinApplication.java
License:Apache License
@Override public void init() { window = new Window("My Vaadin Application"); setMainWindow(window);/*from w w w. ja v a 2s. co m*/ HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel(); horizontalSplitPanel.setSplitPosition(30); window.setContent(horizontalSplitPanel); VerticalLayout verticalLayout = new VerticalLayout(); final PojoOne pojoOne = new PojoOne(); pojoOne.setName("My pojo one"); Button button = new Button("Edit pojo one"); button.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { editPojo(pojoOne); } }); verticalLayout.addComponent(button); final PojoTwo pojoTwo = new PojoTwo(); button = new Button("Edit pojo two"); pojoTwo.setName("My second pojo"); button.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { editPojo(pojoTwo); } }); verticalLayout.addComponent(button); horizontalSplitPanel.setFirstComponent(verticalLayout); form.setLayout(layout); form.setFormFieldFactory(preCreatedFieldsHelper); form.setVisible(false); horizontalSplitPanel.setSecondComponent(form); }
From source file:org.vaadin.johannes.VaadingraphApplication.java
License:LGPL
@Override public void init() { path = getProperty("sifpath"); fileName = path + "sample.sif"; mainWindow = new Window("Vaadingraph Application"); mainWindow.setContent(mainLayout);/* w w w . ja va 2s . co m*/ mainLayout.setMargin(true); mainLayout.addComponent(hl = new HorizontalLayout()); hl.setSpacing(true); hl.addComponent(getNetworkSelect()); hl.addComponent(getSessionSelect()); hl.addComponent(getLayoutSelect()); hl.addComponent(getNodeSizeSelect()); hl.addComponent(getStyleSelect()); final Component cb1 = getTextHideBox(); final Component cb2 = getStyleOptimizedBox(); hl.addComponent(cb1); hl.addComponent(cb2); hl.setComponentAlignment(cb1, Alignment.BOTTOM_LEFT); hl.setComponentAlignment(cb2, Alignment.BOTTOM_LEFT); graph = getNetworkGraph(WIDTH, HEIGHT); graph.addListener(this); mainLayout.addComponent(hl2 = new HorizontalLayout()); mainLayout.addComponent(getAttributeBrowser(graph)); hl2.addComponent(graph); hl2.addComponent(getInfoLabel()); setMainWindow(mainWindow); }