| Method from org.jfree.report.modules.output.table.base.TableProcessor Detail: |
public void addRepaginationListener(RepaginationListener l) {
if (l == null)
{
throw new NullPointerException("Listener == null");
}
if (listeners == null)
{
listeners = new ArrayList(5);
}
listenersCache = null;
listeners.add(l);
}
Adds a repagination listener. This listener will be informed of
pagination events. |
protected void checkInterrupted() throws ReportInterruptedException {
if (isHandleInterruptedState() && Thread.interrupted())
{
throw new ReportInterruptedException("Current thread is interrupted. Returning.");
}
}
Checks, whether the current thread is interrupted. |
protected void configure() {
final ReportConfiguration rc = getReport().getReportConfiguration();
final Iterator keys = rc.findPropertyKeys(getReportConfigurationPrefix());
final int prefixLength = getReportConfigurationPrefix().length();
while (keys.hasNext())
{
final String key = (String) keys.next();
final String propKey = key.substring(prefixLength);
if (getProperties().containsKey(propKey))
{
continue;
}
final Object value = rc.getConfigProperty(key);
setProperty(propKey, value);
}
getTableWriter().setMaxWidth((float) getReport().getDefaultPageFormat().getImageableWidth());
}
Copies all report configuration properties which match the configuration
prefix of this table processor into the property set of this processor. |
abstract protected TableProducer createDummyProducer()
Creates a dummy TableProducer. The TableProducer is responsible to compute the layout. |
abstract protected TableProducer createProducer(TableLayoutInfo gridLayoutBounds)
Creates a TableProducer. The TableProducer is responsible to create the table. |
protected void fireStateUpdate(RepaginationState state) {
if (listeners == null)
{
return;
}
if (listenersCache == null)
{
listenersCache = listeners.toArray();
}
for (int i = 0; i < listenersCache.length; i++)
{
final RepaginationListener l = (RepaginationListener) listenersCache[i];
l.repaginationUpdate(state);
}
}
Sends a repagination update to all registered listeners. |
protected Properties getProperties() {
return properties;
}
Gets the internal properties storage. |
public Object getProperty(String property) {
return getProperty(property, null);
}
Queries the property named with property. If the property is not found,
null is returned. |
public Object getProperty(String property,
Object defaultValue) {
if (property == null)
{
throw new NullPointerException();
}
final Object retval = properties.get(property);
if (retval == null)
{
return defaultValue;
}
return retval;
}
Queries the property named with property. If the property is not found, the
default value is returned. |
protected Iterator getPropertyNames() {
return properties.keySet().iterator();
}
Returns an enumeration of the property names. |
protected JFreeReport getReport() {
return report;
}
Returns the private copy of the used report. The report is initialized for the
report writing, so handle this instance with care. |
abstract protected String getReportConfigurationPrefix()
Gets the report configuration prefix for that processor. This prefix defines
how to map the property names into the global report configuration. |
protected TableWriter getTableWriter() {
return tableWriter;
}
Returns the tablewriter function used in to create the report contents. |
public boolean isHandleInterruptedState() {
return handleInterruptedState;
}
Returns whether the processor should check the threads interrupted state.
If this is set to true and the thread was interrupted, then the report processing
is aborted. |
public boolean isStrictLayout() {
return getProperty(STRICT_LAYOUT, "false").equals("true");
}
returns true, if the TableWriter should perform a stricter layout translation.
When set to true, all element bounds are used to create the table. This could result
in a complex layout, more suitable for printing. If set to false, only the starting
bounds (the left and the upper border) are used to create the layout. This will result
is lesser cells and rows, the layout will be better suitable for later processing. |
public void processReport() throws ReportProcessingException {
ReportState state = repaginate();
final TableWriter w = (TableWriter) state.getDataRow().get(TABLE_WRITER);
w.setProducer(createProducer(w.getProducer().getGridBoundsCollection()));
w.getProducer().configure(getProperties());
w.setMaxWidth((float) getReport().getDefaultPageFormat().getImageableWidth());
final RepaginationState stateEvent = new RepaginationState(this, 0, 0, 0, 0, false);
final int maxRows = state.getNumberOfRows();
int lastRow = -1;
int eventCount = 0;
final int eventTrigger = maxRows / MAX_EVENTS_PER_RUN;
final boolean failOnError =
getReport().getReportConfiguration().isStrictErrorHandling();
ReportStateProgress progress = null;
while (!state.isFinish())
{
checkInterrupted();
if (lastRow != state.getCurrentDisplayItem())
{
lastRow = state.getCurrentDisplayItem();
if (eventCount == 0)
{
stateEvent.reuse(TableWriter.OUTPUT_LEVEL, state.getCurrentPage(),
state.getCurrentDataItem(), state.getNumberOfRows(), true);
fireStateUpdate(stateEvent);
eventCount += 1;
}
else
{
if (eventCount == eventTrigger)
{
eventCount = 0;
}
else
{
eventCount += 1;
}
}
}
progress = state.createStateProgress(progress);
state = state.advance();
if (failOnError && state.isErrorOccured() == true)
{
throw new ReportEventException("Failed to dispatch an event.", state.getErrors());
}
if (!state.isFinish())
{
if (!state.isProceeding(progress))
{
throw new ReportProcessingException("State did not proceed, bailing out!");
}
}
}
}
Processes the report. The generated output is written using the defined
writer, the report is repaginated before the final writing. |
public void removeRepaginationListener(RepaginationListener l) {
if (l == null)
{
throw new NullPointerException("Listener == null");
}
if (listeners == null)
{
return;
}
listenersCache = null;
listeners.remove(l);
}
Removes a repagination listener. |
public void setHandleInterruptedState(boolean handleInterruptedState) {
this.handleInterruptedState = handleInterruptedState;
}
Defines, whether the processor should check the threads interrupted state.
If this is set to true and the thread was interrupted, then the report processing
is aborted. |
public void setProperty(String property,
Object value) {
if (property == null)
{
throw new NullPointerException();
}
if (value == null)
{
properties.remove(property);
}
else
{
properties.put(property, value);
}
}
Defines a property for this output target. Properties are the standard way of configuring
an output target. |
public void setStrictLayout(boolean strictLayout) {
setProperty(STRICT_LAYOUT, String.valueOf(strictLayout));
}
Defines whether strict layouting rules should be used for the TableLayouter. |