|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Box
public class Box
A box.
Default getZclass(): z-vbox.(since 3.5.0)
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
HtmlBasedComponent.ExtraCtrl |
| Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent |
|---|
AbstractComponent.Children |
| Field Summary |
|---|
| Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
_zclass, RS_NO_DISPLAY, RS_NO_HEIGHT, RS_NO_WIDTH |
| Fields inherited from class org.zkoss.zk.ui.AbstractComponent |
|---|
_visible |
| Fields inherited from interface org.zkoss.zk.ui.Component |
|---|
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE |
| Constructor Summary | |
|---|---|
Box()
Default: vertical ( Vbox). |
|
Box(Component[] children)
Constructor a box by assigning an array of children. |
|
Box(java.lang.String orient)
|
|
Box(java.lang.String orient,
Component[] children)
Constructor a box by assigning an array of children. |
|
| Method Summary | |
|---|---|
java.lang.String |
getAlign()
Returns the alignment of cells of a box in the 'opposite' direction (null, start, center, end). |
java.lang.String |
getCaveAttrs()
Returns the attributes used by the 'cave' element (never null). |
java.lang.String |
getChildInnerAttrs(Component child)
Returns the inner attributes used to wrap the children (never null). |
java.lang.String |
getChildOuterAttrs(Component child)
Returns the outer attributes used to wrap the children (never null). |
java.lang.String |
getHeights()
Returns the heights/widths, which is a list of numbers separated by comma to denote the height/width of each cell in a box. |
java.lang.String |
getOrient()
Returns the orient (the same as AbstractComponent.getMold()). |
java.lang.String |
getOuterAttrs()
Returns the exterior attributes for generating the enclosing HTML tag; never return null. |
java.lang.String |
getPack()
Returns the alignment of cells of this box (null, start, center, end). |
java.lang.String |
getSpacing()
Returns the spacing between adjacent children, or null if the default spacing is used. |
java.lang.String |
getValign()
Deprecated. As of release 3.0.0, since it is not compliant to XUL. Use getAlign() and getPack() instead. |
java.lang.String |
getWidths()
Returns the widths/heights, which is a list of numbers separated by comma to denote the width/height of each cell in a box. |
java.lang.String |
getZclass()
Returns the ZK Cascading Style class(es) for this component. |
boolean |
insertBefore(Component newChild,
Component refChild)
Inserts a child before the reference child. |
boolean |
isHorizontal()
Returns whether it is a horizontal box. |
boolean |
isVertical()
Returns whether it is a vertical box. |
void |
onChildRemoved(Component child)
Default: does nothing. |
void |
onDrawNewChild(Component child,
java.lang.StringBuffer out)
Called when a new-created child is about to render. |
void |
setAlign(java.lang.String align)
Sets the alignment of cells of this box in the 'opposite' direction (null, start, center, end). |
void |
setHeights(java.lang.String heights)
Sets the widths/heights, which is a list of numbers separated by comma to denote the width/height of each cell in a box. |
void |
setOrient(java.lang.String orient)
Sets the orient. |
void |
setPack(java.lang.String pack)
Sets the alignment of cells of this box (null, start, center, end). |
void |
setSpacing(java.lang.String spacing)
Sets the spacing between adjacent children. |
void |
setValign(java.lang.String valign)
Deprecated. As of release 3.0.0, since it is not compliant to XUL. Use setAlign(java.lang.String) and setPack(java.lang.String) instead. |
void |
setWidths(java.lang.String widths)
Sets the widths/heights, which is a list of numbers separated by comma to denote the width/height of each cell in a box. |
| Methods inherited from class org.zkoss.zul.impl.XulElement |
|---|
getAction, getActionAttrs, getAllOnClickAttrs, getContext, getCtrlKeys, getInnerAttrs, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
| Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
focus, getAllOnClickAttrs, getDraggable, getDroppable, getHeight, getLeft, getMoldSclass, getRealSclass, getRealStyle, getRealStyleFlags, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, newExtraCtrl, redraw, setClass, setDraggable, setDroppable, setFocus, setHeight, setLeft, setMoldSclass, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.zkoss.zul.impl.api.XulElement |
|---|
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
| Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent |
|---|
focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex |
| Constructor Detail |
|---|
public Box()
Vbox).
public Box(java.lang.String orient)
orient - either "horizontal" or "vertical".public Box(Component[] children)
children - an array of children to be added
public Box(java.lang.String orient,
Component[] children)
children - an array of children to be added| Method Detail |
|---|
public boolean isHorizontal()
isHorizontal in interface Boxpublic boolean isVertical()
isVertical in interface Boxpublic java.lang.String getOrient()
AbstractComponent.getMold()).
Default: "vertical".
getOrient in interface Box
public void setOrient(java.lang.String orient)
throws WrongValueException
setOrient in interface Boxorient - either "horizontal" or "vertical".
WrongValueExceptionpublic java.lang.String getSpacing()
The default spacing depends on the definition of the style class called "xxx-sp", where xxx is
HtmlBasedComponent.getSclass() if it is not null.HtmlBasedComponent.getSclass() is null and it is a horizontal box.HtmlBasedComponent.getSclass() is null and it is a vertical box.Default: null (means to use the default spacing).
getSpacing in interface Boxpublic void setSpacing(java.lang.String spacing)
setSpacing in interface Boxspacing - the spacing (such as "0", "5px", "3pt" or "1em"),
or null to use the default spacinggetSpacing()public java.lang.String getValign()
getAlign() and getPack() instead.
Default: null (i.e., use the browser default, usually middle).
public void setValign(java.lang.String valign)
setAlign(java.lang.String) and setPack(java.lang.String) instead.
valign - the vertical alignment: top, middle and bottom.public java.lang.String getAlign()
Default: start
The align attribute specifies how child elements of the box are aligned,
when the size of the box is larger than the total size of the children. For
boxes that have horizontal orientation, it specifies how its children will
be aligned vertically. For boxes that have vertical orientation, it is used
to specify how its children are algined horizontally. The pack attribute
(getPack()) is
related to the alignment but is used to specify the position in the
opposite direction.
getAlign in interface Boxpublic void setAlign(java.lang.String align)
setAlign in interface Boxalign - the alignment in the 'opposite' direction.
Allowed values: start, center, end.
If empty or null, the browser's default is used
(IE center and FF left, if vertical).public java.lang.String getPack()
Default: null.
The pack attribute specifies where child elements of the box are placed
when the box is larger that the size of the children. For boxes with
horizontal orientation, it is used to indicate the position of children
horizontally. For boxes with vertical orientation, it is used to indicate
the position of children vertically. The align attribute
(getAlign())is used to specify
the position in the opposite direction.
getPack in interface Boxpublic void setPack(java.lang.String pack)
setPack in interface Boxpack - the alignment. Allowed values: start, center, end.
If empty or null, the browser's default is used.public java.lang.String getWidths()
Hbox (i.e., getOrient() is horizontal),
it is a list of widths.
If Vbox (i.e., getOrient() is vertical),
it is a list of heights.
It is the same as getHeights().
Default: empty.
getWidths in interface Boxpublic java.lang.String getHeights()
Hbox (i.e., getOrient() is horizontal),
it is a list of widths.
If Vbox (i.e., getOrient() is vertical),
it is a list of heights.
It is the same as getWidths().
Default: empty.
getHeights in interface Box
public void setWidths(java.lang.String widths)
throws WrongValueException
It is the same as setHeights(java.lang.String).
For example, "10%,20%,30%" means the second cell shall occupy 10% width, the second cell 20%, the third cell 30%, and the following cells don't specify any width.
Note: the splitters are ignored, i.e., they are not cells.
Another example, ",,30%" means the third cell shall occupy 30% width, and the rest of cells don't specify any width. Of course, the real widths depend on the interpretation of the browser.
setWidths in interface BoxWrongValueException
public void setHeights(java.lang.String heights)
throws WrongValueException
It is the same as setWidths(java.lang.String).
setHeights in interface BoxWrongValueExceptionpublic java.lang.String getChildOuterAttrs(Component child)
public java.lang.String getChildInnerAttrs(Component child)
public java.lang.String getOuterAttrs()
HtmlBasedComponentUsed only by component developers.
Default: Generates the tooltip text, style, sclass, draggable
and droppable attribute if necessary.
In other words, the corresponding attribute is generated if
HtmlBasedComponent.getTooltiptext(), HtmlBasedComponent.getRealStyle(),
HtmlBasedComponent.getSclass(), HtmlBasedComponent.getDraggable(), HtmlBasedComponent.getDroppable()
are defined.
You have to call both HtmlBasedComponent.getOuterAttrs() and
HtmlBasedComponent.getInnerAttrs() to generate complete attributes.
For simple components that all attributes are put on the outest HTML element, all you need is as follows.
<xx id="${self.uuid}"${self.outerAttrs}${self.innerAttrs}>
If you want to put attributes in a nested HTML element, you
shall use the following pattern. Notice: if HtmlBasedComponent.getInnerAttrs()
in a different tag, the tag must be named with "${self.uuid}!real".
<xx id="${self.uuid}"${self.outerAttrs}>
<yy id="${self.uuid}!real"${self.innerAttrs}>...
Note: This class handles non-deferrable event listeners automatically.
However, you have to invoke AbstractComponent.appendAsapAttr(java.lang.StringBuffer, java.lang.String) for each event
the component handles in HtmlBasedComponent.getOuterAttrs() as follows.
appendAsapAttr(sb, Events.ON_OPEN);
appendAsapAttr(sb, Events.ON_CHANGE);
Theorectically, you could put any attributes in either
HtmlBasedComponent.getInnerAttrs() or HtmlBasedComponent.getOuterAttrs().
However, zkau.js assumes all attributes are put at the outer one.
If you want something different, you have to provide your own
setAttr (refer to how checkbox is implemented).
getOuterAttrs in class XulElementpublic java.lang.String getCaveAttrs()
public java.lang.String getZclass()
HtmlBasedComponentDefault: null (the default value depends on element).
HtmlBasedComponent.setZclass(java.lang.String)) will completely replace the default style
of a component. In other words, the default style of a component
is associated with the default value of HtmlBasedComponent.getZclass().
Once it is changed, the default style won't be applied at all.
If you want to perform small adjustments, use HtmlBasedComponent.setSclass(java.lang.String)
instead.
getZclass in interface HtmlBasedComponentgetZclass in class HtmlBasedComponentHtmlBasedComponent.getSclass(),
HtmlBasedComponent.getRealSclass()
public boolean insertBefore(Component newChild,
Component refChild)
ComponentYou could use Component.setParent(org.zkoss.zk.ui.Component) or Component.appendChild(org.zkoss.zk.ui.Component)
instead of this method, unless
you want to control where to put the child.
Note: Component.setParent(org.zkoss.zk.ui.Component) always calls back Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
and/or Component.removeChild(org.zkoss.zk.ui.Component),
while Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component) and Component.removeChild(org.zkoss.zk.ui.Component)
always calls back Component.setParent(org.zkoss.zk.ui.Component),
if the parent is changed. Thus, you don't need to override
both Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component) and Component.setParent(org.zkoss.zk.ui.Component), if you want
to customize the behavior.
insertBefore in interface ComponentinsertBefore in class AbstractComponentnewChild - the new child to be inserted.refChild - the child before which you want the new child
being inserted. If null, the new child is append to the end.
public void onChildRemoved(Component child)
AbstractComponent
onChildRemoved in interface ComponentCtrlonChildRemoved in class AbstractComponentComponentCtrl.onChildRemoved(org.zkoss.zk.ui.Component)
public void onDrawNewChild(Component child,
java.lang.StringBuffer out)
throws java.io.IOException
ComponentCtrlIt is called in the redrawing phase by the kernel, so it is too late
to call Component.invalidate() or ComponentCtrl.smartUpdate(java.lang.String, java.lang.String) in this method.
Note: ComponentCtrl.onChildAdded(org.zkoss.zk.ui.Component) is called in the request-processing
phase, while ComponentCtrl.onDrawNewChild(org.zkoss.zk.ui.Component, java.lang.StringBuffer) is called in the redrawing phase.
Component developer might do one of the follows:
ComponentCtrl.onDrawNewChild(org.zkoss.zk.ui.Component, java.lang.StringBuffer) to add special tags, if
new child needs to be added an exterior with some tags before
insertion.ComponentCtrl.onChildAdded(org.zkoss.zk.ui.Component) and calls Component.invalidate()
onDrawNewChild in interface ComponentCtrlonDrawNewChild in class AbstractComponentchild - the child being renderedout - the rendered result of the child.
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||