public class Element extends Object implements DataTarget, ReportElement
Modifier and Type | Field and Description |
---|---|
static String |
ANONYMOUS_ELEMENT_PREFIX
The internal constant to mark anonymous element names.
|
Constructor and Description |
---|
Element()
Constructs an element.
|
Modifier and Type | Method and Description |
---|---|
Element |
clone()
Clones this Element, the datasource and the private stylesheet of this Element.
|
void |
copyAttributes(ReportAttributeMap<Object> attributes) |
void |
copyInto(Element target) |
Element |
derive() |
Element |
derive(boolean preserveElementInstanceIds)
Creates a deep copy of this element and regenerates all instance-ids.
|
Object |
getAttribute(String namespace,
String name) |
Expression |
getAttributeExpression(String namespace,
String name)
Returns the attribute expression for the given attribute identified by its namespace and attribute name.
|
String[] |
getAttributeExpressionNames(String name)
Returns the names of all attributes for the given namespace that have attribute-expressions assigned.
|
String[] |
getAttributeExpressionNamespaces()
Returns the namespaces of all attributes that have attribute-expressions assigned.
|
ReportAttributeMap<Expression> |
getAttributeExpressions() |
String[] |
getAttributeNames(String namespace) |
String[] |
getAttributeNamespaces() |
ReportAttributeMap<Object> |
getAttributes()
Returns the attributes of the element as unmodifable collection.
|
<TS> TS |
getAttributeTyped(String namespace,
String attribute,
Class<TS> filter) |
long |
getChangeTracker()
Returns the element's change-tracker.
|
ReportElement |
getChildElementByType(ElementType type) |
ReportElement[] |
getChildElementsByName(String name) |
ReportElement[] |
getChildElementsByType(ElementType type) |
SimpleStyleSheet |
getComputedStyle() |
org.pentaho.reporting.libraries.resourceloader.ResourceKey |
getContentBase() |
DataSource |
getDataSource()
Deprecated.
Whereever possible use ElementType implementations instead. This method only exists to let old reports
run.
|
ElementStyleSheet |
getDefaultStyleSheet()
Creates the global stylesheet for this element type.
|
org.pentaho.reporting.libraries.resourceloader.ResourceKey |
getDefinitionSource()
Returns the resource-key of the file that defined this element.
|
<T> T |
getElementContext(Class<T> contextType) |
ElementType |
getElementType() |
String |
getElementTypeName() |
Object |
getFirstAttribute(String localName) |
String |
getHRefTarget()
Returns the currently set link target for this element.
|
String |
getId()
Returns the Xml-ID of this element.
|
ReportDefinition |
getMasterReport()
Returns the master-report element.
|
ElementMetaData |
getMetaData() |
String |
getName()
Returns the name of the Element.
|
InstanceID |
getObjectID()
Returns a unique identifier for the given instance.
|
Band |
getParent()
Return the parent of the Element.
|
Section |
getParentSection() |
ReportDefinition |
getReportDefinition()
Returns the currently assigned report definition.
|
ElementStyleSheet |
getStyle()
Returns this elements private stylesheet.
|
Expression |
getStyleExpression(StyleKey property)
Returns the expressions for the report.
|
Map<StyleKey,Expression> |
getStyleExpressions()
Returns a map of all style expressions attached to this element.
|
Object |
getTreeLock()
Returns the tree lock object for the self tree.
|
boolean |
isDynamicContent()
Checks whether the layout of this element is dynamic and adjusts to the element's printable content.
|
boolean |
isVisible()
Defines whether this Element should be painted.
|
void |
notifyNodeChildAdded(Object o)
Notifies the element and any parent element that a child node has been added.
|
void |
notifyNodeChildRemoved(Object o)
Notifies the element and any parent element that a child node has been removed.
|
void |
notifyNodePropertiesChanged()
Notifies the element and any parent element that a property of this element has changed.
|
void |
notifyNodePropertiesChanged(Object parameter) |
void |
notifyNodeStructureChanged()
Notifies the element and any parent element that the structure of this element has changed in some undisclosed way.
|
void |
setAttribute(String namespace,
String name,
Object value)
Defines a attribute's static value.
|
void |
setAttribute(String namespace,
String name,
Object value,
boolean notifyChange) |
void |
setAttributeExpression(String namespace,
String name,
Expression value)
Assigns a new attribute expression for the given attribute.
|
void |
setComputedStyle(SimpleStyleSheet computedStyle) |
void |
setDataSource(DataSource ds)
Deprecated.
The data-source should not be used anymore. Use ElementType implementations instead. This method only
exists to let old reports run.
|
void |
setDynamicContent(boolean dynamicContent)
Defines the stylesheet property for the dynamic attribute.
|
void |
setElementType(ElementType elementType) |
void |
setHRefTarget(String target)
Redefines the link target for this element.
|
void |
setId(String id)
Defines the Xml-ID of this element.
|
void |
setName(String name)
Defines the name for this Element.
|
void |
setStyleExpression(StyleKey property,
Expression function)
Adds a function to the report's collection of expressions.
|
void |
setVisible(boolean b)
Defines, whether this Element should be visible in the output.
|
String |
toString()
Returns a string representation of the band, useful mainly for debugging purposes.
|
public static final String ANONYMOUS_ELEMENT_PREFIX
public Element()
public SimpleStyleSheet getComputedStyle()
getComputedStyle
in interface ReportElement
public void setComputedStyle(SimpleStyleSheet computedStyle)
setComputedStyle
in interface ReportElement
public void setAttributeExpression(String namespace, String name, Expression value)
ReportElement
null
clears the
expression and will preserve the attribute's static value.
Functions cannot be used as attribute-expressions as attribute- and style-expressions do not receive events and are
not guaranteed to be executed unless the element is processed.setAttributeExpression
in interface ReportElement
namespace
- the attribute's namespace.name
- the attribute's name.value
- the expression.public Expression getAttributeExpression(String namespace, String name)
ReportElement
getAttributeExpression
in interface ReportElement
namespace
- the attribute's namespace.name
- the attribute's name.null
if the attribute has no expression assigned.public String[] getAttributeExpressionNamespaces()
ReportElement
getAttributeExpressionNamespaces
in interface ReportElement
public String[] getAttributeExpressionNames(String name)
ReportElement
getAttributeExpressionNames
in interface ReportElement
name
- the namespace for which the attribute-names should be returned, never null.public ReportAttributeMap<Expression> getAttributeExpressions()
public void setAttribute(String namespace, String name, Object value)
ReportElement
null
removes the attribute. Attribute values are not checked for type
safety.setAttribute
in interface ReportElement
namespace
- the attribute's namespace.name
- the attribute name.value
- the attribute value, or null to remove the attribute.public void setAttribute(String namespace, String name, Object value, boolean notifyChange)
setAttribute
in interface ReportElement
public Object getAttribute(String namespace, String name)
getAttribute
in interface ReportElement
public Object getFirstAttribute(String localName)
getFirstAttribute
in interface ReportElement
public String[] getAttributeNamespaces()
getAttributeNamespaces
in interface ReportElement
public String[] getAttributeNames(String namespace)
getAttributeNames
in interface ReportElement
public ReportAttributeMap<Object> getAttributes()
getAttributes
in interface ReportElement
public <TS> TS getAttributeTyped(String namespace, String attribute, Class<TS> filter)
getAttributeTyped
in interface ReportElement
public void setElementType(ElementType elementType)
public ElementType getElementType()
getElementType
in interface ReportElement
public String getElementTypeName()
public final ElementMetaData getMetaData()
getMetaData
in interface ReportElement
public final Band getParent()
public final Section getParentSection()
getParentSection
in interface ReportElement
public void setName(String name)
name
- the name of this elementpublic String getName()
getName
in interface ReportElement
public final DataSource getDataSource()
getDataSource
in interface DataTarget
public void setDataSource(DataSource ds)
setDataSource
in interface DataTarget
ds
- the datasource (null
not permitted).NullPointerException
- if the given data source is null.public boolean isVisible()
public void setVisible(boolean b)
b
- the new visibility statepublic Element clone()
clone
in interface DataTarget
clone
in class Object
public final Element derive()
public Element derive(boolean preserveElementInstanceIds)
preserveElementInstanceIds
- defines whether this call generates new instance-ids for the derived elements. Instance-IDs are used by
the report processor to recognize reoccurring elements and must not changed within the report run. Outside
of the report processors new instance ids should be generated at all times to separate instances and to
make them uniquely identifiable.public ElementStyleSheet getStyle()
getStyle
in interface ReportElement
public final Object getTreeLock()
getTreeLock
in interface ReportElement
public String getId()
getId
in interface ReportElement
public void setId(String id)
id
- the element id.public final InstanceID getObjectID()
getObjectID
in interface ReportElement
public boolean isDynamicContent()
public void setDynamicContent(boolean dynamicContent)
dynamicContent
- the new state of the dynamic flag.public ReportDefinition getReportDefinition()
getReportDefinition
in interface ReportElement
public ReportDefinition getMasterReport()
public void setHRefTarget(String target)
target
- the targetpublic String getHRefTarget()
public ElementStyleSheet getDefaultStyleSheet()
getDefaultStyleSheet
in interface ReportElement
public void setStyleExpression(StyleKey property, Expression function)
setStyleExpression
in interface ReportElement
property
- the stylekey that will be modified by this element.function
- the function.public Expression getStyleExpression(StyleKey property)
getStyleExpression
in interface ReportElement
property
- the stylekey for which an style-expression is returned.public Map<StyleKey,Expression> getStyleExpressions()
getStyleExpressions
in interface ReportElement
public org.pentaho.reporting.libraries.resourceloader.ResourceKey getDefinitionSource()
public org.pentaho.reporting.libraries.resourceloader.ResourceKey getContentBase()
public long getChangeTracker()
getChangeTracker
in interface ReportElement
notifyNodePropertiesChanged()
,
notifyNodeStructureChanged()
public void notifyNodePropertiesChanged()
public void notifyNodePropertiesChanged(Object parameter)
public void notifyNodeChildAdded(Object o)
o
- the node that has been added.public void notifyNodeChildRemoved(Object o)
o
- the node that has been removed.public void notifyNodeStructureChanged()
public String toString()
public ReportElement[] getChildElementsByType(ElementType type)
getChildElementsByType
in interface ReportElement
public ReportElement getChildElementByType(ElementType type)
getChildElementByType
in interface ReportElement
public ReportElement[] getChildElementsByName(String name)
getChildElementsByName
in interface ReportElement
public void copyInto(Element target)
public <T> T getElementContext(Class<T> contextType)
getElementContext
in interface ReportElement
public void copyAttributes(ReportAttributeMap<Object> attributes)