org.zkoss.zul
Class Row

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlBasedComponent
          extended by org.zkoss.zul.impl.XulElement
              extended by org.zkoss.zul.Row
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HtmlBasedComponent, Component, Scope, ComponentCtrl, Row, XulElement
Direct Known Subclasses:
Group, Groupfoot

public class Row
extends XulElement
implements Row

A single row in a Rows element. Each child of the Row element is placed in each successive cell of the grid. The row with the most child elements determines the number of columns in each row.

Default getZclass(): z-row. (since 3.5.0)

Author:
tomyeh
See Also:
Serialized Form

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
Row()
           
 
Method Summary
 void beforeChildAdded(Component newChild, Component refChild)
          Default: does nothing.
 void beforeParentChanged(Component parent)
          Default: does nothing.
 java.lang.Object clone()
          Clones the component.
 java.lang.String getAlign()
          Returns the horizontal alignment of the whole row.
 java.lang.String getChildAttrs(int index)
          Returns the HTML attributes for the child of the specified index.
 Detail getDetailChild()
          Returns the child detail component.
 Detail getDetailChildApi()
          Returns the child detail component.
 Grid getGrid()
          Returns the grid that contains this row.
 Grid getGridApi()
          Returns the grid that contains this row.
 Group getGroup()
          Returns the group that this row belongs to, or null.
 Group getGroupApi()
          Returns the group that this row belongs to, or null.
 java.lang.String getOuterAttrs()
          Returns the exterior attributes for generating the enclosing HTML tag; never return null.
protected  java.lang.String getRealSclass()
          Returns the real style class that will be generated to the client (when HtmlBasedComponent.getOuterAttrs() is called).
protected  java.lang.String getRealStyle()
          Returns the real style that will be generated to client (when HtmlBasedComponent.getOuterAttrs() is called).
protected  int getRealStyleFlags()
          Returns a combination of HtmlBasedComponent.RS_NO_WIDTH and HtmlBasedComponent.RS_NO_HEIGHT.
 java.lang.String getSclass()
          Returns the style class.
 java.lang.String getSpans()
          Returns the spans, which is a list of numbers separated by comma.
 java.lang.String getValign()
          Returns the vertical alignment of the whole row.
 java.lang.Object getValue()
          Returns the value.
 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 isNowrap()
          Returns the nowrap.
 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 horizontal alignment of the whole row.
 void setNowrap(boolean nowrap)
          Sets the nowrap.
 void setSclass(java.lang.String sclass)
          Sets the CSS class.
 void setSpans(java.lang.String spans)
          Sets the spans, which is a list of numbers separated by comma.
 void setStyle(java.lang.String style)
          Sets the CSS style.
 void setValign(java.lang.String valign)
          Sets the vertical alignment of the whole row.
 void setValue(java.lang.Object value)
          Sets the value.
 boolean setVisible(boolean visible)
          Sets whether this component is visible.
 
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, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, newExtraCtrl, redraw, setClass, setDraggable, setDroppable, setFocus, setHeight, setLeft, setMoldSclass, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addEventHandler, addEventListener, addForward, addForward, addForward, addForward, addMoved, addSharedAnnotationMap, addSharedEventHandlerMap, appendAsapAttr, appendAsapAttr, appendChild, applyProperties, beforeChildRemoved, containsVariable, detach, disableClientUpdate, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getCommand, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getExtraCtrl, getFellow, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getMoldURI, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, hasFellow, invalidate, isAsapRequired, isChildable, isInvalidated, isListenerAvailable, isVisible, newChildren, onChildAdded, onPageAttached, onPageDetached, onWrongValue, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setComponentDefinition, setId, setMold, setPage, setPageBefore, setParent, setVariable, smartUpdate, smartUpdate, smartUpdate, smartUpdateDeferred, smartUpdateValues, toString, unsetVariable
 
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, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, setLeft, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex
 
Methods inherited from interface org.zkoss.zk.ui.Component
addEventListener, addForward, addForward, addForward, addForward, appendChild, applyProperties, containsVariable, detach, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getDefinition, getDesktop, getFellow, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, invalidate, isChildable, isInvalidated, isListenerAvailable, isVisible, redraw, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, setAttribute, setAttribute, setId, setMold, setPage, setPageBefore, setParent, setVariable, unsetVariable
 

Constructor Detail

Row

public Row()
Method Detail

getDetailChild

public Detail getDetailChild()
Returns the child detail component.

Since:
3.5.0

getDetailChildApi

public Detail getDetailChildApi()
Returns the child detail component.

Specified by:
getDetailChildApi in interface Row
Since:
3.5.2

getGrid

public Grid getGrid()
Returns the grid that contains this row.


getGridApi

public Grid getGridApi()
Returns the grid that contains this row.

Specified by:
getGridApi in interface Row
Since:
3.5.2

getAlign

public java.lang.String getAlign()
Returns the horizontal alignment of the whole row.

Default: null (system default: left unless CSS specified).

Specified by:
getAlign in interface Row

setAlign

public void setAlign(java.lang.String align)
Sets the horizontal alignment of the whole row.

Specified by:
setAlign in interface Row

isNowrap

public boolean isNowrap()
Returns the nowrap.

Default: null (system default: wrap).

Specified by:
isNowrap in interface Row

setNowrap

public void setNowrap(boolean nowrap)
Sets the nowrap.

Specified by:
setNowrap in interface Row

getValign

public java.lang.String getValign()
Returns the vertical alignment of the whole row.

Default: null (system default: top).

Specified by:
getValign in interface Row

setValign

public void setValign(java.lang.String valign)
Sets the vertical alignment of the whole row.

Specified by:
setValign in interface Row

setVisible

public boolean setVisible(boolean visible)
Description copied from interface: Component
Sets whether this component is visible.

Specified by:
setVisible in interface Component
Overrides:
setVisible in class AbstractComponent
Returns:
the previous visibility

getValue

public java.lang.Object getValue()
Returns the value.

Default: null.

Note: the value is application dependent, you can place whatever value you want.

Specified by:
getValue in interface Row

setValue

public void setValue(java.lang.Object value)
Sets the value.

Specified by:
setValue in interface Row
Parameters:
value - the value.

Note: the value is application dependent, you can place whatever value you want.


getSpans

public java.lang.String getSpans()
Returns the spans, which is a list of numbers separated by comma.

Default: empty.

Specified by:
getSpans in interface Row

setSpans

public void setSpans(java.lang.String spans)
              throws WrongValueException
Sets the spans, which is a list of numbers separated by comma.

For example, "1,2,3" means the second column will span two columns and the following column span three columns, while others occupies one column.

Specified by:
setSpans in interface Row
Throws:
WrongValueException

getRealSclass

protected java.lang.String getRealSclass()
Description copied from class: HtmlBasedComponent
Returns the real style class that will be generated to the client (when HtmlBasedComponent.getOuterAttrs() is called).

Default: it simply returns the catenation of HtmlBasedComponent.getSclass() and HtmlBasedComponent.getZclass() (since 3.5.0).

Derived classes might override it to provide, say, dual style classes. For example,

final String sclass = getSclass();
return sclass != null ? sclass + " my-addon": "myaddon";

Overrides:
getRealSclass in class HtmlBasedComponent
See Also:
HtmlBasedComponent.getZclass()

getZclass

public java.lang.String getZclass()
Description copied from class: HtmlBasedComponent
Returns the ZK Cascading Style class(es) for this component. It usually depends on the implementation of the mold (@{link #getMold}).

Default: 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.

Specified by:
getZclass in interface HtmlBasedComponent
Overrides:
getZclass in class HtmlBasedComponent
See Also:
HtmlBasedComponent.getSclass(), HtmlBasedComponent.getRealSclass()

getRealStyle

protected java.lang.String getRealStyle()
Description copied from class: HtmlBasedComponent
Returns the real style that will be generated to client (when HtmlBasedComponent.getOuterAttrs() is called).

Default: this method will append width, height and others to HtmlBasedComponent.setStyle(java.lang.String) (never null).

Use HtmlBasedComponent.getRealStyleFlags() to control what attributes to exclude.

Overrides:
getRealStyle in class HtmlBasedComponent

getGroup

public Group getGroup()
Returns the group that this row belongs to, or null.

Since:
3.5.0

getGroupApi

public Group getGroupApi()
Returns the group that this row belongs to, or null.

Specified by:
getGroupApi in interface Row
Since:
3.5.2

getChildAttrs

public java.lang.String getChildAttrs(int index)
Returns the HTML attributes for the child of the specified index.


getRealStyleFlags

protected int getRealStyleFlags()
Description copied from class: HtmlBasedComponent
Returns a combination of HtmlBasedComponent.RS_NO_WIDTH and HtmlBasedComponent.RS_NO_HEIGHT.

Default: return 0.

Overrides:
getRealStyleFlags in class HtmlBasedComponent

getOuterAttrs

public java.lang.String getOuterAttrs()
Description copied from class: HtmlBasedComponent
Returns the exterior attributes for generating the enclosing HTML tag; never return null.

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

Overrides:
getOuterAttrs in class XulElement

setStyle

public void setStyle(java.lang.String style)
Description copied from class: HtmlBasedComponent
Sets the CSS style.

Specified by:
setStyle in interface HtmlBasedComponent
Overrides:
setStyle in class HtmlBasedComponent

setSclass

public void setSclass(java.lang.String sclass)
Description copied from class: HtmlBasedComponent
Sets the CSS class.

Specified by:
setSclass in interface HtmlBasedComponent
Overrides:
setSclass in class HtmlBasedComponent
See Also:
HtmlBasedComponent.setZclass(java.lang.String)

getSclass

public java.lang.String getSclass()
Returns the style class. By default, it is the same as grid's stye class, unless setSclass(java.lang.String) is called with non-empty value.

Specified by:
getSclass in interface HtmlBasedComponent
Overrides:
getSclass in class HtmlBasedComponent
See Also:
HtmlBasedComponent.getRealSclass(), HtmlBasedComponent.getZclass()

beforeParentChanged

public void beforeParentChanged(Component parent)
Description copied from class: AbstractComponent
Default: does nothing.

Specified by:
beforeParentChanged in interface ComponentCtrl
Overrides:
beforeParentChanged in class AbstractComponent
Parameters:
parent - the new parent. If null, it means detachment.
See Also:
ComponentCtrl.beforeParentChanged(org.zkoss.zk.ui.Component)

beforeChildAdded

public void beforeChildAdded(Component newChild,
                             Component refChild)
Description copied from class: AbstractComponent
Default: does nothing.

Specified by:
beforeChildAdded in interface ComponentCtrl
Overrides:
beforeChildAdded in class AbstractComponent
Parameters:
newChild - the child to be added (never null).
refChild - another child component that the new child will be inserted before it. If null, the new child will be the last child.
See Also:
ComponentCtrl.beforeChildAdded(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)

insertBefore

public boolean insertBefore(Component newChild,
                            Component refChild)
Description copied from interface: Component
Inserts a child before the reference child.

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

Specified by:
insertBefore in interface Component
Overrides:
insertBefore in class AbstractComponent
Parameters:
newChild - 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.
Returns:
true if newChild is added successfully or moved; false if it already has the specified child and the order doesn't change.

onChildRemoved

public void onChildRemoved(Component child)
Description copied from class: AbstractComponent
Default: does nothing.

Specified by:
onChildRemoved in interface ComponentCtrl
Overrides:
onChildRemoved in class AbstractComponent
See Also:
ComponentCtrl.onChildRemoved(org.zkoss.zk.ui.Component)

clone

public java.lang.Object clone()
Description copied from interface: Component
Clones the component. All of its children is cloned. Notice that the cloned component doesn't belong to any page, nor desktop. It doesn't have parent, either.

Specified by:
clone in interface Component
Overrides:
clone in class AbstractComponent

onDrawNewChild

public void onDrawNewChild(Component child,
                           java.lang.StringBuffer out)
                    throws java.io.IOException
Description copied from interface: ComponentCtrl
Called when a new-created child is about to render. It gives the parent a chance to fine-tune the output. Note: it won't be called if the parent is rendered, too. In other words, it is called only if the child is attached dynamically.

It 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:

Specified by:
onDrawNewChild in interface ComponentCtrl
Overrides:
onDrawNewChild in class AbstractComponent
Parameters:
child - the child being rendered
out - the rendered result of the child.
Throws:
java.io.IOException


Copyright &copy; 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo