gov.noaa.pmel.sgt.swing
Class JPlotLayout

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JLayeredPane
                          |
                          +--gov.noaa.pmel.sgt.JPane
                                |
                                +--gov.noaa.pmel.sgt.swing.JGraphicLayout
                                      |
                                      +--gov.noaa.pmel.sgt.swing.JPlotLayout
All Implemented Interfaces:
AbstractPane, javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.beans.PropertyChangeListener, javax.swing.Scrollable, java.io.Serializable

public class JPlotLayout
extends JGraphicLayout
implements java.beans.PropertyChangeListener

JPlotLayout creates a pre-defined graphics layout for SGTLine, SGTGrid, Collection, SGTVector, and PointCollection data.

Since:
2.0
Version:
$Revision: 1.47 $, $Date: 2001/12/13 19:07:06 $
Author:
Donald Denbo
See Also:
LineCartesianRenderer, PointCartesianRenderer, GridCartesianRenderer, VectorCartesianRenderer, Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
static int GRID
           
static int LINE
           
static int POINTS
           
static int VECTOR
           
 
Fields inherited from class gov.noaa.pmel.sgt.swing.JGraphicLayout
X_AXIS, Y_AXIS, Z_AXIS
 
Fields inherited from class javax.swing.JLayeredPane
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface gov.noaa.pmel.sgt.AbstractPane
BOTTOM, CENTER, LEFT, MIDDLE, RIGHT, SPECIFIED_LOCATION, TOP
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JPlotLayout(boolean isGrid, boolean isPoints, boolean isXTime, boolean isYTime, java.lang.String id, java.awt.Image img, boolean is_key_pane)
          JPlotLayout constructor.
JPlotLayout(boolean isGrid, boolean isXTime, boolean isYTime, java.lang.String id, java.awt.Image img, boolean is_key_pane)
          JPlotLayout constructor.
JPlotLayout(int type, boolean isXTime, boolean isYTime, java.lang.String id, java.awt.Image img, boolean is_key_pane)
          JPlotLayout constructor.
JPlotLayout(SGTData dataset)
          Default constructor.
JPlotLayout(SGTData dataset, java.lang.String id, java.awt.Image img, boolean is_key_pane)
          JPlotLayout constructor.
 
Method Summary
 void addData(Collection lines)
          Add a Collection of lines using the default attributes and description.
 void addData(Collection lines, Attribute attr)
          Add a Collection of lines using the default description.
 void addData(Collection lines, Attribute attr, java.lang.String descrip)
          Add a Collecdtion of lines.
 void addData(Collection lines, java.lang.String descrip)
          Add a Collection of lines using the default attributes.
 void addData(PointCollection points, java.lang.String descrip)
          Add a PointCollection.
 void addData(SGTData datum)
          Add data to the layout.
 void addData(SGTData datum, Attribute attr)
          Add data to the layout.
 void addData(SGTData datum, Attribute attr, java.lang.String descrip)
          Add data to the layout.
 void addData(SGTData datum, java.lang.String descrip)
          Add data to the layout.
 void clear()
          Remove all data from the JPlotLayout
 void clear(java.lang.String data_id)
          Remove a specific dataset from the JPlotLayout
 SGTData getData(CartesianRenderer rend)
          Find a dataset from the renderer.
 SGTData getData(java.lang.String data_id)
          Find a dataset from the data's id.
 Layer getFirstLayer()
          Get the first Layer associated with the Pane
 Rectangle2D.Double getKeyBoundsP()
          Get the key size in physical units
 Point2D.Double getKeyPositionP()
          Get the key position in physical units
 Dimension2D getLayerSizeP()
          Get the JPlotLayout layer size in physical coordinates.
 java.lang.String getLocationSummary(SGTData grid)
          Construct a string that summarizes the location of the data.
 double getMainTitleHeightP()
          Get main label height in physical units
 Domain getRange()
          Get the current Domain
 double getSecondaryTitleHeightP()
          Get second and third label heights in physical units
 int getXAutoIntervals()
          Return the number of intervals for the x axis.
 int getYAutoIntervals()
          Return the number of intervals for the y axis.
 void init()
          Override JPane init method.
 boolean isXAutoRange()
          Tests if the auto range feature is enabled for the x axis.
 boolean isYAutoRange()
          Tests if the auto range feature is enabled for the y axis.
 int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)
          Implements the print method in java.awt.print.Printable
 void propertyChange(java.beans.PropertyChangeEvent evt)
          Used by JPlotLayout to listen for changes in line, grid, vector, and point attributes.
 void resetZoom()
          Set the axes to the range of the SGTData objects.
 void setAutoIntervals(int xint, int yint)
          Set the approximate number of x and y axes intervals for auto range.
 void setAutoRange(boolean xauto, boolean yauto)
          Turn on/off the auto range feature for the x and y axes.
 void setAxesOriginP(Point2D.Double pt)
          Set the axes origin in physical units
 void setCoastLine(SGTLine coast)
          Set the coastline.
 void setKeyAlignment(int vert, int horz)
          Set the key alignment
 void setKeyBoundsP(Rectangle2D.Double bounds)
          Set the key size in physical units
 void setKeyLocationP(Point2D.Double loc)
          Set the key position in physical units
 void setLayerSizeP(Dimension2D d)
          Set the layer size in physical units
 void setRange(Domain domain)
          Set the x and y range of the domain.
 void setRange(Domain domain, boolean testZUp)
          Set the x and y range of the domain.
 void setRange(SoTDomain std, boolean testZUp)
          Set the x and y range of the domain.
 void setRangeNoVeto(Domain domain)
          Set the x and y range of the domain.
 void setTitleHeightP(double main, double second)
          Set the main and secondary label heights in physical units
 void setXAutoIntervals(int xint)
          Set the approximate number of x axis intervals for auto range.
 void setXAutoRange(boolean xauto)
          Turn on/off the auto range feature for the x axis.
 void setYAutoIntervals(int yint)
          Set the approximate number of y axis intervals for auto range.
 void setYAutoRange(boolean yauto)
          Turn on/off the auto range feature for the y axis.
 
Methods inherited from class gov.noaa.pmel.sgt.swing.JGraphicLayout
addAttribute, addPropertyChangeListener, addVetoableChangeListener, findRange, findRange, findSoTRange, findSoTRange, findSoTRange, findTimeRange, findTimeRange, getAttribute, getBaseUnit, getData, getIconImage, getId, getKeyLayerSizeP, getKeyPane, getZoomBoundsU, isClipping, isEditClasses, isKeyPane, isOverlayed, removePropertyChangeListener, removeVetoableChangeListener, setBaseUnit, setClipping, setEditClasses, setId, setKeyLayerSizeP, setOverlayed, setTitles
 
Methods inherited from class gov.noaa.pmel.sgt.JPane
add, add, add, add, add, draw, draw, draw, drawPage, getBounds, getComponent, getLayer, getLayerFromDataId, getMaximumSize, getMinimumSize, getObjectAt, getPageHAlign, getPageOrigin, getPageSize, getPageVAlign, getPreferredScrollableViewportSize, getPreferredSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedObject, getStrokeDrawer, getZoomBounds, isBatch, isModified, isPrinter, moveLayerDown, moveLayerDown, moveLayerUp, moveLayerUp, paintComponent, processMouseEvent, processMouseMotionEvent, setBatch, setBatch, setModified, setPageAlign, setPageHAlign, setPageOrigin, setPageVAlign, setScrollableBlockIncrement, setScrollableUnitIncrement, setSelectedObject, setSize, toString
 
Methods inherited from class javax.swing.JLayeredPane
getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getPosition, highestLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, putLayer, remove, setLayer, setLayer, setPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, removeAll, removeContainerListener, setLayout, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, contains, createImage, createImage, dispatchEvent, enable, enableInputMethods, getBackground, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, show, show, size, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

POINTS

public static final int POINTS

LINE

public static final int LINE

GRID

public static final int GRID

VECTOR

public static final int VECTOR
Constructor Detail

JPlotLayout

public JPlotLayout(SGTData dataset)
Default constructor. No Logo image is used and the LineKey will be in the same JPane.

JPlotLayout

public JPlotLayout(SGTData dataset,
                   java.lang.String id,
                   java.awt.Image img,
                   boolean is_key_pane)
JPlotLayout constructor. Whether the data is GRID, POINTS, LINE, or VECTOR, isXtime, and isYTime is determined from the dataset.
Parameters:
dataset - the template data
id - identifier
img - Logo image
is_key_pane - if true LineKey is in separate pane

JPlotLayout

public JPlotLayout(boolean isGrid,
                   boolean isXTime,
                   boolean isYTime,
                   java.lang.String id,
                   java.awt.Image img,
                   boolean is_key_pane)
JPlotLayout constructor. This constructor is retained for backward compatability.
Parameters:
isGrid - if true data is grid
isXtime - if true x coordinate is time
isYTime - if true y coordinate is time
id - identifier
img - Logo image
is_key_pane - if true LineKey is in separate pane

JPlotLayout

public JPlotLayout(boolean isGrid,
                   boolean isPoints,
                   boolean isXTime,
                   boolean isYTime,
                   java.lang.String id,
                   java.awt.Image img,
                   boolean is_key_pane)
JPlotLayout constructor. All other constructors call this one. Data is not plotted during construction of the JPlotLayout object and the addData method must be called to associated data with this object.
Parameters:
isGrid - if true data is grid
isPoints - if true data is points
isXtime - if true x coordinate is time
isYTime - if true y coordinate is time
id - identifier
img - Logo image
is_key_pane - if true LineKey is in separate pane

JPlotLayout

public JPlotLayout(int type,
                   boolean isXTime,
                   boolean isYTime,
                   java.lang.String id,
                   java.awt.Image img,
                   boolean is_key_pane)
JPlotLayout constructor. All other constructors call this one. Data is not plotted during construction of the JPlotLayout object and the addData method must be called to associated data with this object.
Parameters:
type - type of plot , POINT, GRID, LINE, or VECTOR
isXtime - if true x coordinate is time
isYTime - if true y coordinate is time
id - identifier
img - Logo image
is_key_pane - if true LineKey is in separate pane
Method Detail

getLocationSummary

public java.lang.String getLocationSummary(SGTData grid)
Description copied from class: JGraphicLayout
Construct a string that summarizes the location of the data.
Overrides:
getLocationSummary in class JGraphicLayout

addData

public void addData(Collection lines)
Add a Collection of lines using the default attributes and description. The description will be taken from the dependent variable name

addData

public void addData(Collection lines,
                    Attribute attr)
Add a Collection of lines using the default description. The description will be taken from the dependent variable name

addData

public void addData(PointCollection points,
                    java.lang.String descrip)
Add a PointCollection.

addData

public void addData(Collection lines,
                    java.lang.String descrip)
Add a Collection of lines using the default attributes.

addData

public void addData(Collection lines,
                    Attribute attr,
                    java.lang.String descrip)
Add a Collecdtion of lines.

addData

public void addData(SGTData datum)
Add data to the layout. LineKey descriptor will be taken from the dependent variable name.
Overrides:
addData in class JGraphicLayout
Parameters:
data - datum data to be added

addData

public void addData(SGTData datum,
                    Attribute attr)
Add data to the layout. LineKey descriptor will be taken from the dependent variable name.
Parameters:
data - datum data to be added
attr - attribute for graphics

addData

public void addData(SGTData datum,
                    java.lang.String descrip)
Add data to the layout. JPlotLayout will use a default attribute.
Overrides:
addData in class JGraphicLayout

addData

public void addData(SGTData datum,
                    Attribute attr,
                    java.lang.String descrip)
Add data to the layout. Data will be added to X axis and Z_AXIS will be assigned to Y axis. If this is not the first invocation of addData a new Layer will be created. If overlayed, the Transforms from the first Layer will be attached and no axes will be created. If not overlayed, new transforms and axes will be created and adjusted so that the data is horizontally stacked.
Parameters:
datum - data to be added
descrip - LineKey description for datum

resetZoom

public void resetZoom()
Description copied from class: JGraphicLayout
Set the axes to the range of the SGTData objects.
Overrides:
resetZoom in class JGraphicLayout

getRange

public Domain getRange()
Description copied from class: JGraphicLayout
Get the current Domain
Overrides:
getRange in class JGraphicLayout

setRange

public void setRange(Domain domain)
              throws java.beans.PropertyVetoException
Set the x and y range of the domain.
Overrides:
setRange in class JGraphicLayout
Parameters:
range - new domain

setRange

public void setRange(SoTDomain std,
                     boolean testZUp)
              throws java.beans.PropertyVetoException
Set the x and y range of the domain.
Parameters:
testZUp - if true, flip the y axis if reversed

setRange

public void setRange(Domain domain,
                     boolean testZUp)
              throws java.beans.PropertyVetoException
Set the x and y range of the domain.
Property Change: domainRange.
Parameters:
testZUp - if true, flip the y axis if reversed

setRangeNoVeto

public void setRangeNoVeto(Domain domain)
Set the x and y range of the domain.

getData

public SGTData getData(java.lang.String data_id)
Find a dataset from the data's id.
Parameters:
data_id - the id
Returns:
SGTData

getData

public SGTData getData(CartesianRenderer rend)
Find a dataset from the renderer.
Parameters:
rend - the renderer
Returns:
SGTData

clear

public void clear()
Remove all data from the JPlotLayout

clear

public void clear(java.lang.String data_id)
Remove a specific dataset from the JPlotLayout
Parameters:
data_id - the data id

getLayerSizeP

public Dimension2D getLayerSizeP()
Get the JPlotLayout layer size in physical coordinates.

getFirstLayer

public Layer getFirstLayer()
Description copied from interface: AbstractPane
Get the first Layer associated with the Pane
Overrides:
getFirstLayer in class JPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Returns:
the first Layer object

setAxesOriginP

public void setAxesOriginP(Point2D.Double pt)
Set the axes origin in physical units

setLayerSizeP

public void setLayerSizeP(Dimension2D d)
Set the layer size in physical units

setTitleHeightP

public void setTitleHeightP(double main,
                            double second)
Set the main and secondary label heights in physical units
Parameters:
main - main label height
second - second and third label height

getMainTitleHeightP

public double getMainTitleHeightP()
Get main label height in physical units

getSecondaryTitleHeightP

public double getSecondaryTitleHeightP()
Get second and third label heights in physical units

setKeyBoundsP

public void setKeyBoundsP(Rectangle2D.Double bounds)
Set the key size in physical units
Overrides:
setKeyBoundsP in class JGraphicLayout

getKeyBoundsP

public Rectangle2D.Double getKeyBoundsP()
Get the key size in physical units
Overrides:
getKeyBoundsP in class JGraphicLayout

setKeyAlignment

public void setKeyAlignment(int vert,
                            int horz)
Set the key alignment
Parameters:
vert - vertical alignment
horz - horizontal alignment
See Also:
ColorKey, LineKey, PointCollectionKey

getKeyPositionP

public Point2D.Double getKeyPositionP()
Get the key position in physical units

setKeyLocationP

public void setKeyLocationP(Point2D.Double loc)
Set the key position in physical units

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Used by JPlotLayout to listen for changes in line, grid, vector, and point attributes.
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Following copied from interface: java.beans.PropertyChangeListener
Parameters:
evt - A PropertyChangeEvent object describing the event source and the property that has changed.

setCoastLine

public void setCoastLine(SGTLine coast)
Set the coastline.

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pf,
                 int pageIndex)
Implements the print method in java.awt.print.Printable
Overrides:
print in class JPane
Following copied from interface: java.awt.print.Printable
Parameters:
graphics - the context into which the page is drawn
pageFormat - the size and orientation of the page being drawn
pageIndex - the zero based index of the page to be drawn
Returns:
PAGE_EXISTS if the page is rendered successfully or NO_SUCH_PAGE if pageIndex specifies a non-existent page.
Throws:
java.awt.print.PrinterException - thrown when the print job is terminated.

setXAutoRange

public void setXAutoRange(boolean xauto)
Turn on/off the auto range feature for the x axis. Auto range creates a "nice" range with a delta of 1., 2., 5. or 10^n of these. The start and end of the range is extended to the next full delta.

setYAutoRange

public void setYAutoRange(boolean yauto)
Turn on/off the auto range feature for the y axis. Auto range creates a "nice" range with a delta of 1., 2., 5. or 10^n of these. The start and end of the range is extended to the next full delta.

setAutoRange

public void setAutoRange(boolean xauto,
                         boolean yauto)
Turn on/off the auto range feature for the x and y axes. Auto range creates a "nice" range with a delta of 1., 2., 5. or 10^n of these. The start and end of the range is extended to the next full delta.

isXAutoRange

public boolean isXAutoRange()
Tests if the auto range feature is enabled for the x axis.

isYAutoRange

public boolean isYAutoRange()
Tests if the auto range feature is enabled for the y axis.

setXAutoIntervals

public void setXAutoIntervals(int xint)
Set the approximate number of x axis intervals for auto range.

setYAutoIntervals

public void setYAutoIntervals(int yint)
Set the approximate number of y axis intervals for auto range.

setAutoIntervals

public void setAutoIntervals(int xint,
                             int yint)
Set the approximate number of x and y axes intervals for auto range.

getXAutoIntervals

public int getXAutoIntervals()
Return the number of intervals for the x axis.

getYAutoIntervals

public int getYAutoIntervals()
Return the number of intervals for the y axis.

init

public void init()
Override JPane init method. The scrolling list parameters are computed here if necessary.
Overrides:
init in class JPane


Send comments about the Scientific Graphics toolkit to dwd@pmel.noaa.gov. For more information about Java Development in the EPIC Group see the EPIC Software Page
Generated on December 13 2001