|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pentaho.reporting.engine.classic.core.Element
public class Element
Base class for all report elements (displays items that can appear within a report band).
Elements can either be Bands (which are container classes that group elements) or content-elements. Content elements produce printable values when thegetValue(org.pentaho.reporting.engine.classic.core.function.ExpressionRuntime)
method is called.
All elements have a non-null name and have a private style sheet defined. The style sheet is used to store and access
all element properties that can be used to control the layout of the element or affect the elements appeareance in
the generated content.
Elements can inherit all style information from its parent. A style value is inherited whenever the element's
stylesheet does not define an own value for the corresponding key. Some style-keys cannot be inherited at all, in
that case the default-style-sheets value is used as fall-back value. In addition to the bands stylesheet, elements
may also inherit from stylesheets assigned to the current report definition's StyleSheetCollection. Foreign
stylesheet will be lost after the local cloning is complete.
Use the following code to create and assign a global stylesheet to an element:
JFreeReport report = .. // created elsewhere ElementStyleSheet globalStyle = report.getStyleSheetCollection().createStyleSheet ("a name for the global style"); Element element = .. // created elsewhere element.getStyleSheet().addParent(globalStyle); report.getItemBand().addElement (element);Global stylesheets will always be queried before the parent's stylesheet gets queried. The order of the add-operation does matter, StyleSheets which are added last will be preferred over previously added stylesheets.
Field Summary | |
---|---|
static String |
ANONYMOUS_ELEMENT_PREFIX
The internal constant to mark anonymous element names. |
Constructor Summary | |
---|---|
Element()
Constructs an element. |
Method Summary | |
---|---|
Object |
clone()
Clones this Element, the datasource and the private stylesheet of this Element. |
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. |
String[] |
getAttributeNames(String name)
|
String[] |
getAttributeNamespaces()
|
ReportAttributeMap |
getAttributes()
Returns the attributes of the element as unmodifable collection. |
long |
getChangeTracker()
Returns the element's change-tracker. |
org.pentaho.reporting.libraries.resourceloader.ResourceKey |
getContentBase()
|
DataSource |
getDataSource()
Deprecated. Whereever possible use ElementType implementations instead. |
org.pentaho.reporting.libraries.resourceloader.ResourceKey |
getDefinitionSource()
Returns the resource-key of the file that defined this element. |
ElementType |
getElementType()
|
String |
getElementTypeName()
|
String |
getHRefTarget()
Returns the currently set link target for this element. |
String |
getId()
Returns the Xml-ID of this 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 |
getStyleExpressions()
Returns a map of all style expressions attached to this element. |
Object |
getTreeLock()
Returns the tree lock object for the self tree. |
Object |
getValue(ExpressionRuntime runtime)
Deprecated. this method should not be used directly. Use getElementType().getValue(..) instead. |
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 |
setDataSource(DataSource ds)
Deprecated. The data-source should not be used anymore. Use ElementType implementations instead. |
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ANONYMOUS_ELEMENT_PREFIX
Constructor Detail |
---|
public Element()
Method Detail |
---|
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 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)
public Object getAttribute(String namespace, String name)
getAttribute
in interface ReportElement
public String[] getAttributeNamespaces()
getAttributeNamespaces
in interface ReportElement
public String[] getAttributeNames(String name)
getAttributeNames
in interface ReportElement
public ReportAttributeMap getAttributes()
getAttributes
in interface ReportElement
public void setElementType(ElementType elementType)
public ElementType getElementType()
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 Object getValue(ExpressionRuntime runtime)
runtime
- the expression runtime for evaluating inline expression.
public boolean isVisible()
public void setVisible(boolean b)
b
- the new visibility statepublic Object clone() throws CloneNotSupportedException
clone
in interface DataTarget
clone
in class Object
CloneNotSupportedException
- should never happen.public final Element derive() throws CloneNotSupportedException
CloneNotSupportedException
public Element derive(boolean preserveElementInstanceIds) throws CloneNotSupportedException
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.
CloneNotSupportedException
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)
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 void setHRefTarget(String target)
target
- the targetpublic String getHRefTarget()
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 getStyleExpressions()
getStyleExpressions
in interface ReportElement
public org.pentaho.reporting.libraries.resourceloader.ResourceKey getDefinitionSource()
public org.pentaho.reporting.libraries.resourceloader.ResourceKey getContentBase()
public long getChangeTracker()
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()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |