Vbox"
(Undo revision 10204 by Ejikipaticy (Talk)) |
|||
(19 intermediate revisions by 6 users not shown) | |||
Line 3: | Line 3: | ||
= Vbox = | = Vbox = | ||
− | *Demonstration: | + | *Demonstration: [http://www.zkoss.org/zkdemo/layout/box Vbox] |
*Java API: <javadoc>org.zkoss.zul.Vbox</javadoc> | *Java API: <javadoc>org.zkoss.zul.Vbox</javadoc> | ||
*JavaScript API: <javadoc directory="jsdoc">zul.box.Box</javadoc> | *JavaScript API: <javadoc directory="jsdoc">zul.box.Box</javadoc> | ||
+ | *Style Guide: [[ZK_Style_Guide/XUL_Component_Specification/Box| Vbox]] | ||
= Employment/Purpose = | = Employment/Purpose = | ||
Line 11: | Line 12: | ||
The vbox component is used to create a vertically oriented box. Added components will be placed underneath each other in a column. | The vbox component is used to create a vertically oriented box. Added components will be placed underneath each other in a column. | ||
− | Notice that hbox and vbox are designed to | + | = Suggest Alternative Components= |
+ | == Vlayout/Hlayout == | ||
+ | Notice that hbox and vbox are designed to provide a more sophisticated layout, such as splitter, alignment, and packing. If you need only the layout feature, it is suggested to use [[ZK Component Reference/Layouts/Hlayout | Hlayout]] and [[ZK Component Reference/Layouts/Vlayout | Vlayout]] instead, since the performance is much better (due to the use of HTML DIV instead of TABLE). | ||
+ | |||
+ | == Splitlatyout == | ||
+ | If you need a splitter, please use [[ZK%20Component%20Reference/Layouts/Splitlayout| splitlayout]]. | ||
= Example = | = Example = | ||
Line 29: | Line 35: | ||
</zk> | </zk> | ||
</source> | </source> | ||
− | =Align and | + | =Properties= |
+ | |||
+ | * '''Inherited''' Properties: [[ZK Component Reference/Containers/Box#Properties | Box]] | ||
+ | |||
+ | ==Align and Pack== | ||
+ | {{versionSince| 5.0.0}} | ||
+ | |||
[[Image:ZKComRef_Vbox_Simple_Example_align_pack.PNG]] | [[Image:ZKComRef_Vbox_Simple_Example_align_pack.PNG]] | ||
+ | |||
+ | <source lang="xml" highlight="23"> | ||
+ | <zk xmlns:n="native"> | ||
+ | <style content=".box {| class='wikitable' | width="100%" | ||
+ | <custom-attributes | ||
+ | packs="${['', 'start', 'center', 'end']}" | ||
+ | aligns="${['', 'stretch', 'start', 'center', 'end']}" | ||
+ | /> | ||
+ | |||
+ | <vlayout> | ||
+ | <hlayout height="70px" width="600px"> | ||
+ | <div hflex="1" vflex="1" sclass="box"> | ||
+ | <n:h3>pack / align</n:h3> | ||
+ | </div> | ||
+ | <div forEach="${aligns}" hflex="1" vflex="1" sclass="box"> | ||
+ | <n:h3>${each}</n:h3> | ||
+ | </div> | ||
+ | </hlayout> | ||
+ | <hlayout forEach="${packs}" height="150px" width="600px"> | ||
+ | <custom-attributes pack="${each}"/> | ||
+ | <div hflex="1" vflex="1" sclass="box"> | ||
+ | <n:h3>${pack}</n:h3> | ||
+ | </div> | ||
+ | |||
+ | <vbox forEach="${aligns}" align="${each}" pack="${pack}" hflex="1" vflex="1" sclass="box"> | ||
+ | <button label="1" /> | ||
+ | <button label="2" /> | ||
+ | <button label="3" /> | ||
+ | </vbox> | ||
+ | </hlayout> | ||
+ | </vlayout> | ||
+ | </zk> | ||
+ | </source> | ||
+ | |||
+ | = Cell Component = | ||
+ | {{versionSince| 5.0.0}} | ||
+ | In ZK5, we have introduced a new component named Cell which can be embedded into a Grid or Box (Hbox and Vbox) to fully control the layout and the style. You can now use the rowspan or the colspan property to layout your Grid, for example a content cell can now cross over multiple rows. The code below demonstrates how to do this: | ||
<source lang="xml" > | <source lang="xml" > | ||
− | < | + | <vbox> |
− | + | <cell sclass="years"> | |
− | + | ... | |
− | + | </cell> | |
− | + | </vbox> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</source> | </source> | ||
+ | = Limitation = | ||
+ | Box component is consisted by Table element. Therefore, when put Input element like Textbox, Combobox inside Box component, specify width and height to Box component will be ignored when browser try to render table element. | ||
+ | |||
+ | For example, | ||
+ | <source lang="xml"> | ||
+ | <hbox height="200px" width="200px" style="border: 1px solid red"> | ||
+ | <textbox hflex="1" value="1" /> | ||
+ | <textbox hflex="1" value="1" /> | ||
+ | </hbox> | ||
+ | </source> | ||
+ | You will see the Box width exceed 200px. Also check the [http://jsfiddle.net/A5g9q/ sample] with pure HTML in jsfiddle. | ||
− | =Supported | + | =Supported Events= |
− | {| | + | {| class='wikitable' | width="100%" |
! <center>Name</center> | ! <center>Name</center> | ||
! <center>Event Type</center> | ! <center>Event Type</center> | ||
Line 89: | Line 110: | ||
| None | | None | ||
|} | |} | ||
+ | *Inherited Supported Events: [[ZK Component Reference/Containers/Box#Supported_Events | Box]] | ||
=Supported Children= | =Supported Children= | ||
Line 94: | Line 116: | ||
*ALL | *ALL | ||
− | =Use | + | =Use Cases= |
− | {| | + | {| class='wikitable' | width="100%" |
! Version !! Description !! Example Location | ! Version !! Description !! Example Location | ||
|- | |- | ||
Line 105: | Line 127: | ||
=Version History= | =Version History= | ||
− | + | {{LastUpdated}} | |
− | {| | + | {| class='wikitable' | width="100%" |
! Version !! Date !! Content | ! Version !! Date !! Content | ||
|- | |- |
Latest revision as of 09:53, 6 June 2024
Vbox
Employment/Purpose
The vbox component is used to create a vertically oriented box. Added components will be placed underneath each other in a column.
Suggest Alternative Components
Vlayout/Hlayout
Notice that hbox and vbox are designed to provide a more sophisticated layout, such as splitter, alignment, and packing. If you need only the layout feature, it is suggested to use Hlayout and Vlayout instead, since the performance is much better (due to the use of HTML DIV instead of TABLE).
Splitlatyout
If you need a splitter, please use splitlayout.
Example
<zk>
<vbox>
<button label="Button 1"/>
<button label="Button 2"/>
</vbox>
<hbox>
<button label="Button 3"/>
<button label="Button 4"/>
</hbox>
</zk>
Properties
- Inherited Properties: Box
Align and Pack
Since 5.0.0
<zk xmlns:n="native">
<style content=".box {| class='wikitable' | width="100%"
<custom-attributes
packs="${['', 'start', 'center', 'end']}"
aligns="${['', 'stretch', 'start', 'center', 'end']}"
/>
<vlayout>
<hlayout height="70px" width="600px">
<div hflex="1" vflex="1" sclass="box">
<n:h3>pack / align</n:h3>
</div>
<div forEach="${aligns}" hflex="1" vflex="1" sclass="box">
<n:h3>${each}</n:h3>
</div>
</hlayout>
<hlayout forEach="${packs}" height="150px" width="600px">
<custom-attributes pack="${each}"/>
<div hflex="1" vflex="1" sclass="box">
<n:h3>${pack}</n:h3>
</div>
<vbox forEach="${aligns}" align="${each}" pack="${pack}" hflex="1" vflex="1" sclass="box">
<button label="1" />
<button label="2" />
<button label="3" />
</vbox>
</hlayout>
</vlayout>
</zk>
Cell Component
Since 5.0.0 In ZK5, we have introduced a new component named Cell which can be embedded into a Grid or Box (Hbox and Vbox) to fully control the layout and the style. You can now use the rowspan or the colspan property to layout your Grid, for example a content cell can now cross over multiple rows. The code below demonstrates how to do this:
<vbox>
<cell sclass="years">
...
</cell>
</vbox>
Limitation
Box component is consisted by Table element. Therefore, when put Input element like Textbox, Combobox inside Box component, specify width and height to Box component will be ignored when browser try to render table element.
For example,
<hbox height="200px" width="200px" style="border: 1px solid red">
<textbox hflex="1" value="1" />
<textbox hflex="1" value="1" />
</hbox>
You will see the Box width exceed 200px. Also check the sample with pure HTML in jsfiddle.
Supported Events
None | None |
- Inherited Supported Events: Box
Supported Children
*ALL
Use Cases
Version | Description | Example Location |
---|---|---|
Version History
Version | Date | Content |
---|---|---|