NextApp Echo
App Container 1.0.5

nextapp.echoservlet.ui
Class ButtonRenderer

java.lang.Object
  extended bynextapp.echoservlet.ui.ButtonRenderer
All Implemented Interfaces:
java.io.Serializable

public class ButtonRenderer
extends java.lang.Object
implements java.io.Serializable

A utility for rendering buttons and toggle buttons.

See Also:
Serialized Form

Field Summary
private  java.lang.String id
           
private  java.lang.String linkStyleName
           
private  java.lang.String rolloverStyleName
           
private  Element root
           
private  java.lang.String scriptAction
           
private  java.lang.String scriptRolloverEnter
           
private  java.lang.String scriptRolloverExit
           
private  java.lang.String styleName
           
private  int subId
           
private  java.lang.String toolTipText
           
 
Constructor Summary
private ButtonRenderer(RenderingContext rc, AbstractButtonUI buttonUI)
          Creates a ButtonRenderer for the given Button.
 
Method Summary
private static void addAlignmentSettings(ComponentStyle style, int horizontalAlignment, int verticalAlignment)
          Adds alignment (text-align/vertical-align) properties to a ComponentStyle.
private  void addRolloverEvents(Element e)
          Adds MouseOver and MouseOut events that will trigger enabling/disabling rollover attributes on the element.
private  void addRolloverId(Element e)
          Adds an Id attribute to the element if a rollover style exists, such that the elements class may be changed to the rollover style when necessary.
private  Element createLinkElement()
          Creates a hyperlink element with the proper style and action.
static Element getElement(RenderingContext rc, AbstractButtonUI buttonUI)
          Returns an Element containing an HTML representation of the provided button.
private  Element getRoot()
          Returns the root element of the hierarchy of elements that will visually represent the button.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private java.lang.String id

rolloverStyleName

private java.lang.String rolloverStyleName

scriptAction

private java.lang.String scriptAction

scriptRolloverEnter

private java.lang.String scriptRolloverEnter

scriptRolloverExit

private java.lang.String scriptRolloverExit

subId

private int subId

styleName

private java.lang.String styleName

root

private Element root

linkStyleName

private java.lang.String linkStyleName

toolTipText

private java.lang.String toolTipText
Constructor Detail

ButtonRenderer

private ButtonRenderer(RenderingContext rc,
                       AbstractButtonUI buttonUI)
Creates a ButtonRenderer for the given Button.

Parameters:
rc - The RenderingContext that is rendering the button.
buttonUI - The peer of the button to be rendered.
Method Detail

addAlignmentSettings

private static void addAlignmentSettings(ComponentStyle style,
                                         int horizontalAlignment,
                                         int verticalAlignment)
Adds alignment (text-align/vertical-align) properties to a ComponentStyle.

Parameters:
style - The style to which the properties are to be added.
horizontalAlignment - The horizontal alignment setting desired for the style, one of the following value:
  • EchoConstants.LEFT
  • EchoConstants.CENTER
  • EchoConstants.RIGHT
verticalAlignment - The vertical alignment setting desired for the style, one of the following value:
  • EchoConstants.TOP
  • EchoConstants.CENTER
  • EchoConstants.BOTTOM

getElement

public static Element getElement(RenderingContext rc,
                                 AbstractButtonUI buttonUI)
Returns an Element containing an HTML representation of the provided button.

Parameters:
rc - The RenderingContext that is rendering the button.
buttonUI - The peer of the button to be rendered.
Returns:
A hierarchy of HTML elements that visually represent the button.

addRolloverEvents

private void addRolloverEvents(Element e)
Adds MouseOver and MouseOut events that will trigger enabling/disabling rollover attributes on the element. Also assigns the element an Id if rollover styles are enabled.

Parameters:
e - The Element to which rollover events will be added.

addRolloverId

private void addRolloverId(Element e)
Adds an Id attribute to the element if a rollover style exists, such that the elements class may be changed to the rollover style when necessary.

Parameters:
e - The Element to which an Id attribute will be added.

createLinkElement

private Element createLinkElement()
Creates a hyperlink element with the proper style and action.

Returns:
A hyperlink element with the proper style and action.

getRoot

private Element getRoot()
Returns the root element of the hierarchy of elements that will visually represent the button.

Returns:
The root element of the hierarchy of elements that will visually represent the button.

NextApp Echo
App Container 1.0.5