Package org.opencms.gwt.client.property
Class A_CmsPropertyEditor
- java.lang.Object
-
- org.opencms.gwt.client.property.A_CmsPropertyEditor
-
- All Implemented Interfaces:
I_CmsFormWidgetMultiFactory
- Direct Known Subclasses:
CmsNavModePropertyEditor
,CmsSimplePropertyEditor
,CmsVfsModePropertyEditor
public abstract class A_CmsPropertyEditor extends java.lang.Object implements I_CmsFormWidgetMultiFactory
The abstract base class for dialogs to edit properties.- Since:
- 8.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FIELD_LINK
The field id for the link selector widget.static java.lang.String
FIELD_URLNAME
The field id of the "url name" form field.protected java.util.List<java.lang.String>
m_allProps
The list of all property names.protected java.lang.String
m_disabledReason
The reason to disable the form input fields.protected CmsForm
m_form
The form containing the fields.protected I_CmsPropertyEditorHandler
m_handler
The handler for this sitemap entry editor.protected boolean
m_nameOnlyDisabled
True if only the name edit field is disabled.protected java.util.Map<java.lang.String,org.opencms.xml.content.CmsXmlContentProperty>
m_propertyConfig
The configuration of the properties.protected I_CmsFormField
m_urlNameField
The URL name field.protected CmsDefaultStringModel
m_urlNameModel
The model for the URL name field.
-
Constructor Summary
Constructors Constructor Description A_CmsPropertyEditor(java.util.Map<java.lang.String,org.opencms.xml.content.CmsXmlContentProperty> propertyConfig, I_CmsPropertyEditorHandler handler)
Creates a new sitemap entry editor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addSpecialFields()
Method to add special, non-property fields.protected abstract void
buildFields()
Builds and renders the fields for the properties.static void
checkWidgetRequirements(java.lang.String key, I_CmsFormWidget widget)
Checks whether a widget can be used in the sitemap entry editor, and throws an exception otherwise.I_CmsFormWidget
createFormWidget(java.lang.String key, java.util.Map<java.lang.String,java.lang.String> widgetParams, com.google.common.base.Optional<java.lang.String> defaultValue)
Creates a new form widget.protected CmsBasicFormField
createUrlNameField()
Creates the text field for editing the URL name.void
disableInput(java.lang.String disabledReason, boolean nameOnlyDisabled)
Disables all input to the form.CmsForm
getForm()
Gets the form for the properties.protected java.lang.String
getTitle(java.util.Map<java.lang.String,java.lang.String> fieldValues)
Gets the title from a map of field values.protected CmsDefaultStringModel
getUrlNameModel(java.lang.String urlName)
Lazily creates the model object for the URL name field.void
initializeWidgets(CmsPopup dialog)
Initializes the widgets for editing the properties.protected java.lang.String
message(java.lang.String key, java.lang.Object... args)
Returns a localized message from the message bundle.protected void
setGhostValue(I_CmsFormField field, java.lang.String value, boolean ghostMode)
Sets the ghost value for a form field if its normal value is empty and the field's widget supports ghost values.void
setPropertyNames(java.util.List<java.lang.String> propertyNames)
Sets the names of properties which can be edited.protected abstract void
setupFieldContainer()
Sets up the widget which will contain the input fields for the properties.protected void
setUrlNameField(java.lang.String urlName)
Sets the contents of the URL name field in the form.protected void
showUrlNameError(java.lang.String message)
Shows an error message next to the URL name input field.
-
-
-
Field Detail
-
FIELD_LINK
public static final java.lang.String FIELD_LINK
The field id for the link selector widget.- See Also:
- Constant Field Values
-
FIELD_URLNAME
public static final java.lang.String FIELD_URLNAME
The field id of the "url name" form field.- See Also:
- Constant Field Values
-
m_allProps
protected java.util.List<java.lang.String> m_allProps
The list of all property names.
-
m_disabledReason
protected java.lang.String m_disabledReason
The reason to disable the form input fields.
-
m_nameOnlyDisabled
protected boolean m_nameOnlyDisabled
True if only the name edit field is disabled.
-
m_handler
protected I_CmsPropertyEditorHandler m_handler
The handler for this sitemap entry editor.
-
m_propertyConfig
protected java.util.Map<java.lang.String,org.opencms.xml.content.CmsXmlContentProperty> m_propertyConfig
The configuration of the properties.
-
m_urlNameField
protected I_CmsFormField m_urlNameField
The URL name field.
-
m_urlNameModel
protected CmsDefaultStringModel m_urlNameModel
The model for the URL name field.
-
-
Constructor Detail
-
A_CmsPropertyEditor
public A_CmsPropertyEditor(java.util.Map<java.lang.String,org.opencms.xml.content.CmsXmlContentProperty> propertyConfig, I_CmsPropertyEditorHandler handler)
Creates a new sitemap entry editor.- Parameters:
handler
- the handlerpropertyConfig
- the property configuration
-
-
Method Detail
-
checkWidgetRequirements
public static void checkWidgetRequirements(java.lang.String key, I_CmsFormWidget widget)
Checks whether a widget can be used in the sitemap entry editor, and throws an exception otherwise.- Parameters:
key
- the widget keywidget
- the created widget
-
createFormWidget
public I_CmsFormWidget createFormWidget(java.lang.String key, java.util.Map<java.lang.String,java.lang.String> widgetParams, com.google.common.base.Optional<java.lang.String> defaultValue)
Description copied from interface:I_CmsFormWidgetMultiFactory
Creates a new form widget.- Specified by:
createFormWidget
in interfaceI_CmsFormWidgetMultiFactory
- Parameters:
key
- the key identifying the widget typewidgetParams
- the widget initialization parametersdefaultValue
- an optional default value- Returns:
- the created form widget
- See Also:
I_CmsFormWidgetMultiFactory.createFormWidget(java.lang.String, java.util.Map, com.google.common.base.Optional)
-
disableInput
public void disableInput(java.lang.String disabledReason, boolean nameOnlyDisabled)
Disables all input to the form.- Parameters:
disabledReason
- the reason to display to the usernameOnlyDisabled
- true if only the name editing field is disabled
-
initializeWidgets
public void initializeWidgets(CmsPopup dialog)
Initializes the widgets for editing the properties.- Parameters:
dialog
- the dialog which the property editor is part of
-
setPropertyNames
public void setPropertyNames(java.util.List<java.lang.String> propertyNames)
Sets the names of properties which can be edited.- Parameters:
propertyNames
- the property names
-
addSpecialFields
protected void addSpecialFields()
Method to add special, non-property fields.
-
buildFields
protected abstract void buildFields()
Builds and renders the fields for the properties.
-
createUrlNameField
protected CmsBasicFormField createUrlNameField()
Creates the text field for editing the URL name.- Returns:
- the newly created form field
-
getTitle
protected java.lang.String getTitle(java.util.Map<java.lang.String,java.lang.String> fieldValues)
Gets the title from a map of field values.- Parameters:
fieldValues
- the map of field values- Returns:
- the title
-
getUrlNameModel
protected CmsDefaultStringModel getUrlNameModel(java.lang.String urlName)
Lazily creates the model object for the URL name field.- Parameters:
urlName
- the initial value for the URL name- Returns:
- the model object for the URL name field
-
message
protected java.lang.String message(java.lang.String key, java.lang.Object... args)
Returns a localized message from the message bundle.- Parameters:
key
- the message keyargs
- the message parameters- Returns:
- the localized message
-
setGhostValue
protected void setGhostValue(I_CmsFormField field, java.lang.String value, boolean ghostMode)
Sets the ghost value for a form field if its normal value is empty and the field's widget supports ghost values.- Parameters:
field
- the form fieldvalue
- the ghost value to setghostMode
- if true, sets the widget to ghost mode
-
setupFieldContainer
protected abstract void setupFieldContainer()
Sets up the widget which will contain the input fields for the properties.
-
setUrlNameField
protected void setUrlNameField(java.lang.String urlName)
Sets the contents of the URL name field in the form.- Parameters:
urlName
- the new URL name
-
showUrlNameError
protected void showUrlNameError(java.lang.String message)
Shows an error message next to the URL name input field.- Parameters:
message
- the message which should be displayed, or null if no message should be displayed
-
-