edu.swri.swiftvis.plot
Class PlotArea2D

java.lang.Object
  extended by edu.swri.swiftvis.plot.PlotArea2D
All Implemented Interfaces:
PlotObject, java.io.Serializable, javax.swing.tree.TreeNode

public class PlotArea2D
extends java.lang.Object
implements PlotObject

This class is intended to represent the area that a plot or set of related plots should occupy. You get to specify how many different plots you want in the area and how they are arranged as well as if there should be a legend. Basically, you get to say how many rows and columns you want. You can specify if the horizontal or vertical is primary and specify axis options for each one. For the secondary direction you can specify one or more axis options for each row or column. Each secondary axis can have one or more data specifications under it.

See Also:
Serialized Form

Nested Class Summary
private  class PlotArea2D.ClickPosition
           
private static class PlotArea2D.ListenerCellPair
           
private  class PlotArea2D.PlotAreaMiniature
           
 
Field Summary
private  javax.swing.JList allDataJList
           
private  javax.swing.JList allPrimaryJList
           
private  javax.swing.JList allSecondaryJList
           
private  javax.swing.JList dataJList
           
private  javax.swing.JPanel dataPropertiesPanel
           
private  int[][][][] dataSelection
           
private  EditableDouble height
           
private  java.awt.Image img
           
private  double imgLeft
           
private  double imgTop
           
private  boolean lastInside
           
private  javax.swing.JList legendDataJList
           
private  EditableDouble legendHeight
           
private  javax.swing.JPanel legendPropertiesPanel
           
private  EditableDouble legendWidth
           
private  EditableDouble legendX
           
private  EditableDouble legendY
           
private  javax.swing.JList listenerJList
           
private  PlotArea2D.PlotAreaMiniature listenerMini
           
private  java.util.List<PlotArea2D.ListenerCellPair> listeners
           
private  PlotArea2D.PlotAreaMiniature mini
           
private  PlotSpec parent
           
private  java.util.Vector<DataPlotStyle> plotDataList
           
private  int primaryAxisDirection
           
private  java.util.Vector<AxisOptions> primaryAxisList
           
private  javax.swing.JComboBox primaryComboBox
           
private  double primaryEachSize
           
private  double primaryMaxBuffer
           
private  double primaryMinBuffer
           
private  javax.swing.JPanel primaryPropertiesPanel
           
private  int[] primarySelection
           
private  javax.swing.JComponent propPanel
           
private  java.util.Vector<AxisOptions> secondaryAxisList
           
private  double secondaryEachSize
           
private  javax.swing.JList secondaryJList
           
private  double secondaryMaxBuffer
           
private  double secondaryMinBuffer
           
private  javax.swing.JPanel secondaryPropertiesPanel
           
private  int[][] secondarySelection
           
private  boolean selected
           
private static long serialVersionUID
           
private  boolean useBuffer
           
private  EditableDouble width
           
private  EditableDouble x
           
private  EditableDouble y
           
 
Constructor Summary
private PlotArea2D(PlotArea2D c, PlotSpec spec)
           
  PlotArea2D(PlotSpec spec)
           
 
Method Summary
private  void addPlotListener()
           
private  void addToSecondaryList()
           
private  void allDataListSelectionMade()
           
private  void allPrimaryListSelectionMade()
           
private  void allSecondaryListSelectionMade()
           
private  void checkLocation(double val)
           
 java.util.Enumeration<javax.swing.tree.TreeNode> children()
           
 PlotArea2D copy(PlotSpec p)
           
private  void createData()
           
private  void createPrimary()
           
private  void createSecondary()
           
private  void dataListSelectionMade()
           
private  void deleteData()
           
private  void deletePrimary()
           
private  void deleteSecondary()
           
 void draw(java.awt.Graphics2D g, java.awt.geom.Rectangle2D bounds)
          Draw this object on the provided graphics.
private  void drawLegendToGraphics(java.awt.Graphics2D g, java.awt.geom.Rectangle2D bounds)
           
private  void drawToGraphics(java.awt.Graphics2D g, java.awt.geom.Rectangle2D bounds)
          This function will actually draw in the image that will be put to screen.
private  void duplicateData()
           
private  void duplicatePrimary()
           
private  void duplicateSecondary()
           
 void fireRedraw()
          Sends a message up the tree to redraw the screen.
 void forceRedraw()
          Send a message down the tree that current draw buffers are invalid.
 boolean getAllowsChildren()
           
 javax.swing.tree.TreeNode getChildAt(int index)
           
 int getChildCount()
           
 int getIndex(javax.swing.tree.TreeNode node)
           
 javax.swing.tree.TreeNode getParent()
           
 javax.swing.JComponent getPropertiesPanel()
          Returns a panel that can be used to set the properties of this plot object.
 DataSink getSink()
           
 boolean hasData()
           
 boolean isLeaf()
           
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
private  void legendDataListSelectionMade()
           
 void mouseClicked(java.awt.event.MouseEvent e, double mx, double my)
           
 void mouseDragged(java.awt.event.MouseEvent e, double mx, double my)
           
 void mouseMoved(java.awt.event.MouseEvent e, double mx, double my)
           
 void mousePressed(java.awt.event.MouseEvent e, double mx, double my)
           
 void mouseReleased(java.awt.event.MouseEvent e, double mx, double my)
           
private  void moveUpData()
           
private  void orientationChanged(java.awt.event.ActionEvent e)
           
private  void primarySelectionMade()
           
private  void primarySizeChanged(java.awt.event.ActionEvent e)
           
 void print(java.awt.Graphics2D g, java.awt.geom.Rectangle2D bounds)
          Draw the object without buffering so it is a vector image.
 void relink(java.util.Hashtable<GraphElement,GraphElement> linkHash)
           
private  void removeFromSecondaryList()
           
private  void removePlotListener()
           
private  void secondaryListSelectionMade()
           
private  void secondarySizeChanged(java.awt.event.ActionEvent e)
           
private  void setDataOnAxes()
           
 void setSelected(boolean val)
           
private  void swapPlots(int low)
           
 void syncGUI()
           
 java.lang.String toString()
           
 void treeAltered(PlotObject po)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

private PlotSpec parent

x

private EditableDouble x

y

private EditableDouble y

width

private EditableDouble width

height

private EditableDouble height

primaryAxisDirection

private int primaryAxisDirection

primarySelection

private int[] primarySelection

secondarySelection

private int[][] secondarySelection

dataSelection

private int[][][][] dataSelection

primaryAxisList

private java.util.Vector<AxisOptions> primaryAxisList

secondaryAxisList

private java.util.Vector<AxisOptions> secondaryAxisList

plotDataList

private java.util.Vector<DataPlotStyle> plotDataList

legendX

private EditableDouble legendX

legendY

private EditableDouble legendY

legendWidth

private EditableDouble legendWidth

legendHeight

private EditableDouble legendHeight

listeners

private java.util.List<PlotArea2D.ListenerCellPair> listeners

propPanel

private transient javax.swing.JComponent propPanel

selected

private transient boolean selected

img

private transient java.awt.Image img

mini

private transient PlotArea2D.PlotAreaMiniature mini

useBuffer

private transient boolean useBuffer

primaryComboBox

private transient javax.swing.JComboBox primaryComboBox

secondaryJList

private transient javax.swing.JList secondaryJList

dataJList

private transient javax.swing.JList dataJList

allPrimaryJList

private transient javax.swing.JList allPrimaryJList

allSecondaryJList

private transient javax.swing.JList allSecondaryJList

allDataJList

private transient javax.swing.JList allDataJList

legendDataJList

private transient javax.swing.JList legendDataJList

listenerJList

private transient javax.swing.JList listenerJList

listenerMini

private transient PlotArea2D.PlotAreaMiniature listenerMini

primaryPropertiesPanel

private transient javax.swing.JPanel primaryPropertiesPanel

secondaryPropertiesPanel

private transient javax.swing.JPanel secondaryPropertiesPanel

dataPropertiesPanel

private transient javax.swing.JPanel dataPropertiesPanel

legendPropertiesPanel

private transient javax.swing.JPanel legendPropertiesPanel

imgLeft

private transient double imgLeft

imgTop

private transient double imgTop

primaryMinBuffer

private transient double primaryMinBuffer

primaryMaxBuffer

private transient double primaryMaxBuffer

secondaryMinBuffer

private transient double secondaryMinBuffer

secondaryMaxBuffer

private transient double secondaryMaxBuffer

primaryEachSize

private transient double primaryEachSize

secondaryEachSize

private transient double secondaryEachSize

lastInside

private transient boolean lastInside

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

PlotArea2D

public PlotArea2D(PlotSpec spec)

PlotArea2D

private PlotArea2D(PlotArea2D c,
                   PlotSpec spec)
Method Detail

toString

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

getSink

public DataSink getSink()

hasData

public boolean hasData()

syncGUI

public void syncGUI()

draw

public void draw(java.awt.Graphics2D g,
                 java.awt.geom.Rectangle2D bounds)
Draw this object on the provided graphics.

Specified by:
draw in interface PlotObject

print

public void print(java.awt.Graphics2D g,
                  java.awt.geom.Rectangle2D bounds)
Description copied from interface: PlotObject
Draw the object without buffering so it is a vector image.

Specified by:
print in interface PlotObject

getPropertiesPanel

public javax.swing.JComponent getPropertiesPanel()
Returns a panel that can be used to set the properties of this plot object. I'm not yet certain what this will do for the Spec. The plot itself also has a properties panel so I'm not certain which one to use. Right now I'm thinking that I'll use both. The plot one will have a tree at the top and other stuff below. This one will have buttons to add new things into the plot.

Specified by:
getPropertiesPanel in interface PlotObject

treeAltered

public void treeAltered(PlotObject po)
Specified by:
treeAltered in interface PlotObject

setSelected

public void setSelected(boolean val)
Specified by:
setSelected in interface PlotObject

fireRedraw

public void fireRedraw()
Description copied from interface: PlotObject
Sends a message up the tree to redraw the screen.

Specified by:
fireRedraw in interface PlotObject

forceRedraw

public void forceRedraw()
Send a message down the tree that current draw buffers are invalid. This generally happens because data has changed.

Specified by:
forceRedraw in interface PlotObject

copy

public PlotArea2D copy(PlotSpec p)
Specified by:
copy in interface PlotObject

relink

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

mousePressed

public void mousePressed(java.awt.event.MouseEvent e,
                         double mx,
                         double my)
Specified by:
mousePressed in interface PlotObject

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e,
                          double mx,
                          double my)
Specified by:
mouseReleased in interface PlotObject

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e,
                         double mx,
                         double my)
Specified by:
mouseClicked in interface PlotObject

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e,
                       double mx,
                       double my)
Specified by:
mouseMoved in interface PlotObject

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e,
                         double mx,
                         double my)
Specified by:
mouseDragged in interface PlotObject

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface PlotObject

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface PlotObject

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface PlotObject

children

public java.util.Enumeration<javax.swing.tree.TreeNode> children()
Specified by:
children in interface javax.swing.tree.TreeNode

getAllowsChildren

public boolean getAllowsChildren()
Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode

getChildAt

public javax.swing.tree.TreeNode getChildAt(int index)
Specified by:
getChildAt in interface javax.swing.tree.TreeNode

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface javax.swing.tree.TreeNode

getIndex

public int getIndex(javax.swing.tree.TreeNode node)
Specified by:
getIndex in interface javax.swing.tree.TreeNode

getParent

public javax.swing.tree.TreeNode getParent()
Specified by:
getParent in interface javax.swing.tree.TreeNode

isLeaf

public boolean isLeaf()
Specified by:
isLeaf in interface javax.swing.tree.TreeNode

drawToGraphics

private void drawToGraphics(java.awt.Graphics2D g,
                            java.awt.geom.Rectangle2D bounds)
This function will actually draw in the image that will be put to screen. The way that I'm going to do this breaks some of the pure ideas of the tree structure, but I think that it has to for efficiency. The drawing is done in three parts. First, the primary axis figures out how much space it will take up on the size of the plot where it will be drawn. Second, the same is done for all the secondary axes. They should each save this because they will be asked to draw in their space later. Once the exact plot area has been decided on, the calls will be made for each of the PlotData elements to draw themselves to that part of the image (clipping must be set). After all the data has been drawn, the axes and their marks can be drawn over it.


drawLegendToGraphics

private void drawLegendToGraphics(java.awt.Graphics2D g,
                                  java.awt.geom.Rectangle2D bounds)

setDataOnAxes

private void setDataOnAxes()

checkLocation

private void checkLocation(double val)

orientationChanged

private void orientationChanged(java.awt.event.ActionEvent e)

primarySizeChanged

private void primarySizeChanged(java.awt.event.ActionEvent e)

secondarySizeChanged

private void secondarySizeChanged(java.awt.event.ActionEvent e)

primarySelectionMade

private void primarySelectionMade()

secondaryListSelectionMade

private void secondaryListSelectionMade()

addToSecondaryList

private void addToSecondaryList()

removeFromSecondaryList

private void removeFromSecondaryList()

dataListSelectionMade

private void dataListSelectionMade()

allPrimaryListSelectionMade

private void allPrimaryListSelectionMade()

createPrimary

private void createPrimary()

deletePrimary

private void deletePrimary()

duplicatePrimary

private void duplicatePrimary()

allSecondaryListSelectionMade

private void allSecondaryListSelectionMade()

createSecondary

private void createSecondary()

deleteSecondary

private void deleteSecondary()

duplicateSecondary

private void duplicateSecondary()

allDataListSelectionMade

private void allDataListSelectionMade()

createData

private void createData()

deleteData

private void deleteData()

duplicateData

private void duplicateData()

moveUpData

private void moveUpData()

swapPlots

private void swapPlots(int low)

legendDataListSelectionMade

private void legendDataListSelectionMade()

addPlotListener

private void addPlotListener()

removePlotListener

private void removePlotListener()