Save This Page
Home » pentaho-reporting-engine-classic-0.8.10 » org » jfree » report » [javadoc | source]
org.jfree.report
public class: Element [javadoc | source]
java.lang.Object
   org.jfree.report.Element

All Implemented Interfaces:
    ReportElement, DataTarget

Direct Known Subclasses:
    GroupHeader, ReportFooter, TextElement, DrawableElement, AbstractRootLevelBand, DetailsFooter, Watermark, CrosstabGroupBody, ImageElement, ItemBand, Section, JFreeReport, ShapeElement, AnchorElement, ReportDefinitionImpl, ReportHeader, NoDataBand, GroupFooter, AbstractReportDefinition, Band, PageFooter, GroupDataBody, GroupBody, RelationalGroup, PageHeader, SubGroupBody, SubReport, Group, DetailsHeader

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 the org.jfree.report.Element#getValue(org.jfree.report.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
public static final  String ANONYMOUS_ELEMENT_PREFIX    The internal constant to mark anonymous element names. 
Constructor:
 public Element() 
Method from org.jfree.report.Element Summary:
clone,   createGlobalDefaultStyle,   getAttribute,   getAttributeExpression,   getAttributeExpressionNames,   getAttributeExpressionNamespaces,   getAttributeNames,   getAttributeNamespaces,   getAttributes,   getContentBase,   getDataSource,   getDefinitionSource,   getElementType,   getElementTypeName,   getHRefTarget,   getId,   getMetaData,   getName,   getObjectID,   getParent,   getParentSection,   getReportDefinition,   getStyle,   getStyleExpression,   getStyleExpressions,   getTreeLock,   getValue,   isDynamicContent,   isVisible,   setAttribute,   setAttributeExpression,   setDataSource,   setDynamicContent,   setElementType,   setHRefTarget,   setId,   setName,   setParent,   setStyleExpression,   setVisible
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jfree.report.Element Detail:
 public Object clone() throws CloneNotSupportedException 
    Clones this Element, the datasource and the private stylesheet of this Element. The clone does no longer have a parent, as the old parent would not recognize that new object anymore.
 protected ElementDefaultStyleSheet createGlobalDefaultStyle() 
    Creates the global stylesheet for this element type. The global stylesheet is an immutable stylesheet that provides reasonable default values for some of the style keys.

    The global default stylesheet is always the last stylesheet that will be queried for values.

 public Object getAttribute(String namespace,
    String name) 
 public Expression getAttributeExpression(String namespace,
    String name) 
 public String[] getAttributeExpressionNames(String name) 
 public String[] getAttributeExpressionNamespaces() 
 public String[] getAttributeNames(String name) 
 public String[] getAttributeNamespaces() 
 public ReportAttributeMap getAttributes() 
    Returns the attributes of the element as unmodifable collection. The collection can be safely stored as it is guaranteed to never change. (However, no assumptions are made about the contents inside the collection.)
 public ResourceKey getContentBase() 
 public final DataSource getDataSource() 
Deprecated! Whereever - possible use ElementType implementations instead.

    Returns the datasource for this Element. You cannot override this function as the Element needs always to be the last consumer in the chain of filters. This function must never return null.
 public ResourceKey getDefinitionSource() 
    Returns the resource-key of the file that defined this element. This method may return null if the whole report was created in memory.
 public ElementType getElementType() 
 public String getElementTypeName() 
 public String getHRefTarget() 
    Returns the currently set link target for this element.
 public String getId() 
 public final ElementMetaData getMetaData() 
 public String getName() 
    Returns the name of the Element. The name of the Element is never null.
 public final Object getObjectID() 
    Returns a unique identifier for the given instance. The identifier can be used to recognize cloned instance which have the same anchestor. The identifier is unique as long as the element remains in the JVM, it does not guarantee uniqueness or the ability to recognize clones, after the element has been serialized.
 public final Band getParent() 
    Return the parent of the Element. You can use this to explore the component tree.
 public final Section getParentSection() 
 public ReportDefinition getReportDefinition() 
    Returns the currently assigned report definition.
 public ElementStyleSheet getStyle() 
    Returns this elements private stylesheet. This sheet can be used to override the default values set in one of the parent-stylesheets.
 public Expression getStyleExpression(StyleKey property) 
    Returns the expressions for the report.
 public Map getStyleExpressions() 
    Returns a map of all style expressions attached to this element. The map is keyed by an StyleKey and contains Expression instances.
 public final Object getTreeLock() 
    Returns the tree lock object for the self tree. If the element is part of a content hierarchy, the parent's tree lock is returned.
 public Object getValue(ExpressionRuntime runtime) 
Deprecated! this - method should not be used directly. Use getElementType().getValue(..) instead.

    Queries this Element's datasource for a value.
 public boolean isDynamicContent() 
    Checks whether the layout of this element is dynamic and adjusts to the element's printable content. If set to false, the element's minimum-size will be also used as maximum size.
 public boolean isVisible() 
    Defines whether this Element should be painted. The detailed implementation is up to the outputtarget.
 public  void setAttribute(String namespace,
    String name,
    Object value) 
 public  void setAttributeExpression(String namespace,
    String name,
    Expression value) 
 public  void setDataSource(DataSource ds) 
Deprecated! The - data-source should not be used anymore. Use ElementType implementations instead.

    Sets the data source for this Element. The data source is used to produce or query the element's display value.
 public  void setDynamicContent(boolean dynamicContent) 
    Defines the stylesheet property for the dynamic attribute. Calling this function with either parameter will override any previously defined value for the dynamic attribute. The value can no longer be inherited from parent stylesheets.
 public  void setElementType(ElementType elementType) 
 public  void setHRefTarget(String target) 
    Redefines the link target for this element.
 public  void setId(String id) 
 public  void setName(String name) 
    Defines the name for this Element. The name must not be empty, or a NullPointerException is thrown.

    Names can be used to lookup an element within a band. There is no requirement for element names to be unique.

 protected final  void setParent(Section parent) 
    Defines the parent of the Element.

    This method is public as a implementation side effect. Only a band or section implementation should call this method. Calling this method manually will create a huge disaster.

 public  void setStyleExpression(StyleKey property,
    Expression function) 
    Adds a function to the report's collection of expressions.
 public  void setVisible(boolean b) 
    Defines, whether this Element should be visible in the output. The interpretation of this flag is up to the content processor.