zul
Class Widget

java.lang.Object
  extended by zk.Object
      extended by zk.Widget
          extended by zul.Widget
Direct Known Subclasses:
Absolutechildren, Absolutelayout, Anchorchildren, Anchorlayout, Applet, Audio, Bandpopup, Biglistbox, Borderlayout, Box, Calendar, Cardlayout, Cell, Chosenbox, Columnchildren, Columnlayout, ContainerWidget, Detail, Div, Dropupload, Fisheyebar, Flash, Foot, Frozen, HeadWidget, Html, Iframe, Image, Include, InputWidget, ItemWidget, Label, LabelImageWidget, LayoutRegion, Listfoot, Menubar, Menuseparator, MeshWidget, Navbar, Navseparator, Option, Paging, Panel, Popup, Portalchildren, Portallayout, Progressmeter, Radiogroup, Row, Rows, Select, Selectbox, Separator, Slider, Span, Splitter, Tabbox, Tablechildren, Tablelayout, Tabpanels, Tabs, Toolbar, Treechildren, Treefoot, Treerow

public class Widget
extends Widget

The base class for ZUL widget.

The corresponding Java class is org.zkoss.zul.impl.XulElement.


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  boolean afterKeyDown_(Event evt, boolean simulated)
          Called after Widget.doKeyDown_(zk.Event) is called and the event propagation is not stopped.
protected  boolean beforeCtrlKeys_(Event evt)
          Called before a control key is pressed.
 String getContext()
          Returns the ID of the popup (Popup) that should appear when the user right-clicks on the element (aka., context menu).
 String getCtrlKeys()
          Returns what keystrokes to intercept.
static Widget getOpenTooltip()
          Returns the tooltip that is opened, or null if no tooltip is opened.
 String getPopup()
          Returns the ID of the popup (Popup) that should appear when the user clicks on the element.
 String getTooltip()
          Returns the ID of the popup (Popup) that should be used as a tooltip window when the mouse hovers over the element for a moment.
 Widget setContext(Popup context)
          Sets the ID of the popup (Popup) that should appear when the user right-clicks on the element (aka., context menu).
 void setContext(String context)
          Sets the ID of the popup (Popup) that should appear when the user right-clicks on the element (aka., context menu).
 Widget setCtrlKeys(String keys)
          Sets what keystrokes to intercept.
 Widget setPopup(Popup popup)
          Sets the ID of the popup (Popup) that should appear when the user clicks on the element.
 void setPopup(String popup)
          Sets the ID of the popup (Popup) that should appear when the user clicks on the element.
 Widget setTooltip(Popup popup)
          Sets the ID of the popup (Popup) that should be used as a tooltip window when the mouse hovers over the element for a moment.
 void setTooltip(String tooltip)
          Sets the ID of the popup (Popup) that should be used as a tooltip window when the mouse hovers over the element for a moment.
 
Methods inherited from class zk.Widget
$, $f, $f, $f, $init, $n, $n, $o, $s, afterAnima_, afterParentChanged_, appendChild, appendChild, beforeParentChanged_, beforeSendAU_, bind_, bind, bindChildren_, bindDoubleTap_, bindSwipe_, bindTapHold_, canActivate, cleanDrag_, clear, clearCache, cloneDrag_, deferRedraw_, deferRedrawHTML_, detach, doBlur_, doClick_, doDoubleClick_, doFocus_, doKeyDown_, doKeyPress_, doKeyUp_, domAttrs_, domClass_, domListen_, doMouseDown_, doMouseEnter_, doMouseLeave_, doMouseMove_, doMouseOut_, doMouseOver_, doMouseUp_, domStyle_, domTextStyleAttr_, domTooltiptext_, domUnlisten_, doResizeScroll_, 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, isRealElement, isRealVisible, isRealVisible, isVisible, isVisible, isWatchable_, listen, listenOnFitSize_, mimicMouseDown_, newInstance, nextUuid, onAfterSize, onChildAdded_, onChildRemoved_, onChildRenderDefer_, 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_, unbindTapHold_, 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

getContext

public String getContext()
Returns the ID of the popup (Popup) that should appear when the user right-clicks on the element (aka., context menu).

Default: null (no context menu).

Returns:
String

setContext

public Widget setContext(Popup context)
Sets the ID of the popup (Popup) that should appear when the user right-clicks on the element (aka., context menu).

An onOpen event is sent to the context menu if it is going to appear. Therefore, developers can manipulate it dynamically (perhaps based on OpenEvent.getReference) by listening to the onOpen event.

Note: To simplify the use, it not only searches its ID space, but also all ID spaces in the desktop. It first searches its own ID space, and then the other Id spaces in the same browser window (might have one or multiple desktops).

If there are two components with the same ID (of course, in different ID spaces), you can specify the UUID with the following format:
uuid(comp_uuid)

Example:


 wgt.setContext('an_id');
 wgt.setContext('uuid(an_uuid)');
 wgt.setContext(a_wgt);
 
Both reference a component whose ID is "some". But, if there are several components with the same ID, the first one can reference to any of them. And, the second one reference to the component in the same ID space (of the label component).

The context menu can be shown by a position from Popup.open(zk.Widget, Offset, String, Map) or the location of x and y, you can specify the following format:

For example,
 wgt.setContext('an_id', 'start_before');
 
Since 6.5.2, the context menu can also be shown on customized location of x and y by adding parentheses"()", for example,
 wgt.setContext('an_id', 'x=(zk.currentPointer[0] + 10), y=(zk.currentPointer[1] - 10)');
 

Parameters:
context - the popup widget.
Returns:
zul.Widget

setContext

public void setContext(String context)
Sets the ID of the popup (Popup) that should appear when the user right-clicks on the element (aka., context menu).

Parameters:
context - the ID of the popup widget.
See Also:
setContext(zul.wgt.Popup)

getPopup

public String getPopup()
Returns the ID of the popup (Popup) that should appear when the user clicks on the element.

Default: null (no popup).

Returns:
String the ID of the popup widget

setPopup

public Widget setPopup(Popup popup)
Sets the ID of the popup (Popup) that should appear when the user clicks on the element.

An onOpen event is sent to the popup menu if it is going to appear. Therefore, developers can manipulate it dynamically (perhaps based on OpenEvent.getReference) by listening to the onOpen event.

Note: To simplify the use, it not only searches its ID space, but also all ID spaces in the desktop. It first searches its own ID space, and then the other Id spaces in the same browser window (might have one or multiple desktops).

If there are two components with the same ID (of course, in different ID spaces), you can specify the UUID with the following format:
uuid(comp_uuid)

Example:


 wgt.setPopup('an_id');
 wgt.setPopup('uuid(an_uuid)');
 wgt.setPopup(a_wgt);
 
Both reference a component whose ID is "some". But, if there are several components with the same ID, the first one can reference to any of them. And, the second one reference to the component in the same ID space (of the label component).

The popup menu can be shown by a position from Popup.open(zk.Widget, Offset, String, Map) or the location of x and y, you can specify the following format:

For example,
 wgt.setPopup('an_id', 'start_before');
 
Since 6.5.2, the popup can also be shown on customized location of x and y by adding parentheses"()", for example,
 wgt.setPopup('an_id', 'x=(zk.currentPointer[0] + 10), y=(zk.currentPointer[1] - 10)');
 

Parameters:
popup - the popup widget.
Returns:
zul.Widget

setPopup

public void setPopup(String popup)
Sets the ID of the popup (Popup) that should appear when the user clicks on the element.

Parameters:
popup - the ID of the popup widget.
See Also:
setPopup(zul.wgt.Popup)

getTooltip

public String getTooltip()
Returns the ID of the popup (Popup) that should be used as a tooltip window when the mouse hovers over the element for a moment. The tooltip will automatically disappear when the mouse is moved away.

Default: null (no tooltip).

Returns:
String the ID of the popup widget

setTooltip

public Widget setTooltip(Popup popup)
Sets the ID of the popup (Popup) that should be used as a tooltip window when the mouse hovers over the element for a moment.

An onOpen event is sent to the tooltip if it is going to appear. Therefore, developers can manipulate it dynamically (perhaps based on OpenEvent.getReference) by listening to the onOpen event.

Note: To simplify the use, it not only searches its ID space, but also all ID spaces in the desktop. It first searches its own ID space, and then the other Id spaces in the same browser window (might have one or multiple desktops).

If there are two components with the same ID (of course, in different ID spaces), you can specify the UUID with the following format:
uuid(comp_uuid)

Example:


 wgt.setTooltip('an_id');
 wgt.setTooltip('uuid(an_uuid)');
 wgt.setTooltip(a_wgt);
 
Both reference a component whose ID is "some". But, if there are several components with the same ID, the first one can reference to any of them. And, the second one reference to the component in the same ID space (of the label component).

The tooltip can be shown by a position from Popup.open(zk.Widget, Offset, String, Map) or the location of x and y, and can be specified with a delay time (in millisecond), you can specify the following format:

For example,
 wgt.setTooltip('an_id', 'start_before');
 
Since 6.5.2, the tooltip can also be shown on customized location of x and y by adding parentheses"()", for example,
 wgt.setPopup('an_id', 'x=(zk.currentPointer[0] + 10), y=(zk.currentPointer[1] - 10)');
 

Parameters:
popup - the popup widget.
Returns:
zul.Widget

setTooltip

public void setTooltip(String tooltip)
Sets the ID of the popup (Popup) that should be used as a tooltip window when the mouse hovers over the element for a moment.

Parameters:
tooltip - the ID of the popup widget.
See Also:
setPopup(zul.wgt.Popup)

getCtrlKeys

public String getCtrlKeys()
Returns what keystrokes to intercept.

Default: null.

Returns:
String

setCtrlKeys

public Widget setCtrlKeys(String keys)
Sets what keystrokes to intercept.

The string could be a combination of the following:

^k
A control key, i.e., Ctrl+k, where k could be a~z, 0~9, #n
@k
A alt key, i.e., Alt+k, where k could be a~z, 0~9, #n
$n
A shift key, i.e., Shift+n, where n could be #n. Note: $a ~ $z are not supported.
#home
Home
#end
End
#ins
Insert
#del
Delete
#bak
Backspace
#left
Left arrow
#right
Right arrow
#up
Up arrow
#down
Down arrow
#pgup
PageUp
#pgdn
PageDn
#f1 #f2 ... #f12
Function keys representing F1, F2, ... F12

For example,

^a^d@c#f10#left#right
It means you want to intercept Ctrl+A, Ctrl+D, Alt+C, F10, Left and Right.
^#left
It means Ctrl+Left.
^#f1
It means Ctrl+F1.
@#f3
It means Alt+F3.

Note: it doesn't support Ctrl+Alt, Shift+Ctrl, Shift+Alt or Shift+Ctrl+Alt.

Parameters:
keys -
Returns:
zul.Widget

beforeCtrlKeys_

protected boolean beforeCtrlKeys_(Event evt)
Called before a control key is pressed. A control key includes onOK and onCancel; refer to #setCtrlKeys for details.

Default: does nothing (but return false) It is usually overridden by a stateful widget, such as an input box, to update its state to the server, such as firing the onChange event.

Parameters:
evt - the widget event.
Returns:
boolean if true, the widget want to abort the firing of the control key. In other words, if true is returned, the control key is ignored.

afterKeyDown_

protected boolean afterKeyDown_(Event evt,
                                boolean simulated)
Called after Widget.doKeyDown_(zk.Event) is called and the event propagation is not stopped.

Default: handles the control keys, including onOK and onCancel, by searching up the ancestor chain to see if any one is listening. If found, it calls beforeCtrlKeys_(zk.Event) for each widget that were searched, and then fire the event.

Parameters:
evt - the widget event.
simulated - if the event was not sent to the widget originally (rather, it is caused by pressing when none of widget but document gains the focus)
Returns:
boolean true if the event has been processed
See Also:
setCtrlKeys(_global_.String)

getOpenTooltip

public static Widget getOpenTooltip()
Returns the tooltip that is opened, or null if no tooltip is opened.

Returns:
zk.Widget
Since:
5.0.5


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