Project Wonder 5.0

er.extensions.components
Class ERXAccessibleSubmitButton

java.lang.Object
  extended by com.webobjects.appserver.WOElement
      extended by com.webobjects.appserver.WODynamicElement
          extended by com.webobjects.appserver._private.WODynamicGroup
              extended by com.webobjects.appserver._private.WOHTMLDynamicElement
                  extended by com.webobjects.appserver._private.WOInput
                      extended by er.extensions.components._private.ERXSubmitButton
                          extended by er.extensions.components.ERXAccessibleSubmitButton

public class ERXAccessibleSubmitButton
extends ERXSubmitButton

Extends ERXSubmitButton with self-configuring accessibility hot key for the button. The default hot key is the first character. If that has been used by a button that appeared earlier on the page, the next choice is a capital character. If no non-conflicting capital characters are available, it selects the first character that does not conflict with an earlier button. If you want a different hot key, specify it in the accesskey binding. Note that if this conflicts with the self configured choice for a button that appeared earlier on the page that this conflict will not be resolved. You will have to define an accesskey for the conflicting button as well. If you don't want a hot key, bind accesskey to the empty string.

The default is to use the u (underline) element to identify the hot key in the button text. Use the accesskeyElement binding to specify a different element. The element can be decorated with other attributes, e.g.

 accesskeyElement = "span style='text-decoration: underline;'";
 

You can have this class replace WOSubmitButton via ERXPatcher.setClassForName(ERXAccessibleSubmitButton.class, "WOSubmitButton"); or use it explicitly by name in your WOD. It works best (does the most work for you) if you use it with the value attribute. No self configuring is done if there is any content between the open and close tags.

See Also:
ERXSubmitButton
Author:
chill
Bindings
accesskey optional key for hot key, "" to disable hot key
           
accesskeyElement optional element name and decoration to wrap hot key character with in the button text
           
value the button text
           

Field Summary
protected  com.webobjects.appserver.WOAssociation _accesskey
           
protected  com.webobjects.appserver.WOAssociation _accesskeyElement
           
 
Fields inherited from class er.extensions.components._private.ERXSubmitButton
_action, _actionClass, _class, _directActionName, _id, _shouldSubmitForm, log, STYLE_PREFIX
 
Fields inherited from class com.webobjects.appserver._private.WOInput
_escapeHTML, _value
 
Fields inherited from class com.webobjects.appserver._private.WOHTMLDynamicElement
_associations, _constantAttributesRepresentation, _dyneltName, _finishedInitialization
 
Fields inherited from class com.webobjects.appserver._private.WODynamicGroup
_children
 
Fields inherited from class com.webobjects.appserver.WODynamicElement
_ConstructorParameters
 
Constructor Summary
ERXAccessibleSubmitButton(java.lang.String name, com.webobjects.foundation.NSDictionary<java.lang.String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOElement template)
           
 
Method Summary
protected  java.lang.String accesskey(com.webobjects.appserver.WOComponent component)
           
protected  java.lang.String accesskeyElement(com.webobjects.appserver.WOComponent component)
           
 void appendAttributesToResponse(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context)
          Adds the accesskey binding as we took it out of the associations dictionary
 void appendChildrenToResponse(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context)
          Adds styledValue between the open and close tags
 void appendToResponse(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context)
          Records the accesskey for this button so other buttons on the page won't use it.
protected  boolean hasUsedHotKey(com.webobjects.appserver.WOComponent component, java.lang.String hotKey)
           
protected  boolean isDisabled(com.webobjects.appserver.WOComponent component)
           
protected  void recordUsedHotKey(com.webobjects.appserver.WOComponent component, java.lang.String hotKey)
          Records that hotKey is being used by a ERXAccessibleSubmitButton on this page.
protected  java.lang.String styledValue(com.webobjects.appserver.WOComponent component)
           
protected  com.webobjects.foundation.NSMutableArray usedHotKeys(com.webobjects.appserver.WOComponent component)
           
 
Methods inherited from class er.extensions.components._private.ERXSubmitButton
_appendCloseTagToResponse, _appendNameAttributeToResponse, _appendOpenTagToResponse, _appendTypeAttributeToResponse, appendIEButtonFixToResponse, elementName, invokeAction, isDisabledInContext, takeValuesFromRequest, toString, type
 
Methods inherited from class com.webobjects.appserver._private.WOInput
_appendValueAttributeToResponse, _shouldEscapeHTML, constantAttributesRepresentation, disabledInComponent, nameInContext
 
Methods inherited from class com.webobjects.appserver._private.WOHTMLDynamicElement
_appendAttributesFromAssociationsToResponse, _frameworkNameInComponent, appendConstantAttributesToResponse, appendNonURLAttributesToResponse, appendURLAttributesToResponse, computeActionStringInContext, computeQueryDictionaryInContext, elementName, escapeHTML, nonUrlAttributeAssociations, urlAttributeAssociations
 
Methods inherited from class com.webobjects.appserver._private.WODynamicGroup
addChildElement, childrenElements, EmptyGroup, hasChildrenElements, invokeChildrenAction, takeChildrenValuesFromRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_accesskey

protected com.webobjects.appserver.WOAssociation _accesskey

_accesskeyElement

protected com.webobjects.appserver.WOAssociation _accesskeyElement
Constructor Detail

ERXAccessibleSubmitButton

public ERXAccessibleSubmitButton(java.lang.String name,
                                 com.webobjects.foundation.NSDictionary<java.lang.String,com.webobjects.appserver.WOAssociation> associations,
                                 com.webobjects.appserver.WOElement template)
Method Detail

accesskey

protected java.lang.String accesskey(com.webobjects.appserver.WOComponent component)
Parameters:
component - WOComponent to evaluate the associations in
Returns:
the character to use for the button's accesskey attribute, or null if there will not be an accesskey

accesskeyElement

protected java.lang.String accesskeyElement(com.webobjects.appserver.WOComponent component)
Parameters:
component - WOComponent to evaluate the associations in
Returns:
element name and decoration to wrap hot key character with in the button text

isDisabled

protected boolean isDisabled(com.webobjects.appserver.WOComponent component)
Parameters:
component - WOComponent to evaluate the associations in
Returns:
true if accesskey should not be generated

styledValue

protected java.lang.String styledValue(com.webobjects.appserver.WOComponent component)
Parameters:
component - WOComponent to evaluate the associations in
Returns:
String from the value binding with the accesskey wrapped in accesskeyElement

appendToResponse

public void appendToResponse(com.webobjects.appserver.WOResponse response,
                             com.webobjects.appserver.WOContext context)
Records the accesskey for this button so other buttons on the page won't use it.

Overrides:
appendToResponse in class ERXSubmitButton
See Also:
ERXSubmitButton.appendToResponse(com.webobjects.appserver.WOResponse, com.webobjects.appserver.WOContext)

appendAttributesToResponse

public void appendAttributesToResponse(com.webobjects.appserver.WOResponse response,
                                       com.webobjects.appserver.WOContext context)
Adds the accesskey binding as we took it out of the associations dictionary

Overrides:
appendAttributesToResponse in class ERXSubmitButton
See Also:
ERXSubmitButton.appendAttributesToResponse(com.webobjects.appserver.WOResponse, com.webobjects.appserver.WOContext)

appendChildrenToResponse

public void appendChildrenToResponse(com.webobjects.appserver.WOResponse response,
                                     com.webobjects.appserver.WOContext context)
Adds styledValue between the open and close tags

Overrides:
appendChildrenToResponse in class ERXSubmitButton
See Also:
ERXSubmitButton.appendChildrenToResponse(com.webobjects.appserver.WOResponse, com.webobjects.appserver.WOContext)

hasUsedHotKey

protected boolean hasUsedHotKey(com.webobjects.appserver.WOComponent component,
                                java.lang.String hotKey)
Parameters:
component - WOComponent to evaluate the associations in
hotKey - the character to check
Returns:
true if hotKey has been used by another ERXAccessibleSubmitButton on this page

recordUsedHotKey

protected void recordUsedHotKey(com.webobjects.appserver.WOComponent component,
                                java.lang.String hotKey)
Records that hotKey is being used by a ERXAccessibleSubmitButton on this page.

Parameters:
component - WOComponent to evaluate the associations in
hotKey - the character to record

usedHotKeys

protected com.webobjects.foundation.NSMutableArray usedHotKeys(com.webobjects.appserver.WOComponent component)
Parameters:
component - WOComponent to evaluate the associations in
Returns:
NSMutableArray containing the hotKeys being used by ERXAccessibleSubmitButtons on this page

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.