Class Box
- All Implemented Interfaces:
Serializable,Cloneable,org.zkoss.zk.ui.Component,org.zkoss.zk.ui.ext.Scope,org.zkoss.zk.ui.sys.ComponentCtrl
Default getZclass(): z-vbox.(since 3.5.0)
- Author:
- tomyeh
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zk.ui.HtmlBasedComponent.ExtraCtrlNested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.AbstractComponent.Children, org.zkoss.zk.ui.AbstractComponent.ForwardInfo, org.zkoss.zk.ui.AbstractComponent.TargetInfo -
Field Summary
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclassFields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPEFields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetAlign()Returns the alignment of cells of a box in the 'opposite' direction (null, start, center, end).Returns the orient (the same asAbstractComponent.getMold()).getPack()Returns the pack alignment of cells of this box (start, center, end) plus an indication stretch option.org.zkoss.zk.ui.sys.PropertyAccessgetPropertyAccess(String prop) Returns the spacing between adjacent children, or null if the default spacing is used.booleanReturns whether it is a horizontal box.booleanReturns whether sizing the cell's size by its content.booleanReturns whether it is a vertical box.protected voidrenderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) voidSets the alignment of cells of this box in the 'opposite' direction (start, center, end, stretch).voidSets the orient.voidSets the alignment of cells of this box (start, center, end) plus an stretch option.voidsetSizedByContent(boolean byContent) Sets whether sizing the cell's size by its content.voidsetSpacing(String spacing) Sets the spacing between adjacent children.Methods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributesMethods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, focus, getAction, getClientAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, removeSclass, removeSclass, service, setAction, setClass, setClientAction, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setSkeleton, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectlyMethods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getStubonlyDescendants, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setStubonlyDescendants, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
Constructor Details
-
Box
public Box()Default: vertical (Vbox). -
Box
- Parameters:
orient- either "horizontal" or "vertical".
-
Box
public Box(org.zkoss.zk.ui.Component[] children) Constructor a box by assigning an array of children.- Parameters:
children- an array of children to be added- Since:
- 2.4.0
-
Box
Constructor a box by assigning an array of children.- Parameters:
children- an array of children to be added- Since:
- 2.4.0
-
-
Method Details
-
isHorizontal
public boolean isHorizontal()Returns whether it is a horizontal box.- Since:
- 3.0.0
-
isVertical
public boolean isVertical()Returns whether it is a vertical box.- Since:
- 3.0.0
-
getOrient
Returns the orient (the same asAbstractComponent.getMold()).Default: "vertical".
-
setOrient
Sets the orient.- Parameters:
orient- either "horizontal" or "vertical".- Throws:
org.zkoss.zk.ui.WrongValueException
-
getSpacing
Returns the spacing between adjacent children, or null if the default spacing is used.The default spacing depends on the definition of the style class called "xxx-sp", where xxx is
HtmlBasedComponent.getSclass()if it is not null.- hbox if
HtmlBasedComponent.getSclass()is null and it is a horizontal box. - vbox if
HtmlBasedComponent.getSclass()is null and it is a vertical box.
Default: null (means to use the default spacing).
-
setSpacing
Sets the spacing between adjacent children.- Parameters:
spacing- the spacing (such as "0", "5px", "3pt" or "1em"). If null, empty ("") or "auto", the default spacing is used (i.e., controlled by CSS alone)- See Also:
-
getAlign
Returns the alignment of cells of a box in the 'opposite' direction (null, start, center, end).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 aligned horizontally. The pack attribute (
getPack()) is related to the alignment but is used to specify the position in the opposite direction.- start
- Child elements are aligned starting from the left or top edge of the box. If the box is larger than the total size of the children, the extra space is placed on the right or bottom side.
- center
- Extra space is split equally along each side of the child elements, resulting in the children being placed in the center of the box.
- end
- Child elements are placed on the right or bottom edge of the box. If the box is larger than the total size of the children, the extra space is placed on the left or top side.
- stretch(since 5.0)
- Child elements are stretched to fill the box.
- Since:
- 3.0.0
-
setAlign
Sets the alignment of cells of this box in the 'opposite' direction (start, center, end, stretch).Refer to
getAlign()for more information- Parameters:
align- the alignment in the 'opposite' direction. Allowed values: start, center, end, stretch. If empty or null, the browser's default is used (IE center and FF left, if vertical).- Since:
- 3.0.0
-
getPack
Returns the pack alignment of cells of this box (start, center, end) plus an indication stretch option.Default: start.
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.- start
- Child elements are aligned starting from the left or top edge of the box. If the box is larger than the total size of the children, the Extra space is placed on the right or bottom side.
- center
- Extra space is split equally along each side of the child elements, resulting in the children being placed in the center of the box.
- end
- Child elements are placed on the right or bottom edge of the box. If the box is larger than the total size of the children, the extra space is placed on the left or top side.
- stretch(since 5.0)
- This is an extra option in addition to the (start, center, end) options.
When add this extra option in the pack attribute, the Extra space is placed
proportionally and evenly along each child elements. If you specify
"stretch,start", then the Extra proportionally and evenly allocated space
for each child is placed on the right or bottom side of the child.
If you specify "stretch,center", then the Extra proportionally and evenly
allocated space for each child is split equally along each side of the
child. If you specify "stretch,end", then the Extra proportionally and
evenly allocated space for each child is placed on the left or top side of
the child. Note that if there are
Splitterchild inside this Box, then this Box behaves as if the pack attribute has been set the "stretch" option; no matter you really specify "stretch" in pack attribute or not. If you give null to the pack attribute, it is the same as "start". If simply give "stretch" to this pack attribute then it is the same as "stretch,start"
- Since:
- 3.0.0
-
setPack
Sets the alignment of cells of this box (start, center, end) plus an stretch option.- Parameters:
pack- the alignment. Allowed values: (start, center, end) plus an stretch option. If empty or null, it defaults to "start".- Since:
- 3.0.0
- See Also:
-
setSizedByContent
public void setSizedByContent(boolean byContent) Sets whether sizing the cell's size by its content.Default: true. It means the cell's size is depended on its content.
With
Splitter, you can specify the sizedByContent to be false for resizing smoothly, if it contains a grid or other sophisticated components.- Parameters:
byContent-- Since:
- 5.0.4
-
isSizedByContent
public boolean isSizedByContent()Returns whether sizing the cell's size by its content.Default: true.
- Since:
- 5.0.4
- See Also:
-
evalCSSFlex
public boolean evalCSSFlex()- Overrides:
evalCSSFlexin classorg.zkoss.zk.ui.HtmlBasedComponent
-
renderProperties
- Overrides:
renderPropertiesin classXulElement- Throws:
IOException
-
getZclass
- Overrides:
getZclassin classorg.zkoss.zk.ui.HtmlBasedComponent
-
getPropertyAccess
- Specified by:
getPropertyAccessin interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
getPropertyAccessin classXulElement
-