com.wewebu.ow.server.settingsimpl
Class OwSettingsPropertyLanguageString

java.lang.Object
  extended by com.wewebu.ow.server.ui.OwEventTarget
      extended by com.wewebu.ow.server.app.OwSettingsPropertyControl
          extended by com.wewebu.ow.server.settingsimpl.OwSettingsPropertyLanguageString
All Implemented Interfaces:
OwSettingsProperty

public class OwSettingsPropertyLanguageString
extends OwSettingsPropertyControl

A single settings String property that can be configured language dependent. e.g. you can set a different string for each language.

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


Field Summary
protected static String ITEM_QUERY_KEY
          query key for the item parameter for the delete event
protected  Object m_defaultValue
          default value of property
protected  OwEventTarget m_externalFormEventTarget
          external form view overrides internal form
protected  String m_strError
          a error message for this field, if update failed
protected  String m_strSetName
          set name
protected  Map m_value
          current value of property
 
Fields inherited from interface com.wewebu.ow.server.app.OwSettingsProperty
ITEM_VALUE_NODE
 
Constructor Summary
OwSettingsPropertyLanguageString()
           
 
Method Summary
protected  Object createSingleClonedValue(Object oSingleValue_p)
          create a clone out of the given single property value
protected  Map createValueMap(Node valueNode_p)
          create a list of values, if property is a list
protected  Object getDefaultListItemValue()
          overridable to create a default value for list properties
 String getDisplayName()
          get display name of property
 String getFormName()
          get the form used for the edit fields
 OwEventTarget getFormTarget()
          get the target, that is used for form data and renders form
 String getHelpPath()
          get optional help path for the control
 Locale getLocaleFromContext()
          get locale from context
 String getName()
          get ID of property
protected  Node getPropertyDefinitionNode()
          get a reference to the property definition node
 String getPropertyError()
          Gets a error message for this field
 String getSafePropertyError()
          gets a error message for this field, if update failed, clears the message automatically
protected  Object getSingleValue(Node valueNode_p)
          overridable to create a single value for the given node
 Object getValue()
          get current value of property
 Node getValueNode(Document doc_p)
          return the property value as a DOM Node for serialization
 boolean hasError()
          Check if this property has an error associated, without clear the error message
protected  void init()
          init the target after the context is set.
 void init(Node propertyDefinitionNode_p, Node valueNode_p, String strSetName_p)
          set current value of property, to be overridden
 void insertFormField(Writer w_p)
          insert the property into a HTML form for editing
 boolean isEditable()
          get flag indicating if property can be edited
 boolean isList()
          get flag indicating list or scalar value
 boolean isModified()
          true = value was modified, false otherwise
 boolean isUser()
          get flag indicating the scope of the property
 void onAdd(javax.servlet.http.HttpServletRequest request_p)
          called when user clicked the add item button for a list property
 void onDelete(javax.servlet.http.HttpServletRequest request_p)
          called when user clicked a delete button on a list entry
 void saved()
          signal that value was saved and modified flag can be reset
 void setDefault()
          set the default value
 void setExternalFormTarget(OwEventTarget eventtarget_p)
          override the internal form with an external one, must be called BEFORE event target is attached.
 void setLocaleFromContext(OwMainAppContext mainContext_p)
          set locale from context
 void setValue(Object value_p)
          set current value of property, to be overridden
 boolean updateExternalFormTarget(javax.servlet.http.HttpServletRequest request_p, boolean fSave_p)
          update the target after a form event, so it can set its form fields
 
Methods inherited from class com.wewebu.ow.server.ui.OwEventTarget
attach, detach, disableRequestListener, enableRequestListener, getAjaxEventURL, getContext, getEventURL, getFormEventFunction, getFormEventURL, getID, onExternalRequest, onFormEvent, onRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_defaultValue

protected Object m_defaultValue
default value of property


m_strSetName

protected String m_strSetName
set name


ITEM_QUERY_KEY

protected static final String ITEM_QUERY_KEY
query key for the item parameter for the delete event

See Also:
Constant Field Values

m_value

protected Map m_value
current value of property


m_strError

protected String m_strError
a error message for this field, if update failed


m_externalFormEventTarget

protected OwEventTarget m_externalFormEventTarget
external form view overrides internal form

Constructor Detail

OwSettingsPropertyLanguageString

public OwSettingsPropertyLanguageString()
Method Detail

init

protected void init()
             throws Exception
init the target after the context is set.

Specified by:
init in class OwEventTarget
Throws:
Exception

getHelpPath

public String getHelpPath()
get optional help path for the control

Specified by:
getHelpPath in class OwSettingsPropertyControl
Returns:
JSP path or null if no help is available

getValue

public Object getValue()
get current value of property

Returns:
Object if isList() is true, Object otherwise

createSingleClonedValue

protected Object createSingleClonedValue(Object oSingleValue_p)
create a clone out of the given single property value

Specified by:
createSingleClonedValue in class OwSettingsPropertyControl
Parameters:
oSingleValue_p - single Object value
Returns:
Object

isModified

public boolean isModified()
true = value was modified, false otherwise

Specified by:
isModified in class OwSettingsPropertyControl

saved

public void saved()
signal that value was saved and modified flag can be reset


getDefaultListItemValue

protected Object getDefaultListItemValue()
                                  throws Exception
overridable to create a default value for list properties

Returns:
Object with default value for a new list item
Throws:
Exception

isList

public boolean isList()
get flag indicating list or scalar value

Returns:
boolean true = list value, otherwise scalar

setValue

public void setValue(Object value_p)
set current value of property, to be overridden

Parameters:
value_p - Object

updateExternalFormTarget

public boolean updateExternalFormTarget(javax.servlet.http.HttpServletRequest request_p,
                                        boolean fSave_p)
                                 throws Exception
update the target after a form event, so it can set its form fields

Overrides:
updateExternalFormTarget in class OwEventTarget
Parameters:
request_p - HttpServletRequest
fSave_p - boolean true = save the changes of the form data, false = just update the form data, but do not save
Returns:
true = field data was valid, false = field data was invalid
Throws:
Exception

getSafePropertyError

public String getSafePropertyError()
gets a error message for this field, if update failed, clears the message automatically

Specified by:
getSafePropertyError in class OwSettingsPropertyControl
Returns:
String error message or an empty string

hasError

public boolean hasError()
Description copied from class: OwSettingsPropertyControl
Check if this property has an error associated, without clear the error message

Specified by:
hasError in class OwSettingsPropertyControl
Since:
2.5.2.0
See Also:
OwSettingsPropertyControl.hasError()

getPropertyError

public String getPropertyError()
Description copied from class: OwSettingsPropertyControl
Gets a error message for this field

Specified by:
getPropertyError in class OwSettingsPropertyControl
Returns:
String error message or an empty string
Since:
2.5.2.0
See Also:
OwSettingsPropertyControl.getPropertyError()

insertFormField

public void insertFormField(Writer w_p)
                     throws Exception
insert the property into a HTML form for editing

Specified by:
insertFormField in class OwSettingsPropertyControl
Parameters:
w_p - Writer to write HTML code to
Throws:
Exception

onDelete

public void onDelete(javax.servlet.http.HttpServletRequest request_p)
              throws Exception
called when user clicked a delete button on a list entry

Parameters:
request_p - HttpServletRequest
Throws:
Exception

onAdd

public void onAdd(javax.servlet.http.HttpServletRequest request_p)
           throws Exception
called when user clicked the add item button for a list property

Parameters:
request_p - HttpServletRequest
Throws:
Exception

getPropertyDefinitionNode

protected Node getPropertyDefinitionNode()
get a reference to the property definition node


setDefault

public void setDefault()
set the default value


getValueNode

public Node getValueNode(Document doc_p)
return the property value as a DOM Node for serialization

Parameters:
doc_p - DOM Document to add to
Returns:
Node

isUser

public boolean isUser()
get flag indicating the scope of the property

Returns:
boolean true = user, false = app scope

isEditable

public boolean isEditable()
get flag indicating if property can be edited

Returns:
boolean true = editable

getDisplayName

public String getDisplayName()
get display name of property

Specified by:
getDisplayName in class OwSettingsPropertyControl
Returns:
String display name

getName

public String getName()
get ID of property

Returns:
String with ID

getFormName

public String getFormName()
get the form used for the edit fields

Overrides:
getFormName in class OwEventTarget
Returns:
String form name

setExternalFormTarget

public void setExternalFormTarget(OwEventTarget eventtarget_p)
                           throws Exception
override the internal form with an external one, must be called BEFORE event target is attached.
NOTE: By default, view will render its own form, unless you call setFormTarget When setting an external form, the view will not render a own form, but use the form name of the given OwEditable. ==> Several form views can update each other.

Overrides:
setExternalFormTarget in class OwEventTarget
Parameters:
eventtarget_p - OwEventTarget to be used for form data
Throws:
Exception

getFormTarget

public OwEventTarget getFormTarget()
get the target, that is used for form data and renders form

Overrides:
getFormTarget in class OwEventTarget
Returns:
OwEventTarget

init

public void init(Node propertyDefinitionNode_p,
                 Node valueNode_p,
                 String strSetName_p)
          throws Exception
set current value of property, to be overridden

Parameters:
propertyDefinitionNode_p - the node which defines the property in the plugin descriptors setting
valueNode_p - the node with the current value
strSetName_p - name of the property set for which the property is created
Throws:
Exception

getSingleValue

protected Object getSingleValue(Node valueNode_p)
overridable to create a single value for the given node

Returns:
Object with value

createValueMap

protected Map createValueMap(Node valueNode_p)
create a list of values, if property is a list

Parameters:
valueNode_p - Node with child value nodes
Returns:
List of Objects representing values

setLocaleFromContext

public void setLocaleFromContext(OwMainAppContext mainContext_p)
set locale from context

Parameters:
mainContext_p -
Since:
3.1.0.4

getLocaleFromContext

public Locale getLocaleFromContext()
get locale from context

Returns:
m_Locale current locale
Since:
3.1.0.4


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.