diff options
author | Marko Gronroos <magi@vaadin.com> | 2016-07-01 11:48:12 +0300 |
---|---|---|
committer | Marko Gronroos <magi@vaadin.com> | 2016-07-13 19:38:45 +0300 |
commit | 261cc183e8309c826afd7bf3dc85fa63d02b17f1 (patch) | |
tree | aba367b694de9334627a2c32d9969a39728f4df0 | |
parent | 0abb0f38866995c92db321fb17fd9af24d74e928 (diff) | |
download | vaadin-framework-261cc183e8309c826afd7bf3dc85fa63d02b17f1.tar.gz vaadin-framework-261cc183e8309c826afd7bf3dc85fa63d02b17f1.zip |
Scaled images and fixes to Grid, FormLayout, and Slider docs. #19835
Change-Id: I6007358e1240c458d3b9148d4def6729d4c42aac
Updated a Slider diagram. #19835
Change-Id: I4d0a75b5f85bcce37e8579b7544672c2433f50f1
-rw-r--r-- | documentation/components/img/slider-example1-hi.png | bin | 12675 -> 12676 bytes | |||
-rw-r--r-- | documentation/components/original-drawings/slider-example1.svg | 34 | ||||
-rw-r--r-- | documentation/layout/layout-formlayout.asciidoc | 14 | ||||
-rw-r--r-- | documentation/layout/layout-gridlayout.asciidoc | 70 |
4 files changed, 54 insertions, 64 deletions
diff --git a/documentation/components/img/slider-example1-hi.png b/documentation/components/img/slider-example1-hi.png Binary files differindex d2d6c495a4..70ca635e60 100644 --- a/documentation/components/img/slider-example1-hi.png +++ b/documentation/components/img/slider-example1-hi.png diff --git a/documentation/components/original-drawings/slider-example1.svg b/documentation/components/original-drawings/slider-example1.svg index f1c2e405cf..2548aa360b 100644 --- a/documentation/components/original-drawings/slider-example1.svg +++ b/documentation/components/original-drawings/slider-example1.svg @@ -10,8 +10,8 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="210mm" - height="297mm" + width="70.273331mm" + height="66.604446mm" id="svg1901" sodipodi:version="0.32" inkscape:version="0.91 r" @@ -66,11 +66,11 @@ pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" - inkscape:pageopacity="0.0" + inkscape:pageopacity="1" inkscape:pageshadow="2" inkscape:zoom="1.4" - inkscape:cx="212.24603" - inkscape:cy="847.82098" + inkscape:cx="140.18358" + inkscape:cy="87.607372" inkscape:document-units="px" inkscape:current-layer="layer1" gridtolerance="10000" @@ -79,7 +79,11 @@ inkscape:window-x="800" inkscape:window-y="153" showgrid="false" - inkscape:window-maximized="0" /> + inkscape:window-maximized="0" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> <metadata id="metadata1906"> <rdf:RDF> @@ -88,6 +92,7 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> @@ -95,7 +100,8 @@ inkscape:label="Taso 1" inkscape:groupmode="layer" id="layer1" - style="opacity:1"> + style="opacity:1" + transform="translate(-67.505424,-64.081154)"> <rect style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" id="rect3344" @@ -106,11 +112,11 @@ <image sodipodi:absref="/home/magi/itmill/vaadin/documentation/components/original-drawings/../img/slider-orig.png" xlink:href="../img/slider-orig.png" - y="64.081154" - x="67.505424" - id="image2463" + width="249" height="236" - width="249" /> + id="image2463" + x="67.505424" + y="64.081154" /> <g transform="matrix(0.04895833,0,0,0.04895833,85.307423,133.89853)" id="g1317"> @@ -118,17 +124,17 @@ id="path6080" style="fill:url(#linearGradient7607)" inkscape:connector-curvature="0" - d="m 70.29,24.826 v 602.34 h 35.44 v -35.44 h 35.44 v -35.4 h 35.4 v -35.44 h 70.88 v 70.84 h 35.43 v 70.88 h 35.44 v 70.87 h 35.44 v 35.44 h 70.84 v -35.44 h 35.44 v -70.87 H 424.6 v -70.88 h -35.4 v -70.84 h -35.44 v -70.88 h 141.72 v -35.43 h -35.44 v -35.44 H 424.6 v -35.44 h -35.4 v -35.41 h -35.44 v -35.43 h -35.44 v -35.44 h -35.44 v -35.44 h -35.43 v -35.44 h -35.44 v -35.43 h -35.44 v -35.44 h -35.4 V 60.256 H 105.73 V 24.818 H 70.29 z" /> + d="m 70.29,24.826 0,602.34 35.44,0 0,-35.44 35.44,0 0,-35.4 35.4,0 0,-35.44 70.88,0 0,70.84 35.43,0 0,70.88 35.44,0 0,70.87 35.44,0 0,35.44 70.84,0 0,-35.44 35.44,0 0,-70.87 -35.44,0 0,-70.88 -35.4,0 0,-70.84 -35.44,0 0,-70.88 141.72,0 0,-35.43 -35.44,0 0,-35.44 -35.44,0 0,-35.44 -35.4,0 0,-35.41 -35.44,0 0,-35.43 -35.44,0 0,-35.44 -35.44,0 0,-35.44 -35.43,0 0,-35.44 -35.44,0 0,-35.43 -35.44,0 0,-35.44 -35.4,0 0,-35.41 -35.44,0 0,-35.438 -35.44,0 z" /> <path id="rect1430" style="fill:#000000;fill-rule:evenodd" inkscape:connector-curvature="0" - d="m 35.438,24.812 v 602.35 h 35.437 v -35.44 h 35.435 v -35.41 H 70.875 V 95.662 L 106.31,95.66 V 60.254 H 70.875 V 24.816 H 35.438 z m 70.872,70.844 v 35.434 h 35.41 V 95.656 h -35.41 z m 35.41,35.434 v 35.44 h 35.44 v -35.44 h -35.44 z m 35.44,35.44 v 35.44 h 35.43 v -35.44 h -35.43 z m 35.43,35.44 v 35.44 h 35.44 v -35.44 h -35.44 z m 35.44,35.44 v 35.43 h 35.44 v -35.43 h -35.44 z m 35.44,35.43 v 35.44 h 35.44 v -35.44 h -35.44 z m 35.44,35.44 v 35.41 h 35.43 v -35.41 h -35.43 z m 35.43,35.41 v 35.43 h 35.41 v -35.43 h -35.41 z m 35.41,35.43 v 35.44 H 283.47 v 106.32 h 35.44 V 450 h 141.71 v -35.44 h -35.43 v -35.44 h -35.44 z m -70.84,141.76 v 70.84 h 35.43 v -70.84 h -35.43 z m 35.43,70.84 v 70.87 h 35.41 v -70.87 h -35.41 z m 35.41,70.87 v 70.88 h 35.44 v -70.88 h -35.44 z m 0,70.88 h -70.84 v 35.44 h 70.84 v -35.44 z m -70.84,0 v -70.88 h -35.44 v 70.88 h 35.44 z m -35.44,-70.88 v -70.87 h -35.44 v 70.87 h 35.44 z m -35.44,-70.87 v -70.84 h -35.44 v 70.84 h 35.44 z M 212.59,520.88 V 450 h -35.43 v 35.44 h -35.44 v 35.44 h 70.87 z m -70.87,0 h -35.41 v 35.43 h 35.41 v -35.43 z" /> + d="m 35.438,24.812 0,602.35 35.437,0 0,-35.44 35.435,0 0,-35.41 -35.435,0 0,-460.65 35.435,-0.002 0,-35.406 -35.435,0 0,-35.438 -35.437,0 z m 70.872,70.844 0,35.434 35.41,0 0,-35.434 -35.41,0 z m 35.41,35.434 0,35.44 35.44,0 0,-35.44 -35.44,0 z m 35.44,35.44 0,35.44 35.43,0 0,-35.44 -35.43,0 z m 35.43,35.44 0,35.44 35.44,0 0,-35.44 -35.44,0 z m 35.44,35.44 0,35.43 35.44,0 0,-35.43 -35.44,0 z m 35.44,35.43 0,35.44 35.44,0 0,-35.44 -35.44,0 z m 35.44,35.44 0,35.41 35.43,0 0,-35.41 -35.43,0 z m 35.43,35.41 0,35.43 35.41,0 0,-35.43 -35.41,0 z m 35.41,35.43 0,35.44 -106.28,0 0,106.32 35.44,0 0,-70.88 141.71,0 0,-35.44 -35.43,0 0,-35.44 -35.44,0 z m -70.84,141.76 0,70.84 35.43,0 0,-70.84 -35.43,0 z m 35.43,70.84 0,70.87 35.41,0 0,-70.87 -35.41,0 z m 35.41,70.87 0,70.88 35.44,0 0,-70.88 -35.44,0 z m 0,70.88 -70.84,0 0,35.44 70.84,0 0,-35.44 z m -70.84,0 0,-70.88 -35.44,0 0,70.88 35.44,0 z m -35.44,-70.88 0,-70.87 -35.44,0 0,70.87 35.44,0 z m -35.44,-70.87 0,-70.84 -35.44,0 0,70.84 35.44,0 z m -35.44,-70.84 0,-70.88 -35.43,0 0,35.44 -35.44,0 0,35.44 70.87,0 z m -70.87,0 -35.41,0 0,35.43 35.41,0 0,-35.43 z" /> <path id="rect3779" style="fill:#ffffff" inkscape:connector-curvature="0" - d="m 70.875,95.656 v 460.65 h 35.435 v -35.43 h 35.41 v -35.44 h 35.44 v -35.44 h 35.43 v 70.88 h 35.44 v 70.84 h 35.44 v 70.87 h 35.44 v 70.88 h 70.84 v -70.88 h -35.41 v -70.87 h -35.43 v -70.84 h -35.44 v -106.32 h 106.28 v -35.44 h -35.41 v -35.43 h -35.43 v -35.41 h -35.44 v -35.44 h -35.44 v -35.43 h -35.44 v -35.44 h -35.43 v -35.44 h -35.44 v -35.44 H 106.31 V 95.648 H 70.875 z" /> + d="m 70.875,95.656 0,460.65 35.435,0 0,-35.43 35.41,0 0,-35.44 35.44,0 0,-35.44 35.43,0 0,70.88 35.44,0 0,70.84 35.44,0 0,70.87 35.44,0 0,70.88 70.84,0 0,-70.88 -35.41,0 0,-70.87 -35.43,0 0,-70.84 -35.44,0 0,-106.32 106.28,0 0,-35.44 -35.41,0 0,-35.43 -35.43,0 0,-35.41 -35.44,0 0,-35.44 -35.44,0 0,-35.43 -35.44,0 0,-35.44 -35.43,0 0,-35.44 -35.44,0 0,-35.44 -35.41,0 0,-35.438 -35.435,0 z" /> </g> </g> </svg> diff --git a/documentation/layout/layout-formlayout.asciidoc b/documentation/layout/layout-formlayout.asciidoc index b43329e456..487d0ac9d0 100644 --- a/documentation/layout/layout-formlayout.asciidoc +++ b/documentation/layout/layout-formlayout.asciidoc @@ -18,8 +18,7 @@ shown for each field. The field captions can have an icon in addition to the text. [classname]#FormLayout# is an ordered layout and much like [classname]#VerticalLayout#. For description of margins, spacing, and other features in ordered layouts, see -<<dummy/../../../framework/layout/layout-orderedlayout#layout.orderedlayout,"VerticalLayout -and HorizontalLayout">>. +<<dummy/../../../framework/layout/layout-orderedlayout#layout.orderedlayout, "VerticalLayout and HorizontalLayout">>. The following example shows typical use of [classname]#FormLayout# in a form: @@ -32,11 +31,11 @@ tf1.setIcon(FontAwesome.USER); tf1.setRequired(true); tf1.addValidator(new NullValidator("Must be given", false)); form.addComponent(tf1); - + TextField tf2 = new TextField("Street address"); tf2.setIcon(FontAwesome.ROAD); form.addComponent(tf2); - + TextField tf3 = new TextField("Postal code"); tf3.setIcon(FontAwesome.ENVELOPE); tf3.addValidator(new IntegerRangeValidator("Doh!", 1, 99999)); @@ -91,9 +90,4 @@ shown as a part of the caption column. For information on setting margins and spacing, see also <<dummy/../../../framework/layout/layout-orderedlayout#layout.orderedlayout.spacing,"Spacing in Ordered Layouts">> and -<<dummy/../../../framework/layout/layout-settings#layout.settings.margins,"Layout -Margins">>. - - - - +<<dummy/../../../framework/layout/layout-settings#layout.settings.margins, "Layout Margins">>. diff --git a/documentation/layout/layout-gridlayout.asciidoc b/documentation/layout/layout-gridlayout.asciidoc index e96aa8e2bd..135c2706bc 100644 --- a/documentation/layout/layout-gridlayout.asciidoc +++ b/documentation/layout/layout-gridlayout.asciidoc @@ -12,22 +12,18 @@ ifdef::web[] image:{live-demo-image}[alt="Live Demo", link="http://demo.vaadin.com/sampler/#ui/layout/grid-layout"] endif::web[] -[classname]#GridLayout# container lays components out on a grid, defined by the -number of columns and rows. The columns and rows of the grid serve as -coordinates that are used for laying out components on the grid. Each component -can use multiple cells from the grid, defined as an area (x1,y1,x2,y2), although -they typically take up only a single grid cell. +[classname]#GridLayout# container lays components out on a grid consisting of rows and columns. +The columns and rows of the grid serve as coordinates that are used for laying out components on the grid. +Each component can use multiple cells from the grid, defined as an area (x1,y1,x2,y2), although they typically take up only a single grid cell. -The grid layout maintains a cursor for adding components in left-to-right, -top-to-bottom order. If the cursor goes past the bottom-right corner, it will -automatically extend the grid downwards by adding a new row. - -The following example demonstrates the use of [classname]#GridLayout#. The -[methodname]#addComponent# takes a component and optional coordinates. The -coordinates can be given for a single cell or for an area in x,y (column,row) -order. The coordinate values have a base value of 0. If coordinates are not -given, the cursor will be used. +The grid layout maintains a cursor for adding components in left-to-right, top-to-bottom order. +If the cursor goes past the bottom-right corner, it will automatically extend the grid downwards by adding a new row. +The following example demonstrates the use of [classname]#GridLayout#. +The [methodname]#addComponent()# method takes the component to be added and optional coordinates. +The coordinates can be given for a single cell or for an area in x,y (column,row) order. +The coordinate values have a base value of 0. +If the coordinates are not given, the cursor will be used. [source, java] ---- @@ -64,31 +60,21 @@ image::img/gridlayout.png[width=50%, scaledwidth=75%] A component to be placed on the grid must not overlap with existing components. A conflict causes throwing a [classname]#GridLayout.OverlapsException#. +[[layout.gridlayout.sizing]] == Sizing Grid Cells -You can define the size of both a grid layout and its components in either fixed -or percentual units, or leave the size undefined altogether, as described in -<<dummy/../../../framework/components/components-features#components.features.sizeable,"Sizing -Components">>. -<<dummy/../../../framework/layout/layout-settings#layout.settings.size,"Layout -Size">> gives an introduction to sizing of layouts. - -The size of the [classname]#GridLayout# component is undefined by default, so it -will shrink to fit the size of the components placed inside it. In most cases, -especially if you set a defined size for the layout but do not set the contained -components to full size, there will be some unused space. The position of the -non-full components within the grid cells will be determined by their -__alignment__. See -<<dummy/../../../framework/layout/layout-settings#layout.settings.alignment,"Layout -Cell Alignment">> for details on how to align the components inside the cells. +You can define the size of both a grid layout and its components in either fixed or percentual units, or leave the size undefined altogether, as described in <<dummy/../../../framework/components/components-features#components.features.sizeable,"Sizing Components">>. +<<dummy/../../../framework/layout/layout-settings#layout.settings.size,"Layout Size">> gives an introduction to sizing of layouts. + +The size of the [classname]#GridLayout# component is undefined by default, so it will shrink to fit the size of the components placed inside it. +In most cases, especially if you set a defined size for the layout but do not set the contained components to full size, there will be some unused space. +The position of the non-full components within the grid cells will be determined by their __alignment__. +See <<dummy/../../../framework/layout/layout-settings#layout.settings.alignment,"Layout Cell Alignment">> for details on how to align the components inside the cells. The components contained within a [classname]#GridLayout# layout can be laid out in a number of different ways depending on how you specify their height or -width. The layout options are similar to [classname]#HorizontalLayout# and -[classname]#VerticalLayout#, as described in -<<dummy/../../../framework/layout/layout-orderedlayout#layout.orderedlayout,"VerticalLayout -and HorizontalLayout">>. - +width. +The layout options are similar to [classname]#HorizontalLayout# and [classname]#VerticalLayout#, as described in <<dummy/../../../framework/layout/layout-orderedlayout#layout.orderedlayout, "VerticalLayout and HorizontalLayout">>. [WARNING] .A layout that contains components with percentual size must have a defined size! @@ -100,9 +86,11 @@ requirement holds for height and width separately. The debug mode allows detecting such invalid cases; see <<dummy/../../../framework/advanced/advanced-debug#advanced.debug.mode,"Enabling the Debug Mode">>. - ==== +[[layout.gridlayout.sizing.expanding]] +=== Expanding Rows and Columns + Often, you want to have one or more rows or columns that take all the available space left over from non-expanding rows or columns. You need to set the rows or columns as __expanding__ with [methodname]#setRowExpandRatio()# and @@ -117,7 +105,7 @@ expanding rows/columns. [source, java] ---- GridLayout grid = new GridLayout(3,2); - +ifdef::web[] // Layout containing relatively sized components must have // a defined size, here is fixed size. grid.setWidth("600px"); @@ -137,7 +125,7 @@ for (int i=0; i<labels.length; i++) { label.setWidth(null); // Set width as undefined grid.addComponent(label); } - +endif::web[] // Set different expansion ratios for the two columns grid.setColumnExpandRatio(1, 1); grid.setColumnExpandRatio(2, 5); @@ -145,6 +133,7 @@ grid.setColumnExpandRatio(2, 5); // Set the bottom row to expand grid.setRowExpandRatio(1, 1); +ifdef::web[] // Align and size the labels. for (int col=0; col<grid.getColumns(); col++) { for (int row=0; row<grid.getRows(); row++) { @@ -157,11 +146,12 @@ for (int col=0; col<grid.getColumns(); col++) { c.setHeight("100%"); } } +endif::web[] ---- [[figure.ui.gridlayout.sizing.expanding]] .Expanding rows and columns in [classname]#GridLayout# -image::img/gridlayout_sizing_expanding.png[width=75%, scaledwidth=100%] +image::img/gridlayout_sizing_expanding.png[width=100%, scaledwidth=100%] If the size of the contained components is undefined or fixed, the expansion ratio is of the __excess__ space, as in @@ -180,10 +170,10 @@ and 80 pixels, regardless of the minimum size of their contained components. [source, css] ---- .v-gridlayout {} -.v-gridlayout-margin {} + .v-gridlayout-margin {} ---- -The `v-gridlayout` is the root element of the [classname]#GridLayout# component. +The root element of the [classname]#GridLayout# component has `v-gridlayout` style. The `v-gridlayout-margin` is a simple element inside it that allows setting a padding between the outer element and the cells. For styling the individual grid cells, you should style the components inserted in the cells. |