ERXComponent Class Reference

Inherits com::webobjects::appserver::WOComponent.

Inherited by MonitorComponent, AjaxSocialNetworkLink, AjaxWOWODCComponent, ComponentRevealExample, AjaxStatelessJSONClient, ERAkismet, ERReCaptcha, CCSegmentedSlider, CaptchaPage, ERPChartsPage, ExcelGeneratedPage, ExcelGenerationPage, GoogleChartsPage, Main, ERXFlickrBatchNavigation, ERXBooleanPopUpButton, ERXNonSynchronizingComponent, ERXSimpleSpamCheck, ERIUIContainer, ERIUIDialogButton, ERIUIPreference, ERIUIPreferenceGroup, ERIUIToggleButton, ERIUIToolBar, ERIUIViewport, ArrayView, DictionaryView, Main, Prefs, ERMODComponent, MenuHeader, PageWrapper, Main, MovieDetail, MovieList, Wrapper, Main, PersonShowPage, RestHeaderFooter, ERXRouteURL, SEComponent, SEEntitySnapshots, SESnapshotsList, ERTagCloud, ERTagField, Main, Main, and UberComponent.

Collaboration diagram for ERXComponent:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void _awakeInContext (WOContext aArg0)
void appendToResponse (WOResponse response, WOContext context)
boolean clickToOpenEnabled (WOResponse response, WOContext context)
String componentName ()
NSMutableDictionary dynamicBindings ()
 ERXComponent (WOContext context)
WOActionResults invokeAction (WORequest request, WOContext context)
ERXLocalizer localizer ()
void reset ()
void takeValuesFromRequest (WORequest request, WOContext context)

Protected Member Functions

void _checkAccess () throws SecurityException
String _frameworkName ()
void _includeCSSResources (WOResponse response, WOContext context)
void _includeJavascriptResources (WOResponse response, WOContext context)
NSArray< StringadditionalCSSFiles ()
NSArray< StringadditionalJavascriptFiles ()
boolean booleanValueForBinding (String binding, ERXUtilities.BooleanOperation defaultValue)
boolean booleanValueForBinding (String binding, boolean defaultValue)
boolean booleanValueForBinding (String binding)
void checkAccess () throws SecurityException
String defaultCSSPath ()
String defaultJavascriptPath ()
float floatValueForBinding (String binding, float defaultValue)
int intValueForBinding (String binding, int defaultValue)
boolean isPageAccessAllowed ()
Object objectValueForBinding (String binding, Object defaultValue)
Object objectValueForBinding (String binding)
void postAppendToResponse (WOResponse response, WOContext context)
void preAppendToResponse (WOResponse response, WOContext context)
String primaryCSSFile ()
String primaryJavascriptFile ()
String stringValueForBinding (String binding, String defaultValue)
String stringValueForBinding (String binding)
boolean useDefaultComponentCSS ()
boolean useDefaultComponentJavascript ()

Protected Attributes

NSMutableDictionary _dynamicBindings = null

Package Functions

public< T extends WOComponent > T pageWithName (Class< T > componentClass)


Detailed Description

ERXComponent provides a common base class for WOComponents along with a bunch of miscellaneous handy features.

Author:
mschrag

Constructor & Destructor Documentation

ERXComponent ( WOContext  context  ) 

Constructs a new ERXComponent.

Parameters:
context the WOContext


Member Function Documentation

void _awakeInContext ( WOContext  aArg0  ) 

void _checkAccess (  )  throws SecurityException [protected]

_checkAccess is called prior to all three phases of the R-R loop to ensure that the user has permission to access this component. You should override checkAccess to implement addition security checks.

Exceptions:
SecurityException if the user does not have permission

String _frameworkName (  )  [protected]

Returns the name of this component's framework or "app" if frameworkName() returns null.

Returns:
the name of this component's framework

void _includeCSSResources ( WOResponse  response,
WOContext  context 
) [protected]

Injects per-component CSS dependencies into the head tag based on the definitions in useDefaultComponentCSS(), defaultCSSPath(), primaryCSSFile(), and additionalCSSFiles().

If you return true for useDefaultComponentCSS (and do not override primaryCSSFile), this component will inject a reference to defaultCSSPath() + /YourComponentName.css. For instance, if your component is named HeaderFooter, useDefaultComponentCSS will automatically add a reference to defaultCSSPath() + /HeaderFooter.css for you. This allows you to very easily specify per-component CSS files without upper-level components knowing about them. Currently _includeCSSResources does not try to do anything fancy in terms of recombinding CSS files.

Override defaultCSSPath to provide the base path relative to WebServerResources that contains your CSS files. If all of your CSS is in WebServerResources/css, you would return "css" from defaultCSSPath().

If you do not want to use the component's name as the name of the CSS file, you can optionally override primaryCSSFile() to return the name of a specific CSS file, as well as additionalCSSFiles() to return an NSArray of CSS files. All of these file names will be prepended with the defaultCSSPath if it is set.

Parameters:
response the response to write into
context the current context

void _includeJavascriptResources ( WOResponse  response,
WOContext  context 
) [protected]

Injects per-component javascript dependencies into the head tag based on the definitions in useDefaultComponentJavascript(), defaultJavascriptPath(), primaryJavascriptFile(), and additionalJavascriptFiles().

If you return true for useDefaultComponentJavascript (and do not override primaryJavascriptFile), this component will inject a reference to defaultJavascriptPath() + /YourComponentName.js. For instance, if your component is named HeaderFooter, useDefaultComponentJavascript will automatically add a reference to defaultJavascriptPath() + /HeaderFooter.js for you. This allows you to very easily specify per-component Javascript files without upper-level components knowing about them. Currently _includeJavascriptResources does not try to do anything fancy in terms of recombinding Javascript files.

Override defaultJavascriptPath to provide the base path relative to WebServerResources that contains your Javascript files. If all of your Javascript is in WebServerResources/scripts, you would return "scripts" from defaultJavascriptPath().

If you do not want to use the component's name as the name of the Javascript file, you can optionally override primaryJavascriptFile() to return the name of a specific Javascript file, as well as additionalJavascriptFiles() to return an NSArray of Javascript files. All of these file names will be prepended with the defaultJavascriptPath if it is set.

Parameters:
response the response to write into
context the current context

NSArray<String> additionalCSSFiles (  )  [protected]

Returns an array of additional CSS files for this component, or null (or empty array) if there aren't any. Each path will be prepended with defaultCSSPath().

Returns:
an array of additional CSS files for this component.

NSArray<String> additionalJavascriptFiles (  )  [protected]

Returns an array of additional Javascript files for this component, or null (or empty array) if there aren't any. Each path will be prepended with defaultJavascriptPath().

Returns:
an array of additional Javascript files for this component.

void appendToResponse ( WOResponse  response,
WOContext  context 
)

boolean booleanValueForBinding ( String  binding,
ERXUtilities.BooleanOperation  defaultValue 
) [protected]

Resolves a given binding as a boolean value with the option of specifing a boolean operator as the default value.

Parameters:
binding name of the component binding.
defaultValue boolean operator to be evaluated if the binding is not present.
Returns:
result of evaluating binding as a boolean.

boolean booleanValueForBinding ( String  binding,
boolean  defaultValue 
) [protected]

Resolves a given binding as a boolean value.

Parameters:
binding binding to be resolved as a boolean value.
defaultValue default boolean value to be used if the binding is not bound.
Returns:
result of evaluating binding as a boolean.

boolean booleanValueForBinding ( String  binding  )  [protected]

Resolves a given binding as a boolean value. Defaults to false.

Parameters:
binding binding to be resolved as a boolean value.
Returns:
result of evaluating binding as a boolean.

void checkAccess (  )  throws SecurityException [protected]

Override to provide custom security checks. It is not necessary to call super on this method.

Exceptions:
SecurityException if the security check fails

Reimplemented in SEPage.

boolean clickToOpenEnabled ( WOResponse  response,
WOContext  context 
)

Returns whether or not click-to-open should be enabled for this component. By default this returns ERXClickToOpenSupport.isEnabled().

Parameters:
response the response
context the context
Returns:
whether or not click-to-open is enabled for this component

String componentName (  ) 

Returns the name of this component without the package name.

Returns:
the name of this component without the package name

String defaultCSSPath (  )  [protected]

Returns the default path prefix for CSS, which will be prepended to all required CSS files for this component. The default is "".

Returns:
the default CSS path.

String defaultJavascriptPath (  )  [protected]

Returns the default path prefix for Javascript, which will be prepended to all required Javascript files for this component. The default is "".

Returns:
the default Javascript path.

NSMutableDictionary dynamicBindings (  ) 

Lazily initialized dictionary which can be used for the 'item' binding in a repetition for example: 'item = dynamicBindings.myVariable'. Useful in rapid turnaround modes where adding a iVar would cause hot code swapping to stop working.

Returns:
a dictionay for use with dynamic bindings

float floatValueForBinding ( String  binding,
float  defaultValue 
) [protected]

Resolves a given binding as a float value.

Parameters:
binding binding to be resolved as a float value.
defaultValue default float value to be used if the binding is not bound.
Returns:
result of evaluating binding as a float.

int intValueForBinding ( String  binding,
int  defaultValue 
) [protected]

Resolves a given binding as a int value. Useful for image sizes and the like.

Parameters:
binding binding to be resolved as a int value.
defaultValue default int value to be used if the binding is not bound.
Returns:
result of evaluating binding as a int.

WOActionResults invokeAction ( WORequest  request,
WOContext  context 
)

boolean isPageAccessAllowed (  )  [protected]

Override and return true for any components to which you would like to allow page level access.

Returns:
true by default

Reimplemented in AjaxWOWODCComponent, AjaxWOWODCPage, SEComponent, and SEPage.

ERXLocalizer localizer (  ) 

Convenience method to get the localizer.

Returns:
the current localizer

Reimplemented in ERXDirectActionBatchNavigationBar, ERXPluralString, and ERMDBatchSizeControl.

Object objectValueForBinding ( String  binding,
Object  defaultValue 
) [protected]

Resolves a given binding as an object in the normal fashion of calling valueForBinding. This has the one advantage of being able to resolve the resulting object as a {link ERXUtilities$Operation} if it is an Operation and then returning the result as the evaluation of that operation.

Parameters:
binding name of the component binding.
defaultValue value to be used if valueForBinding returns null.
Returns:
the object for the given binding and in the case that it is an instance of an Operation the value of that operation.

Object objectValueForBinding ( String  binding  )  [protected]

Resolves a given binding as an object in the normal fashion of calling valueForBinding. This has the one advantage of being able to resolve the resulting object as a {link ERXUtilities$Operation} if it is an Operation and then returning the result as the evaluation of that operation.

Parameters:
binding name of the component binding.
Returns:
the object for the given binding and in the case that it is an instance of an Operation the value of that operation.

public<T extends WOComponent> T pageWithName ( Class< T >  componentClass  )  [package]

This variant of pageWithName provides a Java5 genericized version of the original pageWithName. You would call it with:

MyNextPage nextPage = pageWithName(MyNextPage.class);

Parameters:
<T> the type of component to create
componentClass the Class of the component to load
Returns:
an instance of the requested component class

void postAppendToResponse ( WOResponse  response,
WOContext  context 
) [protected]

Override to hook into appendToResponse after super.appendToResponse. It is not necessary to call super on this method.

Parameters:
response the current response
context the current context

void preAppendToResponse ( WOResponse  response,
WOContext  context 
) [protected]

Override to hook into appendToResponse after security checks but before the super.appendToResponse. It is not necessary to call super on this method.

Parameters:
response the current response
context the current context

Reimplemented in ERTagCloud.

String primaryCSSFile (  )  [protected]

Returns the primary CSS file for this component, or null if there isn't one. This path will be prepended with defaultCSSPath().

Returns:
the primary CSS file for this component

String primaryJavascriptFile (  )  [protected]

Returns the primary Javascript file for this component, or null if there isn't one. This path will be prepended with defaultJavascriptPath().

Returns:
the primary Javascript file for this component

void reset (  ) 

String stringValueForBinding ( String  binding,
String  defaultValue 
) [protected]

Retrieves a given binding and if it is not null then returns toString called on the bound object.

Parameters:
binding to be resolved
defaultValue value to be used if valueForBinding returns null.
Returns:
resolved binding in string format

String stringValueForBinding ( String  binding  )  [protected]

Retrieves a given binding and if it is not null then returns toString called on the bound object.

Parameters:
binding to be resolved
Returns:
resolved binding in string format

void takeValuesFromRequest ( WORequest  request,
WOContext  context 
)

boolean useDefaultComponentCSS (  )  [protected]

Returns true if this component provides a default CSS file that has the same name as the component itself.

Returns:
true if this component provides a default-named CSS

Reimplemented in AjaxForm, AjaxHeaderFooter, AjaxNotifications, Calendar, ClientSideRendering, ExpensiveUpdates, LiveSearch, Main, ModalEditor, RowToggle, RSSReader, and ToggleDetails.

boolean useDefaultComponentJavascript (  )  [protected]

Returns true if this component provides a default Javascript file that has the same name as the component itself.

Returns:
true if this component provides a default-named Javascript


Member Data Documentation


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:03 2012 for Project Wonder by  doxygen 1.5.8