Class CompositeElement
java.lang.Object
com.aquima.interactions.composer.model.Element
com.aquima.interactions.composer.model.CompositeElement
- All Implemented Interfaces:
ICompositeElement
,IElement
,Serializable
- Direct Known Subclasses:
Container
,ContentItem
,Document
Base class for composite elements. A composite element is an element that can have children elements.
- Since:
- 7.0
- Author:
- O. Kerpershoek, Jon van Leuven
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CompositeElement
(CompositeElement other, boolean duplicateContents) Copy constructor that creates a composite element based on another composite element.protected
CompositeElement
(ElementDefinition definition, ContentStyle contentStyle) Constructs a composite element from a definition.protected
CompositeElement
(String name, ContentStyle contentStyle) Constructs an empty composite element with a name and content style. -
Method Summary
Modifier and TypeMethodDescriptionThis method will invoke the visitor for this runtime element.final IElement
addElement
(IElement element) This method will add the element to the container.final void
addElements
(IElement[] elements) This method will add the array of elements to the container.boolean
boolean
equalsContent
(ICompositeElement other) Method indicating if the composite element has the same content as another composite element.This method returns the content style of the element.getElement
(int index) This method returns the child element at the specified position.getElement
(RuntimeKey key) This method returns the element for the specified runtime key.int
This method returns the number of elements that is contained in this container.IElement[]
This method returns an array containing all the elements that are directly included in this container.int
hashCode()
final IElement
insertElement
(int index, IElement element) This method will add the element to the container at the specified position.final IElement[]
This method will remove all the elements from the container.final IElement
removeElement
(int index) This method will remove the element at the specified position.protected final void
replaceElementWithElements
(Element element, Element[] replacements) void
setContentStyle
(ContentStyle contentStyle) This method sets the content style of the element.void
setElements
(Element[] elements) This method will add the array of elements to the composite model.toString()
Methods inherited from class com.aquima.interactions.composer.model.Element
addPresentationStyle, evaluateTsl, getName, getParent, getPresentationStyles, getProperty, getPropertyKeys, getRuntimeKey, getVisibilityCondition, hasFocus, hasPresentationStyle, isReadonly, isReadonlyInheritFromParent, isVisible, setFocus, setParent, setPresentationStyle, setPresentationStyles, setPresentationStyles, setProperty, setReadonly, setReadonlyInheritFromParent, setRuntimeKey, setVisibilityCondition, setVisible
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.aquima.interactions.composer.IElement
duplicate, getName, getParent, getPresentationStyles, getProperty, getPropertyKeys, getRuntimeKey, hasFocus, hasPresentationStyle, isReadonly, isReadonlyInheritFromParent, isVisible, setProperty
-
Constructor Details
-
CompositeElement
Constructs an empty composite element with a name and content style.- Parameters:
name
- The name of the composite element.contentStyle
- The content style for the composite element (may be null)
-
CompositeElement
Copy constructor that creates a composite element based on another composite element. The duplicateContents parameter may be used to specify if all contents should be duplicated. Note: Duplicating a composite element can be quite expensive depending on the amount of content that is present on the composite element. If the duplicate contents is false the children of the composite element are not copied or used thus creating an empty composite element. This constructor is mainly available for implementations of the duplicate method.- Parameters:
other
- The container which should be imitated.duplicateContents
- A boolean indicating it should create copies of the contents of the other composite element, or when false to ignore the other composite element children.
-
CompositeElement
Constructs a composite element from a definition.Note: This constructor will not add any child elements.
- Parameters:
definition
- The definition of the composite element.contentStyle
- The content style for the composite element.
-
-
Method Details
-
getContentStyle
This method returns the content style of the element.- Specified by:
getContentStyle
in interfaceICompositeElement
- Returns:
- The content style of the element, may be null.
-
setContentStyle
This method sets the content style of the element.- Parameters:
contentStyle
- The content style of the element, may not be null.
-
getElementCount
public int getElementCount()Description copied from interface:ICompositeElement
This method returns the number of elements that is contained in this container.- Specified by:
getElementCount
in interfaceICompositeElement
- Returns:
- The number of child elements of this container.
-
getElement
Description copied from interface:ICompositeElement
This method returns the element for the specified runtime key.- Specified by:
getElement
in interfaceICompositeElement
- Parameters:
key
- The runtime key of the element that is requested.- Returns:
- The element for the specified runtime key.
-
getElement
Description copied from interface:ICompositeElement
This method returns the child element at the specified position.- Specified by:
getElement
in interfaceICompositeElement
- Parameters:
index
- The position of the child element that is requested.- Returns:
- The child element at the specified position.
-
getElements
Description copied from interface:ICompositeElement
This method returns an array containing all the elements that are directly included in this container.- Specified by:
getElements
in interfaceICompositeElement
- Returns:
- Array with the direct sub elements of the container.
-
setElements
This method will add the array of elements to the composite model. The elements will be appended at the end after any existing elements. This method has the same effect as calling the addElement method for each element in the array.- Parameters:
elements
- The array of elements that should be added to the container.
-
insertElement
This method will add the element to the container at the specified position.- Parameters:
index
- The position at which the element should be added.element
- The element that should be added to the container.- Returns:
- The element that was just added.
-
replaceElementWithElements
-
addElement
This method will add the element to the container. The element will be appended at the end after any existing elements.- Parameters:
element
- The element that should be added to the container.- Returns:
- The element that was just added.
-
addElements
This method will add the array of elements to the container. The elements will be appended at the end after any existing elements. This method has the same effect as calling the addElement method for each element in the array.- Parameters:
elements
- The array of elements that should be added to the container.
-
removeElement
This method will remove the element at the specified position.- Parameters:
index
- The position of the element that should be removed.- Returns:
- The element that was removed from the container.
-
removeAllElements
This method will remove all the elements from the container.- Returns:
- Array of all the children that were removed from the container.
-
accept
Description copied from class:Element
This method will invoke the visitor for this runtime element. -
equalsContent
Description copied from interface:ICompositeElement
Method indicating if the composite element has the same content as another composite element.- Specified by:
equalsContent
in interfaceICompositeElement
- Parameters:
other
- composite element to compare with- Returns:
- boolean indicating if the content of this composite element is equal to the content of the provided composite element.
-
equals
-
hashCode
public int hashCode() -
toString
-