public class OwStandardFieldManager extends OwFieldManager
Standard Implementation of the Property User Interface.
Displays Property as HTML and creates HTML Form Elements for editing properties, also performs validation.
NOTE: This class is instantiated once for a block of properties. is only one static instance
of this class in one application.
To be implemented with the specific DMS system.
Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.
For licensing information read the license.txt file or
go to: http://wiki.alfresco.com
Modifier and Type | Field and Description |
---|---|
static String |
ARRAY_ITEM_INDEX_KEY
query string for the selected array item
|
protected static String |
COMPLEX_ID_DELIMITER
delimiter to build complex id's
|
static String |
FIELD_ID_KEY
query string for the selected field
|
protected DateFormat |
m_DateFormat |
protected DateFormat |
m_DateWithoutTimeFormat |
protected int |
m_defMaxStringSize
value of input fields where MAXLENGTH
|
protected Map<String,OwFieldManagerControl> |
m_FieldCtrlMap
map of OwFieldManagerControl controls
|
protected OwMimeManager |
m_MimeManager
a reference to a mimemanager that can be used to render objects
|
protected NumberFormat |
m_NumberFormat |
protected boolean |
m_restoreFromRequestStrategy
use default restore mechanism or restore from request strategy (for invalid field values)
|
protected int |
m_textareaThreshold
threshold of string length for a textarea, below this threshold a textfield is rendered
|
protected DateFormat |
m_TimeFormat |
static String |
MAX_STRING_SIZE_CONFIG_NODE
configuration node name for the max size of string input fields ("MAXLENGTH" attribute)
|
static String |
THRESHOLD_CONFIG_NODE
threshold config node of string length for a textarea, below this threshold a textfield is rendered
|
FLAG_DISABLE_VALIDATION, m_externalFormEventTarget, m_FieldErrors, m_ids2displayNames, m_MainContext, m_ObjectMap
Constructor and Description |
---|
OwStandardFieldManager() |
Modifier and Type | Method and Description |
---|---|
void |
attachFieldControlByClass(String strFieldClassName_p,
OwFieldManagerControl control_p,
Node configNode_p)
attach a field control to the fieldmanager
|
void |
attachFieldControlByType(String strJavaClassName_p,
OwFieldManagerControl control_p,
Node configNode_p)
attach a field control to the fieldmanager
|
protected void |
attachFieldControlsFromConfiguration()
read XML configuration and attach the field controls
|
Object |
convertValue(javax.servlet.http.HttpServletRequest request_p,
OwFieldDefinition fieldDef_p,
Object value_p,
String strID_p)
Will extract the value from request, and transform it into dependent type representation defined by OwFieldDefinition.
|
protected OwComboModel |
createComboBoxModel(OwFieldDefinition fieldDef_p,
Object value_p,
boolean fAllowEmptyField_p)
Creates a model for combobox.
|
void |
detach()
detach from event target map
|
protected DateFormat |
getDateFormater()
get the formatter used for dates
|
protected DateFormat |
getDateWithoutTimeFormater()
get the formatter used for time
|
OwField |
getField(String complexid_p)
get the field from the given complex ID
<fieldid>.<dimension 0>.<dimension 1>...<dimension n> |
protected OwFieldManagerControl |
getFieldControl(OwFieldDefinition fieldDef)
Helper method to get an registered OwFieldManagerControl for specific field definition.
|
OwFieldManagerControl |
getFieldControlByClass(String strFieldClassName_p)
get a field control by the given field class name
|
OwFieldManagerControl |
getFieldControlByType(String strJavaClassName_p)
get a field control by the given java class type
|
OwMimeManager |
getMimeManager()
get a reference to a mimemanager that can be used to render objects
|
protected NumberFormat |
getNumberFormater()
get the formatter used for numbers
|
protected DateFormat |
getTimeFormater()
get the formatter used for time
|
protected String |
getValueIndexTitle(String strID_p) |
protected void |
init()
init the target after the context is set.
|
void |
insertChoiceListControl(Writer w_p,
OwFieldDefinition fieldDef_p,
Object value_p,
String strID_p,
boolean fAllowEmptyField_p)
Insert choice list for enum fields as default HTML single selectable list.
|
protected void |
insertEditableBoolean(Writer w_p,
OwFieldDefinition fieldDef_p,
Object value_p,
String strID_p)
Insert a field for editing boolean properties, the
rendered input field is preset with three CSS classes for customization.
|
protected void |
insertEditableString(Writer w_p,
OwFieldDefinition fieldDef_p,
Object value_p,
String strID_p)
Insert a HTML input text field, which depends on the max value size
of the property renders a single line Textfield or a multi line Textarea.
|
protected void |
insertEditFieldInternal(Writer w_p,
OwFieldDefinition fieldDef_p,
OwField field_p,
String strID_p)
format and displays the value attached to the PropertyClass in HTML for use in a HTML Form.
|
void |
insertLabel(Writer w_p,
boolean readOnlyView_p,
boolean readOnly_p,
OwField property_p,
String suffix_p,
boolean writeLabel_p)
Renders a property control label on the given Writer.
value type are considered at rendering time. |
protected void |
insertReadOnlyFieldInternal(Writer w_p,
OwFieldDefinition fieldDef_p,
Object value_p)
formates and displays the value attached to the PropertyClass in HTML
|
protected void |
insertSingleComplexEditFieldInternal(Writer w_p,
OwFieldDefinition fieldDef_p,
Object value_p,
String strID_p)
insert a complex field
|
protected void |
insertSingleComplexReadOnlyFieldInternal(Writer w_p,
OwFieldDefinition fieldDef_p,
Object[] value_p)
Inserts a read only complex field
|
void |
insertSingleEditFieldInternal(Writer w_p,
OwFieldDefinition fieldDef_p,
Object value_p,
String strID_p)
Render a single value editing.
|
void |
insertSingleReadOnlyFieldInternal(Writer w_p,
OwFieldDefinition fieldDef_p,
Object value_p)
Render a single read-only value
|
void |
onAddArrayItem(javax.servlet.http.HttpServletRequest request_p)
called when user clicks to add an array item
|
void |
onDeleteArrayItem(javax.servlet.http.HttpServletRequest request_p)
called when user clicks to delete an array item
|
protected Date |
parseDate(Object value_p,
String strDateFormat_p)
Helper to parse an object to a java.util.Date,
which will simply cast the object or use it together with the provided
date format in a parse operation.
|
void |
reset()
clear the map before you call insert...
|
protected Object |
updateComplexSingleFieldInternal(javax.servlet.http.HttpServletRequest request_p,
OwFieldDefinition fieldDef_p,
Object value_p,
String strID_p)
update a single complex field type
|
protected Object |
updateFieldInternal(javax.servlet.http.HttpServletRequest request_p,
OwFieldDefinition fieldDef_p,
Object value_p,
String strID_p)
update the property value upon request and validates the new value.
|
Object |
updateSingleFieldInternal(javax.servlet.http.HttpServletRequest request_p,
OwFieldDefinition fieldDef_p,
Object value_p,
String strID_p)
update a single value of a property value upon request and validates the new value.
|
protected void |
validateValue(Object value_p,
OwFieldDefinition fieldDef_p) |
protected void |
writeAddMultiValueItemLink(Writer w_p,
OwFieldDefinition fieldDef_p,
String strID_p)
Overridable method to insert the "Add" Link after a multi-valued field.
|
protected void |
writeRemoveMultiValueItemLink(Writer w_p,
OwFieldDefinition fieldDef_p,
int index_p,
String strID_p)
Overridable method to insert the "Delete" Link after each item of a multi-valued field.
|
clearFieldError, computeChangedFields, getConfigNode, getFieldJSErrorCtrlID, getFieldProvider, getFocusControlID, getFormName, getFormTarget, getSafeFieldError, getUpdateStatus, init, insertEditField, insertReadOnlyField, isFieldProviderName, isFieldProviderType, renderErrors, resetErrors, safeEqual, setExternalFormTarget, setFieldError, setFieldProvider, setFocusControlID, update, update, updateExternalFormTarget
attach, disableRequestListener, enableRequestListener, getAjaxEventURL, getContext, getEventURL, getFormEventFunction, getFormEventURL, getID, onExternalRequest, onFormEvent, onRequest
public static final String ARRAY_ITEM_INDEX_KEY
public static final String FIELD_ID_KEY
public static final String THRESHOLD_CONFIG_NODE
public static final String MAX_STRING_SIZE_CONFIG_NODE
protected static final String COMPLEX_ID_DELIMITER
protected DateFormat m_DateFormat
protected DateFormat m_TimeFormat
protected DateFormat m_DateWithoutTimeFormat
protected NumberFormat m_NumberFormat
protected Map<String,OwFieldManagerControl> m_FieldCtrlMap
protected OwMimeManager m_MimeManager
protected int m_textareaThreshold
protected int m_defMaxStringSize
protected boolean m_restoreFromRequestStrategy
protected void init() throws Exception
init
in class OwFieldManager
Exception
protected void attachFieldControlsFromConfiguration() throws Exception
Exception
public OwMimeManager getMimeManager()
getMimeManager
in class OwFieldManager
protected NumberFormat getNumberFormater()
protected DateFormat getDateFormater()
DateFormat
for date conversionsprotected DateFormat getTimeFormater()
DateFormat
for time conversionsprotected DateFormat getDateWithoutTimeFormater()
DateFormat
for time conversionspublic void attachFieldControlByType(String strJavaClassName_p, OwFieldManagerControl control_p, Node configNode_p) throws Exception
attachFieldControlByType
in class OwFieldManager
strJavaClassName_p
- java type of the field that uses the controlcontrol_p
- OwFieldManagerControl that renders the fieldconfigNode_p
- DOM Node to the configuration XML for the control, or null to use defaultsException
public void attachFieldControlByClass(String strFieldClassName_p, OwFieldManagerControl control_p, Node configNode_p) throws Exception
attachFieldControlByClass
in class OwFieldManager
strFieldClassName_p
- class name of the field that uses the controlcontrol_p
- OwFieldManagerControl that renders the fieldconfigNode_p
- DOM Node to the configuration XML for the control, or null to use defaultsException
public OwFieldManagerControl getFieldControlByType(String strJavaClassName_p)
strJavaClassName_p
- Stringpublic OwFieldManagerControl getFieldControlByClass(String strFieldClassName_p)
strFieldClassName_p
- Stringprotected OwFieldManagerControl getFieldControl(OwFieldDefinition fieldDef)
fieldDef
- OwFieldDefinitionpublic void detach()
detach
in class OwEventTarget
protected void insertReadOnlyFieldInternal(Writer w_p, OwFieldDefinition fieldDef_p, Object value_p) throws Exception
insertReadOnlyFieldInternal
in class OwFieldManager
w_p
- Writer object to write HTML tofieldDef_p
- OwFieldDefinition definition of fieldvalue_p
- Object Value to be displayedException
public void reset()
reset
in class OwFieldManager
public void insertSingleReadOnlyFieldInternal(Writer w_p, OwFieldDefinition fieldDef_p, Object value_p) throws Exception
Render a single read-only value
w_p
- Writer used for writing the renderingfieldDef_p
- OwFieldDefinition of property for which the control is renderedvalue_p
- Object reference to the value of the propertyException
public void insertChoiceListControl(Writer w_p, OwFieldDefinition fieldDef_p, Object value_p, String strID_p, boolean fAllowEmptyField_p) throws Exception
w_p
- Writer for writing the renderingfieldDef_p
- OwFieldDefinition of propertyvalue_p
- Object to display with given enumstrID_p
- String for ID attribute of HTML controlfAllowEmptyField_p
- boolean true = add a empty field to the listException
protected OwComboModel createComboBoxModel(OwFieldDefinition fieldDef_p, Object value_p, boolean fAllowEmptyField_p) throws Exception
fieldDef_p
- - fieldDefinitionvalue_p
- - the value of the objectfAllowEmptyField_p
- - allow empty value flag.OwComboModel
- the model of the combo to be rendered.Exception
protected void insertEditFieldInternal(Writer w_p, OwFieldDefinition fieldDef_p, OwField field_p, String strID_p) throws Exception
insertEditFieldInternal
in class OwFieldManager
w_p
- Writer object to write HTML tofieldDef_p
- OwFieldDefinition definition of fieldfield_p
- OwField Value to be displayedstrID_p
- ID of the HTML elementException
protected void writeRemoveMultiValueItemLink(Writer w_p, OwFieldDefinition fieldDef_p, int index_p, String strID_p) throws IOException, Exception
w_p
- The writer to write tofieldDef_p
- - the field definition object, can be nullindex_p
- The index of the item inside the fieldstrID_p
- The ID of the fieldException
IOException
protected void writeAddMultiValueItemLink(Writer w_p, OwFieldDefinition fieldDef_p, String strID_p) throws IOException, Exception
w_p
- The writer to write tofieldDef_p
- - the OwFieldDefinition
object. Can be null
.strID_p
- The ID of the fieldException
IOException
public OwField getField(String complexid_p)
<fieldid>.<dimension 0>.<dimension 1>...<dimension n>
getField
in class OwFieldManager
complexid_p
- String e.g. 1254993.1.5.2.3public void onDeleteArrayItem(javax.servlet.http.HttpServletRequest request_p) throws Exception
Exception
public void onAddArrayItem(javax.servlet.http.HttpServletRequest request_p) throws Exception
Exception
protected void insertSingleComplexReadOnlyFieldInternal(Writer w_p, OwFieldDefinition fieldDef_p, Object[] value_p) throws Exception
w_p
- output writerfieldDef_p
- the complex field definitionvalue_p
- the complex value (must be anException
protected void insertSingleComplexEditFieldInternal(Writer w_p, OwFieldDefinition fieldDef_p, Object value_p, String strID_p) throws Exception
w_p
- fieldDef_p
- value_p
- strID_p
- Exception
public void insertSingleEditFieldInternal(Writer w_p, OwFieldDefinition fieldDef_p, Object value_p, String strID_p) throws Exception
Render a single value editing. Depending on the type of the property different edit controls are rendered. All controls have the default Workdesk CSS class for improving/customizing the rendering.
Also it is tried to format the value_p to a number and then the control is extended with an additional CSS class.
CSS class(es) preset for the control:w_p
- Writer used for writing the renderingfieldDef_p
- OwFieldDefinition of property for which the control is renderedvalue_p
- Object reference to the value of the propertystrID_p
- String representing the HTML name/id attributeException
protected Date parseDate(Object value_p, String strDateFormat_p)
This method will return null, if conversion into Date representation fails or the provided value is null
value_p
- Object which should be interpreted as Date valuestrDateFormat_p
- String representing the format which should be used for parse operationprotected String getValueIndexTitle(String strID_p)
strID_p
- protected void insertEditableString(Writer w_p, OwFieldDefinition fieldDef_p, Object value_p, String strID_p) throws Exception
For better customization possibilities the rendered input fields have following three CSS (Cascading Style Sheet) classes:
w_p
- Writer which is used to write out the renderingfieldDef_p
- OwFieldDefinition of the Property to be renderedvalue_p
- Object that should be a String which is the default value of the TextfieldstrID_p
- String representing the HTML name/ID attributeException
protected void insertEditableBoolean(Writer w_p, OwFieldDefinition fieldDef_p, Object value_p, String strID_p) throws Exception
w_p
- Writer for writing out the renderingfieldDef_p
- OwFieldDefinition of the property that should be renderedvalue_p
- Object representing a Boolean or boolean valuestrID_p
- String used for HTML name/ID of rendered input fieldException
protected Object updateFieldInternal(javax.servlet.http.HttpServletRequest request_p, OwFieldDefinition fieldDef_p, Object value_p, String strID_p) throws Exception
updateFieldInternal
in class OwFieldManager
request_p
- HttpServletRequestfieldDef_p
- OwFieldDefinition definition of fieldvalue_p
- Object old ValuestrID_p
- ID of the HTML elementException
protected Object updateComplexSingleFieldInternal(javax.servlet.http.HttpServletRequest request_p, OwFieldDefinition fieldDef_p, Object value_p, String strID_p) throws Exception
request_p
- fieldDef_p
- value_p
- strID_p
- Exception
public Object updateSingleFieldInternal(javax.servlet.http.HttpServletRequest request_p, OwFieldDefinition fieldDef_p, Object value_p, String strID_p) throws Exception
request_p
- HttpServletRequestfieldDef_p
- OwFieldDefinition definition of fieldvalue_p
- Object old ValuestrID_p
- ID of the HTML elementException
protected void validateValue(Object value_p, OwFieldDefinition fieldDef_p) throws Exception
value_p
- fieldDef_p
- Exception
public void insertLabel(Writer w_p, boolean readOnlyView_p, boolean readOnly_p, OwField property_p, String suffix_p, boolean writeLabel_p) throws Exception
insertLabel
in class OwFieldManager
w_p
- WriterreadOnlyView_p
- ReadOnly viewreadOnly_p
- ReadOnly propertyproperty_p
- Propertysuffix_p
- StringwriteLabel_p
- write labelException
public Object convertValue(javax.servlet.http.HttpServletRequest request_p, OwFieldDefinition fieldDef_p, Object value_p, String strID_p) throws OwException
OwFieldManager
convertValue
in class OwFieldManager
request_p
- HttpServletRequestfieldDef_p
- OwFieldDefinitionvalue_p
- Object old/current value of fieldstrID_p
- String id of fieldOwException
- if unable to convert valueCopyright © 2014 Alfresco Business Solutions. All Rights Reserved.