Class ScatterPlot
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.visualization.core.PaintablePanel
-
- adams.gui.visualization.stats.scatterplot.AbstractScatterPlot
-
- adams.gui.visualization.stats.scatterplot.ScatterPlot
-
- All Implemented Interfaces:
TextSupporter
,SpreadSheetSupporter
,TextSupplier
,PopupMenuCustomizer<MouseEvent>
,PaintListener
,PaintletManager
,TipTextCustomizer
,PopupMenuCustomizer
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
public class ScatterPlot extends AbstractScatterPlot implements PopupMenuCustomizer
create a paintable panel displaying a scatter plot panel as well as combo boxes for choosing attributes.- Author:
- msf8
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
ScatterPlot.AttColorListener
Listener for when the color attribute BaseComboBox selection changesprotected class
ScatterPlot.AttXListener
Listener for when the x attribute BaseComboBox selection changes.protected class
ScatterPlot.AttYListener
Listener for when the y attribute BaseComboBox selection changes.-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected Index
m_ColorIndex
Index given as an option to choose color attributeprotected BaseRegExp
m_ColorIndexReg
regular expression given as an option to choose color attributeprotected int
m_ColorIntIndex
the index of the color attribute.protected BaseComboBox<String>
m_ComboBoxColor
For choosing attribute to use for color.protected BaseComboBox<String>
m_ComboBoxX
For choosing attribute to display on y axisprotected BaseComboBox<String>
m_ComboBoxY
For choosing attribute to display on x axisprotected AbstractScatterPlotOverlay[]
m_DefaultOverlays
default object for the GAEprotected AbstractScatterPlotPaintlet
m_DefaultPaintlet
default paintlet for GOEpanelprotected SpreadSheetFileChooser
m_FileChooser
the file chooser for saving a specific sequence.protected DefaultComboBoxModel<String>
m_ModelColor
Model for the comboBox choosing the color attribute to displayprotected DefaultComboBoxModel<String>
m_ModelX
Model for the comboBox choosing the x attribute to displayprotected DefaultComboBoxModel<String>
m_ModelY
Model for the comboBox choosing the y attribute to displayprotected MouseClickAction
m_MouseClickAction
the mouse click action.protected GenericArrayEditorPanel
m_PanelOverlay
for displaying a genericarrayEditor for choosing overlaysprotected GenericObjectEditorPanel
m_PanelPaintlet
for displaying a genericobjecteditor for choosing paintletprotected Index
m_XIndex
Index object given as an option to choose x objectprotected BaseRegExp
m_XIndexReg
Regular expression given as an option to choose x attributeprotected Index
m_YIndex
Index given as an option to choose y attributeprotected BaseRegExp
m_YIndexReg
regular expression given as an option to choose y attribute-
Fields inherited from class adams.gui.visualization.stats.scatterplot.AbstractScatterPlot
m_Data, m_Overlays, m_Paintlet, m_Plot, m_Selection, m_SelectionEnabled, m_XIntIndex, m_YIntIndex
-
Fields inherited from class adams.gui.visualization.core.PaintablePanel
m_Paintlets
-
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description ScatterPlot()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
change()
called when a field has changed, updates all paintlets etcprotected void
changeOverlay()
called when new overlays have been chosenprotected void
changePaintlet()
Called when the paintlet used has been changedvoid
customizePopupMenu(MouseEvent e, JPopupMenu menu)
Optional customizing of the menu that is about to be popped up.Index
getColorIndex()
Get the index object for choosing the color attribute.BaseRegExp
getColorRegExp()
Gets the regular expression used when determining the color attribute.MouseClickAction
getMouseClickAction()
Returns the mouse click action in use.AbstractScatterPlotOverlay[]
getOverlays()
Get the overlays array containing overlays to applyAbstractScatterPlotPaintlet
getPaintlet()
Get the paintlet used initially to plot the dataPlotPanel
getPlot()
Returns the plot.Index
getXIndex()
Get the index object for choosing the attribute to display.BaseRegExp
getXRegExp()
Gets the regular expression used when determining the x attribute.Index
getYIndex()
Get the index object for choosing the y attribute.BaseRegExp
getYRegExp()
Gets the regular expression used when determining the y attribute.protected void
initGUI()
Initializes the widgets.protected void
initialize()
Initializes the members.void
prepareUpdate()
Updates the overlays, calculates eachvoid
reset()
Called by the class that creates this scatterplot called after fields have been setprotected void
save()
Saves all data points to a spreadsheet.protected void
save(double[] xRange, double[] yRange)
Saves the data as spreadsheet.protected void
saveVisible()
Saves only the visible data points to a spreadsheet.void
setColorIndex(Index val)
Set the index for the color attribute.void
setColorRegExp(BaseRegExp val)
Set the regular expression to use when determining the color attribute.void
setMouseClickAction(MouseClickAction value)
Sets the mouse click action to use.void
setOverlays(AbstractScatterPlotOverlay[] val)
Set the overlays array containing overlays to applyvoid
setPaintlet(AbstractScatterPlotPaintlet val)
Set the paintlet to use initially to plot the datavoid
setXIndex(Index val)
Set the x attribute index.void
setXRegExp(BaseRegExp val)
Set the regular expression to use when determining the x attribute.void
setYIndex(Index val)
Set the index for the y attribute.void
setYRegExp(BaseRegExp val)
Set the regular expression to use when determining the y attribute.protected void
showData()
Displays the data as spreadsheet.-
Methods inherited from class adams.gui.visualization.stats.scatterplot.AbstractScatterPlot
canPaint, clearSelection, finishInit, getCustomSupplyTextMenuItemCaption, getCustomTextFileFilter, getData, getSelection, getXIntIndex, getYIntIndex, isSelectionEnabled, processTipText, removeOverlays, setData, setSelectionEnabled, setXIntIndex, setYIntIndex, supplyText, toSpreadSheet
-
Methods inherited from class adams.gui.visualization.core.PaintablePanel
addPaintlet, canHandleFixedLabels, check, paint, painted, paintlets, performUpdate, postUpdate, printAll, removePaintlet, update
-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
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, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, 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, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, 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, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, 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, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
m_XIndexReg
protected BaseRegExp m_XIndexReg
Regular expression given as an option to choose x attribute
-
m_XIndex
protected Index m_XIndex
Index object given as an option to choose x object
-
m_YIndexReg
protected BaseRegExp m_YIndexReg
regular expression given as an option to choose y attribute
-
m_YIndex
protected Index m_YIndex
Index given as an option to choose y attribute
-
m_ColorIndexReg
protected BaseRegExp m_ColorIndexReg
regular expression given as an option to choose color attribute
-
m_ColorIndex
protected Index m_ColorIndex
Index given as an option to choose color attribute
-
m_ColorIntIndex
protected int m_ColorIntIndex
the index of the color attribute.
-
m_ComboBoxY
protected BaseComboBox<String> m_ComboBoxY
For choosing attribute to display on x axis
-
m_ComboBoxX
protected BaseComboBox<String> m_ComboBoxX
For choosing attribute to display on y axis
-
m_ComboBoxColor
protected BaseComboBox<String> m_ComboBoxColor
For choosing attribute to use for color.
-
m_ModelX
protected DefaultComboBoxModel<String> m_ModelX
Model for the comboBox choosing the x attribute to display
-
m_ModelY
protected DefaultComboBoxModel<String> m_ModelY
Model for the comboBox choosing the y attribute to display
-
m_ModelColor
protected DefaultComboBoxModel<String> m_ModelColor
Model for the comboBox choosing the color attribute to display
-
m_PanelOverlay
protected GenericArrayEditorPanel m_PanelOverlay
for displaying a genericarrayEditor for choosing overlays
-
m_PanelPaintlet
protected GenericObjectEditorPanel m_PanelPaintlet
for displaying a genericobjecteditor for choosing paintlet
-
m_DefaultOverlays
protected AbstractScatterPlotOverlay[] m_DefaultOverlays
default object for the GAE
-
m_DefaultPaintlet
protected AbstractScatterPlotPaintlet m_DefaultPaintlet
default paintlet for GOEpanel
-
m_MouseClickAction
protected MouseClickAction m_MouseClickAction
the mouse click action.
-
m_FileChooser
protected SpreadSheetFileChooser m_FileChooser
the file chooser for saving a specific sequence.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractScatterPlot
-
getPlot
public PlotPanel getPlot()
Returns the plot.- Overrides:
getPlot
in classAbstractScatterPlot
- Returns:
- the plot
-
reset
public void reset()
Called by the class that creates this scatterplot called after fields have been set
-
changeOverlay
protected void changeOverlay()
called when new overlays have been chosen
-
changePaintlet
protected void changePaintlet()
Called when the paintlet used has been changed
-
getXIndex
public Index getXIndex()
Get the index object for choosing the attribute to display.- Returns:
- chosen index
-
setXIndex
public void setXIndex(Index val)
Set the x attribute index.- Parameters:
val
- chosen index
-
setXRegExp
public void setXRegExp(BaseRegExp val)
Set the regular expression to use when determining the x attribute.- Parameters:
val
- regular expression for choosing x attribute
-
getXRegExp
public BaseRegExp getXRegExp()
Gets the regular expression used when determining the x attribute.- Returns:
- regular expression for choosing x attribute
-
getYIndex
public Index getYIndex()
Get the index object for choosing the y attribute.- Returns:
- chosen index
-
setYIndex
public void setYIndex(Index val)
Set the index for the y attribute.- Parameters:
val
- chosen y index
-
setYRegExp
public void setYRegExp(BaseRegExp val)
Set the regular expression to use when determining the y attribute.- Parameters:
val
- regular expression for choosing y attribute
-
getYRegExp
public BaseRegExp getYRegExp()
Gets the regular expression used when determining the y attribute.- Returns:
- regular expression for choosing y attribute
-
getColorIndex
public Index getColorIndex()
Get the index object for choosing the color attribute.- Returns:
- chosen index
-
setColorIndex
public void setColorIndex(Index val)
Set the index for the color attribute.- Parameters:
val
- chosen color index
-
setColorRegExp
public void setColorRegExp(BaseRegExp val)
Set the regular expression to use when determining the color attribute.- Parameters:
val
- regular expression for choosing color attribute
-
getColorRegExp
public BaseRegExp getColorRegExp()
Gets the regular expression used when determining the color attribute.- Returns:
- regular expression for choosing color attribute
-
setOverlays
public void setOverlays(AbstractScatterPlotOverlay[] val)
Set the overlays array containing overlays to apply- Parameters:
val
- Array containing overlays to apply to the scatter plot
-
getOverlays
public AbstractScatterPlotOverlay[] getOverlays()
Get the overlays array containing overlays to apply- Returns:
- Array containing overlays to apply to the scatter plot
-
getPaintlet
public AbstractScatterPlotPaintlet getPaintlet()
Get the paintlet used initially to plot the data- Returns:
- Paintlet used
-
setPaintlet
public void setPaintlet(AbstractScatterPlotPaintlet val)
Set the paintlet to use initially to plot the data- Overrides:
setPaintlet
in classAbstractScatterPlot
- Parameters:
val
- Initial paintlet to use
-
change
public void change()
called when a field has changed, updates all paintlets etc
-
prepareUpdate
public void prepareUpdate()
Updates the overlays, calculates each- Specified by:
prepareUpdate
in classPaintablePanel
-
setMouseClickAction
public void setMouseClickAction(MouseClickAction value)
Sets the mouse click action to use.- Parameters:
value
- the action
-
getMouseClickAction
public MouseClickAction getMouseClickAction()
Returns the mouse click action in use.- Returns:
- the action, null if non set
-
showData
protected void showData()
Displays the data as spreadsheet.
-
save
protected void save(double[] xRange, double[] yRange)
Saves the data as spreadsheet.- Parameters:
xRange
- the optional limits for XyRange
- the optional limits for Y
-
save
protected void save()
Saves all data points to a spreadsheet.
-
saveVisible
protected void saveVisible()
Saves only the visible data points to a spreadsheet.
-
customizePopupMenu
public void customizePopupMenu(MouseEvent e, JPopupMenu menu)
Optional customizing of the menu that is about to be popped up.- Specified by:
customizePopupMenu
in interfacePopupMenuCustomizer<MouseEvent>
- Specified by:
customizePopupMenu
in interfacePopupMenuCustomizer
- Parameters:
e
- The mouse eventmenu
- The menu to customize.
-
-