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:
CoordConvertFilter, GroupNumberingFilter, MovieFilter, RegionSelectionFilter, SliceSelectionFilter, SortFilter, 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.awt.Rectangle bounds
           
protected  boolean changed
           
protected  java.util.Vector<DataElement> dataVect
           
protected  DataSource input
           
private  OutputInfoPanel oip
           
protected  javax.swing.JTabbedPane propPanel
           
protected  java.util.Vector<DataSink> sinkVector
           
private  SourceInfoPanel sip
           
 
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.
 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 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)
           
 void setBounds(java.awt.Rectangle b)
           
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)
           
 boolean validInput(DataSource ds)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.swri.swiftvis.DataSource
getNumParameters, getNumValues, getParameterDescription, getParameterName, getValueDescription, useParameterNameString
 
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.Vector<DataElement> dataVect

input

protected DataSource input

sinkVector

protected java.util.Vector<DataSink> sinkVector

bounds

protected java.awt.Rectangle bounds

changed

protected transient boolean changed

propPanel

protected transient javax.swing.JTabbedPane propPanel

sip

private transient SourceInfoPanel sip

oip

private transient OutputInfoPanel oip
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

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

setBounds

public void setBounds(java.awt.Rectangle b)
Specified by:
setBounds 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()
Specified by:
getPaint 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

abstractRedoAllElements

protected void abstractRedoAllElements()

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.