All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.gui.beans.BeanVisual

java.lang.Object
    |
    +----java.awt.Component
            |
            +----java.awt.Container
                    |
                    +----javax.swing.JComponent
                            |
                            +----javax.swing.JPanel
                                    |
                                    +----weka.gui.beans.BeanVisual

public class BeanVisual
extends javax.swing.JPanel
implements java.io.Serializable
BeanVisual encapsulates icons and label for a given bean. Has methods to load icons, set label text and toggle between static and animated versions of a bean's icon.

Since:
1.0
Version:
$Revision: 1.3 $
Author:
Mark Hall
See Also:
javax.swing.JPanel, java.io.Serializable

Variable Index

 o EAST_CONNECTOR
 
 o ICON_PATH
 
 o NORTH_CONNECTOR
 
 o SOUTH_CONNECTOR
 
 o WEST_CONNECTOR
 

Constructor Index

 o BeanVisual(String, String, String)
Constructor

Method Index

 o addPropertyChangeListener(PropertyChangeListener)
Add a listener for property change events
 o getAnimatedIcon()
Returns the animated icon
 o getClosestConnectorPoint(Point)
Returns the coordinates of the closest "connector" point to the supplied point.
 o getConnectorPoint(int)
Returns the coordinates of the connector point given a compass point
 o getStaticIcon()
Returns the static icon
 o getText()
Get the visual's label
 o loadIcons(String, String)
Loads static and animated versions of a beans icons.
 o paintComponent(Graphics)
 
 o removePropertyChangeListener(PropertyChangeListener)
Remove a property change listener
 o setAnimated()
Set the animated version of the icon
 o setDisplayConnectors(boolean)
Turn on/off the connector points
 o setStatic()
Set the static version of the icon
 o setText(String)
Set the label for the visual.

Field Detail

 o ICON_PATH
public static final java.lang.String ICON_PATH
 o NORTH_CONNECTOR
public static final int NORTH_CONNECTOR
 o SOUTH_CONNECTOR
public static final int SOUTH_CONNECTOR
 o EAST_CONNECTOR
public static final int EAST_CONNECTOR
 o WEST_CONNECTOR
public static final int WEST_CONNECTOR

Constructor Detail

 o BeanVisual
public BeanVisual(java.lang.String visualName,
                  java.lang.String iconPath,
                  java.lang.String animatedIconPath)
          Constructor
Parameters:
visualName - name for the bean
iconPath - path to the icon file
animatedIconPath - path to the animated icon file

Method Detail

 o loadIcons
public boolean loadIcons(java.lang.String iconPath,
                         java.lang.String animatedIconPath)
          Loads static and animated versions of a beans icons. These are assumed to be defined in the system resource location (i.e. in the CLASSPATH). If the named icons do not exist, no changes to the visual appearance is made. Since default icons for generic types of beans (eg. DataSource, Classifier etc) are assumed to exist, it allows developers to add custom icons for for specific instantiations of these beans (eg. J48, DiscretizeFilter etc) at their leisure.
Parameters:
iconPath - path to
animatedIconPath - a String value
 o setText
public void setText(java.lang.String text)
          Set the label for the visual. Informs any property change listeners
Parameters:
text - the label
 o getText
public java.lang.String getText()
          Get the visual's label
Returns:
a String value
 o setStatic
public void setStatic()
          Set the static version of the icon
 o setAnimated
public void setAnimated()
          Set the animated version of the icon
 o getClosestConnectorPoint
public java.awt.Point getClosestConnectorPoint(java.awt.Point pt)
          Returns the coordinates of the closest "connector" point to the supplied point. Coordinates are in the parent containers coordinate space.
Parameters:
pt - the reference point
Returns:
the closest connector point
 o getConnectorPoint
public java.awt.Point getConnectorPoint(int compassPoint)
          Returns the coordinates of the connector point given a compass point
Parameters:
compassPoint - a compass point
Returns:
a Point value
 o getStaticIcon
public javax.swing.ImageIcon getStaticIcon()
          Returns the static icon
Returns:
an ImageIcon value
 o getAnimatedIcon
public javax.swing.ImageIcon getAnimatedIcon()
          Returns the animated icon
Returns:
an ImageIcon value
 o setDisplayConnectors
public void setDisplayConnectors(boolean dc)
          Turn on/off the connector points
Parameters:
dc - a boolean value
 o addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Add a listener for property change events
Parameters:
pcl - a PropertyChangeListener value
Overrides:
addPropertyChangeListener in class javax.swing.JComponent
 o removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Remove a property change listener
Parameters:
pcl - a PropertyChangeListener value
Overrides:
removePropertyChangeListener in class javax.swing.JComponent
 o paintComponent
public void paintComponent(java.awt.Graphics gx)

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home