com.day.cq.wcm.core.impl.components
Class ComponentImpl

java.lang.Object
  extended by org.apache.sling.adapter.SlingAdaptable
      extended by com.day.cq.wcm.core.impl.components.ComponentImpl
All Implemented Interfaces:
LabeledResource, Component, org.apache.sling.api.adapter.Adaptable
Direct Known Subclasses:
VirtualComponentImpl

public class ComponentImpl
extends org.apache.sling.adapter.SlingAdaptable
implements Component

Implements a 'local' component that extends the cached one by adding support for accessing local resources.


Field Summary
protected  SystemComponent base
           
 
Constructor Summary
ComponentImpl(org.apache.sling.api.resource.Resource resource, SystemComponent base)
           
 
Method Summary
<AdapterType>
AdapterType
adaptTo(Class<AdapterType> type)
          
 String getCellName()
          Returns the cell name of this component.
 ComponentEditConfig getChildEditConfig()
          Returns the child edit config of this component or the one of it's super component.
 String getComponentGroup()
          Returns the name of the component group.
 ComponentEditConfig getDeclaredChildEditConfig()
          Returns the child edit config of this component
 ComponentEditConfig getDeclaredEditConfig()
          Returns the edit config of this component
 String getDescription()
          Returns the description of this resource.
 String getDesignDialogPath()
          Returns the design dialog path of this component or of an inherited one.
 ComponentEditConfig getDesignEditConfig(String cellName)
          Returns the design edit config for the given cell name
 String getDialogPath()
          Returns the dialog path of this component or of an inherited one.
 ComponentEditConfig getEditConfig()
          Returns the edit config of this component or the one of it's super component.
 Map<String,String> getHtmlTagAttributes()
          Returns additional tag attributes that are added to the surrounding html tag.
 String getIconPath()
          Returns the path to an icon for this component or null if the component does not provide an icon.
 org.apache.sling.api.resource.Resource getLocalResource(String name)
          Finds the resource with the given name that is stored "in" this component.
 String getName()
          Returns the name of this resource.
 String getPath()
          Returns the path of this resource
 org.apache.sling.api.resource.ValueMap getProperties()
          Returns the properties of this Component.
 String getResourceType()
          Returns the resource type to be used for this component.
 Component getSuperComponent()
          Returns the super component if the super resource type is defined and points to a valid component.
 String getThumbnailPath()
          Returns the path to a thumbnail for this component or null if the component does not provide a thumbnail.
 String getTitle()
          Returns the tile of this resource.
 Collection<VirtualComponent> getVirtualComponents()
          Returns a collection of virtual components that are configured for this component.
 boolean isContainer()
          Checks if this component is a container component.
 boolean isDesignable()
          Checks if this component is designable.
 boolean isEditable()
          Checks if this component is editable.
 boolean noDecoration()
          Checks if this component does not need decoration when included.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

base

protected final SystemComponent base
Constructor Detail

ComponentImpl

public ComponentImpl(org.apache.sling.api.resource.Resource resource,
                     SystemComponent base)
Method Detail

getPath

public String getPath()
Description copied from interface: LabeledResource
Returns the path of this resource

Specified by:
getPath in interface LabeledResource
Returns:
the path of this resource

getName

public String getName()
Description copied from interface: LabeledResource
Returns the name of this resource. this is usually the last segment of it's path.

Specified by:
getName in interface LabeledResource
Returns:
the name of the resource

getTitle

public String getTitle()
Description copied from interface: LabeledResource
Returns the tile of this resource.

Specified by:
getTitle in interface LabeledResource
Returns:
the tile of this resource or null if not defined.

getDescription

public String getDescription()
Description copied from interface: LabeledResource
Returns the description of this resource.

Specified by:
getDescription in interface LabeledResource
Returns:
the description of this resource or null if not defined.

getIconPath

public String getIconPath()
Description copied from interface: Component
Returns the path to an icon for this component or null if the component does not provide an icon.

If this component does not define a path the one of the super component is returned.

Note: the path is a webapp relative URL. eg: /docroot/c1.gif

Specified by:
getIconPath in interface Component
Returns:
the path to an icon or null

getThumbnailPath

public String getThumbnailPath()
Description copied from interface: Component
Returns the path to a thumbnail for this component or null if the component does not provide a thumbnail.

If this component does not define a path the one of the super component is returned.

Note: the path is a webapp relative URL. eg: /docroot/c1.gif

Specified by:
getThumbnailPath in interface Component
Returns:
the path to a thumbnail or null

getComponentGroup

public String getComponentGroup()
Description copied from interface: Component
Returns the name of the component group. This is merely informational for dialogs that want to group the components.

Specified by:
getComponentGroup in interface Component
Returns:
the name of the component group or null if not defined.

getCellName

public String getCellName()
Description copied from interface: Component
Returns the cell name of this component. If the cell name is an empty string is returned, the wcm request filter will not create a new edit context.

Specified by:
getCellName in interface Component
Returns:
the cell name

getDialogPath

public String getDialogPath()
Description copied from interface: Component
Returns the dialog path of this component or of an inherited one.

Please note, that inheriting a dialog is not always desirable, since (currently) the resource type is defined as hidden field in the dialog. so extending a component without defining an own dialog would result in content having the base component's resource type.

Specified by:
getDialogPath in interface Component
Returns:
the dialog path or null

getDesignDialogPath

public String getDesignDialogPath()
Description copied from interface: Component
Returns the design dialog path of this component or of an inherited one.

Specified by:
getDesignDialogPath in interface Component
Returns:
the design dialog path or null

isEditable

public boolean isEditable()
Description copied from interface: Component
Checks if this component is editable. This is the case if it defines or inherits a dialog

Specified by:
isEditable in interface Component
Returns:
true if the component is editable.

isDesignable

public boolean isDesignable()
Description copied from interface: Component
Checks if this component is designable. This is the case if it defines or inherits a design dialog

Specified by:
isDesignable in interface Component
Returns:
true if the component is designable.

isContainer

public boolean isContainer()
Description copied from interface: Component
Checks if this component is a container component. For example a paragraph system component. Container components affect the cell name generation of included resources where the cell name of the respective component is used instead of the name of the addressed resource.

Specified by:
isContainer in interface Component
Returns:
true if this component is a container.

noDecoration

public boolean noDecoration()
Description copied from interface: Component
Checks if this component does not need decoration when included.

Specified by:
noDecoration in interface Component
Returns:
true if this component does not need decoration when included.

getProperties

public org.apache.sling.api.resource.ValueMap getProperties()
Description copied from interface: Component
Returns the properties of this Component.

Specified by:
getProperties in interface Component
Returns:
the component properties

getDeclaredEditConfig

public ComponentEditConfig getDeclaredEditConfig()
Description copied from interface: Component
Returns the edit config of this component

Specified by:
getDeclaredEditConfig in interface Component
Returns:
the edit config or null if not available

getDeclaredChildEditConfig

public ComponentEditConfig getDeclaredChildEditConfig()
Description copied from interface: Component
Returns the child edit config of this component

Specified by:
getDeclaredChildEditConfig in interface Component
Returns:
the child edit config or null if not available

getEditConfig

public ComponentEditConfig getEditConfig()
Description copied from interface: Component
Returns the edit config of this component or the one of it's super component.

Specified by:
getEditConfig in interface Component
Returns:
the edit config or null if not available

getDesignEditConfig

public ComponentEditConfig getDesignEditConfig(String cellName)
Description copied from interface: Component
Returns the design edit config for the given cell name

Specified by:
getDesignEditConfig in interface Component
Parameters:
cellName - name of the cell
Returns:
the design edit config

getChildEditConfig

public ComponentEditConfig getChildEditConfig()
Description copied from interface: Component
Returns the child edit config of this component or the one of it's super component.

Specified by:
getChildEditConfig in interface Component
Returns:
the edit config or null if not available

getHtmlTagAttributes

public Map<String,String> getHtmlTagAttributes()
Description copied from interface: Component
Returns additional tag attributes that are added to the surrounding html tag.

Specified by:
getHtmlTagAttributes in interface Component
Returns:
map of additional tag attributes.

getSuperComponent

public Component getSuperComponent()
Description copied from interface: Component
Returns the super component if the super resource type is defined and points to a valid component.

Specified by:
getSuperComponent in interface Component
Returns:
the super component or null

getResourceType

public String getResourceType()
Description copied from interface: Component
Returns the resource type to be used for this component. this is usually the path of this component without the first path segment, but can be overridden by setting the "sling:resourceType".

Specified by:
getResourceType in interface Component
Returns:
the resource type

getLocalResource

public org.apache.sling.api.resource.Resource getLocalResource(String name)
Finds the resource with the given name that is stored "in" this component. If the resource cannot be found, the super component is asked. This is usually used in image scripts that need to load additional images.

Specified by:
getLocalResource in interface Component
Parameters:
name - name of the resource
Returns:
resource or null

getVirtualComponents

public Collection<VirtualComponent> getVirtualComponents()
Returns a collection of virtual components that are configured for this component.

Specified by:
getVirtualComponents in interface Component
Returns:
a collection of virtual components.

adaptTo

public <AdapterType> AdapterType adaptTo(Class<AdapterType> type)

Specified by:
adaptTo in interface org.apache.sling.api.adapter.Adaptable
Overrides:
adaptTo in class org.apache.sling.adapter.SlingAdaptable


Copyright © 2008 Day Management AG. All Rights Reserved.