zul.box
Class Box

java.lang.Object
  extended by zk.Object
      extended by zk.Widget
          extended by zul.Widget
              extended by zul.box.Box

public class Box
extends Widget

A box.

Default Widget.getZclass(): z-vbox.


Field Summary
 
Fields inherited from class zk.Widget
$weave, auDelay, autag, bindLevel, className, desktop, effects_, firstChild, id, insertingBefore_, inServer, lastChild, nChildren, nextSibling, parent, previousSibling, uuid, widgetName
 
Fields inherited from class zk.Object
$class, $oid
 
Method Summary
protected  String encloseChildHTML_(Widget child, boolean prefixSpace, Array out)
          Enclose child with HTML tag such as TR or TD, and return a HTML code or add HTML fragments in out array.
 String getAlign()
          Returns the alignment of cells of a box in the 'opposite' direction (null, start, center, end).
 String getOrient()
          Returns the orient.
 String getPack()
          Returns the pack alignment of cells of this box (start, center, end) plus an indication stretch option.
 String getSpacing()
          Returns the spacing between adjacent children, or null if the default spacing is used.
 boolean isSizedByContent()
          Returns whether sizing the cell's size by its content.
 boolean isVertical()
          Returns whether it is a vertical box.
 void setAlign(String align)
          Sets the alignment of cells of this box in the 'opposite' direction (start, center, end, stretch).
 void setPack(String pack)
          Sets the alignment of cells of this box (start, center, end) plus an stretch option.
 void setSizedByContent(boolean byContent)
          Sets whether sizing the cell's size by its content.
 void setSpacing(String spacing)
          Sets the spacing between adjacent children.
 
Methods inherited from class zul.Widget
afterKeyDown_, beforeCtrlKeys_, getContext, getCtrlKeys, getOpenTooltip, getPopup, getTooltip, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from class zk.Widget
$, $f, $f, $f, $init, $n, $n, $o, afterAnima_, afterParentChanged_, appendChild, appendChild, beforeParentChanged_, beforeSendAU_, bind_, bind, bindChildren_, bindDoubleTap_, bindSwipe_, canActivate, cleanDrag_, clear, clearCache, cloneDrag_, deferRedrawHTML_, detach, doBlur_, doClick_, doDoubleClick_, doFocus_, doKeyDown_, doKeyPress_, doKeyUp_, domAttrs_, domClass_, domListen_, doMouseDown_, doMouseMove_, doMouseOut_, doMouseOver_, doMouseUp_, domStyle_, domTextStyleAttr_, domTooltiptext_, domUnlisten_, doRightClick_, doSelect_, doSwipe_, doTooltipOut_, doTooltipOver_, dropEffect_, extraBind_, fire, fireX, focus_, focus, forcerender, fromPageCoord, get, getAction, getCaveNode, getChildAt, getChildIndex, getClass, getDraggable, getDragMessage_, getDragNode, getDragOptions_, getDrop_, getDroppable, getElementsById, getElementsByName, getFirstNode_, getFloatZIndex_, getHeight, getHflex, getId, getLeft, getMold, getOldWidget_, getPage, getRenderdefer, getSclass, getScrollLeft, getScrollTop, getStyle, getTextNode, getTooltiptext, getTop, getTopWidget, getVflex, getWidth, getZclass, getZIndex, hide, ignoreDescendantFloatUp_, ignoreDrag_, initDrag_, insertBefore, insertChildHTML_, isAutoId, isBinding, isFloating_, isListen, isRealVisible, isRealVisible, isVisible, isVisible, isWatchable_, listen, listenOnFitSize_, mimicMouseDown_, newInstance, nextUuid, onChildAdded_, onChildRemoved_, onChildReplaced_, onChildVisible_, onDrop_, redraw, redrawHTML_, register, removeChild, removeChild, removeChildHTML_, removeHTML_, replaceCavedChildren_, replaceChildHTML_, replaceHTML, replaceWidget, rerender, rerender, scrollIntoView, sendAU_, set, set, setAction, setChildren, setDomVisible_, setDraggable, setDroppable, setFloating_, setFloatZIndex_, setHeight, setHflex, setId, setLeft, setListener, setListener, setListeners, setMold, setRenderdefer, setSclass, setScrollLeft, setScrollTop, setStyle, setTooltiptext, setTop, setTopmost, setVflex, setVisible, setWidth, setZclass, setZIndex, shallChildROD_, shallIgnoreClick_, show, smartUpdate, unbind_, unbind, unbindChildren_, unbindDoubleTap_, unbindSwipe_, uncloneDrag_, unlisten, unlistenOnFitSize_, updateDomClass_, updateDomStyle_, uuid, zsync
 
Methods inherited from class zk.Object
$init, $instanceof, $super, $super, $supers, $supers, afterInit, isAssignableFrom, isInstance, proxy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAlign

public String getAlign()
Returns the alignment of cells of a box in the 'opposite' direction (null, start, center, end).

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
Child elements are stretched to fill the box.

Default: start

Returns:
String

setAlign

public void setAlign(String align)
Sets the alignment of cells of this box in the 'opposite' direction (start, center, end, stretch).

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).

getPack

public String getPack()
Returns the pack alignment of cells of this box (start, center, end) plus an indication stretch option.

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
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 Splitter child 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 given null or simply "stretch" to this pack attribute then it is the same as "stretch,start"

Default: start.

Returns:
String

setPack

public void setPack(String pack)
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 "stretch,start".
See Also:
getPack()

getSpacing

public String 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

  1. Widget.getSclass() if it is not null.
  2. hbox if Widget.getSclass() is null and it is a horizontal box.
  3. vbox if Widget.getSclass() is null and it is a vertical box.

Default: null (means to use the default spacing).

Returns:
String

setSpacing

public void setSpacing(String spacing)
Sets the spacing between adjacent children.

Parameters:
spacing - the spacing (such as "0", "5px", "3pt" or "1em"), or null to use the default spacing
See Also:
getSpacing()

isSizedByContent

public boolean isSizedByContent()
Returns whether sizing the cell's size by its content.

Default: true.

Returns:
boolean
Since:
5.0.4

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

Parameters:
byContent -
Since:
5.0.4

isVertical

public boolean isVertical()
Returns whether it is a vertical box.

Returns:
boolean

getOrient

public String getOrient()
Returns the orient.

Returns:
String

encloseChildHTML_

protected String encloseChildHTML_(Widget child,
                                   boolean prefixSpace,
                                   Array out)
Enclose child with HTML tag such as TR or TD, and return a HTML code or add HTML fragments in out array.

Parameters:
child - the child which will be enclosed
prefixSpace - if true the previousSibling of the child will put in front of child.
out - an array of HTML fragments.
Returns:
String


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo