jigcell.compare.plotter
Class JPlotBridge

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by jigcell.compare.impl.Transferer
          extended by jigcell.compare.impl.DataSource
              extended by jigcell.compare.plotter.Plotter
                  extended by jigcell.compare.plotter.JPlotBridge
All Implemented Interfaces:
java.awt.datatransfer.Transferable, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, IDataSource, IWriteableDataSource, IPlotter

public final class JPlotBridge
extends Plotter

Standard interface for JPlot.

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.plotter.IPlotter
IPlotter.Combine
 
Nested classes/interfaces inherited from interface jigcell.compare.IDataSource
IDataSource.Option
 
Field Summary
private static java.lang.String PREFIX_TEMPFILE
          Prefix for temporary file names
private static int[][] TABLE_COLORS
          Table of plotter colors
 
Fields inherited from class jigcell.compare.plotter.Plotter
data, SERIES_COLOR, SERIES_NAME
 
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.plotter.IPlotter
OPTION_COMBINE, OPTION_VIEWRANGE, OPTION_VIEWTITLE
 
Fields inherited from interface jigcell.compare.IWriteableDataSource
OPTION_WRITEDESCRIPTION, OPTION_WRITEICON
 
Fields inherited from interface jigcell.compare.IDataSource
OPTION_NAME
 
Constructor Summary
JPlotBridge()
          Creates a new JPlot bridge.
 
Method Summary
private  java.io.File createPointFile()
          Builds a point file with the plot data.
private  java.io.File createScriptFile(java.lang.String pointFilePath)
          Builds a script file to control the plot.
private static java.lang.String getDefaultSeriesColor(long pos)
          The color of series pos.
 java.lang.String getName()
          The name of this data source.
 void plot()
          Produces a plot from the underlying data.
private  void writeCombineAcrossData(java.io.PrintWriter pointFileWriter)
          Produces a plot using the combine across option.
private  void writeCombineNoneData(java.io.PrintWriter pointFileWriter)
          Produces a plot using the combine none option.
private  void writeData(java.io.PrintWriter pointFileWriter)
          Writes data information for the graph to the writer.
private  void writeHeader(java.io.PrintWriter pointFileWriter)
          Writes header information for the graph to the writer.
private  void writeScript(java.io.PrintWriter scriptFileWriter, java.lang.String pointFilePath)
          Writes script information for the graph to the writer.
 
Methods inherited from class jigcell.compare.plotter.Plotter
getPredictedCompatibility, getPredictedCompatibility, getSeries, getSeriesColor, getSeriesColorOption, getSeriesCombine, getSeriesCount, getSeriesName, getSeriesNameOption, getViewRange, isImmutable, setData, setSeries, setSeriesColor, setSeriesCombine, setSeriesName, setSeriesNames, setTitle, setViewRange, splitMultipleSeries, write
 
Methods inherited from class jigcell.compare.impl.DataSource
addOption, addPropertyChangeListener, addPropertyChangeListener, clone, configure, getOption, getOptions, getOptionType, getPropertyChangeListeners, getPropertyChangeListeners, getReadDescriptionOption, getReadIconOption, getState, getWriteDescriptionOption, getWriteIconOption, initializeSource, persistSource, propertyChange, 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, configure, getOption, getState, setOption, setState
 
Methods inherited from interface java.awt.datatransfer.Transferable
getTransferData, getTransferDataFlavors, isDataFlavorSupported
 

Field Detail

TABLE_COLORS

private static final int[][] TABLE_COLORS
Table of plotter colors


PREFIX_TEMPFILE

private static final java.lang.String PREFIX_TEMPFILE
Prefix for temporary file names

See Also:
Constant Field Values
Constructor Detail

JPlotBridge

public JPlotBridge()
Creates a new JPlot bridge.

Method Detail

getDefaultSeriesColor

private static java.lang.String getDefaultSeriesColor(long pos)
The color of series pos.

Parameters:
pos - Position

getName

public java.lang.String getName()
The name of this data source.

Specified by:
getName in interface IDataSource
Overrides:
getName in class Plotter

plot

public void plot()
          throws PlotException
Produces a plot from the underlying data.

Throws:
PlotException

createPointFile

private java.io.File createPointFile()
                              throws java.io.IOException,
                                     PlotException
Builds a point file with the plot data.

Throws:
java.io.IOException
PlotException

createScriptFile

private java.io.File createScriptFile(java.lang.String pointFilePath)
                               throws java.io.IOException,
                                      PlotException
Builds a script file to control the plot.

Parameters:
pointFilePath - Path to the point file
Throws:
java.io.IOException
PlotException

writeCombineAcrossData

private void writeCombineAcrossData(java.io.PrintWriter pointFileWriter)
                             throws PlotException
Produces a plot using the combine across option.

Parameters:
pointFileWriter - Writer for point file
Throws:
PlotException

writeCombineNoneData

private void writeCombineNoneData(java.io.PrintWriter pointFileWriter)
                           throws PlotException
Produces a plot using the combine none option.

Parameters:
pointFileWriter - Writer for point file
Throws:
PlotException

writeData

private void writeData(java.io.PrintWriter pointFileWriter)
                throws PlotException
Writes data information for the graph to the writer.

Parameters:
pointFileWriter - Writer for point file
Throws:
PlotException

writeHeader

private void writeHeader(java.io.PrintWriter pointFileWriter)
                  throws PlotException
Writes header information for the graph to the writer.

Parameters:
pointFileWriter - Writer for point file
Throws:
PlotException

writeScript

private void writeScript(java.io.PrintWriter scriptFileWriter,
                         java.lang.String pointFilePath)
                  throws PlotException
Writes script information for the graph to the writer.

Parameters:
scriptFileWriter - Writer for script file
pointFilePath - Path to the plotter point file
Throws:
PlotException