NextApp Echo
App Container 1.1.4

nextapp.echoservlet.ui
Class ToggleButtonUI

java.lang.Object
  extended bynextapp.echoservlet.ComponentPeer
      extended bynextapp.echoservlet.ui.AbstractButtonUI
          extended bynextapp.echoservlet.ui.ToggleButtonUI
All Implemented Interfaces:
Alignment, ClientActionProducer, java.util.EventListener, nextapp.echo.event.ImageUpdateListener, java.beans.PropertyChangeListener, java.io.Serializable
Direct Known Subclasses:
CheckBoxUI, RadioButtonUI

public abstract class ToggleButtonUI
extends AbstractButtonUI
implements java.beans.PropertyChangeListener

A base peer class for components derived from ToggleButton.

See Also:
Serialized Form

Field Summary
protected static java.lang.String ROLLOVER_SELECTED_ICON_IMAGE
          A constant used to identify the rollover selected icon for the in the ImageManager.
protected static java.lang.String SELECTED_ICON_IMAGE
          A constant used to identify the selected icon for the in the ImageManager.
protected static Service SERVICE_TOGGLE_BUTTON_SCRIPT
          A service providing JavaScript to handle client-side management of toggle buttons.
static java.lang.String TOGGLE_IMAGE_PREFIX
          A prefix used in the value of the image "name" attribute of a an <img> element rendered to represent a toggle button's state icon.
 
Fields inherited from class nextapp.echoservlet.ui.AbstractButtonUI
ICON_IMAGE, imageManager, renderedActive, ROLLOVER_ICON_IMAGE
 
Constructor Summary
ToggleButtonUI()
           
 
Method Summary
abstract  java.lang.String getDefaultStateImageUri(RenderingContext rc, boolean selected)
          Returns the URI of the default image used to represent the toggle button's state.
static java.lang.String getScriptCustomStateIconToggleRollover(Connection conn, java.lang.String id, java.lang.String stateId, java.lang.String imageUri, java.lang.String selectedImageUri, java.lang.String styleName)
          Returns the necessary script to produce a button rollover effect.
 Id getStateId()
          Returns the Id of the controller input field in which the ToggleButton's state is to be stored.
 java.lang.String getStateImageUri(RenderingContext rc, boolean selected)
          Returns the URI of the image that will be used to represent state for this particular toggle button.
 void propertyChange(java.beans.PropertyChangeEvent e)
           
 void registered()
          Called when the component is registered.
 void unregistered()
          Called when the component is unregistered.
 
Methods inherited from class nextapp.echoservlet.ui.AbstractButtonUI
clientAction, getHorizontalAlignment, getScriptAction, getVerticalAlignment, imageUpdate, render
 
Methods inherited from class nextapp.echoservlet.ComponentPeer
addAncillaryService, generateId, getBackground, getChildCount, getChildren, getComponent, getFocusedElementId, getFont, getForeground, getId, getInstancePeer, getParent, getPeer, getTabIndex, redraw, removeAncillaryService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOGGLE_IMAGE_PREFIX

public static final java.lang.String TOGGLE_IMAGE_PREFIX
A prefix used in the value of the image "name" attribute of a an <img> element rendered to represent a toggle button's state icon.

See Also:
Constant Field Values

SERVICE_TOGGLE_BUTTON_SCRIPT

protected static final Service SERVICE_TOGGLE_BUTTON_SCRIPT
A service providing JavaScript to handle client-side management of toggle buttons.


SELECTED_ICON_IMAGE

protected static final java.lang.String SELECTED_ICON_IMAGE
A constant used to identify the selected icon for the in the ImageManager.

See Also:
Constant Field Values

ROLLOVER_SELECTED_ICON_IMAGE

protected static final java.lang.String ROLLOVER_SELECTED_ICON_IMAGE
A constant used to identify the rollover selected icon for the in the ImageManager.

See Also:
Constant Field Values
Constructor Detail

ToggleButtonUI

public ToggleButtonUI()
Method Detail

getScriptCustomStateIconToggleRollover

public static java.lang.String getScriptCustomStateIconToggleRollover(Connection conn,
                                                                      java.lang.String id,
                                                                      java.lang.String stateId,
                                                                      java.lang.String imageUri,
                                                                      java.lang.String selectedImageUri,
                                                                      java.lang.String styleName)
Returns the necessary script to produce a button rollover effect.

Parameters:
conn - The connection on which the button is being rendered.
id - The Id of the toggle button.
stateId - The Id of the toggle button that holds the selected state of the toggle button. This property is different from the id on RadioButtons.
imageUri - The URI of the icon that should be displayed when the button is not selected.
selectedImageUri - The URI of the icon that should be displayed when the button is selected.
styleName - The toggle button's CSS style name.
Returns:
A JavaScript method call that may be invoked to produce mouse rollover effects.

getDefaultStateImageUri

public abstract java.lang.String getDefaultStateImageUri(RenderingContext rc,
                                                         boolean selected)
Returns the URI of the default image used to represent the toggle button's state.

Parameters:
rc - The RenderingContext to which the button is being rendered.
selected - True if the selected state image is being requested.
Returns:
The URI of the default state image.

getStateId

public Id getStateId()
Returns the Id of the controller input field in which the ToggleButton's state is to be stored. In the case where multiple RadioButtons are in a ButtonGroup, the state will be stored in only one field, specified by this method.

The default implementation returns the Id of this peer.

Returns:
The Id of the controller input field used to store the ToggleButton's state.

getStateImageUri

public java.lang.String getStateImageUri(RenderingContext rc,
                                         boolean selected)
Returns the URI of the image that will be used to represent state for this particular toggle button.

Parameters:
rc - The RenderingContext to which the button is being rendered.
selected - True if the selected state image is being requested.
Returns:
The URI of the state image.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class AbstractButtonUI
See Also:
PropertyChangeListener.propertyChange(PropertyChangeEvent)

registered

public void registered()
Description copied from class: ComponentPeer
Called when the component is registered. This method should be overridden if necessary.

Overrides:
registered in class AbstractButtonUI
See Also:
ComponentPeer.registered()

unregistered

public void unregistered()
Description copied from class: ComponentPeer
Called when the component is unregistered. This method should be overridden if necessary.

Overrides:
unregistered in class AbstractButtonUI
See Also:
ComponentPeer.unregistered()

NextApp Echo
App Container 1.1.4