| java.lang.Object org.jfree.report.Element
All known Subclasses: org.jfree.report.TextElement, org.jfree.report.DrawableElement, org.jfree.report.Band, org.jfree.report.ShapeElement, org.jfree.report.AnchorElement, org.jfree.report.ImageElement,
Element | public class Element implements DataTarget(Code) | | 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.
author: David Gilbert author: Thomas Morgner |
Constructor Summary | |
public | Element() Constructs an element.
The element inherits the element's defined default ElementStyleSheet to provide reasonable default values for
common stylekeys. |
ANONYMOUS_ELEMENT_PREFIX | final public static String ANONYMOUS_ELEMENT_PREFIX(Code) | | The internal constant to mark anonymous element names.
|
Element | public Element()(Code) | | Constructs an element.
The element inherits the element's defined default ElementStyleSheet to provide reasonable default values for
common stylekeys. When the element is added to the band, the bands stylesheet is set as parent to the element's
stylesheet.
A datasource is assigned with this element is set to a default source, which always returns null.
|
clone | public Object clone() throws CloneNotSupportedException(Code) | | 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.
a clone of this Element. throws: CloneNotSupportedException - should never happen. |
createGlobalDefaultStyle | protected ElementDefaultStyleSheet createGlobalDefaultStyle()(Code) | | 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.
the global stylesheet. |
getContentType | public String getContentType()(Code) | | Defines the content-type for this Element. The content-type is used as a hint, how to process the contents of this
Element. An Element implementation should restrict itself to the content-type set here, or the report processing
may fail or the Element may not be printed.
An Element is not allowed to change its content-type after the report processing has started.
If an content-type is unknown to the output-target, the processor must ignore the content.
the content-type as string. |
getDataSource | final public DataSource getDataSource()(Code) | | 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.
the assigned datasource. |
getHRefTarget | public String getHRefTarget()(Code) | | Returns the currently set link target for this element.
the link target. |
getMaximumSize | public Dimension2D getMaximumSize()(Code) | | Returns the maximum size of this Element, if defined.
the maximum size |
getMinimumSize | public Dimension2D getMinimumSize()(Code) | | Returns the minimum size of this Element, if defined.
the minimum size |
getName | public String getName()(Code) | | Returns the name of the Element. The name of the Element is never null.
the name. |
getObjectID | final public Object getObjectID()(Code) | | 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.
the object identifier. |
getParent | final public Band getParent()(Code) | | Return the parent of the Element. You can use this to explore the component tree.
the parent of the self. |
getPreferredSize | public Dimension2D getPreferredSize()(Code) | | Returns the preferred size of this Element, if defined.
the preferred size |
getReportDefinition | public ReportDefinition getReportDefinition()(Code) | | Returns the currently assigned report definition.
the report definition or null, if no report has been assigned. |
getStyle | public ElementStyleSheet getStyle()(Code) | | Returns this elements private stylesheet. This sheet can be used to override the default values set in one of the
parent-stylesheets.
the Element's stylesheet |
getStyleExpression | public Expression getStyleExpression(StyleKey property)(Code) | | Returns the expressions for the report.
Parameters: property - the stylekey for which an style-expression is returned. the expressions. |
getStyleExpressions | public Map getStyleExpressions()(Code) | | Returns a map of all style expressions attached to this element. The map is keyed by an StyleKey and contains
Expression instances.
the expression. |
getTreeLock | final public Object getTreeLock()(Code) | | 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.
the treelock object. |
getValue | public Object getValue(ExpressionRuntime runtime)(Code) | | Queries this Element's datasource for a value.
Parameters: runtime - the expression runtime for evaluating inline expression. the value of the datasource, which can be null. |
isDynamicContent | public boolean isDynamicContent()(Code) | | 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.
true, if the Element's layout is dynamic, false otherwise. |
isLayoutCacheable | public boolean isLayoutCacheable()(Code) | | Returns whether the layout of this Element is cacheable. No matter what's defined here, dynamic elements cannot be
cachable at all.
returns always false, as this property is no longer used. |
isVisible | public boolean isVisible()(Code) | | Defines whether this Element should be painted. The detailed implementation is up to the outputtarget.
the current visiblity state. |
setDataSource | public void setDataSource(DataSource ds)(Code) | | Sets the data source for this Element. The data source is used to produce or query the element's display value.
Parameters: ds - the datasource (null not permitted). throws: NullPointerException - if the given data source is null. |
setDynamicContent | public void setDynamicContent(boolean dynamicContent)(Code) | | 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.
Parameters: dynamicContent - the new state of the dynamic flag. |
setHRefTarget | public void setHRefTarget(String target)(Code) | | Redefines the link target for this element.
Parameters: target - the target |
setLayoutCacheable | public void setLayoutCacheable(boolean layoutCacheable)(Code) | | Defines whether the layout of this Element can be cached.
This method has no effect.
Parameters: layoutCacheable - true, if the layout is cacheable, false otherwise. |
setMaximumSize | public void setMaximumSize(Dimension2D maximumSize)(Code) | | Defines the stylesheet property for the maximum Element size.
Parameters: maximumSize - the new maximum size or null, if the value should be inherited. |
setMinimumSize | public void setMinimumSize(Dimension2D minimumSize)(Code) | | Defines the stylesheet property for the minimum Element size.
Parameters: minimumSize - the new minimum size or null, if the value should be inherited. |
setName | public void setName(String name)(Code) | | 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.
Parameters: name - the name of this self (null not permitted) throws: NullPointerException - if the given name is null. |
setParent | final protected void setParent(Band parent)(Code) | | Defines the parent of the Element. Only a band should call this method.
Parameters: parent - (null allowed). |
setPreferredSize | public void setPreferredSize(Dimension2D preferredSize)(Code) | | Defines the stylesheet property for the preferred Element size.
Parameters: preferredSize - the new preferred size or null, if the value is not defined. |
setReportDefinition | protected void setReportDefinition(ReportDefinition reportDefinition)(Code) | | Assigns the given report definition to the Element. If the reportdefinition is null, the Element is not part of a
report definition at all.
Parameters: reportDefinition - the report definition (maybe null). |
setStyleExpression | public void setStyleExpression(StyleKey property, Expression function)(Code) | | Adds a function to the report's collection of expressions.
Parameters: property - the stylekey that will be modified by this element. Parameters: function - the function. |
setVisible | public void setVisible(boolean b)(Code) | | Defines, whether this Element should be visible in the output. The interpretation of this flag is up to the content
processor.
Parameters: b - the new visibility state |
|
|