Package mgui.interfaces.plots.sgt
Class SgtPlotLayout<T extends SgtPlotObject<?>,G extends gov.noaa.pmel.sgt.Graph,A extends gov.noaa.pmel.sgt.Axis>
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLayeredPane
gov.noaa.pmel.sgt.JPane
mgui.interfaces.plots.sgt.SgtPlotLayout<T,G,A>
- All Implemented Interfaces:
gov.noaa.pmel.sgt.AbstractPane
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.awt.print.Printable
,java.beans.PropertyChangeListener
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.Scrollable
,AttributeListener
,InterfaceObject
,NamedObject
,SgtPlotListener
,TreeObject
,CleanableObject
- Direct Known Subclasses:
SgtCartesianLayout
public abstract class SgtPlotLayout<T extends SgtPlotObject<?>,G extends gov.noaa.pmel.sgt.Graph,A extends gov.noaa.pmel.sgt.Axis> extends gov.noaa.pmel.sgt.JPane implements java.beans.PropertyChangeListener, SgtPlotListener, InterfaceObject, AttributeListener
The base layout panel for an SGT plot.
The initiation process will typically call (in order):
initRange
to initialize this layout's range from an initial plot objectinitGraph
to initialize this layout's graph object wrt. ranges, labels, titles, etc.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SgtPlotLayout.GraphType
Nested classes/interfaces inherited from class javax.swing.JLayeredPane
javax.swing.JLayeredPane.AccessibleJLayeredPane
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
-
Field Summary
Fields Modifier and Type Field Description protected AttributeList
attributes
protected int
auto_interval_x
protected int
auto_interval_y
protected boolean
auto_range_x
protected boolean
auto_range_y
protected java.util.HashMap<java.lang.String,SgtAxis<A>>
axis_map
protected java.lang.String
base_layer
protected java.util.HashMap<gov.noaa.pmel.sgt.dm.SGTData,gov.noaa.pmel.sgt.Attribute>
data_attributes
protected gov.noaa.pmel.sgt.dm.Collection
data_collection
protected java.util.HashMap<java.lang.String,gov.noaa.pmel.sgt.Graph>
graph_map
protected SgtPlotLayout.GraphType
graph_type
protected boolean
is_destroyed
protected java.util.HashMap<java.lang.String,gov.noaa.pmel.sgt.Layer>
layers
protected gov.noaa.pmel.sgt.DataKey
object_key
protected java.util.HashMap<java.lang.String,SgtPlotObject<?>>
object_map
protected boolean
rev_axis_x
protected boolean
rev_axis_y
protected java.util.ArrayList<InterfaceTreeNode>
treeNodes
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
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface gov.noaa.pmel.sgt.AbstractPane
BOTTOM, CENTER, DEFAULT_SCALE, LEFT, MIDDLE, RIGHT, SHRINK_TO_FIT, SPECIFIED_LOCATION, TO_FIT, TOP
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
-
Constructor Summary
Constructors Constructor Description SgtPlotLayout(java.lang.String title, java.awt.Dimension size, SgtPlotLayout.GraphType type)
SgtPlotLayout(SgtPlotLayout.GraphType graph_type)
-
Method Summary
Modifier and Type Method Description void
addAttribute(gov.noaa.pmel.sgt.dm.SGTData data, gov.noaa.pmel.sgt.Attribute attr)
Set attributes for the given data object.SgtAxis<A>
addAxis(java.lang.String name, A axis, SgtPlotFunctions.AxisType type)
Adds an axis to this plot.void
addData(T object)
Add a data object to this plot, and if autoranges are set, update ranges accordingly.protected abstract void
addGraph(T object)
Creates a graph forobject
and adds it to its own layer.void
addLayer(java.lang.String name, gov.noaa.pmel.sgt.Layer layer)
Adds a layer with the specified name to this layout.void
addMouseListener(java.awt.event.MouseListener l)
void
attributeUpdated(AttributeEvent e)
Called when an Attribute's value has been updated.void
clean()
Instructs this object to search its members for any object which has been destroyed, and release the pointer to it.void
clearData()
Removes all graph data from this layout.void
destroy()
Destroy this object (prepare it to be removed from memory)gov.noaa.pmel.sgt.Attribute
getAttribute(gov.noaa.pmel.sgt.dm.SGTData data)
Returns the attributes for the given data object.gov.noaa.pmel.sgt.Attribute
getAttribute(java.lang.String name)
Returns the attributes for the data object with the given name.SgtAxis<A>
getAxis(java.lang.String name)
Returns the axis with the specified name;null
if no such axis exists.gov.noaa.pmel.sgt.Layer
getBaseLayer()
Returns the base layer; i.e., containing axes + labels.protected abstract G
getGraph(java.lang.String layer)
Returns the graph for the given layer.gov.noaa.pmel.sgt.Layer
getLayer(java.lang.String name)
Returns the layer associated with the specified name.java.util.ArrayList<java.lang.String>
getLayerNames()
abstract SgtAxis<gov.noaa.pmel.sgt.PlainAxis>
getMainAxis(SgtPlotFunctions.AxisType type)
Returns the main axis of the givenSgtPlotFunctions.AxisType
.java.util.ArrayList<java.lang.String>
getMapKeys()
gov.noaa.pmel.sgt.Graph
getPlot()
java.lang.String
getTreeLabel()
Returns the label text to appear in a tree node.protected abstract G
initPlot(T object)
Initiates the plot using the given initial data object.protected abstract void
initRange(T object)
Initiates this plot's range based upon its first data object.boolean
isDestroyed()
Test whether this object has been destroyedInterfaceTreeNode
issueTreeNode()
Issues a newInterfaceTreeNode
for this object.void
plotObjectAdded(SgtPlotEvent e)
Updates this plot in response to an additional data object.void
plotObjectModified(SgtPlotEvent e)
Updates this plot in response to the modification of a data object.void
plotObjectRemoved(SgtPlotEvent e)
Updates this plot in response to the removal of a data object.void
propertyChange(java.beans.PropertyChangeEvent evt)
void
removeAxis(java.lang.String name)
Removes the axis with the specified name from this layout.void
removeLayer(java.lang.String name)
Removes the layer corresponding the the specified name from this layout.void
setTreeNode(InterfaceTreeNode node)
Sets the children for this node'sInterfaceTreeNode
.protected abstract void
updateRange(T object)
Updates this plot's range based upon an added data object.Methods inherited from class gov.noaa.pmel.sgt.JPane
add, add, add, add, add, addPropertyChangeListener, draw, draw, draw, drawPage, drawPage, getComponent, getFirstLayer, getId, getLayerFromDataId, getMaximumSize, getMinimumSize, getObjectAt, getObjectsAt, getObjectsAt, getPageHAlign, getPageOrigin, getPageScaleMode, getPageSize, getPageVAlign, getPreferredScrollableViewportSize, getPreferredSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedObject, getStrokeDrawer, getVersion, getZoomBounds, getZoomStart, init, isBatch, isModified, isMouseEventsEnabled, isPrinter, moveLayerDown, moveLayerDown, moveLayerUp, moveLayerUp, paintComponent, print, processMouseEvent, processMouseMotionEvent, removePropertyChangeListener, setBatch, setBatch, setId, setModified, setMouseEventsEnabled, setPageAlign, setPageHAlign, setPageOrigin, setPageScaleMode, setPageVAlign, setScrollableBlockIncrement, setScrollableUnitIncrement, setSelectedObject, setSize, toString
Methods inherited from class javax.swing.JLayeredPane
addImpl, getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, paramString, putLayer, remove, removeAll, setLayer, setLayer, setPosition
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
Methods inherited from class java.awt.Container
addContainerListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface gov.noaa.pmel.sgt.AbstractPane
getBounds
Methods inherited from interface mgui.interfaces.NamedObject
getName, setName
-
Field Details
-
is_destroyed
protected boolean is_destroyed -
treeNodes
-
object_key
protected gov.noaa.pmel.sgt.DataKey object_key -
graph_type
-
layers
protected java.util.HashMap<java.lang.String,gov.noaa.pmel.sgt.Layer> layers -
data_attributes
protected java.util.HashMap<gov.noaa.pmel.sgt.dm.SGTData,gov.noaa.pmel.sgt.Attribute> data_attributes -
graph_map
protected java.util.HashMap<java.lang.String,gov.noaa.pmel.sgt.Graph> graph_map -
object_map
-
axis_map
-
data_collection
protected gov.noaa.pmel.sgt.dm.Collection data_collection -
auto_range_x
protected boolean auto_range_x -
auto_range_y
protected boolean auto_range_y -
auto_interval_x
protected int auto_interval_x -
auto_interval_y
protected int auto_interval_y -
rev_axis_x
protected boolean rev_axis_x -
rev_axis_y
protected boolean rev_axis_y -
attributes
-
base_layer
protected java.lang.String base_layer
-
-
Constructor Details
-
SgtPlotLayout
-
SgtPlotLayout
public SgtPlotLayout(java.lang.String title, java.awt.Dimension size, SgtPlotLayout.GraphType type)
-
-
Method Details
-
clean
public void clean()Description copied from interface:CleanableObject
Instructs this object to search its members for any object which has been destroyed, and release the pointer to it.- Specified by:
clean
in interfaceCleanableObject
-
getPlot
public gov.noaa.pmel.sgt.Graph getPlot() -
getLayerNames
public java.util.ArrayList<java.lang.String> getLayerNames() -
getLayer
public gov.noaa.pmel.sgt.Layer getLayer(java.lang.String name)Returns the layer associated with the specified name.- Specified by:
getLayer
in interfacegov.noaa.pmel.sgt.AbstractPane
- Overrides:
getLayer
in classgov.noaa.pmel.sgt.JPane
- Parameters:
name
-- Returns:
-
getBaseLayer
public gov.noaa.pmel.sgt.Layer getBaseLayer()Returns the base layer; i.e., containing axes + labels.- Returns:
-
addLayer
Adds a layer with the specified name to this layout.- Parameters:
name
-layer
-- Throws:
PlotException
-
removeLayer
public void removeLayer(java.lang.String name)Removes the layer corresponding the the specified name from this layout.- Parameters:
name
-
-
addAxis
public SgtAxis<A> addAxis(java.lang.String name, A axis, SgtPlotFunctions.AxisType type) throws PlotExceptionAdds an axis to this plot.- Parameters:
name
-axis
-- Returns:
- the created
SgtAxis
- Throws:
PlotException
-
removeAxis
public void removeAxis(java.lang.String name)Removes the axis with the specified name from this layout.- Parameters:
name
-
-
getAxis
Returns the axis with the specified name;null
if no such axis exists.- Parameters:
name
-- Returns:
-
getMainAxis
Returns the main axis of the givenSgtPlotFunctions.AxisType
.- Parameters:
type
-- Returns:
-
attributeUpdated
Description copied from interface:AttributeListener
Called when an Attribute's value has been updated.- Specified by:
attributeUpdated
in interfaceAttributeListener
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
getMapKeys
public java.util.ArrayList<java.lang.String> getMapKeys() -
addData
Add a data object to this plot, and if autoranges are set, update ranges accordingly.If this is the first data object, X and Y axes and transforms are created and added to the graph; for all additional objects, the transforms will be linked from the first object layer, and no axes will be created.
- Parameters:
xy_data
-- Throws:
PlotException
- If data's ID already exists. Existing data object must be removed first.
-
clearData
public void clearData()Removes all graph data from this layout. -
plotObjectAdded
Description copied from interface:SgtPlotListener
Updates this plot in response to an additional data object.- Specified by:
plotObjectAdded
in interfaceSgtPlotListener
-
plotObjectModified
Description copied from interface:SgtPlotListener
Updates this plot in response to the modification of a data object.- Specified by:
plotObjectModified
in interfaceSgtPlotListener
-
plotObjectRemoved
Description copied from interface:SgtPlotListener
Updates this plot in response to the removal of a data object.- Specified by:
plotObjectRemoved
in interfaceSgtPlotListener
-
initRange
Initiates this plot's range based upon its first data object.- Parameters:
object
-
-
updateRange
Updates this plot's range based upon an added data object.- Parameters:
object
-
-
getGraph
Returns the graph for the given layer.- Parameters:
layer
-- Returns:
-
addGraph
Creates a graph forobject
and adds it to its own layer.- Parameters:
object
-- Throws:
PlotException
-
initPlot
Initiates the plot using the given initial data object. This function should set up axes, transforms, and ranges for the graph object.- Parameters:
layer
-attributes
- attributes for the plot- Returns:
- the graph created for this object
- Throws:
PlotException
-
addAttribute
public void addAttribute(gov.noaa.pmel.sgt.dm.SGTData data, gov.noaa.pmel.sgt.Attribute attr)Set attributes for the given data object.- Parameters:
data
-attr
-
-
getAttribute
public gov.noaa.pmel.sgt.Attribute getAttribute(gov.noaa.pmel.sgt.dm.SGTData data) throws gov.noaa.pmel.sgt.DataNotFoundExceptionReturns the attributes for the given data object.- Parameters:
data
-- Returns:
- Throws:
gov.noaa.pmel.sgt.DataNotFoundException
-
getAttribute
public gov.noaa.pmel.sgt.Attribute getAttribute(java.lang.String name) throws gov.noaa.pmel.sgt.DataNotFoundExceptionReturns the attributes for the data object with the given name.- Parameters:
xy_data
-- Returns:
- Throws:
gov.noaa.pmel.sgt.DataNotFoundException
-
addMouseListener
public void addMouseListener(java.awt.event.MouseListener l)- Overrides:
addMouseListener
in classjava.awt.Component
-
getTreeLabel
public java.lang.String getTreeLabel()Description copied from interface:TreeObject
Returns the label text to appear in a tree node.- Specified by:
getTreeLabel
in interfaceTreeObject
- Returns:
-
issueTreeNode
Description copied from interface:TreeObject
Issues a newInterfaceTreeNode
for this object. The object is responsible for maintaining, updating, and destroying the tree nodes it issues, or notifying containers -- i.e., parent trees -- of changes which require the tree nodes to be modified or destroyed.- Specified by:
issueTreeNode
in interfaceTreeObject
- Returns:
-
setTreeNode
Description copied from interface:TreeObject
Sets the children for this node'sInterfaceTreeNode
.- Specified by:
setTreeNode
in interfaceTreeObject
-
destroy
public void destroy()Description copied from interface:InterfaceObject
Destroy this object (prepare it to be removed from memory)- Specified by:
destroy
in interfaceInterfaceObject
-
isDestroyed
public boolean isDestroyed()Description copied from interface:InterfaceObject
Test whether this object has been destroyed- Specified by:
isDestroyed
in interfaceInterfaceObject
- Returns:
-