Package org.opencms.workplace
Class CmsWidgetDialogParameter
java.lang.Object
org.opencms.workplace.CmsWidgetDialogParameter
- All Implemented Interfaces:
org.opencms.widgets.I_CmsWidgetParameter
public class CmsWidgetDialogParameter
extends Object
implements org.opencms.widgets.I_CmsWidgetParameter
Implements the widget parameter interface for the use of OpenCms widgets on dialogs that
are not based on XML contents.
- Since:
- 6.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the default dialog page.protected ObjectThe (optional) base collection for read / writing collection based parameters.protected ObjectThe (optional) base object for read / writing the parameter value to.protected StringThe (optinal) object property to read / write this parameter value to.protected StringThe default value of the parameter.protected StringThe name of the dialog (page) the widget is used on.protected ThrowableIndicates if the widget value has an error.protected StringThe id of the parameter on the form.protected intThe index of this parameter in the (optional) list of parameters.protected intThe maximum number of occurences of this parameter.protected intThe minimum number of occurences of this parameter.protected StringThe name of the parameter.protected StringOptional localized key prefix identificator.protected StringThe value of the parameter.protected org.opencms.widgets.I_CmsWidgetThe widget used for the parameter.static final intThe maximum number of occurences of a widget dialog element in a list of elements. -
Constructor Summary
ConstructorsConstructorDescriptionCmsWidgetDialogParameter(Object base, String property, String htmlName, String defaultValue, String dialogPage, org.opencms.widgets.I_CmsWidget widget, int minOccurs, int maxOccurs) Create a new Widget parameter based on a given object's property.CmsWidgetDialogParameter(Object base, String property, String htmlName, String dialogPage, org.opencms.widgets.I_CmsWidget widget) Create a new Widget parameter based on a given object's property.CmsWidgetDialogParameter(Object base, String property, String defaultValue, String dialogPage, org.opencms.widgets.I_CmsWidget widget, int minOccurs, int maxOccurs) Create a new Widget parameter based on a given object's property.CmsWidgetDialogParameter(Object base, String property, String dialogPage, org.opencms.widgets.I_CmsWidget widget) Create a new Widget parameter based on a given object's property.CmsWidgetDialogParameter(Object base, String property, org.opencms.widgets.I_CmsWidget widget) Create a new Widget parameter based on a given object's property.CmsWidgetDialogParameter(String value, String defaultValue, String name, org.opencms.widgets.I_CmsWidget widget, String dialog, int minOccurs, int maxOccurs, int index) Create a new Widget parameter with specified occurence settings.CmsWidgetDialogParameter(String name, org.opencms.widgets.I_CmsWidget widget) Create a new Widget parameter.CmsWidgetDialogParameter(String name, org.opencms.widgets.I_CmsWidget widget, int minOccurs, int maxOccurs) Create a new Widget parameter.CmsWidgetDialogParameter(CmsWidgetDialogParameter base, int index) Create a new Widget parameter.CmsWidgetDialogParameter(CmsWidgetDialogParameter base, int index, int originalIndex) Create a new Widget parameter. -
Method Summary
Modifier and TypeMethodDescriptionvoidcommitValue(CmsWidgetDialog dialog) "Commits" (writes) the value of this widget back to the underlying base object.static StringReturns a from id representation for the given widget name and id.getDefault(org.opencms.file.CmsObject cms) Returns the name of the dialog (or dialog page) this widget parameter is used on.getError()Returns the Exception caused when this parameter value was commited, ornullif error occurred.getId()intgetIndex()getKey()intintgetName()getStringValue(org.opencms.file.CmsObject cms) org.opencms.widgets.I_CmsWidgetReturns the widget for this parameter.booleanhasError()booleanhasValue(int index) Checks if a value for this widget base type with the given id is available.protected voidinit(String value, String defaultValue, String name, org.opencms.widgets.I_CmsWidget widget, String dialog, int minOccurs, int maxOccurs, int index) Initializes a widget parameter with the given values.booleanReturnstrueif this widget parameter is mapped to a Collection base object.voidPrepares this widget dialog parameter to be committed.voidSets the error state of this widget.voidsetindex(int index) Sets the index to the provided value.voidsetKeyPrefix(String prefix) voidsetStringValue(org.opencms.file.CmsObject cms, String value)
-
Field Details
-
DEFAULT_DIALOG_PAGE
The name of the default dialog page.- See Also:
-
MAX_OCCURENCES
The maximum number of occurences of a widget dialog element in a list of elements.- See Also:
-
m_baseCollection
The (optional) base collection for read / writing collection based parameters. -
m_baseObject
The (optional) base object for read / writing the parameter value to. -
m_baseObjectProperty
The (optinal) object property to read / write this parameter value to. -
m_defaultValue
The default value of the parameter. -
m_dialogPage
The name of the dialog (page) the widget is used on. -
m_error
Indicates if the widget value has an error. -
m_id
The id of the parameter on the form. -
m_index
The index of this parameter in the (optional) list of parameters. -
m_maxOccurs
The maximum number of occurences of this parameter. -
m_minOccurs
The minimum number of occurences of this parameter. -
m_name
The name of the parameter. -
m_prefix
Optional localized key prefix identificator. -
m_value
The value of the parameter. -
m_widget
The widget used for the parameter.
-
-
Constructor Details
-
CmsWidgetDialogParameter
Create a new Widget parameter.- Parameters:
base- the base of the parameterindex- the index of this parameter in the list
-
CmsWidgetDialogParameter
Create a new Widget parameter.- Parameters:
base- the base of the parameterindex- the index of this parameter in the listoriginalIndex- the original index in the previous version of the list
-
CmsWidgetDialogParameter
public CmsWidgetDialogParameter(Object base, String property, org.opencms.widgets.I_CmsWidget widget) Create a new Widget parameter based on a given object's property.- Parameters:
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 parameter
-
CmsWidgetDialogParameter
public CmsWidgetDialogParameter(Object base, String property, String dialogPage, org.opencms.widgets.I_CmsWidget widget) Create a new Widget parameter based on a given object's property.- Parameters:
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 parameter
-
CmsWidgetDialogParameter
public CmsWidgetDialogParameter(Object base, String property, String htmlName, String dialogPage, org.opencms.widgets.I_CmsWidget widget) Create a new Widget parameter based on a given object's property.- Parameters:
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 parameter
-
CmsWidgetDialogParameter
public CmsWidgetDialogParameter(Object base, String property, String defaultValue, String dialogPage, org.opencms.widgets.I_CmsWidget widget, int minOccurs, int maxOccurs) Create a new Widget parameter based on a given object's property.- Parameters:
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 parameter
-
CmsWidgetDialogParameter
public CmsWidgetDialogParameter(Object base, String property, String htmlName, String defaultValue, String dialogPage, org.opencms.widgets.I_CmsWidget widget, int minOccurs, int maxOccurs) Create a new Widget parameter based on a given object's property.- Parameters:
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 parameter
-
CmsWidgetDialogParameter
Create a new Widget parameter.- Parameters:
name- the name of the parameterwidget- the widget used for this parameter
-
CmsWidgetDialogParameter
public CmsWidgetDialogParameter(String name, org.opencms.widgets.I_CmsWidget widget, int minOccurs, int maxOccurs) Create a new Widget parameter.- Parameters:
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 parameter
-
CmsWidgetDialogParameter
public CmsWidgetDialogParameter(String value, String defaultValue, String name, org.opencms.widgets.I_CmsWidget widget, String dialog, int minOccurs, int maxOccurs, int index) Create a new Widget parameter with specified occurence settings.- Parameters:
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
-
-
Method Details
-
createId
Returns a from id representation for the given widget name and id.- Parameters:
name- the widget parameter nameindex- the widget parameter index- Returns:
- a from id representation for the given widget name and id
-
commitValue
"Commits" (writes) the value of this widget back to the underlying base object.- Parameters:
dialog- the widget dialog where the parameter is used on- Throws:
org.opencms.main.CmsException- in case the String value of the widget is invalid for the base Object
-
getDefault
- Specified by:
getDefaultin interfaceorg.opencms.widgets.I_CmsWidgetParameter- See Also:
-
getDialogPage
Returns the name of the dialog (or dialog page) this widget parameter is used on.This information can be used to create multi-page dialogs where the widgets are spread over several pages.
- Returns:
- the name of the dialog (or dialog page) this widget parameter is used on
-
getError
Returns the Exception caused when this parameter value was commited, ornullif error occurred.- Returns:
- the Exception caused when this parameter value was commited
-
getId
- Specified by:
getIdin interfaceorg.opencms.widgets.I_CmsWidgetParameter- See Also:
-
getIndex
- Specified by:
getIndexin interfaceorg.opencms.widgets.I_CmsWidgetParameter- See Also:
-
getKey
- Specified by:
getKeyin interfaceorg.opencms.widgets.I_CmsWidgetParameter- See Also:
-
getMaxOccurs
- Specified by:
getMaxOccursin interfaceorg.opencms.widgets.I_CmsWidgetParameter- See Also:
-
getMinOccurs
- Specified by:
getMinOccursin interfaceorg.opencms.widgets.I_CmsWidgetParameter- See Also:
-
getName
- Specified by:
getNamein interfaceorg.opencms.widgets.I_CmsWidgetParameter- See Also:
-
getStringValue
public String getStringValue(org.opencms.file.CmsObject cms) throws org.opencms.main.CmsRuntimeException - Specified by:
getStringValuein interfaceorg.opencms.widgets.I_CmsWidgetParameter- Throws:
org.opencms.main.CmsRuntimeException- See Also:
-
getWidget
Returns the widget for this parameter.- Returns:
- the widget for this parameter
-
hasError
- Specified by:
hasErrorin interfaceorg.opencms.widgets.I_CmsWidgetParameter- See Also:
-
hasValue
Checks if a value for this widget base type with the given id is available.This should only be used if the base object is a collection.
- Parameters:
index- the index to check- Returns:
trueif a value for this widget base type with the given id is available
-
isCollectionBase
Returnstrueif this widget parameter is mapped to a Collection base object.- Returns:
trueif this widget parameter is mapped to a Collection base object
-
prepareCommit
Prepares this widget dialog parameter to be committed.This is required if the base type is mapped to a Collection object, because the collection needs to be cleared before the new values are set.
-
setError
Sets the error state of this widget.If the argument is
nullthen the state is set to "no error".- Parameters:
error- the error state to set
-
setindex
Sets the index to the provided value.- Parameters:
index- the new index value to set
-
setKeyPrefix
- Specified by:
setKeyPrefixin interfaceorg.opencms.widgets.I_CmsWidgetParameter- See Also:
-
setStringValue
public void setStringValue(org.opencms.file.CmsObject cms, String value) throws org.opencms.main.CmsIllegalArgumentException - Specified by:
setStringValuein interfaceorg.opencms.widgets.I_CmsWidgetParameter- Throws:
org.opencms.main.CmsIllegalArgumentException- See Also:
-
init
protected void init(String value, String defaultValue, String name, org.opencms.widgets.I_CmsWidget widget, String dialog, int minOccurs, int maxOccurs, int index) Initializes a widget parameter with the given values.- Parameters:
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
-