Class AbstractScatterPlot
- 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
-
- All Implemented Interfaces:
TextSupporter
,SpreadSheetSupporter
,TextSupplier
,PaintListener
,PaintletManager
,TipTextCustomizer
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
- Direct Known Subclasses:
ScatterPlot
,ScatterPlotSimple
public abstract class AbstractScatterPlot extends PaintablePanel implements TipTextCustomizer, SpreadSheetSupporter, TextSupplier
Abstract class for displaying a single scatterplotpanel on a paintable panel.- Author:
- msf8
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
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 SpreadSheet
m_Data
Instances to be plottedprotected AbstractScatterPlotOverlay[]
m_Overlays
Array of overlay optionsprotected AbstractScatterPlotPaintlet
m_Paintlet
Paintlet to display the data points on the scatter plotprotected ScatterPlotPanel
m_Plot
Scatter plot panel to displayprotected List<Point2D.Double>
m_Selection
the selection points collected so far.protected boolean
m_SelectionEnabled
whether selection is enabled.protected int
m_XIntIndex
Index of attribute to be displayed on x axisprotected int
m_YIntIndex
Index of attribute to be displayed on y axis-
Fields inherited from class adams.gui.visualization.core.PaintablePanel
m_Paintlets
-
Fields inherited from class adams.gui.core.BasePanel
m_FileChooser
-
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 AbstractScatterPlot()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canPaint(Graphics g)
Returns true if the paintlets can be executed.void
clearSelection()
Removes any selected points.protected void
finishInit()
Finishes the initialization.String
getCustomSupplyTextMenuItemCaption()
Returns the text for the menu item.ExtensionFileFilter
getCustomTextFileFilter()
Returns a custom file filter for the file chooser.SpreadSheet
getData()
Get the instances being plottedPlotPanel
getPlot()
Returns the plot.List<Point2D.Double>
getSelection()
Returns the currently selected points.int
getXIntIndex()
gets the index of the x attributeint
getYIntIndex()
Sets the index of the y attributeprotected void
initialize()
Initializes the members.boolean
isSelectionEnabled()
Returns whether data points can be selected.String
processTipText(PlotPanel panel, Point mouse, String tiptext)
Processes the given tip text.void
removeOverlays()
Removes all overlays from the scatterplot.void
setData(SpreadSheet data)
Sets the instances to be plottedvoid
setPaintlet(AbstractScatterPlotPaintlet val)
Set the paintlet for dawing the datavoid
setSelectionEnabled(boolean value)
Sets whether data points can be selected.void
setXIntIndex(int value)
Set the index of the attribute to be displayed on the x axisvoid
setYIntIndex(int value)
Set the index of the attribute to be displayed on the y axisString
supplyText()
Supplies the text.SpreadSheet
toSpreadSheet()
Returns the content as spreadsheet.-
Methods inherited from class adams.gui.visualization.core.PaintablePanel
addPaintlet, canHandleFixedLabels, check, paint, painted, paintlets, performUpdate, postUpdate, prepareUpdate, printAll, removePaintlet, update
-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, initGUI, 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_Plot
protected ScatterPlotPanel m_Plot
Scatter plot panel to display
-
m_Data
protected SpreadSheet m_Data
Instances to be plotted
-
m_XIntIndex
protected int m_XIntIndex
Index of attribute to be displayed on x axis
-
m_YIntIndex
protected int m_YIntIndex
Index of attribute to be displayed on y axis
-
m_Paintlet
protected AbstractScatterPlotPaintlet m_Paintlet
Paintlet to display the data points on the scatter plot
-
m_Overlays
protected AbstractScatterPlotOverlay[] m_Overlays
Array of overlay options
-
m_SelectionEnabled
protected boolean m_SelectionEnabled
whether selection is enabled.
-
m_Selection
protected List<Point2D.Double> m_Selection
the selection points collected so far.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classPaintablePanel
-
finishInit
protected void finishInit()
Finishes the initialization.- Overrides:
finishInit
in classBasePanel
-
getPlot
public PlotPanel getPlot()
Returns the plot.- Specified by:
getPlot
in classPaintablePanel
- Returns:
- the plot
-
setPaintlet
public void setPaintlet(AbstractScatterPlotPaintlet val)
Set the paintlet for dawing the data- Parameters:
val
- Paintlet for plotting
-
canPaint
protected boolean canPaint(Graphics g)
Returns true if the paintlets can be executed.- Specified by:
canPaint
in classPaintablePanel
- Parameters:
g
- the graphics context- Returns:
- true if painting can go ahead
-
setData
public void setData(SpreadSheet data)
Sets the instances to be plotted- Parameters:
data
- Instances to be plotted
-
getData
public SpreadSheet getData()
Get the instances being plotted- Returns:
- Instances being plotted
-
getXIntIndex
public int getXIntIndex()
gets the index of the x attribute- Returns:
- index of x attribute
-
getYIntIndex
public int getYIntIndex()
Sets the index of the y attribute- Returns:
- index of y attribute
-
removeOverlays
public void removeOverlays()
Removes all overlays from the scatterplot. Removes the paintlets that do the drawing as well as resetting the array
-
setXIntIndex
public void setXIntIndex(int value)
Set the index of the attribute to be displayed on the x axis- Parameters:
value
- 0-based index of attribute
-
setYIntIndex
public void setYIntIndex(int value)
Set the index of the attribute to be displayed on the y axis- Parameters:
value
- 0-based index of attribute
-
processTipText
public String processTipText(PlotPanel panel, Point mouse, String tiptext)
Processes the given tip text. Among the current mouse position, the panel that initiated the call are also provided.- Specified by:
processTipText
in interfaceTipTextCustomizer
- Parameters:
panel
- the content panel that initiated this callmouse
- the mouse positiontiptext
- the tiptext so far- Returns:
- the processed tiptext
-
toSpreadSheet
public SpreadSheet toSpreadSheet()
Returns the content as spreadsheet.- Specified by:
toSpreadSheet
in interfaceSpreadSheetSupporter
- Returns:
- the content
-
getCustomSupplyTextMenuItemCaption
public String getCustomSupplyTextMenuItemCaption()
Returns the text for the menu item.- Specified by:
getCustomSupplyTextMenuItemCaption
in interfaceTextSupplier
- Returns:
- the menu item text, null for default
-
getCustomTextFileFilter
public ExtensionFileFilter getCustomTextFileFilter()
Returns a custom file filter for the file chooser.- Specified by:
getCustomTextFileFilter
in interfaceTextSupplier
- Returns:
- the file filter, null if to use default one
-
supplyText
public String supplyText()
Supplies the text. May get called even if actor hasn't been executed yet.- Specified by:
supplyText
in interfaceTextSupplier
- Specified by:
supplyText
in interfaceTextSupporter
- Returns:
- the text, null if none available
-
getSelection
public List<Point2D.Double> getSelection()
Returns the currently selected points.- Returns:
- the points
-
clearSelection
public void clearSelection()
Removes any selected points.
-
setSelectionEnabled
public void setSelectionEnabled(boolean value)
Sets whether data points can be selected.- Parameters:
value
- true if can be selected
-
isSelectionEnabled
public boolean isSelectionEnabled()
Returns whether data points can be selected.- Returns:
- true if can be selected
-
-