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.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 java.lang.Stringbase_xNames for the base X and Y axesprotected static java.lang.StringBASE_Xprotected java.lang.Stringbase_yNames for the base X and Y axesprotected static java.lang.StringBASE_YFields 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, 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 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 voidaddGraph(java.lang.String label, gov.noaa.pmel.sgt.CartesianGraph graph)protected voidaddGraph(T object)Creates a graph forobjectand adds it to its own layer.voidattributeUpdated(AttributeEvent e)Called when an Attribute's value has been updated.protected gov.noaa.pmel.sgt.CartesianGraphgetGraph(java.lang.String layer_name)Returns the graph for the given layer.java.lang.StringgetLabelX()Returns the label for the X axis.java.lang.StringgetLabelY()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.doublegetMaxX()Returns the end of the X axis, in physical units (seeJPanefor details).doublegetMaxY()Returns the end of the Y axis, in physical units (seeJPanefor details).doublegetMinX()Returns the start of the X axis, in physical units relative to its size (seeJPanefor details).doublegetMinY()Returns the start of the Y axis, in physical units (seeJPanefor details).gov.noaa.pmel.util.SoTRangegetRangeX()Returns the X axis range, from a string of the formgov.noaa.pmel.util.SoTRangegetRangeY()Returns the Y axis range, from a string of the formdoublegetSizeX()The X dimension of the graph; axes are defined relative to this.doublegetSizeY()The Y dimension of the graph; axes are defined relative to this.protected gov.noaa.pmel.sgt.CartesianGraphinitPlot(T object)Initiates the plot using the given initial data object.protected voidinitRange(T object)Initiates this plot's range based upon its first data object.booleanisAutoRangeX()Indicates whether this layout automatically adjusts its X range to its X data.booleanisAutoRangeY()Indicates whether this layout automatically adjusts its Y range to its Y data.voidremoveAxis(java.lang.String name)Removes the axis with the specified name from this layout.voidsetLabelX(java.lang.String label)Set the label for the X axis.voidsetLabelY(java.lang.String label)Set the label for the Y axis.voidsetRangeX(gov.noaa.pmel.util.SoTRange range)Sets this layout's X range fromrange.voidsetRangeY(gov.noaa.pmel.util.SoTRange range)Sets this layout's Y range fromrange.protected voidupdateAxes()Updates the axes properties with this layout's attributes.protected voidupdateRange(T object)Updates this plot's range based upon an added data object.protected voidupdateRanges()Updates this plot's range if autorange is set, and repaints the layout.protected voidupdateTransforms()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, setTreeNodeMethods 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
-
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:AttributeListenerCalled when an Attribute's value has been updated.- Specified by:
attributeUpdatedin interfaceAttributeListener- Overrides:
attributeUpdatedin 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:SgtPlotLayoutAdds an axis to this plot.- Overrides:
addAxisin 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:SgtPlotLayoutRemoves the axis with the specified name from this layout.- Overrides:
removeAxisin 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:SgtPlotLayoutReturns the main axis of the givenSgtPlotFunctions.AxisType.- Specified by:
getMainAxisin 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 (seeJPanefor details).- Returns:
-
getMaxX
public double getMaxX()Returns the end of the X axis, in physical units (seeJPanefor 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 (seeJPanefor details).- Returns:
-
getMaxY
public double getMaxY()Returns the end of the Y axis, in physical units (seeJPanefor 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:
initRangein 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:
updateRangein 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:SgtPlotLayoutInitiates the plot using the given initial data object. This function should set up axes, transforms, and ranges for the graph object.- Specified by:
initPlotin 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:SgtPlotLayoutReturns the graph for the given layer.- Specified by:
getGraphin classSgtPlotLayout<T extends SgtPlotObject<?>,gov.noaa.pmel.sgt.CartesianGraph,gov.noaa.pmel.sgt.PlainAxis>- Returns:
-
addGraph
Description copied from class:SgtPlotLayoutCreates a graph forobjectand adds it to its own layer.- Specified by:
addGraphin 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
-