|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.goodeast.webobjects.switchablestring.SSHelper
A helper class that is used to add behavior to the dynamic elements. This
class allows us to add multiple inheritance-like extensions to a class's
behavior within the constraints of Java. It has alternative implementations
of appendToResponse and takeValuesFromRequest that can provide static
content as well as form elements.
To use this class, you need to declare that your class implements the
SSHelper.Callbacks interface and implement four methods in your class as follows
(assuming that you have an NSDictionary of WOAssociations called "associations"
as an instance variable):
public void appendToResponse( WOResponse r, WOContext c ) {
SSHelper.performAppendToResponse( r, c, associations, this );}
public void takeValuesFromRequest( WORequest r, WOContext c ) {
SSHelper.performTakeValuesFromRequest( r, c, associations, this );}
public void callSuperAppendToResponse( WOResponse r, WOContext c ) {
super.appendToResponse( r, c );}
public void callSuperTakeValuesFromRequest( WORequest r, WOContext c ) {
super.takeValuesFromRequest( r, c );}
Nested Class Summary | |
static interface |
SSHelper.Callbacks
Used to provide callbacks into the dynamic elements so that the helper can call superclass methods. |
Field Summary | |
protected static java.lang.String |
DEFAULT_SEPARATOR
For lists of items, such as from WOCheckboxMatrix or WOBrowser, the default item separator is ", ". |
Method Summary | |
protected static boolean |
booleanValueForAssociation(java.lang.String assocName,
com.webobjects.foundation.NSDictionary assocDict,
com.webobjects.appserver.WOContext c)
Boolean version of valueForAssociation(). |
static com.webobjects.foundation.NSDictionary |
cleanUpAssociations(com.webobjects.foundation.NSDictionary incomingAssociations,
com.webobjects.foundation.NSArray myAssociations)
Cleans up the dictionary of associations to remove any that are specific to the SwitchableString framework. |
protected static java.lang.String |
filterContent(java.lang.String truncatedString,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOContext c)
Filters the HTML content based on the escapeHTML, allowedTags, and disallowedTags bindings. |
static void |
performAppendToResponse(com.webobjects.appserver.WOResponse r,
com.webobjects.appserver.WOContext c,
com.webobjects.foundation.NSDictionary associations,
SSHelper.Callbacks dynelt)
Performs the appendToResponse phase for a SwitchableString element. |
static void |
performTakeValuesFromRequest(com.webobjects.appserver.WORequest r,
com.webobjects.appserver.WOContext c,
com.webobjects.foundation.NSDictionary associations,
SSHelper.Callbacks dynelt)
Performs the takeValuesFromRequest phase for a SwitchableString element. |
protected static java.lang.String |
readRawValue(com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOContext c)
Returns the contents of the form element, based on which bindings exist. |
protected static java.lang.String |
stringForSelection(java.lang.Object rawValue,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOContext c)
Returns a raw value string based on the selection binding. |
protected static java.lang.String |
stringForSelections(com.webobjects.foundation.NSArray selections,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOContext c)
Returns a raw value string based on the selections binding. |
protected static java.lang.String |
stringForValue(java.lang.Object rawValue,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOContext c)
Returns a raw value string based on the raw value passed through any formatter or formatter subclass that might be bound to the dynamic element. |
protected static java.lang.String |
truncateRawValueString(java.lang.String rawValueString,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOContext c)
Truncates the raw value string at the right length. |
protected static java.lang.Object |
valueForAssociation(java.lang.String assocName,
com.webobjects.foundation.NSDictionary assocDict,
com.webobjects.appserver.WOContext c)
Utility method that makes it neater to pull out an association's value and handles the absence of a binding gracefully. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String DEFAULT_SEPARATOR
Method Detail |
public static com.webobjects.foundation.NSDictionary cleanUpAssociations(com.webobjects.foundation.NSDictionary incomingAssociations, com.webobjects.foundation.NSArray myAssociations)
incomingAssociations
- Dictionary of all incoming WOAssociationsmyAssociations
- Array of associations that should be
removed
protected static java.lang.Object valueForAssociation(java.lang.String assocName, com.webobjects.foundation.NSDictionary assocDict, com.webobjects.appserver.WOContext c)
assocName
- Name of the associationassocDict
- Dictionary of WOAssociationsc
- WOContext in which to evaluate the association
protected static boolean booleanValueForAssociation(java.lang.String assocName, com.webobjects.foundation.NSDictionary assocDict, com.webobjects.appserver.WOContext c)
assocName
- Name of the associationassocDict
- Dictionary of WOAssociationsc
- WOContext in which to evaluate the association
public static void performAppendToResponse(com.webobjects.appserver.WOResponse r, com.webobjects.appserver.WOContext c, com.webobjects.foundation.NSDictionary associations, SSHelper.Callbacks dynelt)
editable
binding is absent, or is present and has a value of true,
then the element is a form element and control flow is passed on to the superclass's
method to generate the appropriate HTML.
r
- Current WOResponsec
- Current WOContextassociations
- Dictionary of WOAssociationsdynelt
- Original WODynamicElement, so that superclass
functionality can be invokedprotected static java.lang.String readRawValue(com.webobjects.foundation.NSDictionary associations, com.webobjects.appserver.WOContext c)
associations
- Dictionary of WOAssociationsc
- The current WOContext
protected static java.lang.String stringForValue(java.lang.Object rawValue, com.webobjects.foundation.NSDictionary associations, com.webobjects.appserver.WOContext c)
rawValue
- Object returned from the value bindingassociations
- Dictionary of WOAssociationsc
- The current WOContext
protected static java.lang.String stringForSelection(java.lang.Object rawValue, com.webobjects.foundation.NSDictionary associations, com.webobjects.appserver.WOContext c)
rawValue
- Object returned from the selection bindingassociations
- Dictionary of WOAssociationsc
- The current WOContext
protected static java.lang.String stringForSelections(com.webobjects.foundation.NSArray selections, com.webobjects.foundation.NSDictionary associations, com.webobjects.appserver.WOContext c)
selections
- Object returned from the selections bindingassociations
- Dictionary of WOAssociationsc
- The current WOContext
protected static java.lang.String truncateRawValueString(java.lang.String rawValueString, com.webobjects.foundation.NSDictionary associations, com.webobjects.appserver.WOContext c)
rawValueString
- String value from the appropriate binding for the
current elementassociations
- Dictionary of WOAssociationsc
- The current WOContext
protected static java.lang.String filterContent(java.lang.String truncatedString, com.webobjects.foundation.NSDictionary associations, com.webobjects.appserver.WOContext c)
truncatedString
- String to be filteredassociations
- Dictionary of WOAssociationsc
- The current WOContext
public static void performTakeValuesFromRequest(com.webobjects.appserver.WORequest r, com.webobjects.appserver.WOContext c, com.webobjects.foundation.NSDictionary associations, SSHelper.Callbacks dynelt)
editable
binding is absent, or is present and has a value of true,
then the element is a form element and control flow is passed on to the superclass's
method to extract the form values from the WORequest.
r
- The current WORequestc
- The current WOContextassociations
- Dictionary of WOAssociationsdynelt
- Original WODynamicElement, so that superclass
functionality can be invoked
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |