diff options
author | Henri Sara <henri.sara@gmail.com> | 2017-01-05 17:38:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-05 17:38:33 +0200 |
commit | 11f10b827e92ed7c07d6584a181f7f1374e8109b (patch) | |
tree | 7df28388d5170b733150cea9b4731b32cb094d02 /documentation/layout/layout-sub-window.asciidoc | |
parent | b74e08cfe8a849a8f74e6f9f0a3d7c0475ce196d (diff) | |
download | vaadin-framework-11f10b827e92ed7c07d6584a181f7f1374e8109b.tar.gz vaadin-framework-11f10b827e92ed7c07d6584a181f7f1374e8109b.zip |
Update layout chapter of the documentation for version 8 (#8154)
The SplitPanel chapter still uses a Tree in its example.
Diffstat (limited to 'documentation/layout/layout-sub-window.asciidoc')
-rw-r--r-- | documentation/layout/layout-sub-window.asciidoc | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/documentation/layout/layout-sub-window.asciidoc b/documentation/layout/layout-sub-window.asciidoc index ed75b800aa..9d10876efc 100644 --- a/documentation/layout/layout-sub-window.asciidoc +++ b/documentation/layout/layout-sub-window.asciidoc @@ -46,7 +46,6 @@ public static class SubWindowUI extends UI { // Create a sub-window and set the content Window subWindow = new Window("Sub-window"); VerticalLayout subContent = new VerticalLayout(); - subContent.setMargin(true); subWindow.setContent(subContent); // Put some components in it @@ -78,7 +77,6 @@ You close a sub-window also programmatically by calling the [guibutton]#OK# or [guibutton]#Cancel# button. You can also call [methodname]#removeWindow()# for the current [classname]#UI#. -ifdef::web[] [[layout.sub-window.openclose.example]] === Sub-Window Management @@ -94,23 +92,10 @@ class MySub extends Window { super("Subs on Sale"); // Set window caption center(); - // Some basic content for the window - VerticalLayout content = new VerticalLayout(); - content.addComponent(new Label("Just say it's OK!")); - content.setMargin(true); - setContent(content); - // Disable the close button setClosable(false); - // Trivial logic for closing the sub-window - Button ok = new Button("OK"); - ok.addClickListener(new ClickListener() { - public void buttonClick(ClickEvent event) { - close(); // Close the sub-window - } - }); - content.addComponent(ok); + setContent(new Button("Close me", event -> close())); } } ---- @@ -122,18 +107,14 @@ You could open the window as follows: ---- // Some UI logic to open the sub-window final Button open = new Button("Open Sub-Window"); -open.addClickListener(new ClickListener() { - public void buttonClick(ClickEvent event) { - MySub sub = new MySub(); +open.addClickListener(event -> { + MySub sub = new MySub(); - // Add it to the root component - UI.getCurrent().addWindow(sub); - } + // Add it to the root component + UI.getCurrent().addWindow(sub); }); ---- -endif::web[] - [[layout.sub-window.position]] == Window Positioning |