adams.gui.visualization.instance
Class InstancePanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by adams.gui.core.BasePanel
                      extended by adams.gui.visualization.core.PaintablePanel
                          extended by adams.gui.visualization.container.DataContainerPanel<T,M>
                              extended by adams.gui.visualization.container.DataContainerPanelWithSidePanel<Instance,InstanceContainerManager>
                                  extended by adams.gui.visualization.instance.InstancePanel
All Implemented Interfaces:
CleanUpHandler, StatusMessageHandler, DatabaseConnectionHandler, DatabaseConnectionProvider, DatabaseConnectionChangeListener, DataChangeListener, PaintListener, ScriptingEngineHandler, SendToActionSupporter, ContainerListManager<InstanceContainerManager>, ContainerListPopupMenuSupplier<InstanceContainerManager,InstanceContainer>, TipTextCustomizer, PopupMenuCustomizer, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class InstancePanel
extends DataContainerPanelWithSidePanel<Instance,InstanceContainerManager>
implements PaintListener, ContainerListPopupMenuSupplier<InstanceContainerManager,InstanceContainer>, PopupMenuCustomizer, TipTextCustomizer

A panel for displaying instances.

Version:
$Revision: 4926 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
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
protected  boolean m_AdjustToVisibleData
          whether to adjust to visible data or not.
protected  CoordinatesPaintlet m_CoordinatesPaintlet
          paintlet for drawing the X-axis.
protected  InstanceContainerList m_InstanceContainerList
          the instance ID list.
protected  InstanceLinePaintlet m_InstancePaintlet
          paintlet for drawing the graph.
protected  InstancePointHitDetector m_InstancePointHitDetector
          the hit detector for the tooltip.
protected  InstanceZoomOverviewPanel m_PanelZoomOverview
          the zoom overview panel.
protected  int m_ToolTipMaxColumns
          the maximum number of columns for the tooltip.
protected  Undo m_Undo
          the undo manager.
 
Fields inherited from class adams.gui.visualization.container.DataContainerPanelWithSidePanel
m_FirstRevalidate, m_SidePanel, m_SplitPane
 
Fields inherited from class adams.gui.visualization.container.DataContainerPanel
m_DatabaseConnection, m_DataChangeListeners, m_Manager, m_PanelProperties, m_PlotPanel, m_PlotWrapperPanel, m_StatusMessageHandler, m_Title
 
Fields inherited from class adams.gui.visualization.core.PaintablePanel
m_Paintlets
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
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
InstancePanel()
          Initializes the panel.
InstancePanel(String title)
          Initializes the panel.
 
Method Summary
protected  boolean canPaint(Graphics g)
          Returns true if the paintlets can be executed.
 void cleanUp()
          Cleans up data structures, frees up memory.
 void customizePopupMenu(MouseEvent e, JPopupMenu menu)
          Optional customizing of the menu that is about to be popped up.
 boolean getAdjustToVisibleData()
          Returns whether the display is adjusted to only the visible spectrums or all of them.
 JPopupMenu getContainerListPopupMenu(ContainerTable<InstanceContainerManager,InstanceContainer> table, int row)
          Returns a popup menu for the table of the spectrum list.
 InstanceLinePaintlet getContainerPaintlet()
          Returns the paintlet used for painting the containers.
protected  AbstractDatabaseConnection getDefaultDatabaseConnection()
          Returns the default database connection.
 InstanceContainerList getInstanceContainerList()
          Returns the panel with the instance list.
 InstanceLinePaintlet getInstancePaintlet()
          Returns the paintlet for painting the instance.
 weka.core.Instances getInstances()
          Returns the currently visible instances.
 AbstractScriptingEngine getScriptingEngine()
          Returns the current scripting engine, can be null.
 ContainerManager getSequenceManager()
          Returns the current container manager.
 Undo getUndo()
          Returns the current undo manager, can be null.
protected  void initGUI()
          Initializes the GUI.
protected  void initialize()
          Initializes the members.
 boolean isUndoSupported()
          Returns whether an Undo manager is currently available.
 boolean isZoomOverviewPanelVisible()
          Returns whether the zoom overview panel is visible or not.
protected  InstanceContainerManager newContainerManager()
          Returns the container manager to use.
protected  void postUpdate()
          Hook method, called after the update was performed.
 void prepareUpdate()
          Updates the axes with the min/max of the new data.
 String processTipText(PlotPanel panel, Point mouse, String tiptext)
          Processes the given tip text.
 void setAdjustToVisibleData(boolean value)
          Sets whether the display is adjusted to only the visible data or everything currently loaded.
 void setUndo(Undo value)
          Sets the undo manager to use, can be null if no undo-support wanted.
 void setZoomOverviewPanelVisible(boolean value)
          Sets the zoom overview panel visible or hides it.
 
Methods inherited from class adams.gui.visualization.container.DataContainerPanelWithSidePanel
getDividerLocation, getSidePanel, isSidePanelVisible, revalidate, setDividerLocation, setDividerLocation, setSidePanelVisible
 
Methods inherited from class adams.gui.visualization.container.DataContainerPanel
databaseConnectionStateChanged, dataChanged, finishInit, getBackgroundColor, getContainerManager, getDatabaseConnection, getForegroundColor, getPlot, getProperties, getSendToClasses, getSendToItem, getStatusMessageHandler, getTitle, hasSendToItem, reset, setBackgroundColor, setContainerManager, setDatabaseConnection, setForegroundColor, setStatusMessageHandler, setTitle, showStatus
 
Methods inherited from class adams.gui.visualization.core.PaintablePanel
addPaintlet, paint, painted, paintlets, performUpdate, removePaintlet, update
 
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, main, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, 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, transferFocusBackward, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface adams.gui.event.PaintListener
painted
 

Field Detail

m_InstanceContainerList

protected InstanceContainerList m_InstanceContainerList
the instance ID list.


m_InstancePaintlet

protected InstanceLinePaintlet m_InstancePaintlet
paintlet for drawing the graph.


m_CoordinatesPaintlet

protected CoordinatesPaintlet m_CoordinatesPaintlet
paintlet for drawing the X-axis.


m_Undo

protected Undo m_Undo
the undo manager.


m_AdjustToVisibleData

protected boolean m_AdjustToVisibleData
whether to adjust to visible data or not.


m_InstancePointHitDetector

protected InstancePointHitDetector m_InstancePointHitDetector
the hit detector for the tooltip.


m_ToolTipMaxColumns

protected int m_ToolTipMaxColumns
the maximum number of columns for the tooltip.


m_PanelZoomOverview

protected InstanceZoomOverviewPanel m_PanelZoomOverview
the zoom overview panel.

Constructor Detail

InstancePanel

public InstancePanel()
Initializes the panel.


InstancePanel

public InstancePanel(String title)
Initializes the panel.

Parameters:
title - the title for the panel
Method Detail

initialize

protected void initialize()
Initializes the members.

Overrides:
initialize in class DataContainerPanelWithSidePanel<Instance,InstanceContainerManager>

getDefaultDatabaseConnection

protected AbstractDatabaseConnection getDefaultDatabaseConnection()
Returns the default database connection.

Specified by:
getDefaultDatabaseConnection in class DataContainerPanel<Instance,InstanceContainerManager>
Returns:
the default database connection

newContainerManager

protected InstanceContainerManager newContainerManager()
Returns the container manager to use.

Specified by:
newContainerManager in class DataContainerPanel<Instance,InstanceContainerManager>
Returns:
the container manager

getContainerPaintlet

public InstanceLinePaintlet getContainerPaintlet()
Returns the paintlet used for painting the containers.

Specified by:
getContainerPaintlet in class DataContainerPanel<Instance,InstanceContainerManager>
Returns:
the paintlet

initGUI

protected void initGUI()
Initializes the GUI.

Overrides:
initGUI in class DataContainerPanelWithSidePanel<Instance,InstanceContainerManager>

getSequenceManager

public ContainerManager getSequenceManager()
Returns the current container manager.

Returns:
the manager

setUndo

public void setUndo(Undo value)
Sets the undo manager to use, can be null if no undo-support wanted.

Parameters:
value - the undo manager to use

getUndo

public Undo getUndo()
Returns the current undo manager, can be null.

Returns:
the undo manager, if any

isUndoSupported

public boolean isUndoSupported()
Returns whether an Undo manager is currently available.

Returns:
true if an undo manager is set

canPaint

protected boolean canPaint(Graphics g)
Returns true if the paintlets can be executed.

Specified by:
canPaint in class PaintablePanel
Parameters:
g - the graphics context
Returns:
true if painting can go ahead

prepareUpdate

public void prepareUpdate()
Updates the axes with the min/max of the new data.

Specified by:
prepareUpdate in class PaintablePanel

customizePopupMenu

public void customizePopupMenu(MouseEvent e,
                               JPopupMenu menu)
Optional customizing of the menu that is about to be popped up.

Specified by:
customizePopupMenu in interface PopupMenuCustomizer
Parameters:
e - the mous event
menu - the menu to customize

getContainerListPopupMenu

public JPopupMenu getContainerListPopupMenu(ContainerTable<InstanceContainerManager,InstanceContainer> table,
                                            int row)
Returns a popup menu for the table of the spectrum list.

Specified by:
getContainerListPopupMenu in interface ContainerListPopupMenuSupplier<InstanceContainerManager,InstanceContainer>
Parameters:
table - the affected table
row - the row the mouse is currently over
Returns:
the popup menu

setZoomOverviewPanelVisible

public void setZoomOverviewPanelVisible(boolean value)
Sets the zoom overview panel visible or hides it.

Parameters:
value - if true then the panel is displayed

isZoomOverviewPanelVisible

public boolean isZoomOverviewPanelVisible()
Returns whether the zoom overview panel is visible or not.

Returns:
true if visible

setAdjustToVisibleData

public void setAdjustToVisibleData(boolean value)
Sets whether the display is adjusted to only the visible data or everything currently loaded.

Parameters:
value - if true then plot is adjusted to visible data

getAdjustToVisibleData

public boolean getAdjustToVisibleData()
Returns whether the display is adjusted to only the visible spectrums or all of them.

Returns:
true if the plot is adjusted to only the visible data

getInstancePaintlet

public InstanceLinePaintlet getInstancePaintlet()
Returns the paintlet for painting the instance.

Returns:
the paintlet

getInstanceContainerList

public InstanceContainerList getInstanceContainerList()
Returns the panel with the instance list.

Returns:
the panel

getInstances

public weka.core.Instances getInstances()
Returns the currently visible instances.

Returns:
the instances, null if none visible

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 interface TipTextCustomizer
Parameters:
panel - the content panel that initiated this call
mouse - the mouse position
tiptext - the tiptext so far
Returns:
the processed tiptext

getScriptingEngine

public AbstractScriptingEngine getScriptingEngine()
Returns the current scripting engine, can be null.

Specified by:
getScriptingEngine in interface ScriptingEngineHandler
Specified by:
getScriptingEngine in class DataContainerPanel<Instance,InstanceContainerManager>
Returns:
the current engine

postUpdate

protected void postUpdate()
Hook method, called after the update was performed.

Overrides:
postUpdate in class PaintablePanel

cleanUp

public void cleanUp()
Cleans up data structures, frees up memory.

Specified by:
cleanUp in interface CleanUpHandler
Overrides:
cleanUp in class DataContainerPanel<Instance,InstanceContainerManager>


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.