public class ERXComponentUtilities extends Object
Modifier and Type | Field and Description |
---|---|
static com.webobjects.appserver.WOAssociation |
EMPTY |
static com.webobjects.appserver.WOAssociation |
FALSE |
static com.webobjects.appserver.WOAssociation |
TRUE |
static com.webobjects.appserver.WOAssociation |
ZERO |
Constructor and Description |
---|
ERXComponentUtilities() |
Modifier and Type | Method and Description |
---|---|
static NSMutableDictionary<String,com.webobjects.appserver.WOAssociation> |
_queryParameterAssociations(NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
boolean removeQueryParameterAssociations) |
static NSMutableDictionary |
_queryParametersInComponent(NSMutableDictionary associations,
com.webobjects.appserver.WOComponent component) |
static void |
appendHtmlAttribute(String key,
com.webobjects.appserver.WOAssociation association,
com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOComponent component)
Appends an association as an HTML attribute.
|
static void |
appendHtmlAttributes(NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
NSArray<String> excludeKeys,
com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOComponent component)
Appends a dictionary of associations as HTML attributes.
|
static void |
appendHtmlAttributes(NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOComponent component)
Appends a dictionary of associations as HTML attributes.
|
static void |
appendHtmlAttributes(NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context)
Appends a dictionary of associations as HTML attributes.
|
static <T> NSArray<T> |
arrayValueForBinding(String name,
NSArray<T> defaultValue,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
com.webobjects.appserver.WOComponent component)
Retrieves the current array value of the given binding from the component.
|
static NSArray |
arrayValueForBinding(String name,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
com.webobjects.appserver.WOComponent component)
Retrieves the current array value of the given binding from the component.
|
static boolean |
bindingIsSettable(String name,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations)
Checks if the association for a binding with the given name can assign
values at runtime.
|
static com.webobjects.appserver.WOAssociation |
bindingNamed(String name,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations)
Returns the association for a binding with the given name.
|
static boolean |
booleanValueForBinding(String name,
boolean defaultValue,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
com.webobjects.appserver.WOComponent component)
Retrieves the current boolean value of the given binding from the component.
|
static boolean |
booleanValueForBinding(String name,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
com.webobjects.appserver.WOComponent component)
Retrieves the current boolean value of the given binding from the component.
|
static boolean |
booleanValueForBinding(com.webobjects.appserver.WOComponent component,
String bindingName)
Returns the boolean value of a binding.
|
static boolean |
booleanValueForBinding(com.webobjects.appserver.WOComponent component,
String bindingName,
boolean defaultValue)
Returns the boolean value of a binding.
|
static NSArray<String> |
componentTree()
Returns an array of the current component names.
|
static boolean |
hasBinding(String name,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations)
Checks if there is an association for a binding with the given name.
|
static String |
htmlTemplate(String componentName,
NSArray languages)
Returns the contents of the html template for the given component name as
a string.
|
static URL |
htmlTemplateUrl(String componentName,
NSArray languages)
Returns the URL of the html template for the given component name.
|
static com.webobjects.appserver.WOElement |
inheritTemplateFrom(String componentName,
NSArray<String> languages)
Allows a component to "inherit" the template (.html and .wod files) from another component.
|
static int |
integerValueForBinding(String name,
int defaultValue,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
com.webobjects.appserver.WOComponent component)
Retrieves the current int value of the given binding from the component.
|
static <T extends com.webobjects.appserver.WOComponent> |
pageWithName(Class<T> componentClass)
Calls pageWithName with ERXWOContext.currentContext() for the current
thread.
|
static <T extends com.webobjects.appserver.WOComponent> |
pageWithName(Class<T> componentClass,
com.webobjects.appserver.WOContext context)
Returns the component for the given class without having to cast.
|
static NSMutableDictionary<String,com.webobjects.appserver.WOAssociation> |
queryParameterAssociations(NSDictionary<String,com.webobjects.appserver.WOAssociation> associations)
Returns the set of ?key=value associations from an associations
dictionary.
|
static NSMutableDictionary<String,com.webobjects.appserver.WOAssociation> |
queryParameterAssociations(NSMutableDictionary<String,com.webobjects.appserver.WOAssociation> associations,
boolean removeQueryParameterAssociations)
Returns the set of ?key=value associations from an associations
dictionary.
|
static NSMutableDictionary |
queryParametersInComponent(NSDictionary associations,
com.webobjects.appserver.WOComponent component)
Returns a query parameter dictionary from a set of ?key=association
WOAssociation dictionary.
|
static NSMutableDictionary |
queryParametersInComponent(NSMutableDictionary associations,
com.webobjects.appserver.WOComponent component,
boolean removeQueryParametersAssociations)
Returns a query parameter dictionary from a set of ?key=association
WOAssociation dictionary.
|
static void |
setValueForBinding(Object value,
String name,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
com.webobjects.appserver.WOComponent component)
Will try to set the given binding in the component to the passed value.
|
static String |
stringValueForBinding(String name,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
com.webobjects.appserver.WOComponent component)
Retrieves the current string value of the given binding from the component.
|
static String |
stringValueForBinding(String name,
String defaultValue,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
com.webobjects.appserver.WOComponent component)
Retrieves the current string value of the given binding from the component.
|
static String |
template(String componentName,
String extension,
NSArray languages)
Returns the contents of the template for the given component name as a
string.
|
static URL |
templateUrl(String componentName,
String extension,
NSArray languages)
Returns the URL of the template for the given component name.
|
static Object |
valueForBinding(String name,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
com.webobjects.appserver.WOComponent component)
Retrieves the current value of the given binding from the component.
|
static Object |
valueForBinding(String name,
Object defaultValue,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
com.webobjects.appserver.WOComponent component)
Retrieves the current value of the given binding from the component.
|
public static com.webobjects.appserver.WOAssociation TRUE
public static com.webobjects.appserver.WOAssociation FALSE
public static com.webobjects.appserver.WOAssociation EMPTY
public static com.webobjects.appserver.WOAssociation ZERO
public static NSMutableDictionary queryParametersInComponent(NSDictionary associations, com.webobjects.appserver.WOComponent component)
associations
- the set of associationscomponent
- the component to evaluate their values withinpublic static NSMutableDictionary queryParametersInComponent(NSMutableDictionary associations, com.webobjects.appserver.WOComponent component, boolean removeQueryParametersAssociations)
associations
- the set of associationscomponent
- the component to evaluate their values withinremoveQueryParametersAssociations
- should the entries be removed from the passed-in dictionary?public static NSMutableDictionary _queryParametersInComponent(NSMutableDictionary associations, com.webobjects.appserver.WOComponent component)
public static NSMutableDictionary<String,com.webobjects.appserver.WOAssociation> queryParameterAssociations(NSDictionary<String,com.webobjects.appserver.WOAssociation> associations)
associations
- the associations to enumeratepublic static NSMutableDictionary<String,com.webobjects.appserver.WOAssociation> queryParameterAssociations(NSMutableDictionary<String,com.webobjects.appserver.WOAssociation> associations, boolean removeQueryParameterAssociations)
true
, the
corresponding entries will be removed from the associations dictionary
that was passed in.associations
- the associations to enumerateremoveQueryParameterAssociations
- should the entries be removed from the passed-in dictionary?public static NSMutableDictionary<String,com.webobjects.appserver.WOAssociation> _queryParameterAssociations(NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, boolean removeQueryParameterAssociations)
public static boolean booleanValueForBinding(com.webobjects.appserver.WOComponent component, String bindingName)
component
- the componentbindingName
- the name of the boolean bindingpublic static boolean booleanValueForBinding(com.webobjects.appserver.WOComponent component, String bindingName, boolean defaultValue)
component
- the componentbindingName
- the name of the boolean bindingdefaultValue
- the default value if the binding is nullpublic static URL htmlTemplateUrl(String componentName, NSArray languages)
componentName
- the name of the component to load a template for (without the
.wo)languages
- the list of languages to use for finding componentspublic static URL templateUrl(String componentName, String extension, NSArray languages)
componentName
- the name of the component to load a template for (without the
.wo)extension
- the file extension of the template (without the dot -- i.e.
"html")languages
- the list of languages to use for finding componentspublic static String htmlTemplate(String componentName, NSArray languages) throws IOException
componentName
- the name of the component to load a template for (without the
.wo)languages
- the list of languages to use for finding componentsIOException
public static String template(String componentName, String extension, NSArray languages) throws IOException
componentName
- the name of the component to load a template for (without the
.wo)extension
- the file extension of the template (without the dot -- i.e.
"html")languages
- the list of languages to use for finding componentsIOException
public static com.webobjects.appserver.WOElement inheritTemplateFrom(String componentName, NSArray<String> languages)
Usage in your WOComponent subclass:
@Override public WOElement template() { return ERXComponentUtilities.inheritTemplateFrom("AddAddress", session().languages()); }This very simple implementation does have some limitations:
componentName
- the name of the component whose template will be inheritedlanguages
- the list of languages to use for finding componentsWOComponent.template()
public static NSArray<String> componentTree()
public static void appendHtmlAttributes(NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context)
associations
- the associations dictionaryresponse
- the response to write tocontext
- the contextpublic static void appendHtmlAttributes(NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOComponent component)
associations
- the associations dictionaryresponse
- the response to write tocomponent
- the component to evaluate the associations withinpublic static void appendHtmlAttributes(NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, NSArray<String> excludeKeys, com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOComponent component)
associations
- the associations dictionaryexcludeKeys
- the associations to ignoreresponse
- the response to write tocomponent
- the component to evaluate the associations withinpublic static void appendHtmlAttribute(String key, com.webobjects.appserver.WOAssociation association, com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOComponent component)
key
- the key to appendassociation
- the associationresponse
- the response to write tocomponent
- the component to evaluate the association withinpublic static <T extends com.webobjects.appserver.WOComponent> T pageWithName(Class<T> componentClass, com.webobjects.appserver.WOContext context)
T
- the type of component tocomponentClass
- the component class to lookupcontext
- the contextpublic static <T extends com.webobjects.appserver.WOComponent> T pageWithName(Class<T> componentClass)
T
- the type of component tocomponentClass
- the component class to lookuppublic static boolean hasBinding(String name, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations)
name
- binding nameassociations
- array of associationstrue
if the association existspublic static com.webobjects.appserver.WOAssociation bindingNamed(String name, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations)
null
will be returned.name
- binding nameassociations
- array of associationsnull
public static boolean bindingIsSettable(String name, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations)
name
- binding nameassociations
- array of associationstrue
if binding is settablepublic static void setValueForBinding(Object value, String name, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOComponent component)
value
- new value for the bindingname
- binding nameassociations
- array of associationscomponent
- component to set the value inpublic static Object valueForBinding(String name, Object defaultValue, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOComponent component)
null
the default
value will be returned.name
- binding namedefaultValue
- default valueassociations
- array of associationscomponent
- component to get value frompublic static Object valueForBinding(String name, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOComponent component)
null
will be returned.name
- binding nameassociations
- array of associationscomponent
- component to get value fromnull
public static String stringValueForBinding(String name, String defaultValue, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOComponent component)
null
the default
value will be returned.name
- binding namedefaultValue
- default valueassociations
- array of associationscomponent
- component to get value frompublic static String stringValueForBinding(String name, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOComponent component)
null
will be returned.name
- binding nameassociations
- array of associationscomponent
- component to get value fromnull
public static boolean booleanValueForBinding(String name, boolean defaultValue, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOComponent component)
name
- binding namedefaultValue
- default valueassociations
- array of associationscomponent
- component to get value frompublic static boolean booleanValueForBinding(String name, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOComponent component)
false
will be returned.name
- binding nameassociations
- array of associationscomponent
- component to get value fromfalse
public static int integerValueForBinding(String name, int defaultValue, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOComponent component)
name
- binding namedefaultValue
- default valueassociations
- array of associationscomponent
- component to get value frompublic static <T> NSArray<T> arrayValueForBinding(String name, NSArray<T> defaultValue, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOComponent component)
null
the default
value will be returned.name
- binding namedefaultValue
- default valueassociations
- array of associationscomponent
- component to get value frompublic static NSArray arrayValueForBinding(String name, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOComponent component)
null
will be returned.name
- binding nameassociations
- array of associationscomponent
- component to get value fromnull
Copyright © 2002 – 2020 Project Wonder.