sos.reports
Interface Report

All Known Implementing Classes:
AbstractReport

public interface Report

A hierarchy of styled information grouped together to form a report. Each report has a non-null root element. Depending on the type of the root element, the root may have child elements, which themselves have child elements, an so forth, forming an element hierarchy.

The content of the report is wrapped by these elements. Use Element.getObject() to work with the report data.

The content of the report may be changed directly by invoking setObject, passing the element whose object is to be changed. However, if the report does not support modification of the element, it will throw an UnsupportedOperationException. Before calling setObject, clients should invoke isElementEditable to ensure that the content can be changed.

In addition to content changes, reports may have structural changes (although the current API does not directly support structural changes at this time). Whenever a change occurs, the report fires the appropriate ReportEvent. To receive these events, register a ReportListener with the report.

Since:
1.0
See Also:
Element, JReportPane, ReportTemplate

Method Summary
 void addReportListener(ReportListener listener)
          Adds the specified ReportListener to this report.
 Element getRootElement()
          Returns this report's root element.
 ReportTemplate getTemplate()
          Returns the report template for which this report was generated, or null if no template was used.
 Theme getTheme()
          Returns the theme controlling the appearance of this report.
 boolean isElementEditable(Element element)
          Returns true if this report supports the modification of the specified report element.
 void removeReportListener(ReportListener listener)
          Removes the specified ReportListener from this report.
 void setObject(Element element, java.lang.Object object)
          Sets the specified element's object to object.
 

Method Detail

addReportListener

public void addReportListener(ReportListener listener)
Adds the specified ReportListener to this report.

Parameters:
listener - object that wishes to be notified when this report fires a ReportEvent
Throws:
java.lang.NullPointerException - if listener is null

getRootElement

public Element getRootElement()
Returns this report's root element.

Returns:
the top of the element hierarchy

getTheme

public Theme getTheme()
Returns the theme controlling the appearance of this report.

Returns:
this report's theme

getTemplate

public ReportTemplate getTemplate()
Returns the report template for which this report was generated, or null if no template was used.

Returns:
the report template that generated this report (may be null)

isElementEditable

public boolean isElementEditable(Element element)
Returns true if this report supports the modification of the specified report element.

Parameters:
element - the report element in question
Returns:
true if element can be modified; false otherwise
Throws:
java.lang.IllegalArgumentException - if element does not belong to this report
java.lang.NullPointerException - if element is null

removeReportListener

public void removeReportListener(ReportListener listener)
Removes the specified ReportListener from this report.

Parameters:
listener - object that no longer wishes to be notified when this report fires a ReportEvent
Throws:
java.lang.NullPointerException - if listener is null

setObject

public void setObject(Element element,
                      java.lang.Object object)
Sets the specified element's object to object.

Parameters:
element - the report element to associate with object
object - the object to associate with element
Throws:
java.lang.IllegalArgumentException - if element does not belong to this report
java.lang.NullPointerException - if element is null
java.lang.UnsupportedOperationException - if this report does not support editing of element


Copyright 2003, 2004 Side of Software (SOS). All rights reserved.