|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nl.openedge.baritus.FormBeanContext
FormBeanContext wraps the form bean, errors the current locale and overrideFields. Furthermore, it acts as a decorator for a HashMap where you can optionally store attributes you do not want to include as properties in your form bean.
Nested Class Summary |
Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
Field Summary | |
static java.lang.String |
ERROR_KEY_EXCEPTION
error key for stacktrace if any |
static java.lang.String |
ERROR_KEY_STACKTRACE
error key for stacktrace if any |
Constructor Summary | |
FormBeanContext()
|
Method Summary | |
void |
clear()
clear the attributes |
boolean |
containsKey(java.lang.Object key)
is the provided key the key of an attribute |
boolean |
containsValue(java.lang.Object value)
is the provided value stored as an attribute |
java.lang.String |
displayProperty(java.lang.String name)
Get the display string of the property with the given name without using a pattern. |
java.lang.String |
displayProperty(java.lang.String name,
java.lang.String pattern)
Get the display string of the property with the given name, optionally using the given pattern. |
java.util.Set |
entrySet()
get the entries of the attributes |
java.lang.String |
format(java.lang.Object value)
Format the given value, independent of the current form, using the class of the value to lookup a formatter. |
java.lang.String |
format(java.lang.Object value,
java.lang.String pattern)
Format the given value, independent of the current form, using the class of the value to lookup a formatter using the provided pattern. |
java.lang.String |
format(java.lang.String formatterName,
java.lang.Object value)
Format the given value, independent of the current form, using the provided name of the formatter to lookup the formatter or - if no formatter was found - using the class of the value to lookup the formatter. |
java.lang.String |
format(java.lang.String formatterName,
java.lang.Object value,
java.lang.String pattern)
Format the given value, independent of the current form using: 1. look in the ConverterRegistry if a formatter was stored with the formatterName and optionally locale as key; 2. if not found, look in the ConverterRegistry if a formatter was stored with the pattern and optionally the locale as key; 3. if not found, look in the ConverterRegistry if a Converter was stored for the type of the property that implements Formatter (as well as Converter); |
java.lang.Object |
get(java.lang.Object key)
Returns the value to which the attributes map maps the specified key. |
java.lang.Object |
getBean()
Get the form bean. |
FormBeanCtrlBase |
getController()
get current controller |
java.util.Locale |
getCurrentLocale()
Get the current locale. |
java.lang.String |
getError(java.lang.String field)
Get the registered error for one field. |
java.util.Map |
getErrors()
Get the map with errors. |
Formatter |
getFormatter(java.lang.String formatterName,
java.lang.String pattern,
java.lang.Class clazz,
java.util.Locale locale)
Get the formatter for the given fieldname/ class/ locale. 1. look in the ConverterRegistry if a formatter was stored with the formatterName and optionally locale as key. 2. if not found, look in the ConverterRegistry if a formatter was stored with the pattern and optionally the locale as key. 3. if not found, look in the ConverterRegistry if a Converter was stored for the type of the property that implements Formatter (as well as Converter). |
java.lang.Object |
getOverrideField(java.lang.String name)
Get the value of the field that was overridden. |
java.util.Map |
getOverrideFields()
Get the map of failed field values. |
boolean |
hasErrors()
Whether any errors were registered during population/ validation. |
boolean |
isEmpty()
are there any attributes |
java.util.Set |
keySet()
get the key set of the attributes |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Associates the specified value with the specified key in the attribute map. |
void |
putAll(java.util.Map t)
put the provided map in the attribute map |
java.lang.Object |
remove(java.lang.Object key)
remove an attribute |
void |
removeError(java.lang.String key)
De-register (remove) an error that was registered with the provided key. |
void |
setBean(java.lang.Object bean)
Set the form bean. |
void |
setController(FormBeanCtrlBase controller)
set current controller |
void |
setCurrentLocale(java.util.Locale locale)
Set the current locale. |
void |
setError(java.lang.String key,
java.lang.String value)
Register (or overwrite) an error with the provided key and value. |
void |
setError(java.lang.String exceptionKey,
java.lang.String stackTraceKey,
java.lang.Throwable t)
Add exception and its stacktrace. |
void |
setError(java.lang.String key,
java.lang.Throwable t,
boolean asStackTrace)
Either add this exception with the given key, or add the stacktrace of this exception with the given key. |
void |
setError(java.lang.Throwable t)
Adds an exception with key 'exception' and adds the stacktrace of this exception with key 'stacktrace'. |
void |
setError(java.lang.Throwable t,
boolean asStackTrace)
Adds an exception with key 'exception' and adds either the stacktrace of this exception with key 'stacktrace' if asStackTrace is true, or add the exception message with key 'exception' if asStackTrace is false. |
void |
setErrors(java.util.Map errors)
Set the map of errors. |
void |
setOverrideField(java.util.Map fields)
Set values of fields that have overrides. |
void |
setOverrideField(java.lang.String name,
java.lang.Object value)
Set value of field that overrides. |
int |
size()
get the number of attributes |
java.lang.String |
toString()
String rep. |
java.util.Collection |
values()
get the attribute values |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
Field Detail |
public static final java.lang.String ERROR_KEY_STACKTRACE
public static final java.lang.String ERROR_KEY_EXCEPTION
Constructor Detail |
public FormBeanContext()
Method Detail |
public java.util.Locale getCurrentLocale()
public void setCurrentLocale(java.util.Locale locale)
locale
- current localepublic java.lang.Object getBean()
public void setBean(java.lang.Object bean)
bean
- the bean that will be populated, and that is returned by makeFormbeanpublic java.util.Map getErrors()
public java.lang.String getError(java.lang.String field)
field
- name of the field to lookup the error for.
public void setErrors(java.util.Map errors)
errors
- The map of errors to setpublic void setError(java.lang.String key, java.lang.Throwable t, boolean asStackTrace)
key
- key to store error undert
- exceptionasStackTrace
- if true, the stacktrace is added; otherwise the exception
is addedpublic void setError(java.lang.String exceptionKey, java.lang.String stackTraceKey, java.lang.Throwable t)
exceptionKey
- key to use for exceptionstackTraceKey
- key to use for stacktracet
- exceptionpublic void setError(java.lang.Throwable t)
t
- exceptionpublic void setError(java.lang.Throwable t, boolean asStackTrace)
t
- exceptionasStackTrace
- if true, the stacktrace is added; otherwise the exceptionpublic void setError(java.lang.String key, java.lang.String value)
key
- the key that the error should be registered with.value
- the value (message) of the error.public void removeError(java.lang.String key)
key
- the key that the error was registered with.public java.util.Map getOverrideFields()
public void setOverrideField(java.lang.String name, java.lang.Object value)
name
- name of the field/ propertyvalue
- usually the original input valuepublic java.lang.Object getOverrideField(java.lang.String name)
name
- name of the field/ property
public void setOverrideField(java.util.Map fields)
fields
- map of fields to override the current values.public boolean hasErrors()
public java.lang.String displayProperty(java.lang.String name)
name
- name of the property
public java.lang.String displayProperty(java.lang.String name, java.lang.String pattern)
name
- name of the propertypattern
- optional pattern to use for formatting
public Formatter getFormatter(java.lang.String formatterName, java.lang.String pattern, java.lang.Class clazz, java.util.Locale locale)
formatterName
- name of formatterpattern
- pattern: might be used as a key to store a Formatterclazz
- class of propertylocale
- locale to get Formatter for
public java.lang.String format(java.lang.Object value)
value
- value to format
public java.lang.String format(java.lang.Object value, java.lang.String pattern)
value
- value to formatpattern
- pattern for format
public java.lang.String format(java.lang.String formatterName, java.lang.Object value)
formatterName
- name of formatter.value
- value to format
public java.lang.String format(java.lang.String formatterName, java.lang.Object value, java.lang.String pattern)
formatterName
- name of formatter.value
- value to formatpattern
- pattern for format
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
key
- key whose associated value is to be returned
Map.get(java.lang.Object)
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.Map.put(java.lang.Object, java.lang.Object)
public java.util.Collection values()
values
in interface java.util.Map
Map.values()
public java.util.Set keySet()
keySet
in interface java.util.Map
Map.keySet()
public void clear()
clear
in interface java.util.Map
Map.clear()
public int size()
size
in interface java.util.Map
Map.size()
public void putAll(java.util.Map t)
putAll
in interface java.util.Map
t
- map to put in attributesMap.putAll(java.util.Map)
public java.util.Set entrySet()
entrySet
in interface java.util.Map
Map.entrySet()
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
key
- the key to look for
Map.containsKey(java.lang.Object)
public boolean isEmpty()
isEmpty
in interface java.util.Map
Map.isEmpty()
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
key
- key of the attribute to remove
Map.remove(java.lang.Object)
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
value
- the value to look for
Map.containsValue(java.lang.Object value)
public FormBeanCtrlBase getController()
public void setController(FormBeanCtrlBase controller)
controller
- current controllerpublic java.lang.String toString()
Object.toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |