Package mgui.interfaces.plots.sgt
Class SgtCartesianLayout<T extends SgtPlotObject<?>>
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,gov.noaa.pmel.sgt.CartesianGraph,gov.noaa.pmel.sgt.PlainAxis>
mgui.interfaces.plots.sgt.SgtCartesianLayout<T>
- Type Parameters:
T
- SgtPlotObject for this layout
- 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:
SgtLineLayout
,SgtPointSetLayout
public abstract class SgtCartesianLayout<T extends SgtPlotObject<?>> extends SgtPlotLayout<T,gov.noaa.pmel.sgt.CartesianGraph,gov.noaa.pmel.sgt.PlainAxis>
Abstract extension of
SgtPlotObject
for CartesianGraph
objects.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class mgui.interfaces.plots.sgt.SgtPlotLayout
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 java.lang.String
base_x
Names for the base X and Y axesprotected static java.lang.String
BASE_X
protected java.lang.String
base_y
Names for the base X and Y axesprotected static java.lang.String
BASE_Y
Fields inherited from class mgui.interfaces.plots.sgt.SgtPlotLayout
attributes, auto_interval_x, auto_interval_y, auto_range_x, auto_range_y, axis_map, base_layer, data_attributes, data_collection, graph_map, graph_type, is_destroyed, layers, object_key, object_map, rev_axis_x, rev_axis_y, 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 SgtCartesianLayout()
SgtCartesianLayout(java.lang.String title, java.awt.Dimension size)
-
Method Summary
Modifier and Type Method Description SgtAxis<gov.noaa.pmel.sgt.PlainAxis>
addAxis(java.lang.String name, gov.noaa.pmel.sgt.PlainAxis axis, SgtPlotFunctions.AxisType type)
Adds an axis to this plot.protected void
addGraph(java.lang.String label, gov.noaa.pmel.sgt.CartesianGraph graph)
protected void
addGraph(T object)
Creates a graph forobject
and adds it to its own layer.void
attributeUpdated(AttributeEvent e)
Called when an Attribute's value has been updated.protected gov.noaa.pmel.sgt.CartesianGraph
getGraph(java.lang.String layer_name)
Returns the graph for the given layer.java.lang.String
getLabelX()
Returns the label for the X axis.java.lang.String
getLabelY()
Returns the label for the Y axis.SgtAxis<gov.noaa.pmel.sgt.PlainAxis>
getMainAxis(SgtPlotFunctions.AxisType type)
Returns the main axis of the givenSgtPlotFunctions.AxisType
.double
getMaxX()
Returns the end of the X axis, in physical units (seeJPane
for details).double
getMaxY()
Returns the end of the Y axis, in physical units (seeJPane
for details).double
getMinX()
Returns the start of the X axis, in physical units relative to its size (seeJPane
for details).double
getMinY()
Returns the start of the Y axis, in physical units (seeJPane
for details).gov.noaa.pmel.util.SoTRange
getRangeX()
Returns the X axis range, from a string of the formgov.noaa.pmel.util.SoTRange
getRangeY()
Returns the Y axis range, from a string of the formdouble
getSizeX()
The X dimension of the graph; axes are defined relative to this.double
getSizeY()
The Y dimension of the graph; axes are defined relative to this.protected gov.noaa.pmel.sgt.CartesianGraph
initPlot(T object)
Initiates the plot using the given initial data object.protected void
initRange(T object)
Initiates this plot's range based upon its first data object.boolean
isAutoRangeX()
Indicates whether this layout automatically adjusts its X range to its X data.boolean
isAutoRangeY()
Indicates whether this layout automatically adjusts its Y range to its Y data.void
removeAxis(java.lang.String name)
Removes the axis with the specified name from this layout.void
setLabelX(java.lang.String label)
Set the label for the X axis.void
setLabelY(java.lang.String label)
Set the label for the Y axis.void
setRangeX(gov.noaa.pmel.util.SoTRange range)
Sets this layout's X range fromrange
.void
setRangeY(gov.noaa.pmel.util.SoTRange range)
Sets this layout's Y range fromrange
.protected void
updateAxes()
Updates the axes properties with this layout's attributes.protected void
updateRange(T object)
Updates this plot's range based upon an added data object.protected void
updateRanges()
Updates this plot's range if autorange is set, and repaints the layout.protected void
updateTransforms()
Updates all graph transforms to fit the axes.Methods inherited from class mgui.interfaces.plots.sgt.SgtPlotLayout
addAttribute, addData, addLayer, addMouseListener, clean, clearData, destroy, getAttribute, getAttribute, getAxis, getBaseLayer, getLayer, getLayerNames, getMapKeys, getPlot, getTreeLabel, isDestroyed, issueTreeNode, plotObjectAdded, plotObjectModified, plotObjectRemoved, propertyChange, removeLayer, setTreeNode
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
-
base_x
protected java.lang.String base_xNames for the base X and Y axes -
base_y
protected java.lang.String base_yNames for the base X and Y axes -
BASE_X
protected static final java.lang.String BASE_X- See Also:
- Constant Field Values
-
BASE_Y
protected static final java.lang.String BASE_Y- See Also:
- Constant Field Values
-
-
Constructor Details
-
SgtCartesianLayout
public SgtCartesianLayout() -
SgtCartesianLayout
public SgtCartesianLayout(java.lang.String title, java.awt.Dimension size)
-
-
Method Details
-
attributeUpdated
Description copied from interface:AttributeListener
Called when an Attribute's value has been updated.- Specified by:
attributeUpdated
in interfaceAttributeListener
- Overrides:
attributeUpdated
in classSgtPlotLayout<T extends SgtPlotObject<?>,gov.noaa.pmel.sgt.CartesianGraph,gov.noaa.pmel.sgt.PlainAxis>
-
addAxis
public SgtAxis<gov.noaa.pmel.sgt.PlainAxis> addAxis(java.lang.String name, gov.noaa.pmel.sgt.PlainAxis axis, SgtPlotFunctions.AxisType type) throws PlotExceptionDescription copied from class:SgtPlotLayout
Adds an axis to this plot.- Overrides:
addAxis
in classSgtPlotLayout<T extends SgtPlotObject<?>,gov.noaa.pmel.sgt.CartesianGraph,gov.noaa.pmel.sgt.PlainAxis>
- Returns:
- the created
SgtAxis
- Throws:
PlotException
-
removeAxis
public void removeAxis(java.lang.String name)Description copied from class:SgtPlotLayout
Removes the axis with the specified name from this layout.- Overrides:
removeAxis
in classSgtPlotLayout<T extends SgtPlotObject<?>,gov.noaa.pmel.sgt.CartesianGraph,gov.noaa.pmel.sgt.PlainAxis>
-
updateAxes
protected void updateAxes()Updates the axes properties with this layout's attributes. -
getMainAxis
Description copied from class:SgtPlotLayout
Returns the main axis of the givenSgtPlotFunctions.AxisType
.- Specified by:
getMainAxis
in classSgtPlotLayout<T extends SgtPlotObject<?>,gov.noaa.pmel.sgt.CartesianGraph,gov.noaa.pmel.sgt.PlainAxis>
- Returns:
-
getRangeX
public gov.noaa.pmel.util.SoTRange getRangeX()Returns the X axis range, from a string of the form[min] [max] [step]
- Returns:
-
getRangeY
public gov.noaa.pmel.util.SoTRange getRangeY()Returns the Y axis range, from a string of the form[min] [max] [step]
- Returns:
-
getSizeX
public double getSizeX()The X dimension of the graph; axes are defined relative to this.- Returns:
-
getMinX
public double getMinX()Returns the start of the X axis, in physical units relative to its size (seeJPane
for details).- Returns:
-
getMaxX
public double getMaxX()Returns the end of the X axis, in physical units (seeJPane
for details).- Returns:
-
getSizeY
public double getSizeY()The Y dimension of the graph; axes are defined relative to this.- Returns:
-
getMinY
public double getMinY()Returns the start of the Y axis, in physical units (seeJPane
for details).- Returns:
-
getMaxY
public double getMaxY()Returns the end of the Y axis, in physical units (seeJPane
for details).- Returns:
-
isAutoRangeX
public boolean isAutoRangeX()Indicates whether this layout automatically adjusts its X range to its X data.- Returns:
-
isAutoRangeY
public boolean isAutoRangeY()Indicates whether this layout automatically adjusts its Y range to its Y data.- Returns:
-
setRangeX
public void setRangeX(gov.noaa.pmel.util.SoTRange range)Sets this layout's X range fromrange
.- Parameters:
range
-
-
setRangeY
public void setRangeY(gov.noaa.pmel.util.SoTRange range)Sets this layout's Y range fromrange
.- Parameters:
range
-
-
getLabelX
public java.lang.String getLabelX()Returns the label for the X axis.- Returns:
-
getLabelY
public java.lang.String getLabelY()Returns the label for the Y axis.- Returns:
-
setLabelX
public void setLabelX(java.lang.String label)Set the label for the X axis.- Parameters:
label
-
-
setLabelY
public void setLabelY(java.lang.String label)Set the label for the Y axis.- Parameters:
label
-
-
initRange
Initiates this plot's range based upon its first data object.- Specified by:
initRange
in classSgtPlotLayout<T extends SgtPlotObject<?>,gov.noaa.pmel.sgt.CartesianGraph,gov.noaa.pmel.sgt.PlainAxis>
- Parameters:
object
-
-
updateRange
Updates this plot's range based upon an added data object.- Specified by:
updateRange
in classSgtPlotLayout<T extends SgtPlotObject<?>,gov.noaa.pmel.sgt.CartesianGraph,gov.noaa.pmel.sgt.PlainAxis>
- Parameters:
object
-
-
updateRanges
protected void updateRanges()Updates this plot's range if autorange is set, and repaints the layout. -
updateTransforms
protected void updateTransforms()Updates all graph transforms to fit the axes. -
initPlot
Description copied from class:SgtPlotLayout
Initiates the plot using the given initial data object. This function should set up axes, transforms, and ranges for the graph object.- Specified by:
initPlot
in classSgtPlotLayout<T extends SgtPlotObject<?>,gov.noaa.pmel.sgt.CartesianGraph,gov.noaa.pmel.sgt.PlainAxis>
- Returns:
- the graph created for this object
-
getGraph
protected gov.noaa.pmel.sgt.CartesianGraph getGraph(java.lang.String layer_name)Description copied from class:SgtPlotLayout
Returns the graph for the given layer.- Specified by:
getGraph
in classSgtPlotLayout<T extends SgtPlotObject<?>,gov.noaa.pmel.sgt.CartesianGraph,gov.noaa.pmel.sgt.PlainAxis>
- Returns:
-
addGraph
Description copied from class:SgtPlotLayout
Creates a graph forobject
and adds it to its own layer.- Specified by:
addGraph
in classSgtPlotLayout<T extends SgtPlotObject<?>,gov.noaa.pmel.sgt.CartesianGraph,gov.noaa.pmel.sgt.PlainAxis>
- Throws:
PlotException
-
addGraph
protected void addGraph(java.lang.String label, gov.noaa.pmel.sgt.CartesianGraph graph) throws PlotException- Throws:
PlotException
-