diff options
author | elmot <elmot@vaadin.com> | 2015-11-23 14:56:59 +0200 |
---|---|---|
committer | elmot <elmot@vaadin.com> | 2015-11-23 15:02:49 +0200 |
commit | f6874bde3d945c8b2d1b5c17ab50e2d0f1f8ff00 (patch) | |
tree | 60016a048dbb231ba3a7095a71a96deee0df8c51 /documentation/layout/layout-root-layout.asciidoc | |
parent | 9c0eeb4b697ffa1db8f44a91724c9d612e4add50 (diff) | |
parent | 4011884ddd073675e7d3539320f8899a43268fd4 (diff) | |
download | vaadin-framework-f6874bde3d945c8b2d1b5c17ab50e2d0f1f8ff00.tar.gz vaadin-framework-f6874bde3d945c8b2d1b5c17ab50e2d0f1f8ff00.zip |
Merge branch 'documentation'
Change-Id: I6ef85a35077e6278831b968595c068898cee2770
Diffstat (limited to 'documentation/layout/layout-root-layout.asciidoc')
-rw-r--r-- | documentation/layout/layout-root-layout.asciidoc | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/documentation/layout/layout-root-layout.asciidoc b/documentation/layout/layout-root-layout.asciidoc new file mode 100644 index 0000000000..86bab9d587 --- /dev/null +++ b/documentation/layout/layout-root-layout.asciidoc @@ -0,0 +1,61 @@ +--- +title: UI, Window, and Panel Content +order: 2 +layout: page +--- + +[[layout.root-layout]] += UI, Window, and Panel Content + +The [classname]#UI#, [classname]#Window#, and [classname]#Panel# all have a +single content component, which you need to set with [methodname]#setContent()#. +The content is usually a layout component, although any component is allowed. + + +[source, java] +---- +Panel panel = new Panel("This is a Panel"); +VerticalLayout panelContent = new VerticalLayout(); +panelContent.addComponent(new Label("Hello!")); +panel.setContent(panelContent); + +// Set the panel as the content of the UI +setContent(panel); +---- + +The size of the content is the default size of the particular layout component, +for example, a [classname]#VerticalLayout# has 100% width and undefined height +by default (this coincides with the defaults for [classname]#Panel# and +[classname]#Label#). If such a layout with undefined height grows higher than +the browser window, it will flow out of the view and scrollbars will appear. In +many applications, you want to use the full area of the browser view. Setting +the components contained inside the content layout to full size is not enough, +and would actually lead to an invalid state if the height of the content layout +is undefined. + + +[source, java] +---- +// First set the root content for the UI +VerticalLayout content = new VerticalLayout(); +setContent(content); + +// Set the content size to full width and height +content.setSizeFull(); + +// Add a title area on top of the screen. This takes +// just the vertical space it needs. +content.addComponent(new Label("My Application")); + +// Add a menu-view area that takes rest of vertical space +HorizontalLayout menuview = new HorizontalLayout(); +menuview.setSizeFull(); +content.addComponent(menuview); +---- + +See +<<dummy/../../../framework/layout/layout-settings#layout.settings.size,"Layout +Size">> for more information about setting layout sizes. + + + |