public class ERXModernizr extends ERXStatelessComponent
ERXModernizr uses the Modernizr library to detect what javascript
capabilities a client browser has and then posts those values back
to the server to store them on the session. To use it, just drop it
in your page wrapper. For storage, this component relies on the
ERXSession.objectStore()
. At the moment the modernizr data
is stored on the session, a notification is fired using the session
as the notification object. This is to permit logging of modernizr data
for later analysis. It also permits you to copy the modernizer data
elsewhere if the session's objectStore is not appropriate for your
needs.
It is recommended that in your ERXSession subclass, you set
_javaScriptEnabled == Boolean.FALSE;
in the constructor.
By default, it will be set to true when ERXSession.javaScriptEnabled()
is called. This component will set the value to true whenever the
modernizr data updates as a result of an ajax call... thus ensuring
no false positives.
As a convenience, this component defines two properties for naming the framework and filename for the modernizer script. This is to allow the min.js for deployment while the full js can be used in development. The component bindings are used as a default value should you prefer to use bindings instead of properties.
Name | Description |
---|---|
filename | filename |
framework | framework |
Name | Description |
---|---|
er.extensions.components.ERXModernizr.modernizrFileName | (default is read from "filename" binding) |
er.extensions.components.ERXModernizr.modernizrFrameworkName | (default is read from "framework" binding) |
WOComponent._EventLoggingEnabler, WOComponent.Event
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility
NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null<T>, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor
NSValidation._MethodBinding, NSValidation._ValidationBinding, NSValidation.DefaultImplementation, NSValidation.Utility, NSValidation.ValidationException
Modifier and Type | Field and Description |
---|---|
static String |
FILE_NAME_PROPERTY |
static String |
FRAMEWORK_NAME_PROPERTY |
static String |
MODERNIZR_KEY |
static String |
MODERNIZR_UPDATED_NOTIFICATION |
_dynamicBindings
_Extension, _IsEventLoggingEnabled, _keyAssociations
_CLASS
_CLASS, _KeyPathSeparatorChar, KeyPathSeparator
NullValue
_CLASS
Constructor and Description |
---|
ERXModernizr(WOContext context) |
Modifier and Type | Method and Description |
---|---|
String |
filename()
The filename for the modernizr javascript file.
|
String |
formValuePrefix() |
String |
framework()
The name of the framework where the modernizr javascript file is
found.
|
protected void |
postNotification(ERXSession session)
Called to post a notification whenever modernizr data is stored
on the session's object store.
|
String |
postURL()
The ajax request URL for this component.
|
boolean |
shouldPostData()
Returns true if the component should include a script to post modernizr
data back to the server.
|
void |
takeValuesFromRequest(WORequest request,
WOContext context)
Overridden to capture the modernizr data being sent from the client.
|
isStateless, reset
appendToResponse, invokeAction, resetCachedBindingsInStatefulComponent, synchronizesVariablesWithBindings
_awakeInContext, _checkAccess, _frameworkName, _includeCSSResources, _includeJavascriptResources, additionalCSSFiles, additionalJavascriptFiles, arrayValueForBinding, arrayValueForBinding, booleanValueForBinding, booleanValueForBinding, booleanValueForBinding, browser, checkAccess, clickToOpenEnabled, componentName, defaultCSSPath, defaultJavascriptPath, dynamicBindings, floatValueForBinding, intValueForBinding, isPageAccessAllowed, localizer, objectValueForBinding, objectValueForBinding, pageWithName, postAppendToResponse, preAppendToResponse, primaryCSSFile, primaryJavascriptFile, shouldCheckAccess, stringValueForBinding, stringValueForBinding, useDefaultComponentCSS, useDefaultComponentJavascript
__valueForBinding, _associationWithName, _childTemplate, _cleanUpStatelessComponent, _componentDefinition, _componentUnroll, _isPage, _setContext, _setIsPage, _setParent, _setSubcomponent, _sleepInContext, _subcomponentForElementWithID, _templateNameForClass, _unroll, application, awake, baseURL, bindingKeys, canAccessFieldsDirectly, canGetValueForBinding, canSetValueForBinding, clone, context, debugString, descriptionForResponse, ensureAwakeInContext, frameworkName, generateResponse, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hasBinding, hasSession, isCachingEnabled, isEventLoggingEnabled, logString, name, pageWithName, parent, path, pathURL, performParentAction, pullValuesFromParent, pushValuesToParent, session, set_componentUnroll, set_unroll, setCachingEnabled, setValueForBinding, setVariableValueForName, sleep, takeValueForKey, takeValueForKeyPath, template, templateWithHTMLString, templateWithHTMLString, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, validationFailedWithException, valueForBinding, valueForBooleanBinding, valueForIntegerBinding, valueForKey, valueForKeyPath, valueForNSArrayBindings, valueForNSDictionaryBindings, valueForNumberBinding, valueForStringBinding, variableValueForName, variableWithName
public static final String FRAMEWORK_NAME_PROPERTY
public static final String FILE_NAME_PROPERTY
public static final String MODERNIZR_KEY
public static final String MODERNIZR_UPDATED_NOTIFICATION
public ERXModernizr(WOContext context)
public String filename()
Name | Description |
---|---|
er.extensions.components.ERXModernizr.modernizrFileName | er.extensions.components.ERXModernizr.modernizrFileName |
public String framework()
Name | Description |
---|---|
er.extensions.components.ERXModernizr.modernizrFrameworkName | er.extensions.components.ERXModernizr.modernizrFrameworkName |
public String postURL()
public String formValuePrefix()
public boolean shouldPostData()
public void takeValuesFromRequest(WORequest request, WOContext context)
takeValuesFromRequest
in class ERXNonSynchronizingComponent
request
- from which the values will be takencontext
- of the requestprotected void postNotification(ERXSession session)
session
- Copyright © 2002 – 2024 Project Wonder.