edu.swri.swiftvis.filters
Class AbstractSingleSourceFilter

java.lang.Object
  extended by edu.swri.swiftvis.filters.AbstractSingleSourceFilter
All Implemented Interfaces:
DataSink, DataSource, Filter, GraphElement, java.io.Serializable
Direct Known Subclasses:
ClusterFilter, ConstantsFilter, CoordConvertFilter, CountRebinFilter, ElementTableEditor, GroupNumberingFilter, LinearFitFilter, MassFilter, MovieFilter, RegionSelectionFilter, RotationFilter, SliceSelectionFilter, SortFilter, SyMBAMassFilter, ThinningFilter, WakePeakFilter

public abstract class AbstractSingleSourceFilter
extends java.lang.Object
implements Filter

This abstract class is intended to help people extend SwiftVis. Most filters that can only take data from a single source should extend this class instead of directly implementing the Filter interface.

Author:
Mark Lewis
See Also:
Serialized Form

Field Summary
protected  java.util.ArrayList<DataElement> dataVect
           
protected  DataSource input
           
protected  javax.swing.JTabbedPane propPanel
           
protected  java.util.ArrayList<DataSink> sinkVector
           
 
Constructor Summary
protected AbstractSingleSourceFilter()
           
protected AbstractSingleSourceFilter(AbstractSingleSourceFilter c, java.util.List<GraphElement> l)
          This constructor is used by the copy method of subclasses.
 
Method Summary
protected  void abstractRedoAllElements()
           
 void addInput(DataSource in)
           
 void addOutput(DataSink sink)
           
 void clearData()
          This method does what the name implies, it clears out data vectors.
protected abstract  boolean doingInThreads()
          Method implemented to inform the AbstractFilter whether the Filter is handling threading threading or if if the AbstractFilter should put the work into the ThreadHandler itself.
 void drawNode(java.awt.Graphics2D g)
           
 java.awt.Rectangle getBounds()
           
 DataElement getElement(int i)
          Returns the specified data element for this source.
 int getNumElements()
          Returns the number of data elements that this source has in it.
 int getNumOutputs()
           
 int getNumSources()
           
 DataSink getOutput(int which)
           
protected  OutputInfoPanel getOutputInfoPanel()
           
 java.awt.Paint getPaint()
           
 javax.swing.JComponent getPropertiesPanel()
           
 DataSource getSource(int which)
           
protected  SourceInfoPanel getSourceInfoPanel()
           
protected  void localRedo()
           
 void moveUpInput(int index)
           
 void redo()
           
protected abstract  void redoAllElements()
          This method is intended to reprocess all the input elements to redo the output.
 void relink(java.util.Hashtable<GraphElement,GraphElement> linkHash)
           
 void removeInput(DataSource in)
           
 void removeOutput(DataSink sink)
           
protected abstract  void setupSpecificPanelProperties()
          This method should add any tabbed panes to the propPanel that are specific to the given filter.
 void sourceAltered(DataSource source)
           
 java.lang.String toString()
           
 void translate(int dx, int dy)
           
 boolean validInput(DataSource ds)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.swri.swiftvis.DataSource
getNumParameters, getNumValues, getParameterDescription, getValueDescription
 
Methods inherited from interface edu.swri.swiftvis.GraphElement
copy, getDescription
 
Methods inherited from interface edu.swri.swiftvis.GraphElement
copy, getDescription
 

Field Detail

dataVect

protected java.util.ArrayList<DataElement> dataVect

input

protected DataSource input

sinkVector

protected java.util.ArrayList<DataSink> sinkVector

propPanel

protected transient javax.swing.JTabbedPane propPanel
Constructor Detail

AbstractSingleSourceFilter

protected AbstractSingleSourceFilter()

AbstractSingleSourceFilter

protected AbstractSingleSourceFilter(AbstractSingleSourceFilter c,
                                     java.util.List<GraphElement> l)
This constructor is used by the copy method of subclasses.

Parameters:
c - The filter we are copying.
l - A list of other elements being copied. Only links to these should go through.
Method Detail

validInput

public boolean validInput(DataSource ds)
Specified by:
validInput in interface DataSink

addInput

public void addInput(DataSource in)
Specified by:
addInput in interface DataSink

removeInput

public void removeInput(DataSource in)
Specified by:
removeInput in interface DataSink

moveUpInput

public void moveUpInput(int index)
Specified by:
moveUpInput in interface DataSink

getSource

public DataSource getSource(int which)
Specified by:
getSource in interface DataSink

getNumSources

public int getNumSources()
Specified by:
getNumSources in interface DataSink

sourceAltered

public void sourceAltered(DataSource source)
Specified by:
sourceAltered in interface DataSink

addOutput

public void addOutput(DataSink sink)
Specified by:
addOutput in interface DataSource

removeOutput

public void removeOutput(DataSink sink)
Specified by:
removeOutput in interface DataSource

getNumOutputs

public int getNumOutputs()
Specified by:
getNumOutputs in interface DataSource

getOutput

public DataSink getOutput(int which)
Specified by:
getOutput in interface DataSource

getBounds

public java.awt.Rectangle getBounds()
Specified by:
getBounds in interface GraphElement

translate

public void translate(int dx,
                      int dy)
Specified by:
translate in interface GraphElement

clearData

public void clearData()
Description copied from interface: GraphElement
This method does what the name implies, it clears out data vectors. It is used for saving templates which shouldn't have the data in them.

Specified by:
clearData in interface GraphElement

getPaint

public java.awt.Paint getPaint()

drawNode

public void drawNode(java.awt.Graphics2D g)
Specified by:
drawNode in interface GraphElement

getElement

public DataElement getElement(int i)
Description copied from interface: DataSource
Returns the specified data element for this source. I'm using this instead of an iterator because direct access is much more efficient when trying to make tables of data.

Specified by:
getElement in interface DataSource
Parameters:
i - Which data element to return. Should be between 0 and getNumElements()-1.
Returns:
The selected element.

getNumElements

public int getNumElements()
Returns the number of data elements that this source has in it. I'm using this instead of an iterator because direct access is much more efficient when trying to make tables of data.

Specified by:
getNumElements in interface DataSource
Returns:
The number of data elements in this source.

getPropertiesPanel

public javax.swing.JComponent getPropertiesPanel()
Specified by:
getPropertiesPanel in interface GraphElement

relink

public void relink(java.util.Hashtable<GraphElement,GraphElement> linkHash)
Specified by:
relink in interface GraphElement

redo

public void redo()
Specified by:
redo in interface GraphElement

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

abstractRedoAllElements

protected void abstractRedoAllElements()

localRedo

protected void localRedo()

getSourceInfoPanel

protected SourceInfoPanel getSourceInfoPanel()

getOutputInfoPanel

protected OutputInfoPanel getOutputInfoPanel()

redoAllElements

protected abstract void redoAllElements()
This method is intended to reprocess all the input elements to redo the output. It must be properly implemented by all extending classes.


setupSpecificPanelProperties

protected abstract void setupSpecificPanelProperties()
This method should add any tabbed panes to the propPanel that are specific to the given filter. This is called when the propPanel is created. After it is called, the source and output info panels are added.


doingInThreads

protected abstract boolean doingInThreads()
Method implemented to inform the AbstractFilter whether the Filter is handling threading threading or if if the AbstractFilter should put the work into the ThreadHandler itself.

Returns:
True if redoAllElements() is threaded; False if redoAllElements() should be threaded by AbstractFilter