| Method from org.jfree.report.Element Detail: |
public Object clone() throws CloneNotSupportedException {
final Element e = (Element) super.clone();
e.style = (InternalElementStyleSheet) style.getCopy();
e.datasource = (DataSource) datasource.clone();
e.parent = null;
e.style.updateElementReference(e);
e.attributes = (ReportAttributeMap) attributes.clone();
if (attributeExpressions != null)
{
e.attributeExpressions = (ReportAttributeMap) attributeExpressions.clone();
final String[] namespaces = e.attributeExpressions.getNameSpaces();
for (int i = 0; i < namespaces.length; i++)
{
final String namespace = namespaces[i];
final Map attrsNs = attributeExpressions.getAttributes(namespace);
final Iterator it = attrsNs.entrySet().iterator();
while (it.hasNext())
{
final Map.Entry entry = (Map.Entry) it.next();
final Expression exp = (Expression) entry.getValue();
e.attributeExpressions.setAttribute(namespace, (String) entry.getKey(), exp.clone());
}
}
}
if (styleExpressions != null)
{
e.styleExpressions = (HashMap) styleExpressions.clone();
final Iterator styleExpressionsIt =
e.styleExpressions.entrySet().iterator();
while (styleExpressionsIt.hasNext())
{
final Map.Entry entry = (Map.Entry) styleExpressionsIt.next();
final Expression exp = (Expression) entry.getValue();
entry.setValue(exp.clone());
}
}
return e;
}
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() {
return ElementDefaultStyleSheet.getDefaultStyle();
}
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) {
return attributes.getAttribute(namespace, name);
}
|
public Expression getAttributeExpression(String namespace,
String name) {
if (attributeExpressions == null)
{
return null;
}
return (Expression) attributeExpressions.getAttribute(namespace, name);
}
|
public String[] getAttributeExpressionNames(String name) {
if (attributeExpressions == null)
{
return Element.EMPTY_NAMES;
}
return attributeExpressions.getNames(name);
}
|
public String[] getAttributeExpressionNamespaces() {
if (attributeExpressions == null)
{
return Element.EMPTY_NAMES;
}
return attributeExpressions.getNameSpaces();
}
|
public String[] getAttributeNames(String name) {
return attributes.getNames(name);
}
|
public String[] getAttributeNamespaces() {
return attributes.getNameSpaces();
}
|
public ReportAttributeMap getAttributes() {
if (cachedAttributes != null)
{
if (cachedAttributes.getChangeTracker() == attributes.getChangeTracker())
{
return cachedAttributes;
}
}
cachedAttributes = attributes.createUnmodifiableMap();
return cachedAttributes;
}
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() {
final Object o = getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.CONTENT_BASE);
if (o instanceof ResourceKey)
{
return (ResourceKey) o;
}
if (parent != null)
{
return parent.getContentBase();
}
return null;
}
|
public final DataSource getDataSource() {
return datasource;
} 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() {
final Object o = getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.SOURCE);
if (o instanceof ResourceKey)
{
return (ResourceKey) o;
}
if (parent != null)
{
return parent.getDefinitionSource();
}
return null;
}
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() {
final Object attribute = attributes.getAttribute
(AttributeNames.Core.NAMESPACE, AttributeNames.Core.ELEMENT_TYPE);
if (attribute instanceof ElementType == false)
{
return LegacyType.INSTANCE;
}
return (ElementType) attribute;
}
|
public String getElementTypeName() {
return getElementType().getMetaData().getName();
}
|
public String getHRefTarget() {
return (String) getStyle().getStyleProperty(ElementStyleKeys.HREF_TARGET);
}
Returns the currently set link target for this element. |
public String getId() {
return (String) getAttribute(AttributeNames.Xml.NAMESPACE, AttributeNames.Xml.ID);
}
|
public final ElementMetaData getMetaData() {
return getElementType().getMetaData();
}
|
public String getName() {
final Object o = getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME);
if (o != null)
{
return String.valueOf(o);
}
return "";
}
Returns the name of the Element. The name of the Element is never null. |
public final Object getObjectID() {
return treeLock;
}
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() {
if (parent instanceof Band)
{
return (Band) parent;
}
return null;
}
Return the parent of the Element. You can use this to explore the component tree. |
public final Section getParentSection() {
return parent;
}
|
public ReportDefinition getReportDefinition() {
if (parent != null)
{
return parent.getReportDefinition();
}
return null;
}
Returns the currently assigned report definition. |
public ElementStyleSheet getStyle() {
return style;
}
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) {
if (styleExpressions == null)
{
return null;
}
return (Expression) styleExpressions.get(property);
}
Returns the expressions for the report. |
public Map getStyleExpressions() {
if (styleExpressions != null)
{
return styleExpressions;
}
return Empty.MAP;
}
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() {
final Section parent = getParentSection();
if (parent != null)
{
return parent.getTreeLock();
}
return treeLock;
}
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) {
return getElementType().getValue(runtime, this);
} Deprecated! this - method should not be used directly. Use getElementType().getValue(..) instead.
Queries this Element's datasource for a value. |
public boolean isDynamicContent() {
return getStyle().getBooleanStyleProperty(ElementStyleKeys.DYNAMIC_HEIGHT);
}
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() {
final Boolean b = (Boolean) getStyle().getStyleProperty(ElementStyleKeys.VISIBLE, Boolean.FALSE);
return b.booleanValue();
}
Defines whether this Element should be painted. The detailed implementation is up to the outputtarget. |
public void setAttribute(String namespace,
String name,
Object value) {
attributes.setAttribute(namespace, name, value);
if (cachedAttributes != null)
{
if (cachedAttributes.getChangeTracker() != attributes.getChangeTracker())
{
cachedAttributes = null;
}
}
}
|
public void setAttributeExpression(String namespace,
String name,
Expression value) {
if (attributeExpressions == null)
{
attributeExpressions = new ReportAttributeMap();
}
attributeExpressions.setAttribute(namespace, name, value);
}
|
public void setDataSource(DataSource ds) {
if (ds == null)
{
throw new NullPointerException("Element.setDataSource(...) : null data source.");
}
this.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) {
getStyle().setBooleanStyleProperty(ElementStyleKeys.DYNAMIC_HEIGHT, 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) {
if (elementType == null)
{
throw new NullPointerException("Element.setElementType(..): ElementType cannot be null");
}
attributes.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.ELEMENT_TYPE, elementType);
}
|
public void setHRefTarget(String target) {
getStyle().setStyleProperty(ElementStyleKeys.HREF_TARGET, target);
}
Redefines the link target for this element. |
public void setId(String id) {
setAttribute(AttributeNames.Xml.NAMESPACE, AttributeNames.Xml.ID, id);
}
|
public void setName(String name) {
setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME, 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) {
this.parent = parent;
this.style.parentChanged();
}
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) {
if (styleExpressions == null)
{
if (function == null)
{
return;
}
styleExpressions = new HashMap();
}
if (function == null)
{
styleExpressions.remove(property);
}
else
{
styleExpressions.put(property, function);
}
}
Adds a function to the report's collection of expressions. |
public void setVisible(boolean b) {
if (b)
{
getStyle().setStyleProperty(ElementStyleKeys.VISIBLE, Boolean.TRUE);
}
else
{
getStyle().setStyleProperty(ElementStyleKeys.VISIBLE, Boolean.FALSE);
}
}
Defines, whether this Element should be visible in the output. The interpretation of this flag is up to the content
processor. |