Package com.day.cq.wcm.core.components
Class CustomEditConfig
- java.lang.Object
-
- com.day.cq.wcm.core.components.CustomEditConfig
-
- All Implemented Interfaces:
JSONItem
,ComponentEditConfig
,EditConfig
public class CustomEditConfig extends java.lang.Object implements EditConfig
Helper class to create a edit config if not edit context is available.
-
-
Field Summary
-
Fields inherited from interface com.day.cq.wcm.api.components.EditConfig
LISTENER_AFTERCREATE, LISTENER_AFTERDELETE, LISTENER_AFTEREDIT, LISTENER_AFTERINSERT, LISTENER_AFTERMOVE, LISTENER_AFTERREMOVE, REFRESH_PAGE, REFRESH_PARENT, REFRESH_SELF
-
-
Constructor Summary
Constructors Constructor Description CustomEditConfig(ComponentEditConfig cfg)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
drawEditing(java.io.PrintWriter out, java.lang.String contentPath, java.lang.String resourceType, java.lang.String dlgPath, Cell cell, boolean isContainer)
DialogMode
getDialogMode()
Returns the display mode of the dialogjava.util.Map<java.lang.String,DropTarget>
getDropTargets()
Returns amap of configurations of drop targets.java.lang.String
getEmptyText()
Gets the text to be displayed whenComponentEditConfig.isEmpty()
istrue
.java.util.Map<java.lang.String,java.lang.Object>
getFormParameterMap()
Returns the additional form parameters to be included in the dialog.java.util.Map<java.lang.String,java.lang.String>
getFormParameters()
Returns a modifiable map for additional form parameters to be included in the dialog.InplaceEditingConfig
getInplaceEditingConfig()
Returns the configuration for inplace editing of this configuration.java.lang.String
getInsertBehavior()
Returns the insert behavior ornull
of not definedEditLayout
getLayout()
Returns the edit layout for the edit control widget.java.util.Map<java.lang.String,java.lang.String>
getListeners()
Returns a modifiable map of edit listenersJSONItem
getLiveRelationship()
Returns the component live relationship.Toolbar
getToolbar()
Returns the (modifiable) toolbar for the editbar/menu.java.lang.Boolean
isDeepCancel()
Returns if cancelling inheritance of the component sets the cq:isCancelledForChildren flag or not.boolean
isDefault()
Checks if this config has all default values in respect to the default values of the widgets.boolean
isEmpty()
Returns theempty
flag.java.lang.Boolean
isOrderable()
Returns if the edited component is orderable.boolean
isTargetingDisabled()
Returns if targeting is disabled for this component.void
setDeepCancel(java.lang.Boolean deepCancel)
Sets if cancelling inheritance of the component sets the cq:isCancelledForChildren flag or not.void
setDialogMode(DialogMode mode)
Sets the dialog modevoid
setEmpty(boolean empty)
Sets theempty
flag.void
setEmptyText(java.lang.String emptyText)
Sets the text to be displayed whenComponentEditConfig.isEmpty()
istrue
.void
setInplaceEditingConfig(InplaceEditingConfig inplaceEditingConfig)
Sets the inplace editing configuration.void
setInsertBehavior(java.lang.String insertBehavior)
Sets the insert behaviorvoid
setLayout(EditLayout layout)
Sets the edit layout for the edit control widget.void
setLiveRelationship(JSONItem liveRelationship)
Set the computed live relationship of the component TODO seems like we are only considering this as an additional JSONItem to render - if that's confirmed we might rename this method.void
setOrderable(java.lang.Boolean orderable)
Sets if the edited component is orderable.void
write(JSONWriter out)
Serializes this descriptor to json
-
-
-
Constructor Detail
-
CustomEditConfig
public CustomEditConfig(ComponentEditConfig cfg)
-
-
Method Detail
-
drawEditing
public void drawEditing(java.io.PrintWriter out, java.lang.String contentPath, java.lang.String resourceType, java.lang.String dlgPath, Cell cell, boolean isContainer) throws java.io.IOException
- Throws:
java.io.IOException
-
setLayout
public void setLayout(EditLayout layout)
Description copied from interface:EditConfig
Sets the edit layout for the edit control widget.- Specified by:
setLayout
in interfaceEditConfig
- Parameters:
layout
- edit layout
-
setInsertBehavior
public void setInsertBehavior(java.lang.String insertBehavior)
Description copied from interface:EditConfig
Sets the insert behavior- Specified by:
setInsertBehavior
in interfaceEditConfig
- Parameters:
insertBehavior
- the behavior
-
setDialogMode
public void setDialogMode(DialogMode mode)
Description copied from interface:EditConfig
Sets the dialog mode- Specified by:
setDialogMode
in interfaceEditConfig
- Parameters:
mode
- the mode
-
setInplaceEditingConfig
public void setInplaceEditingConfig(InplaceEditingConfig inplaceEditingConfig)
Description copied from interface:EditConfig
Sets the inplace editing configuration.- Specified by:
setInplaceEditingConfig
in interfaceEditConfig
- Parameters:
inplaceEditingConfig
- The inplace editing configuration
-
setEmpty
public void setEmpty(boolean empty)
Description copied from interface:EditConfig
Sets theempty
flag. Iftrue
this indicates that the component has not visual content and a placeholder text should be rendered.- Specified by:
setEmpty
in interfaceEditConfig
- Parameters:
empty
-true
if a placeholder text should be rendered.
-
setEmptyText
public void setEmptyText(java.lang.String emptyText)
Description copied from interface:EditConfig
Sets the text to be displayed whenComponentEditConfig.isEmpty()
istrue
. Iftext
isnull
then the default text is displayed.- Specified by:
setEmptyText
in interfaceEditConfig
- Parameters:
emptyText
- the text ornull
-
setOrderable
public void setOrderable(java.lang.Boolean orderable)
Description copied from interface:EditConfig
Sets if the edited component is orderable.- Specified by:
setOrderable
in interfaceEditConfig
- Parameters:
orderable
-true
to enable ordering ornull
if the behavior is defined by the widgets.
-
setDeepCancel
public void setDeepCancel(java.lang.Boolean deepCancel)
Description copied from interface:EditConfig
Sets if cancelling inheritance of the component sets the cq:isCancelledForChildren flag or not.- Specified by:
setDeepCancel
in interfaceEditConfig
- Parameters:
deepCancel
-true
if cancel sets the flag ornull
if cancel does not set the flag.
-
setLiveRelationship
public void setLiveRelationship(JSONItem liveRelationship)
Description copied from interface:EditConfig
Set the computed live relationship of the component TODO seems like we are only considering this as an additional JSONItem to render - if that's confirmed we might rename this method.- Specified by:
setLiveRelationship
in interfaceEditConfig
- Parameters:
liveRelationship
- the relationship to set
-
isDefault
public boolean isDefault()
Description copied from interface:ComponentEditConfig
Checks if this config has all default values in respect to the default values of the widgets. Iftrue
the edit config does not need to be submitted to the client.- Specified by:
isDefault
in interfaceComponentEditConfig
- Returns:
true
if default
-
getLayout
public EditLayout getLayout()
Description copied from interface:ComponentEditConfig
Returns the edit layout for the edit control widget.- Specified by:
getLayout
in interfaceComponentEditConfig
- Returns:
- the edit layout for the edit control widget.
-
getDropTargets
public java.util.Map<java.lang.String,DropTarget> getDropTargets()
Description copied from interface:EditConfig
Returns amap of configurations of drop targets. the keys are the ids of the configs. Note that the map is modifiable and can be used to extend the drop targets dynamically.- Specified by:
getDropTargets
in interfaceComponentEditConfig
- Specified by:
getDropTargets
in interfaceEditConfig
- Returns:
- map of drop target configurations.
-
getInsertBehavior
public java.lang.String getInsertBehavior()
Description copied from interface:ComponentEditConfig
Returns the insert behavior ornull
of not defined- Specified by:
getInsertBehavior
in interfaceComponentEditConfig
- Returns:
- insert behavior or
null
-
getToolbar
public Toolbar getToolbar()
Description copied from interface:EditConfig
Returns the (modifiable) toolbar for the editbar/menu.- Specified by:
getToolbar
in interfaceComponentEditConfig
- Specified by:
getToolbar
in interfaceEditConfig
- Returns:
- toolbar
-
getDialogMode
public DialogMode getDialogMode()
Description copied from interface:ComponentEditConfig
Returns the display mode of the dialog- Specified by:
getDialogMode
in interfaceComponentEditConfig
- Returns:
- the dialog mode.
-
getInplaceEditingConfig
public InplaceEditingConfig getInplaceEditingConfig()
Description copied from interface:ComponentEditConfig
Returns the configuration for inplace editing of this configuration.- Specified by:
getInplaceEditingConfig
in interfaceComponentEditConfig
- Returns:
- The inplace editing config;
null
if there is no inplace editing config (which means that no inplace editing is available for the component)
-
isEmpty
public boolean isEmpty()
Description copied from interface:ComponentEditConfig
Returns theempty
flag. Indicates if the respective component has no visual content and a placeholder text should be rendered.- Specified by:
isEmpty
in interfaceComponentEditConfig
- Returns:
true
if a placeholder text should be rendered
-
getEmptyText
public java.lang.String getEmptyText()
Description copied from interface:ComponentEditConfig
Gets the text to be displayed whenComponentEditConfig.isEmpty()
istrue
. Returnsnull
if the default text is displayed.- Specified by:
getEmptyText
in interfaceComponentEditConfig
- Returns:
- the empty text or
null
-
isOrderable
public java.lang.Boolean isOrderable()
Description copied from interface:ComponentEditConfig
Returns if the edited component is orderable.- Specified by:
isOrderable
in interfaceComponentEditConfig
- Returns:
true
if the component is orderable ornull
if the behavior is defined by the widgets.
-
getFormParameters
public java.util.Map<java.lang.String,java.lang.String> getFormParameters()
Description copied from interface:EditConfig
Returns a modifiable map for additional form parameters to be included in the dialog.- Specified by:
getFormParameters
in interfaceComponentEditConfig
- Specified by:
getFormParameters
in interfaceEditConfig
- Returns:
- map of additional form parameters
-
getListeners
public java.util.Map<java.lang.String,java.lang.String> getListeners()
Description copied from interface:EditConfig
Returns a modifiable map of edit listeners- Specified by:
getListeners
in interfaceComponentEditConfig
- Specified by:
getListeners
in interfaceEditConfig
- Returns:
- map of edit listeners
-
getLiveRelationship
public JSONItem getLiveRelationship()
Description copied from interface:ComponentEditConfig
Returns the component live relationship. TODO seems like we are only considering this as an additional JSONItem to render - if that's confirmed we might rename this method.- Specified by:
getLiveRelationship
in interfaceComponentEditConfig
- Returns:
- the computed live relationship.
null
otherwise
-
isDeepCancel
public java.lang.Boolean isDeepCancel()
Description copied from interface:ComponentEditConfig
Returns if cancelling inheritance of the component sets the cq:isCancelledForChildren flag or not.- Specified by:
isDeepCancel
in interfaceComponentEditConfig
- Returns:
true
if cancel sets the flag ornull
if cancel does not set the flag.
-
isTargetingDisabled
public boolean isTargetingDisabled()
Description copied from interface:ComponentEditConfig
Returns if targeting is disabled for this component.- Specified by:
isTargetingDisabled
in interfaceComponentEditConfig
- Returns:
true
if targeting is disabled,false
if targeting is allowed
-
write
public void write(JSONWriter out) throws JSONException
Description copied from interface:JSONItem
Serializes this descriptor to json- Specified by:
write
in interfaceJSONItem
- Parameters:
out
- json writer- Throws:
JSONException
- if a JSON error occurs
-
getFormParameterMap
public java.util.Map<java.lang.String,java.lang.Object> getFormParameterMap()
Description copied from interface:EditConfig
Returns the additional form parameters to be included in the dialog. This method allows to use multi value properties for form parameters.- Specified by:
getFormParameterMap
in interfaceComponentEditConfig
- Specified by:
getFormParameterMap
in interfaceEditConfig
- Returns:
- map of additional form parameters
-
-