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 classScatterPlot.AttColorListenerListener for when the color attribute BaseComboBox selection changesprotected classScatterPlot.AttXListenerListener for when the x attribute BaseComboBox selection changes.protected classScatterPlot.AttYListenerListener 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 Indexm_ColorIndexIndex given as an option to choose color attributeprotected BaseRegExpm_ColorIndexRegregular expression given as an option to choose color attributeprotected intm_ColorIntIndexthe index of the color attribute.protected BaseComboBox<String>m_ComboBoxColorFor choosing attribute to use for color.protected BaseComboBox<String>m_ComboBoxXFor choosing attribute to display on y axisprotected BaseComboBox<String>m_ComboBoxYFor choosing attribute to display on x axisprotected AbstractScatterPlotOverlay[]m_DefaultOverlaysdefault object for the GAEprotected AbstractScatterPlotPaintletm_DefaultPaintletdefault paintlet for GOEpanelprotected SpreadSheetFileChooserm_FileChooserthe file chooser for saving a specific sequence.protected DefaultComboBoxModel<String>m_ModelColorModel for the comboBox choosing the color attribute to displayprotected DefaultComboBoxModel<String>m_ModelXModel for the comboBox choosing the x attribute to displayprotected DefaultComboBoxModel<String>m_ModelYModel for the comboBox choosing the y attribute to displayprotected MouseClickActionm_MouseClickActionthe mouse click action.protected GenericArrayEditorPanelm_PanelOverlayfor displaying a genericarrayEditor for choosing overlaysprotected GenericObjectEditorPanelm_PanelPaintletfor displaying a genericobjecteditor for choosing paintletprotected Indexm_XIndexIndex object given as an option to choose x objectprotected BaseRegExpm_XIndexRegRegular expression given as an option to choose x attributeprotected Indexm_YIndexIndex given as an option to choose y attributeprotected BaseRegExpm_YIndexRegregular 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 voidchange()called when a field has changed, updates all paintlets etcprotected voidchangeOverlay()called when new overlays have been chosenprotected voidchangePaintlet()Called when the paintlet used has been changedvoidcustomizePopupMenu(MouseEvent e, JPopupMenu menu)Optional customizing of the menu that is about to be popped up.IndexgetColorIndex()Get the index object for choosing the color attribute.BaseRegExpgetColorRegExp()Gets the regular expression used when determining the color attribute.MouseClickActiongetMouseClickAction()Returns the mouse click action in use.AbstractScatterPlotOverlay[]getOverlays()Get the overlays array containing overlays to applyAbstractScatterPlotPaintletgetPaintlet()Get the paintlet used initially to plot the dataPlotPanelgetPlot()Returns the plot.IndexgetXIndex()Get the index object for choosing the attribute to display.BaseRegExpgetXRegExp()Gets the regular expression used when determining the x attribute.IndexgetYIndex()Get the index object for choosing the y attribute.BaseRegExpgetYRegExp()Gets the regular expression used when determining the y attribute.protected voidinitGUI()Initializes the widgets.protected voidinitialize()Initializes the members.voidprepareUpdate()Updates the overlays, calculates eachvoidreset()Called by the class that creates this scatterplot called after fields have been setprotected voidsave()Saves all data points to a spreadsheet.protected voidsave(double[] xRange, double[] yRange)Saves the data as spreadsheet.protected voidsaveVisible()Saves only the visible data points to a spreadsheet.voidsetColorIndex(Index val)Set the index for the color attribute.voidsetColorRegExp(BaseRegExp val)Set the regular expression to use when determining the color attribute.voidsetMouseClickAction(MouseClickAction value)Sets the mouse click action to use.voidsetOverlays(AbstractScatterPlotOverlay[] val)Set the overlays array containing overlays to applyvoidsetPaintlet(AbstractScatterPlotPaintlet val)Set the paintlet to use initially to plot the datavoidsetXIndex(Index val)Set the x attribute index.voidsetXRegExp(BaseRegExp val)Set the regular expression to use when determining the x attribute.voidsetYIndex(Index val)Set the index for the y attribute.voidsetYRegExp(BaseRegExp val)Set the regular expression to use when determining the y attribute.protected voidshowData()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:
initializein classAbstractScatterPlot
-
getPlot
public PlotPanel getPlot()
Returns the plot.- Overrides:
getPlotin 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:
setPaintletin 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:
prepareUpdatein 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:
customizePopupMenuin interfacePopupMenuCustomizer<MouseEvent>- Specified by:
customizePopupMenuin interfacePopupMenuCustomizer- Parameters:
e- The mouse eventmenu- The menu to customize.
-
-