|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.workplace.CmsWidgetDialogParameter
public class CmsWidgetDialogParameter
Implements the widget parameter interface for the use of OpenCms widgets on dialogs that are not based on XML contents.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_DIALOG_PAGE
The name of the default dialog page. |
protected java.lang.Object |
m_baseCollection
The (optional) base collection for read / writing collection based parameters. |
protected java.lang.Object |
m_baseObject
The (optional) base object for read / writing the parameter value to. |
protected java.lang.String |
m_baseObjectProperty
The (optinal) object property to read / write this parameter value to. |
protected java.lang.String |
m_defaultValue
The default value of the parameter. |
protected java.lang.String |
m_dialogPage
The name of the dialog (page) the widget is used on. |
protected java.lang.Throwable |
m_error
Indicates if the widget value has an error. |
protected java.lang.String |
m_id
The id of the parameter on the form. |
protected int |
m_index
The index of this parameter in the (optional) list of parameters. |
protected int |
m_maxOccurs
The maximum number of occurences of this parameter. |
protected int |
m_minOccurs
The minimum number of occurences of this parameter. |
protected java.lang.String |
m_name
The name of the parameter. |
protected java.lang.String |
m_prefix
Optional localized key prefix identificator. |
protected java.lang.String |
m_value
The value of the parameter. |
protected I_CmsWidget |
m_widget
The widget used for the parameter. |
static int |
MAX_OCCURENCES
The maximum number of occurences of a widget dialog element in a list of elements. |
Constructor Summary | |
---|---|
CmsWidgetDialogParameter(CmsWidgetDialogParameter base,
int index)
Create a new Widget parameter. |
|
CmsWidgetDialogParameter(CmsWidgetDialogParameter base,
int index,
int originalIndex)
Create a new Widget parameter. |
|
CmsWidgetDialogParameter(java.lang.Object base,
java.lang.String property,
I_CmsWidget widget)
Create a new Widget parameter based on a given object's property. |
|
CmsWidgetDialogParameter(java.lang.Object base,
java.lang.String property,
java.lang.String dialogPage,
I_CmsWidget widget)
Create a new Widget parameter based on a given object's property. |
|
CmsWidgetDialogParameter(java.lang.Object base,
java.lang.String property,
java.lang.String htmlName,
java.lang.String dialogPage,
I_CmsWidget widget)
Create a new Widget parameter based on a given object's property. |
|
CmsWidgetDialogParameter(java.lang.Object base,
java.lang.String property,
java.lang.String defaultValue,
java.lang.String dialogPage,
I_CmsWidget widget,
int minOccurs,
int maxOccurs)
Create a new Widget parameter based on a given object's property. |
|
CmsWidgetDialogParameter(java.lang.Object base,
java.lang.String property,
java.lang.String htmlName,
java.lang.String defaultValue,
java.lang.String dialogPage,
I_CmsWidget widget,
int minOccurs,
int maxOccurs)
Create a new Widget parameter based on a given object's property. |
|
CmsWidgetDialogParameter(java.lang.String name,
I_CmsWidget widget)
Create a new Widget parameter. |
|
CmsWidgetDialogParameter(java.lang.String name,
I_CmsWidget widget,
int minOccurs,
int maxOccurs)
Create a new Widget parameter. |
|
CmsWidgetDialogParameter(java.lang.String value,
java.lang.String defaultValue,
java.lang.String name,
I_CmsWidget widget,
java.lang.String dialog,
int minOccurs,
int maxOccurs,
int index)
Create a new Widget parameter with specified occurence settings. |
Method Summary | |
---|---|
void |
commitValue(CmsWidgetDialog dialog)
"Commits" (writes) the value of this widget back to the underlying base object. |
static java.lang.String |
createId(java.lang.String name,
int index)
Returns a from id representation for the given widget name and id. |
java.lang.String |
getDefault(CmsObject cms)
Returns the default value of this parameter. |
java.lang.String |
getDialogPage()
Returns the name of the dialog (or dialog page) this widget parameter is used on. |
java.lang.Throwable |
getError()
Returns the Exception caused when this parameter value was commited, or null
if error occurred. |
java.lang.String |
getId()
Returns the form id of this parameter. |
int |
getIndex()
Returns the index of this widget parameter, starting with 0. |
java.lang.String |
getKey()
Returns the localized key identificator of this parameter. |
int |
getMaxOccurs()
Returns the maximum occurences of this parameter. |
int |
getMinOccurs()
Returns the minimum occurences of this parameter. |
java.lang.String |
getName()
Returns the name of this parameter. |
java.lang.String |
getStringValue(CmsObject cms)
Returns the value of this parameter. |
I_CmsWidget |
getWidget()
Returns the widget for this parameter. |
boolean |
hasError()
Returns true if this widgets value contains an error. |
boolean |
hasValue(int index)
Checks if a value for this widget base type with the given id is available. |
protected void |
init(java.lang.String value,
java.lang.String defaultValue,
java.lang.String name,
I_CmsWidget widget,
java.lang.String dialog,
int minOccurs,
int maxOccurs,
int index)
Initializes a widget parameter with the given values. |
boolean |
isCollectionBase()
Returns true if this widget parameter is mapped to a Collection base object. |
void |
prepareCommit()
Prepares this widget dialog parameter to be commited. |
void |
setError(java.lang.Throwable error)
Sets the error state of this widget. |
void |
setindex(int index)
Sets the index to the provided value. |
void |
setKeyPrefix(java.lang.String prefix)
Sets an optional localized key prefix identificator of this parameter. |
void |
setStringValue(CmsObject cms,
java.lang.String value)
Sets the value of this parameter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_DIALOG_PAGE
public static final int MAX_OCCURENCES
protected java.lang.Object m_baseCollection
protected java.lang.Object m_baseObject
protected java.lang.String m_baseObjectProperty
protected java.lang.String m_defaultValue
protected java.lang.String m_dialogPage
protected java.lang.Throwable m_error
protected java.lang.String m_id
protected int m_index
protected int m_maxOccurs
protected int m_minOccurs
protected java.lang.String m_name
protected java.lang.String m_prefix
protected java.lang.String m_value
protected I_CmsWidget m_widget
Constructor Detail |
---|
public CmsWidgetDialogParameter(CmsWidgetDialogParameter base, int index)
base
- the base of the parameterindex
- the index of this parameter in the listpublic CmsWidgetDialogParameter(CmsWidgetDialogParameter base, int index, int originalIndex)
base
- the base of the parameterindex
- the index of this parameter in the listoriginalIndex
- the original index in the previous version of the listpublic CmsWidgetDialogParameter(java.lang.Object base, java.lang.String property, I_CmsWidget widget)
base
- the base object to map the parameter to / fromproperty
- the base object property to map the parameter to / fromwidget
- the widget used for this parameterpublic CmsWidgetDialogParameter(java.lang.Object base, java.lang.String property, java.lang.String dialogPage, I_CmsWidget widget)
base
- the base object to map the parameter to / fromproperty
- the base object property to map the parameter to / fromdialogPage
- the dialog page to use the widget onwidget
- the widget used for this parameterpublic CmsWidgetDialogParameter(java.lang.Object base, java.lang.String property, java.lang.String htmlName, java.lang.String dialogPage, I_CmsWidget widget)
base
- the base object to map the parameter to / fromproperty
- the base object property to map the parameter to / fromhtmlName
- the form id name to use in the generated HTMLdialogPage
- the dialog page to use the widget onwidget
- the widget used for this parameterpublic CmsWidgetDialogParameter(java.lang.Object base, java.lang.String property, java.lang.String defaultValue, java.lang.String dialogPage, I_CmsWidget widget, int minOccurs, int maxOccurs)
base
- the base object to map the parameter to / fromproperty
- the base object property to map the parameter to / fromdefaultValue
- the default value to use for this parameterdialogPage
- the dialog page to use the widget onwidget
- the widget used for this parameteminOccurs
- the required minimum numer of occurences of this parametermaxOccurs
- the maximum allowed numer of occurences of this parameterpublic CmsWidgetDialogParameter(java.lang.Object base, java.lang.String property, java.lang.String htmlName, java.lang.String defaultValue, java.lang.String dialogPage, I_CmsWidget widget, int minOccurs, int maxOccurs)
base
- the base object to map the parameter to / fromproperty
- the base object property to map the parameter to / fromhtmlName
- the form id name to use in the generated HTMLdefaultValue
- the default value to use for this parameterdialogPage
- the dialog page to use the widget onwidget
- the widget used for this parameteminOccurs
- the required minimum numer of occurences of this parametermaxOccurs
- the maximum allowed numer of occurences of this parameterpublic CmsWidgetDialogParameter(java.lang.String name, I_CmsWidget widget)
name
- the name of the parameterwidget
- the widget used for this parameterpublic CmsWidgetDialogParameter(java.lang.String name, I_CmsWidget widget, int minOccurs, int maxOccurs)
name
- the name of the parameterwidget
- the widget used for this parameterminOccurs
- the required minimum numer of occurences of this parametermaxOccurs
- the maximum allowed numer of occurences of this parameterpublic CmsWidgetDialogParameter(java.lang.String value, java.lang.String defaultValue, java.lang.String name, I_CmsWidget widget, java.lang.String dialog, int minOccurs, int maxOccurs, int index)
value
- the initial value of the parameterdefaultValue
- the default value of the parametername
- the id of the parameterwidget
- the widget used for this parameterdialog
- the dialog this parameter is used onminOccurs
- the required minimum numer of occurences of this parametermaxOccurs
- the maximum allowed numer of occurences of this parameterindex
- the index of this parameter in the listMethod Detail |
---|
public static java.lang.String createId(java.lang.String name, int index)
name
- the widget parameter nameindex
- the widget parameter index
public void commitValue(CmsWidgetDialog dialog) throws CmsException
dialog
- the widget dialog where the parameter is used on
CmsException
- in case the String value of the widget is invalid for the base Objectpublic java.lang.String getDefault(CmsObject cms)
I_CmsWidgetParameter
If no default value has been provided, null
is returned.
getDefault
in interface I_CmsWidgetParameter
cms
- an initialized instance of an OpenCms user context
I_CmsWidgetParameter.getDefault(org.opencms.file.CmsObject)
public java.lang.String getDialogPage()
This information can be used to create multi-page dialogs where the widgets are spread over several pages.
public java.lang.Throwable getError()
null
if error occurred.
public java.lang.String getId()
I_CmsWidgetParameter
getId
in interface I_CmsWidgetParameter
I_CmsWidgetParameter.getId()
public int getIndex()
I_CmsWidgetParameter
This is usefull in case there are more then one parameters with the same name, for example when creating a list of parameters of the same type.
getIndex
in interface I_CmsWidgetParameter
I_CmsWidgetParameter.getIndex()
public java.lang.String getKey()
I_CmsWidgetParameter
getKey
in interface I_CmsWidgetParameter
I_CmsWidgetParameter.getKey()
public int getMaxOccurs()
I_CmsWidgetParameter
getMaxOccurs
in interface I_CmsWidgetParameter
I_CmsWidgetParameter.getMaxOccurs()
public int getMinOccurs()
I_CmsWidgetParameter
getMinOccurs
in interface I_CmsWidgetParameter
I_CmsWidgetParameter.getMinOccurs()
public java.lang.String getName()
I_CmsWidgetParameter
getName
in interface I_CmsWidgetParameter
I_CmsWidgetParameter.getName()
public java.lang.String getStringValue(CmsObject cms) throws CmsRuntimeException
I_CmsWidgetParameter
getStringValue
in interface I_CmsWidgetParameter
cms
- an initialized instance of an OpenCms user context
CmsRuntimeException
I_CmsWidgetParameter.getStringValue(org.opencms.file.CmsObject)
public I_CmsWidget getWidget()
public boolean hasError()
I_CmsWidgetParameter
true
if this widgets value contains an error.
hasError
in interface I_CmsWidgetParameter
true
if this widgets value contains an errorI_CmsWidgetParameter.hasError()
public boolean hasValue(int index)
This should only be used if the base object is a collection.
index
- the index to check
true
if a value for this widget base type with the given id is availablepublic boolean isCollectionBase()
true
if this widget parameter is mapped to a Collection base object.
true
if this widget parameter is mapped to a Collection base objectpublic void prepareCommit()
This is required if the base type is mapped to a Collection object, becasue the collection needs to be cleared before the new values are set.
public void setError(java.lang.Throwable error)
If the argument is null
then the state is set to "no error".
error
- the error state to setpublic void setindex(int index)
index
- the new index value to setpublic void setKeyPrefix(java.lang.String prefix)
I_CmsWidgetParameter
setKeyPrefix
in interface I_CmsWidgetParameter
prefix
- the optional localized key prefix identificator of this parameterI_CmsWidgetParameter.setKeyPrefix(java.lang.String)
public void setStringValue(CmsObject cms, java.lang.String value) throws CmsIllegalArgumentException
I_CmsWidgetParameter
This method does provide processing of the content based on the users current OpenCms context. This can be used e.g. for link extraction and replacement in the content.
setStringValue
in interface I_CmsWidgetParameter
cms
- an initialized instance of an OpenCms user contextvalue
- the value to set
CmsIllegalArgumentException
I_CmsWidgetParameter.setStringValue(org.opencms.file.CmsObject, java.lang.String)
protected void init(java.lang.String value, java.lang.String defaultValue, java.lang.String name, I_CmsWidget widget, java.lang.String dialog, int minOccurs, int maxOccurs, int index)
value
- the initial value of the parameterdefaultValue
- the default value of the parametername
- the id of the parameterwidget
- the widget used for this parameterdialog
- the dialog this parameter is used onminOccurs
- the required minimum numer of occurences of this parametermaxOccurs
- the maximum allowed numer of occurences of this parameterindex
- the index of this parameter in the list
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |