org.jfree.report.modules.gui.base
Class AbstractExportPlugin

java.lang.Object
  |
  +--org.jfree.report.modules.gui.base.AbstractExportPlugin
Direct Known Subclasses:
CSVExportPlugin, ExcelExportPlugin, HtmlExportPlugin, PageSetupPlugin, PDFExportPlugin, PlainTextExportPlugin, PrintingPlugin, RTFExportPlugin

public abstract class AbstractExportPlugin
extends java.lang.Object
implements ExportPlugin

The AbstractExportPlugin provides a basic implementation of the ExportPlugin interface.

Author:
Thomas Morgner

Inner Class Summary
protected  class AbstractExportPlugin.DefaultExportTaskListener
          The DefaultExportTaskListener is used to monitor the progress of the export and to set the export result.
 
Field Summary
static java.lang.String BASE_RESOURCE_CLASS
          The base resource class.
 
Constructor Summary
AbstractExportPlugin()
          DefaultConstructor.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener l)
           
protected  ReportProgressDialog createProgressDialog()
          Creates a progress dialog, and tries to assign a parent based on the given preview proxy.
 void defineWorkerPool(WorkerPool worker)
          Defines the worker instance for that export plugin.
 void delegateTask(java.lang.Runnable runnable)
          Delegates the task to a worker.
 PreviewProxyBase getBase()
          Returns the preview proxy base.
 java.lang.String getFailureDescription()
          Returns an error description for the last operation.
protected  java.beans.PropertyChangeSupport getPropertyChangeSupport()
           
 PreviewProxy getProxy()
          Returns the preview proxy used to create the export plugin.
protected  Skin getSkin()
           
protected  boolean handleExportResult(boolean result)
          Provides a default implementation to handle export errors.
protected  boolean handleExportResult(ExportTask task)
          Provides a default implementation to handle export errors.
 void init(PreviewProxy proxy)
          Initializes the plugin to work with the given PreviewProxy.
 boolean isAddToToolbar()
          Returns true if the action should be added to the toolbar, and false otherwise.
 boolean isControlPlugin()
          Returns true, when this export plugin is used to configure the report or an other plugin.
 boolean isEnabled()
           
 boolean isSeparated()
          Returns true if the action is separated, and false otherwise.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void setEnabled(boolean enabled)
           
protected  void updateStatusText(java.lang.String text)
          Updates the status text of the base component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_RESOURCE_CLASS

public static final java.lang.String BASE_RESOURCE_CLASS
The base resource class.
Constructor Detail

AbstractExportPlugin

public AbstractExportPlugin()
DefaultConstructor.
Method Detail

getPropertyChangeSupport

protected java.beans.PropertyChangeSupport getPropertyChangeSupport()

isSeparated

public boolean isSeparated()
Returns true if the action is separated, and false otherwise. A separated action starts a new action group and will be spearated from previous actions on the menu and toolbar.
Specified by:
isSeparated in interface ExportPlugin
Returns:
true, if the action should be separated from previous actions, false otherwise.

getFailureDescription

public java.lang.String getFailureDescription()
Returns an error description for the last operation. This implementation provides a basic default failure description text and should be overriden to give a more detailed explaination.
Specified by:
getFailureDescription in interface ExportPlugin
Returns:
returns a error description.

isControlPlugin

public boolean isControlPlugin()
Returns true, when this export plugin is used to configure the report or an other plugin.
Specified by:
isControlPlugin in interface ExportPlugin
Returns:
true if this is a control plugin, false otherwise.

init

public void init(PreviewProxy proxy)
Initializes the plugin to work with the given PreviewProxy.
Specified by:
init in interface ExportPlugin
Parameters:
proxy - the preview proxy that created this plugin.
Throws:
java.lang.NullPointerException - if the proxy or the proxy's basecomponent is null.

getBase

public PreviewProxyBase getBase()
Returns the preview proxy base. This is the same as calling getProxy().getBase().
Returns:
the preview proxy base.

getProxy

public PreviewProxy getProxy()
Returns the preview proxy used to create the export plugin.
Returns:
the preview proxy.

isAddToToolbar

public boolean isAddToToolbar()
Returns true if the action should be added to the toolbar, and false otherwise.
Specified by:
isAddToToolbar in interface ExportPlugin
Returns:
true, if the plugin should be added to the toolbar, false otherwise.

updateStatusText

protected void updateStatusText(java.lang.String text)
Updates the status text of the base component.
Parameters:
text - the new status line text.

handleExportResult

protected boolean handleExportResult(boolean result)
Provides a default implementation to handle export errors. This implementation updates the status line of the preview component.
Parameters:
result - the result of the export operation.
Returns:
the value of result unmodified.

handleExportResult

protected boolean handleExportResult(ExportTask task)
Provides a default implementation to handle export errors. This implementation updates the status line of the preview component.
Parameters:
task - the result of the export operation.
Returns:
true, if the export was successfull, false otherwise.

defineWorkerPool

public void defineWorkerPool(WorkerPool worker)
Defines the worker instance for that export plugin. Workers can be used to delegate tasks to an other thread. The workers are shared among all export plugins of an dialog instance.
Specified by:
defineWorkerPool in interface ExportPlugin
Parameters:
worker - the worker.

delegateTask

public void delegateTask(java.lang.Runnable runnable)
Delegates the task to a worker. If no worker is defined, the runnable is executed directly.
Parameters:
runnable - the task that should be executed.

createProgressDialog

protected ReportProgressDialog createProgressDialog()
Creates a progress dialog, and tries to assign a parent based on the given preview proxy.
Returns:
the progress dialog.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Specified by:
addPropertyChangeListener in interface ExportPlugin

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String property,
                                      java.beans.PropertyChangeListener l)
Specified by:
addPropertyChangeListener in interface ExportPlugin

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Specified by:
removePropertyChangeListener in interface ExportPlugin

setEnabled

public void setEnabled(boolean enabled)
Specified by:
setEnabled in interface ExportPlugin

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface ExportPlugin

getSkin

protected Skin getSkin()