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):
initRangeto initialize this layout's range from an initial plot objectinitGraphto 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 classSgtPlotLayout.GraphTypeNested classes/interfaces inherited from class javax.swing.JLayeredPane
javax.swing.JLayeredPane.AccessibleJLayeredPaneNested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainerNested 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 AttributeListattributesprotected intauto_interval_xprotected intauto_interval_yprotected booleanauto_range_xprotected booleanauto_range_yprotected java.util.HashMap<java.lang.String,SgtAxis<A>>axis_mapprotected java.lang.Stringbase_layerprotected java.util.HashMap<gov.noaa.pmel.sgt.dm.SGTData,gov.noaa.pmel.sgt.Attribute>data_attributesprotected gov.noaa.pmel.sgt.dm.Collectiondata_collectionprotected java.util.HashMap<java.lang.String,gov.noaa.pmel.sgt.Graph>graph_mapprotected SgtPlotLayout.GraphTypegraph_typeprotected booleanis_destroyedprotected java.util.HashMap<java.lang.String,gov.noaa.pmel.sgt.Layer>layersprotected gov.noaa.pmel.sgt.DataKeyobject_keyprotected java.util.HashMap<java.lang.String,SgtPlotObject<?>>object_mapprotected booleanrev_axis_xprotected booleanrev_axis_yprotected java.util.ArrayList<InterfaceTreeNode>treeNodesFields inherited from class javax.swing.JLayeredPane
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYERFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface gov.noaa.pmel.sgt.AbstractPane
BOTTOM, CENTER, DEFAULT_SCALE, LEFT, MIDDLE, RIGHT, SHRINK_TO_FIT, SPECIFIED_LOCATION, TO_FIT, TOPFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields 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 voidaddAttribute(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.voidaddData(T object)Add a data object to this plot, and if autoranges are set, update ranges accordingly.protected abstract voidaddGraph(T object)Creates a graph forobjectand adds it to its own layer.voidaddLayer(java.lang.String name, gov.noaa.pmel.sgt.Layer layer)Adds a layer with the specified name to this layout.voidaddMouseListener(java.awt.event.MouseListener l)voidattributeUpdated(AttributeEvent e)Called when an Attribute's value has been updated.voidclean()Instructs this object to search its members for any object which has been destroyed, and release the pointer to it.voidclearData()Removes all graph data from this layout.voiddestroy()Destroy this object (prepare it to be removed from memory)gov.noaa.pmel.sgt.AttributegetAttribute(gov.noaa.pmel.sgt.dm.SGTData data)Returns the attributes for the given data object.gov.noaa.pmel.sgt.AttributegetAttribute(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;nullif no such axis exists.gov.noaa.pmel.sgt.LayergetBaseLayer()Returns the base layer; i.e., containing axes + labels.protected abstract GgetGraph(java.lang.String layer)Returns the graph for the given layer.gov.noaa.pmel.sgt.LayergetLayer(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.GraphgetPlot()java.lang.StringgetTreeLabel()Returns the label text to appear in a tree node.protected abstract GinitPlot(T object)Initiates the plot using the given initial data object.protected abstract voidinitRange(T object)Initiates this plot's range based upon its first data object.booleanisDestroyed()Test whether this object has been destroyedInterfaceTreeNodeissueTreeNode()Issues a newInterfaceTreeNodefor this object.voidplotObjectAdded(SgtPlotEvent e)Updates this plot in response to an additional data object.voidplotObjectModified(SgtPlotEvent e)Updates this plot in response to the modification of a data object.voidplotObjectRemoved(SgtPlotEvent e)Updates this plot in response to the removal of a data object.voidpropertyChange(java.beans.PropertyChangeEvent evt)voidremoveAxis(java.lang.String name)Removes the axis with the specified name from this layout.voidremoveLayer(java.lang.String name)Removes the layer corresponding the the specified name from this layout.voidsetTreeNode(InterfaceTreeNode node)Sets the children for this node'sInterfaceTreeNode.protected abstract voidupdateRange(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, toStringMethods 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, setPositionMethods 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, updateUIMethods 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, validateTreeMethods 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, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gov.noaa.pmel.sgt.AbstractPane
getBoundsMethods 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:CleanableObjectInstructs this object to search its members for any object which has been destroyed, and release the pointer to it.- Specified by:
cleanin 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:
getLayerin interfacegov.noaa.pmel.sgt.AbstractPane- Overrides:
getLayerin 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;nullif no such axis exists.- Parameters:
name-- Returns:
-
getMainAxis
Returns the main axis of the givenSgtPlotFunctions.AxisType.- Parameters:
type-- Returns:
-
attributeUpdated
Description copied from interface:AttributeListenerCalled when an Attribute's value has been updated.- Specified by:
attributeUpdatedin interfaceAttributeListener
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)- Specified by:
propertyChangein 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:SgtPlotListenerUpdates this plot in response to an additional data object.- Specified by:
plotObjectAddedin interfaceSgtPlotListener
-
plotObjectModified
Description copied from interface:SgtPlotListenerUpdates this plot in response to the modification of a data object.- Specified by:
plotObjectModifiedin interfaceSgtPlotListener
-
plotObjectRemoved
Description copied from interface:SgtPlotListenerUpdates this plot in response to the removal of a data object.- Specified by:
plotObjectRemovedin 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 forobjectand 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:
addMouseListenerin classjava.awt.Component
-
getTreeLabel
public java.lang.String getTreeLabel()Description copied from interface:TreeObjectReturns the label text to appear in a tree node.- Specified by:
getTreeLabelin interfaceTreeObject- Returns:
-
issueTreeNode
Description copied from interface:TreeObjectIssues a newInterfaceTreeNodefor 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:
issueTreeNodein interfaceTreeObject- Returns:
-
setTreeNode
Description copied from interface:TreeObjectSets the children for this node'sInterfaceTreeNode.- Specified by:
setTreeNodein interfaceTreeObject
-
destroy
public void destroy()Description copied from interface:InterfaceObjectDestroy this object (prepare it to be removed from memory)- Specified by:
destroyin interfaceInterfaceObject
-
isDestroyed
public boolean isDestroyed()Description copied from interface:InterfaceObjectTest whether this object has been destroyed- Specified by:
isDestroyedin interfaceInterfaceObject- Returns:
-