weka.gui.beans
Class KnowledgeFlow

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byweka.gui.beans.KnowledgeFlow
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable

public class KnowledgeFlow
extends javax.swing.JPanel
implements java.beans.PropertyChangeListener

Main GUI class for the KnowledgeFlow

Since:
1.0
Version:
$Revision: 1.15 $
Author:
Mark Hall
See Also:
JPanel, PropertyChangeListener, Serialized Form

Nested Class Summary
protected  class KnowledgeFlow.BeanLayout
          Used for displaying the bean components and their visible connections
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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 static int ADDING
           
private static java.util.Properties BEAN_PROPERTIES
          Contains the editor properties
protected static int CONNECTING
           
protected  java.beans.beancontext.BeanContextSupport m_bcSupport
           
private  KnowledgeFlow.BeanLayout m_beanLayout
          The layout area
private  BeanInstance m_editElement
          Reference to bean being manipulated
protected  javax.swing.JFileChooser m_FileChooser
          The file chooser for selecting layout files
private  javax.swing.JButton m_helpB
           
private  javax.swing.JButton m_loadB
           
protected  LogPanel m_logPanel
           
private  int m_mode
           
private  int m_oldX
          Used to record screen coordinates during move and connect operations
private  int m_oldY
          Used to record screen coordinates during move and connect operations
private  javax.swing.JToggleButton m_pointerB
           
private  javax.swing.JButton m_saveB
           
private  java.beans.EventSetDescriptor m_sourceEventSetDescriptor
          Event set descriptor for the bean being manipulated
private  int m_startX
           
private  int m_startY
           
private  javax.swing.JButton m_stopB
           
private  java.lang.Object m_toolBarBean
          Holds the selected toolbar bean
private  javax.swing.ButtonGroup m_toolBarGroup
          Button group to manage all toolbar buttons
private  javax.swing.JTabbedPane m_toolBars
          Tabbed pane to hold tool bars
protected static int MOVING
           
protected static int NONE
           
protected static java.lang.String PROPERTY_FILE
          Location of the property file for the KnowledgeFlow
private static java.util.Vector TOOLBARS
          Holds the details needed to construct button bars for various supported classes of weka algorithms/tools
 
Fields inherited from class javax.swing.JPanel
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
KnowledgeFlow()
          Creates a new KnowledgeFlow instance.
 
Method Summary
private  void addComponent(int x, int y)
           
private  void connectComponents(java.beans.EventSetDescriptor esd, BeanInstance bi, int x, int y)
          Initiates the connection process for two beans
private  void deleteConnectionPopup(java.util.Vector closestConnections, int x, int y)
          Popup a menu giving choices for connections to delete (if any)
private  void doPopup(java.awt.Point pt, BeanInstance bi, int x, int y)
          Popup a context sensitive menu for the bean component
private  javax.swing.JPanel instantiateToolBarBean(boolean wekawrapper, java.lang.String tempBeanCompName, java.lang.String algName)
          Instantiates a bean for display in the toolbars
private  java.awt.Image loadImage(java.lang.String path)
           
private  void loadLayout()
          Load a pre-saved layout
static void main(java.lang.String[] args)
          Main method.
private  void popupCustomizer(java.lang.Class custClass, javax.swing.JComponent bc)
          Popup the customizer for this bean
private  void popupHelp()
          Pop up a help window
private  void processPackage(javax.swing.JPanel holderPanel, java.lang.String tempBeanCompName, HierarchyPropertyParser hpp)
           
 void propertyChange(java.beans.PropertyChangeEvent e)
          Accept property change events
private  void saveLayout()
          Serialize the layout to a file
private  void setUpToolBars()
          Describe setUpToolBars method here.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, isValidateRoot, 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, 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, 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, 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
 

Field Detail

PROPERTY_FILE

protected static java.lang.String PROPERTY_FILE
Location of the property file for the KnowledgeFlow


BEAN_PROPERTIES

private static java.util.Properties BEAN_PROPERTIES
Contains the editor properties


TOOLBARS

private static java.util.Vector TOOLBARS
Holds the details needed to construct button bars for various supported classes of weka algorithms/tools


NONE

protected static final int NONE
See Also:
Constant Field Values

MOVING

protected static final int MOVING
See Also:
Constant Field Values

CONNECTING

protected static final int CONNECTING
See Also:
Constant Field Values

ADDING

protected static final int ADDING
See Also:
Constant Field Values

m_mode

private int m_mode

m_toolBarGroup

private javax.swing.ButtonGroup m_toolBarGroup
Button group to manage all toolbar buttons


m_toolBarBean

private java.lang.Object m_toolBarBean
Holds the selected toolbar bean


m_beanLayout

private KnowledgeFlow.BeanLayout m_beanLayout
The layout area


m_toolBars

private javax.swing.JTabbedPane m_toolBars
Tabbed pane to hold tool bars


m_pointerB

private javax.swing.JToggleButton m_pointerB

m_saveB

private javax.swing.JButton m_saveB

m_loadB

private javax.swing.JButton m_loadB

m_stopB

private javax.swing.JButton m_stopB

m_helpB

private javax.swing.JButton m_helpB

m_editElement

private BeanInstance m_editElement
Reference to bean being manipulated


m_sourceEventSetDescriptor

private java.beans.EventSetDescriptor m_sourceEventSetDescriptor
Event set descriptor for the bean being manipulated


m_oldX

private int m_oldX
Used to record screen coordinates during move and connect operations


m_oldY

private int m_oldY
Used to record screen coordinates during move and connect operations


m_startX

private int m_startX

m_startY

private int m_startY

m_FileChooser

protected javax.swing.JFileChooser m_FileChooser
The file chooser for selecting layout files


m_logPanel

protected LogPanel m_logPanel

m_bcSupport

protected java.beans.beancontext.BeanContextSupport m_bcSupport
Constructor Detail

KnowledgeFlow

public KnowledgeFlow()
Creates a new KnowledgeFlow instance.

Method Detail

loadImage

private java.awt.Image loadImage(java.lang.String path)

setUpToolBars

private void setUpToolBars()
Describe setUpToolBars method here.


processPackage

private void processPackage(javax.swing.JPanel holderPanel,
                            java.lang.String tempBeanCompName,
                            HierarchyPropertyParser hpp)

instantiateToolBarBean

private javax.swing.JPanel instantiateToolBarBean(boolean wekawrapper,
                                                  java.lang.String tempBeanCompName,
                                                  java.lang.String algName)
Instantiates a bean for display in the toolbars

Parameters:
wekawrapper - true if the bean to be instantiated is a wekawrapper
tempBeanCompName - the name of the bean to instantiate
algName - holds the name of a weka algorithm to configure the bean with if it is a wekawrapper bean
Returns:
a JPanel holding the instantiated (and configured bean)

popupHelp

private void popupHelp()
Pop up a help window


doPopup

private void doPopup(java.awt.Point pt,
                     BeanInstance bi,
                     int x,
                     int y)
Popup a context sensitive menu for the bean component

Parameters:
pt - holds the panel coordinates for the component
bi - the bean component over which the user right clicked the mouse
x - the x coordinate at which to popup the menu
y - the y coordinate at which to popup the menu

popupCustomizer

private void popupCustomizer(java.lang.Class custClass,
                             javax.swing.JComponent bc)
Popup the customizer for this bean

Parameters:
custClass - the class of the customizer
bc - the bean to be customized

deleteConnectionPopup

private void deleteConnectionPopup(java.util.Vector closestConnections,
                                   int x,
                                   int y)
Popup a menu giving choices for connections to delete (if any)

Parameters:
closestConnections - a vector containing 0 or more BeanConnections
x - the x coordinate at which to popup the menu
y - the y coordinate at which to popup the menu

connectComponents

private void connectComponents(java.beans.EventSetDescriptor esd,
                               BeanInstance bi,
                               int x,
                               int y)
Initiates the connection process for two beans

Parameters:
esd - the EventSetDescriptor for the source bean
bi - the source bean
x - the x coordinate to start connecting from
y - the y coordinate to start connecting from

addComponent

private void addComponent(int x,
                          int y)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Accept property change events

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
e - a PropertyChangeEvent value

loadLayout

private void loadLayout()
Load a pre-saved layout


saveLayout

private void saveLayout()
Serialize the layout to a file


main

public static void main(java.lang.String[] args)
Main method.

Parameters:
args - a String[] value