weka.gui.visualize
Class AttributePanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JScrollPane
                  extended byweka.gui.visualize.AttributePanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.ScrollPaneConstants, java.io.Serializable

public class AttributePanel
extends javax.swing.JScrollPane

This panel displays one dimensional views of the attributes in a dataset. Colouring is done on the basis of a column in the dataset or an auxiliary array (useful for colouring cluster predictions).

Version:
$Revision: 1.9 $
Author:
Malcolm Ware (mfw4@cs.waikato.ac.nz), Mark Hall (mhall@cs.waikato.ac.nz)
See Also:
Serialized Form

Nested Class Summary
protected  class AttributePanel.AttributeSpacing
          inner inner class used for plotting the points into a bar for a particular attribute.
 
Nested classes inherited from class javax.swing.JScrollPane
javax.swing.JScrollPane.AccessibleJScrollPane, javax.swing.JScrollPane.ScrollBar
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.awt.Color m_barColour
          The default colour to use for the background of the bars if a colour is not defined in Visualize.props
protected  int m_cIndex
           
protected  FastVector m_colorList
          The colour map to use for colouring points
protected  java.awt.Color[] m_DefaultColors
          default colours for colouring discrete class
protected  int[] m_heights
          Holds the random height for each instance.
protected  FastVector m_Listeners
          The list of things listening to this panel
protected  double m_maxC
          Holds the min and max values of the colouring attributes
protected  double m_minC
           
protected  Instances m_plotInstances
          The instances to be plotted
protected  javax.swing.JPanel m_span
          The container window for the attribute bars, and also where the X,Y or B get printed.
protected  int m_xIndex
           
protected  int m_yIndex
           
 
Fields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
 
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.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AttributePanel()
          This constructs an attributePanel.
 
Method Summary
 void addAttributePanelListener(AttributePanelListener a)
          Add a listener to the list of things listening to this panel
private  void extendColourMap()
          Adds more colours to the colour list
static void main(java.lang.String[] args)
          Main method for testing this class.
 void setCindex(int c)
          Set the index of the attribute by which to colour the data.
 void setCindex(int c, double h, double l)
          Set the index of the attribute by which to colour the data.
 void setColours(FastVector cols)
          Sets a list of colours to use for colouring data points
 void setInstances(Instances ins)
          This sets the instances to be drawn into the attribute panel
private  void setProperties()
          Set the properties for the AttributePanel
 void setX(int x)
          shows which bar is the current x attribute.
 void setY(int y)
          shows which bar is the current y attribute.
 
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, 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
 

Field Detail

m_plotInstances

protected Instances m_plotInstances
The instances to be plotted


m_maxC

protected double m_maxC
Holds the min and max values of the colouring attributes


m_minC

protected double m_minC

m_cIndex

protected int m_cIndex

m_xIndex

protected int m_xIndex

m_yIndex

protected int m_yIndex

m_colorList

protected FastVector m_colorList
The colour map to use for colouring points


m_DefaultColors

protected java.awt.Color[] m_DefaultColors
default colours for colouring discrete class


m_Listeners

protected FastVector m_Listeners
The list of things listening to this panel


m_heights

protected int[] m_heights
Holds the random height for each instance.


m_span

protected javax.swing.JPanel m_span
The container window for the attribute bars, and also where the X,Y or B get printed.


m_barColour

protected java.awt.Color m_barColour
The default colour to use for the background of the bars if a colour is not defined in Visualize.props

Constructor Detail

AttributePanel

public AttributePanel()
This constructs an attributePanel.

Method Detail

setProperties

private void setProperties()
Set the properties for the AttributePanel


addAttributePanelListener

public void addAttributePanelListener(AttributePanelListener a)
Add a listener to the list of things listening to this panel

Parameters:
a - the listener to notify when attribute bars are clicked on

setCindex

public void setCindex(int c,
                      double h,
                      double l)
Set the index of the attribute by which to colour the data. Updates the number of entries in the colour list if there are more values for this new attribute than previous ones.

Parameters:
c - the index of the attribute to colour on
h - maximum value of this attribute
l - minimum value of this attribute

setCindex

public void setCindex(int c)
Set the index of the attribute by which to colour the data. Updates the number of entries in the colour list if there are more values for this new attribute than previous ones.

Parameters:
c - the index of the attribute to colour on

extendColourMap

private void extendColourMap()
Adds more colours to the colour list


setColours

public void setColours(FastVector cols)
Sets a list of colours to use for colouring data points

Parameters:
cols - a list of java.awt.Color

setInstances

public void setInstances(Instances ins)
                  throws java.lang.Exception
This sets the instances to be drawn into the attribute panel

Parameters:
ins - The instances.
Throws:
java.lang.Exception

setX

public void setX(int x)
shows which bar is the current x attribute.

Parameters:
x - The attributes index.

setY

public void setY(int y)
shows which bar is the current y attribute.

Parameters:
y - The attributes index.

main

public static void main(java.lang.String[] args)
Main method for testing this class.

Parameters:
args - first argument should be an arff file. Second argument can be an optional class col