OverviewSingleDeprecated

jsx3.gui

class ImageButton

Object
->jsx3.lang.Object
  ->jsx3.app.Model
    ->jsx3.gui.Painted
      ->jsx3.gui.Block
        ->jsx3.gui.ImageButton

All Implemented Interfaces:

jsx3.gui.Form, jsx3.gui.Interactive, jsx3.util.EventDispatcher

class ImageButton
extends jsx3.gui.Block
An object-oriented interface onto a GUI button made of various image files. The class allows for an image file for the following states: The following model events are published:

Since:

3.1

Field Summary
static int
STATE_OFF
Value for the state field indicating that the toggle button is off.
static int
STATE_ON
Value for the state field indicating that the toggle button is on.
static int
TYPE_NORMAL
Value for the type field indicating a normal button.
static int
TYPE_TOGGLE
Value for the type field indicating a toggle (2-state) button.
Constructor Summary
void
init(strName : String, vntLeft : int | String, vntTop : int | String, vntWidth : int, vntHeight : int)
The instance initializer.
Method Summary
int
If this image button is of type TYPE_TOGGLE, then the state must be either STATE_ON or required must be OPTIONAL to pass validation.
String
Returns the URI of the disabled image of this image button.
String
Returns the URI of the down image of this image button.
String
Returns the URI of the image of this image button.
String
Returns the URI of the on image of this image button.
String
Returns the URI of the over image of this image button.
int
Returns the current state of this image button.
int
Returns the type of this image button.
boolean
Returns true if the images of this image button are pre-fetched.
String
Paints this image button.
jsx3.gui.ImageButton
setDisabledImage(strImage : String)
Sets the URI of the disabled image of this image button.
jsx3.gui.ImageButton
setDownImage(strImage : String)
Sets the URI of the down image of this image button.
jsx3.gui.ImageButton
setImage(strImage : String)
Sets the URI of the image of this image button.
jsx3.gui.ImageButton
setOnImage(strImage : String)
Sets the URI of the on image of this image button.
jsx3.gui.ImageButton
setOverImage(strImage : String)
Sets the URI of the over image of this image button.
jsx3.gui.ImageButton
setPreFetch(bFetch : boolean)
Sets whether if the images of this image button are pre-fetched.
jsx3.gui.ImageButton
setState(intState : int)
Sets the current state of this image button and updates the displayed image accordingly.
jsx3.gui.ImageButton
setType(intType : int)
Sets the type of this image button.
Methods Inherited From jsx3.gui.Form
doKeyBinding, doReset, getDisabledBackgroundColor, getDisabledColor, getEnabled, getKeyBinding, getRequired, getValidationState, getValue, setDisabledBackgroundColor, setDisabledColor, setEnabled, setKeyBinding, setRequired, setValidationState, setValue
Methods Inherited From jsx3.gui.Block
getBackground, getBackgroundColor, getBorder, getCSSOverride, getClassName, getColor, getCursor, getDimensions, getDisplay, getFontName, getFontSize, getFontWeight, getHeight, getIndex, getLeft, getMargin, getOverflow, getPadding, getRelativePosition, getTagName, getText, getTextAlign, getTip, getTop, getVisibility, getWidth, getZIndex, hideMask, setBackground, setBackgroundColor, setBorder, setCSSOverride, setClassName, setColor, setCursor, setDimensions, setDisplay, setFontName, setFontSize, setFontWeight, setHeight, setIndex, setLeft, setMargin, setOverflow, setPadding, setRelativePosition, setTagName, setText, setTextAlign, setTip, setTop, setVisibility, setWidth, setZIndex, showMask
Methods Inherited From jsx3.gui.Interactive
doEvent, getCanDrag, getCanDrop, getCanMove, getCanSpy, getEvent, getEvents, getMenu, hasEvent, registerHotKey, removeEvent, removeEvents, setCanDrag, setCanDrop, setCanMove, setCanSpy, setEvent, setMenu, setSpyStyles, showSpy
Methods Inherited From jsx3.gui.Painted
focus, getAbsolutePosition, getAttribute, getAttributes, getDynamicProperty, getRendered, insertHTML, onAfterPaint, paintChild, paintChildren, recalcBox, removeAttribute, removeAttributes, repaint, setAttribute, setDynamicProperty
Methods Inherited From jsx3.app.Model
adoptChild, doClone, findAncestor, findDescendants, getAncestorOfName, getAncestorOfType, getChild, getChildIndex, getChildren, getDescendantOfName, getDescendantsOfType, getFirstChild, getFirstChildOfType, getHelpId, getId, getLastChild, getLoadType, getMetaValue, getNS, getName, getNextSibling, getParent, getPersistence, getPreviousSibling, getServer, getUriResolver, insertBefore, load, loadAndCache, loadXML, onAfterAssemble, onAfterAttach, onBeforeAssemble, onChangeServer, onDestroy, onRemoveChild, onSetChild, onSetParent, removeChild, removeChildren, setChild, setHelpId, setLoadType, setMetaValue, setName, setPersistence, toString, toXML, toXMLDoc
Methods Inherited From jsx3.util.EventDispatcher
publish, subscribe, unsubscribe, unsubscribeAll
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf
Field Detail

STATE_OFF

static final int STATE_OFF
Value for the state field indicating that the toggle button is off.

STATE_ON

static final int STATE_ON
Value for the state field indicating that the toggle button is on.

TYPE_NORMAL

static final int TYPE_NORMAL
Value for the type field indicating a normal button.

TYPE_TOGGLE

static final int TYPE_TOGGLE
Value for the type field indicating a toggle (2-state) button.
Constructor Detail

init

void init(strName : String, vntLeft : int | String, vntTop : int | String, vntWidth : int, vntHeight : int)
The instance initializer.

Parameters:

strNamethe JSX name
vntLefteither a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
vntTopeither a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
vntWidth
vntHeight
Method Detail

doValidate

int doValidate()
If this image button is of type TYPE_TOGGLE, then the state must be either STATE_ON or required must be OPTIONAL to pass validation.

Returns:

 

Overrides:

doValidate in jsx3.gui.Form

getDisabledImage

String getDisabledImage()
Returns the URI of the disabled image of this image button.

Returns:

 

getDownImage

String getDownImage()
Returns the URI of the down image of this image button.

Returns:

 

getImage

String getImage()
Returns the URI of the image of this image button.

Returns:

 

getOnImage

String getOnImage()
Returns the URI of the on image of this image button.

Returns:

 

getOverImage

String getOverImage()
Returns the URI of the over image of this image button.

Returns:

 

getState

int getState()
Returns the current state of this image button.

Returns:

STATE_OFF or STATE_ON 

See Also:

STATE_OFF, STATE_ON

getType

int getType()
Returns the type of this image button.

Returns:

TYPE_NORMAL or TYPE_TOGGLE 

See Also:

TYPE_NORMAL, TYPE_TOGGLE

isPreFetch

boolean isPreFetch()
Returns true if the images of this image button are pre-fetched.

Returns:

 

paint

String paint()
Paints this image button.

Returns:

 

Overrides:

paint in jsx3.gui.Block

setDisabledImage

jsx3.gui.ImageButton setDisabledImage(strImage : String)
Sets the URI of the disabled image of this image button. This is the image that is displayed when this image button disabled.

Parameters:

strImage

Returns:

this object  

setDownImage

jsx3.gui.ImageButton setDownImage(strImage : String)
Sets the URI of the down image of this image button. This is the image that is displayed when the mouse is down over the image button.

Parameters:

strImage

Returns:

this object  

setImage

jsx3.gui.ImageButton setImage(strImage : String)
Sets the URI of the image of this image button. This is the default image that is displayed if the button is off or if the button is in a state for which no image URI is specified.

Parameters:

strImage

Returns:

this object  

setOnImage

jsx3.gui.ImageButton setOnImage(strImage : String)
Sets the URI of the on image of this image button. This is the image that is displayed when this image button is of type TYPE_TOGGLE and its state is STATE_ON.

Parameters:

strImage

Returns:

this object  

setOverImage

jsx3.gui.ImageButton setOverImage(strImage : String)
Sets the URI of the over image of this image button. This is the image that is displayed when the mouse moves over the image button.

Parameters:

strImage

Returns:

this object  

setPreFetch

jsx3.gui.ImageButton setPreFetch(bFetch : boolean)
Sets whether if the images of this image button are pre-fetched. Pre-fetching allows for better responsiveness the first time a state image is displayed.

Parameters:

bFetch

Returns:

this object  

setState

jsx3.gui.ImageButton setState(intState : int)
Sets the current state of this image button and updates the displayed image accordingly.

Parameters:

intStateSTATE_OFF or STATE_ON

Returns:

this object  

setType

jsx3.gui.ImageButton setType(intType : int)
Sets the type of this image button.

Parameters:

intTypeTYPE_NORMAL or TYPE_TOGGLE

Returns:

this object