jigcell.compare.cellcycle
Class CellCycleReportGenerator

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by jigcell.compare.impl.Transferer
          extended by jigcell.compare.impl.DataSource
              extended by jigcell.compare.impl.OwnedDataSource
                  extended by jigcell.compare.impl.PrinterDataSource
                      extended by jigcell.compare.impl.PDFPrinterDataSource
                          extended by jigcell.compare.cellcycle.CellCycleReportGenerator
All Implemented Interfaces:
java.awt.datatransfer.Transferable, java.awt.event.ActionListener, java.awt.event.ItemListener, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, IDataSource, IWriteableDataSource

public final class CellCycleReportGenerator
extends PDFPrinterDataSource
implements java.awt.event.ActionListener, java.awt.event.ItemListener

Prints a summary report of a set of comparisons to a PDF file.

This code is licensed under the DARPA BioCOMP Open Source License. See LICENSE for more details.

Author:
Nicholas Allen
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface jigcell.compare.IDataSource
IDataSource.Option
 
Field Summary
private  InterfaceBuilder builder
          Builder for current configuration interface
private  Compare compare
          Comparator of parent window
private  ConstantTransform data
          Source of data from the currently selected experiment
private static java.lang.String DESCRIPTION_WRITE
          Write operation description
private  ListComboBoxModel experimentModel
          Selection model for prototype experiment
private static java.lang.String LABEL_EXPERIMENT
          Label for experimental prototype selection
private static java.lang.String LABEL_EXPLICITRANGE
          Label for the explicit range selection option
private static java.lang.String LABEL_EXPLICITSELECTION
          Label for the explicit column selection option
private static java.lang.String LABEL_TRANSFORM
          Label for column selection transform
private static java.lang.String LABEL_XAXIS
          Label for the plotter x-axis option
private static java.lang.String LABEL_YAXIS
          Label for the plotter y-axis option
static java.lang.String OPTION_GENERATORS
          Option name for generators that the report can be based on
static java.lang.String OPTION_SELECTION
          Option name for the plotter column selection
static java.lang.String OPTION_VIEWRANGE
          Option name for the plotter view range
private static java.lang.String TITLE_CONFIGURE
          Configure window title
private  javax.swing.text.Document xRangeDocument
          Range of x-axis to use for plots
private  javax.swing.text.Document yRangeDocument
          Range of y-axis to use for plots
 
Fields inherited from class jigcell.compare.impl.PDFPrinterDataSource
OPTION_FILESOURCE
 
Fields inherited from class jigcell.compare.impl.PrinterDataSource
DEFAULT_PAGEHEIGHT, DEFAULT_PAGEWIDTH, DEFAULT_SCREENDPI, MESSAGE_NOFLAVORERROR
 
Fields inherited from class jigcell.compare.impl.OwnedDataSource
MESSAGE_PACKERROR, MESSAGE_PROXYERROR, OPTION_OWNER, OPTION_TRANSFERCLASS, SIGNATURE_TRANSFER
 
Fields inherited from class jigcell.compare.impl.DataSource
OPTIONS_LOCK, SEPARATOR_PAIR, SEPARATOR_PART, SEPARATORS
 
Fields inherited from class jigcell.compare.impl.Transferer
CSV_FOOTER, CSV_LINEPOSTPEND, CSV_LINEPREPEND, CSV_LINESEPARATOR, HTML_FOOTER, HTML_HEADPOSTPEND, HTML_HEADPREPEND, HTML_HEADSEPARATOR, HTML_LINEPOSTPEND, HTML_LINEPREPEND, HTML_LINESEPARATOR
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, MOVE, NONE
 
Fields inherited from interface jigcell.compare.IWriteableDataSource
OPTION_WRITEDESCRIPTION, OPTION_WRITEICON
 
Fields inherited from interface jigcell.compare.IDataSource
OPTION_NAME
 
Constructor Summary
CellCycleReportGenerator(Compare compare, IDataGeneratorList experiments)
          Constructs a data source that produces a report for a set of generators.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
private  ITransform applyColumnSelection(ITransform transform, IDataElement columnSelection)
          Applies the column selection to a transform.
private  IDataElement buildRangeElement()
          Constructs a data element with the user's plotter range.
 boolean configure()
          Does whatever configuration this data source requires and returns whether the configuration was completed successfully.
private  ITransform findLastTransform(IDataGenerator experiment, boolean useFirst)
          Picks a transform to use as input to the report plotter.
private static com.lowagie.text.Image generatePlotImage(IDataElement viewRange, ITransform transform)
          Produces a plot image of the time series data in the transform.
 IDataElement getColumnSelection()
          The column selection option.
 boolean getPredictedCompatibility(java.lang.Class clazz)
          A prediction on whether this data source can hold a particular type.
 boolean getPredictedCompatibility(java.lang.Object instance)
          A prediction on whether this data source can hold a particular type.
private  IDataGeneratorList getPrototypeExperiments()
          The list of experimental prototypes to select from.
 IDataElement getViewRange()
          The view range option.
 void itemStateChanged(java.awt.event.ItemEvent e)
           
 void propertyChange(java.beans.PropertyChangeEvent e)
           
 void setColumnSelection(IDataElement selection)
          The column selection option.
private  void setPrototypeExperiments(IDataGeneratorList experiments)
          Sets the list of experimental prototypes to select from.
private  void setUseRangeControls(boolean enabled)
          Sets whether the view range controls should be enabled.
private  void setUseSelectionControls(boolean enabled)
          Sets whether the column selection controls should be enabled.
 void setViewRange(IDataElement range)
          Sets the view range option.
private  javax.swing.JComponent smashTransformDisplayComponent(javax.swing.JComponent component)
          Heavily constrains the dimensions of most of the components in a transform display.
private  void updateColumnSelector()
          Places the columns of the latest experiment selection into the column selector.
 void write(java.lang.Object data)
          Writes data to the source destroying the previous contents if multiple objects are not supported.
 
Methods inherited from class jigcell.compare.impl.PDFPrinterDataSource
getFileSourceOption, initializeSource, setFileSourceOption
 
Methods inherited from class jigcell.compare.impl.OwnedDataSource
encode, getOwnerOption, getTransferClassOption, setOwnerOption, setTransferClassOption
 
Methods inherited from class jigcell.compare.impl.DataSource
addOption, addPropertyChangeListener, addPropertyChangeListener, clone, getName, getOption, getOptions, getOptionType, getPropertyChangeListeners, getPropertyChangeListeners, getReadDescriptionOption, getReadIconOption, getState, getWriteDescriptionOption, getWriteIconOption, persistSource, removePropertyChangeListener, removePropertyChangeListener, setName, setOption, setOptions, setOptionType, setReadDescriptionOption, setReadIconOption, setState, setWriteDescriptionOption, setWriteIconOption, toString, unpersistSource
 
Methods inherited from class jigcell.compare.impl.Transferer
addExtension, addFlavor, createCSVTable, createFormattedTable, createHTMLTable, getExceptionRecorder, getExpectedClasses, getExpectedClasses, getExpectedClasses, getFlavors, getFlavors, getPreferredExtensions, getPreferredExtensions, getTransferClass, getTransferData, getTransferDataFlavors, getTransferFlavor, isDataFlavorSupported, transfer
 
Methods inherited from class javax.swing.TransferHandler
canImport, createTransferable, exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getSourceActions, getVisualRepresentation, importData
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jigcell.compare.IWriteableDataSource
getWriteDescriptionOption, getWriteIconOption, setWriteDescriptionOption, setWriteIconOption
 
Methods inherited from interface jigcell.compare.IDataSource
addOption, clone, getName, getOption, getState, setOption, setState
 
Methods inherited from interface java.awt.datatransfer.Transferable
getTransferData, getTransferDataFlavors, isDataFlavorSupported
 

Field Detail

OPTION_GENERATORS

public static final java.lang.String OPTION_GENERATORS
Option name for generators that the report can be based on

See Also:
Constant Field Values

OPTION_SELECTION

public static final java.lang.String OPTION_SELECTION
Option name for the plotter column selection

See Also:
Constant Field Values

OPTION_VIEWRANGE

public static final java.lang.String OPTION_VIEWRANGE
Option name for the plotter view range

See Also:
Constant Field Values

DESCRIPTION_WRITE

private static final java.lang.String DESCRIPTION_WRITE
Write operation description

See Also:
Constant Field Values

LABEL_EXPERIMENT

private static final java.lang.String LABEL_EXPERIMENT
Label for experimental prototype selection

See Also:
Constant Field Values

LABEL_EXPLICITRANGE

private static final java.lang.String LABEL_EXPLICITRANGE
Label for the explicit range selection option

See Also:
Constant Field Values

LABEL_EXPLICITSELECTION

private static final java.lang.String LABEL_EXPLICITSELECTION
Label for the explicit column selection option

See Also:
Constant Field Values

LABEL_TRANSFORM

private static final java.lang.String LABEL_TRANSFORM
Label for column selection transform

See Also:
Constant Field Values

LABEL_XAXIS

private static final java.lang.String LABEL_XAXIS
Label for the plotter x-axis option

See Also:
Constant Field Values

LABEL_YAXIS

private static final java.lang.String LABEL_YAXIS
Label for the plotter y-axis option

See Also:
Constant Field Values

TITLE_CONFIGURE

private static final java.lang.String TITLE_CONFIGURE
Configure window title

See Also:
Constant Field Values

compare

private transient Compare compare
Comparator of parent window


data

private transient ConstantTransform data
Source of data from the currently selected experiment


xRangeDocument

private transient javax.swing.text.Document xRangeDocument
Range of x-axis to use for plots


yRangeDocument

private transient javax.swing.text.Document yRangeDocument
Range of y-axis to use for plots


builder

private transient InterfaceBuilder builder
Builder for current configuration interface


experimentModel

private transient ListComboBoxModel experimentModel
Selection model for prototype experiment

Constructor Detail

CellCycleReportGenerator

public CellCycleReportGenerator(Compare compare,
                                IDataGeneratorList experiments)
Constructs a data source that produces a report for a set of generators.

Parameters:
compare - Comparator
experiments - Experimental prototypes
Method Detail

generatePlotImage

private static com.lowagie.text.Image generatePlotImage(IDataElement viewRange,
                                                        ITransform transform)
Produces a plot image of the time series data in the transform.

Parameters:
viewRange - Extent of plot region
transform - Transform

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

configure

public boolean configure()
Does whatever configuration this data source requires and returns whether the configuration was completed successfully.

Specified by:
configure in interface IDataSource
Overrides:
configure in class PDFPrinterDataSource

getColumnSelection

public IDataElement getColumnSelection()
The column selection option. The column selection is either null (use source data) or in the form (column1, column2, ...).


getPredictedCompatibility

public boolean getPredictedCompatibility(java.lang.Class clazz)
A prediction on whether this data source can hold a particular type.

Specified by:
getPredictedCompatibility in interface IWriteableDataSource
Overrides:
getPredictedCompatibility in class OwnedDataSource
Parameters:
clazz - Type

getPredictedCompatibility

public boolean getPredictedCompatibility(java.lang.Object instance)
A prediction on whether this data source can hold a particular type.

Specified by:
getPredictedCompatibility in interface IWriteableDataSource
Overrides:
getPredictedCompatibility in class OwnedDataSource
Parameters:
instance - Type

getViewRange

public IDataElement getViewRange()
The view range option. The range is either null (fit to data) or in the form ((xmin, ymin), (xmax, ymax)).


itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener

setColumnSelection

public void setColumnSelection(IDataElement selection)
The column selection option. The column selection is either null (use source data) or in the form (column1, column2, ...).

Parameters:
selection - Column selection

setViewRange

public void setViewRange(IDataElement range)
Sets the view range option. The range must be either null (fit to data) or in the form ((xmin, ymin), (xmax, ymax)).

Parameters:
range - View range

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class DataSource

write

public void write(java.lang.Object data)
           throws java.lang.Exception
Writes data to the source destroying the previous contents if multiple objects are not supported.

Specified by:
write in interface IWriteableDataSource
Overrides:
write in class PDFPrinterDataSource
Parameters:
data - Data
Throws:
java.lang.Exception

applyColumnSelection

private ITransform applyColumnSelection(ITransform transform,
                                        IDataElement columnSelection)
Applies the column selection to a transform.

Parameters:
transform - Transform
columnSelection - Column selection

buildRangeElement

private IDataElement buildRangeElement()
Constructs a data element with the user's plotter range.


findLastTransform

private ITransform findLastTransform(IDataGenerator experiment,
                                     boolean useFirst)
Picks a transform to use as input to the report plotter.

Parameters:
experiment - Experiment line containing transform
useFirst - Whether the scan should stop at the first eligible transform to use

getPrototypeExperiments

private IDataGeneratorList getPrototypeExperiments()
The list of experimental prototypes to select from.


setPrototypeExperiments

private void setPrototypeExperiments(IDataGeneratorList experiments)
Sets the list of experimental prototypes to select from.

Parameters:
experiments - Experimental prototypes

setUseRangeControls

private void setUseRangeControls(boolean enabled)
Sets whether the view range controls should be enabled.

Parameters:
enabled - Range control enabled state

setUseSelectionControls

private void setUseSelectionControls(boolean enabled)
Sets whether the column selection controls should be enabled.

Parameters:
enabled - Selection control enabled state

smashTransformDisplayComponent

private javax.swing.JComponent smashTransformDisplayComponent(javax.swing.JComponent component)
Heavily constrains the dimensions of most of the components in a transform display. Works around a display bug where the transform interface size breaks when scrollbars are added.

Parameters:
component - Transform interface component

updateColumnSelector

private void updateColumnSelector()
Places the columns of the latest experiment selection into the column selector.