zul.wgt
Class Toolbarbutton

java.lang.Object
  extended by zk.Object
      extended by zk.Widget
          extended by zul.Widget
              extended by zul.LabelImageWidget
                  extended by zul.wgt.Toolbarbutton

public class Toolbarbutton
extends LabelImageWidget

A toolbar button.

Non-xul extension: Toolbarbutton supports getHref(). If getHref() is not null, the onClick handler is ignored and this element is degenerated to HTML's A tag.

Default Widget.getZclass(): z-toolbarbutton.


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
 String getAutodisable()
          Returns a list of component IDs that shall be disabled when the user clicks this button.
 String getDir()
          Returns the direction.
 String getHref()
          Returns the href that the browser shall jump to, if an user clicks this button.
 String getMode()
          Returns the mode.
 String getOrient()
          Returns the orient.
 int getTabindex()
          Returns the tab order of this component.
 String getTarget()
          Returns the target frame or window.
 String getUpload()
          Returns non-null if this button is used for file upload, or null otherwise.
 boolean isChecked()
          Returns whether it is checked.
 boolean isDisabled()
          Returns whether it is disabled.
 void setAutodisable(String autodisable)
          Sets whether to disable the button after the user clicks it.
 void setChecked(boolean val)
          Sets whether it is checked.
 void setDir(String dir)
          Sets the direction.
 void setDisabled(boolean disabled)
          Sets whether it is disabled.
 void setHref(String href)
          Sets the href.
 void setMode(String mode)
          Sets the mode.
 void setOrient(String orient)
          Sets the orient.
 void setTabindex(int tabindex)
          Sets the tab order of this component.
 void setTarget(String target)
          Sets the target frame or window.
 void setUpload(String upload)
          Sets the JavaScript class at the client to handle the upload if this button is used for file upload.
 
Methods inherited from class zul.LabelImageWidget
domContent_, domImage_, domLabel_, getHoverImage, getImage, getImageNode, getLabel, setHoverImage, setImage, setLabel, updateDomContent_
 
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_, bindTapHold_, canActivate, cleanDrag_, clear, clearCache, cloneDrag_, deferRedraw_, 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, 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

setMode

public void setMode(String mode)
Sets the mode. (default/toggle)

Parameters:
mode -

getMode

public String getMode()
Returns the mode.

Returns:
String

setChecked

public void setChecked(boolean val)
Sets whether it is checked. (Note:It's only available in toggle mode.)

Parameters:
val -

isChecked

public boolean isChecked()
Returns whether it is checked. (Note:It's only available in toggle mode.)

Default: false.

Returns:
boolean

setDisabled

public void setDisabled(boolean disabled)
Sets whether it is disabled.

Parameters:
disabled -

isDisabled

public boolean isDisabled()
Returns whether it is disabled.

Default: false.

Returns:
boolean

setHref

public void setHref(String href)
Sets the href.

Parameters:
href -

getHref

public String getHref()
Returns the href that the browser shall jump to, if an user clicks this button.

Default: null. If null, the button has no function unless you specify the onClick event listener.

If it is not null, the onClick event won't be sent.

Returns:
String

setTarget

public void setTarget(String target)
Sets the target frame or window.

Parameters:
target - the name of the frame or window to hyperlink.

getTarget

public String getTarget()
Returns the target frame or window.

Note: it is useful only if href (setHref(_global_.String)) is specified (i.e., use the onClick listener).

Default: null.

Returns:
String

setDir

public void setDir(String dir)
Sets the direction.

Parameters:
dir - either "normal" or "reverse".

getDir

public String getDir()
Returns the direction.

Default: "normal".

Returns:
String

setOrient

public void setOrient(String orient)
Sets the orient.

Parameters:
orient - either "horizontal" or "vertical".

getOrient

public String getOrient()
Returns the orient.

Default: "horizontal".

Returns:
String

setTabindex

public void setTabindex(int tabindex)
Sets the tab order of this component.

Parameters:
tabindex -

getTabindex

public int getTabindex()
Returns the tab order of this component.

Default: -1 (means the same as browser's default).

Returns:
int

setAutodisable

public void setAutodisable(String autodisable)
Sets whether to disable the button after the user clicks it.

Parameters:
autodisable -

getAutodisable

public String getAutodisable()
Returns a list of component IDs that shall be disabled when the user clicks this button.

To represent the button itself, the developer can specify self. For example,


 button.setId('ok');
 wgt.setAutodisable('self,cancel');
 
is the same as

 button.setId('ok');
 wgt.setAutodisable('ok,cancel');
 
that will disable both the ok and cancel buttons when an user clicks it.

The button being disabled will be enabled automatically once the client receives a response from the server. In other words, the server doesn't notice if a button is disabled with this method.

However, if you prefer to enable them later manually, you can prefix with '+'. For example,


 button.setId('ok');
 wgt.setAutodisable('+self,+cancel');
 

Then, you have to enable them manually such as

if (something_happened){
  ok.setDisabled(false);
  cancel.setDisabled(false);

Default: null.

Returns:
String

setUpload

public void setUpload(String upload)
Sets the JavaScript class at the client to handle the upload if this button is used for file upload.

Default: null.

For example, the following example declares a button for file upload:


 button.setLabel('Upload');
 button.setUpload('true');
 

If you want to customize the handling of the file upload at the client, you can specify a JavaScript class when calling this method: button.setUpload('foo.Upload');

Another options for the upload can be specified as follows:

button.setUpload('true,maxsize=-1,native');

Parameters:
upload - a JavaScript class to handle the file upload at the client, or "true" if the default class is used, or null or "false" to disable the file download (and then this button behaves like a normal button).

getUpload

public String getUpload()
Returns non-null if this button is used for file upload, or null otherwise. Refer to setUpload(_global_.String) for more details.

Returns:
String


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