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
EAST_CONNECTOR-
ICON_PATH-
NORTH_CONNECTOR-
SOUTH_CONNECTOR-
WEST_CONNECTOR-
BeanVisual(String, String, String)
- Constructor
addPropertyChangeListener(PropertyChangeListener)
- Add a listener for property change events
getAnimatedIcon()
- Returns the animated icon
getClosestConnectorPoint(Point)
- Returns the coordinates of the closest "connector" point to the
supplied point.
getConnectorPoint(int)
- Returns the coordinates of the connector point given a compass point
getStaticIcon()
- Returns the static icon
getText()
- Get the visual's label
loadIcons(String, String)
- Loads static and animated versions of a beans icons.
paintComponent(Graphics)
-
removePropertyChangeListener(PropertyChangeListener)
- Remove a property change listener
setAnimated()
- Set the animated version of the icon
setDisplayConnectors(boolean)
- Turn on/off the connector points
setStatic()
- Set the static version of the icon
setText(String)
- Set the label for the visual.
ICON_PATH
public static final java.lang.String ICON_PATH
NORTH_CONNECTOR
public static final int NORTH_CONNECTOR
SOUTH_CONNECTOR
public static final int SOUTH_CONNECTOR
EAST_CONNECTOR
public static final int EAST_CONNECTOR
WEST_CONNECTOR
public static final int WEST_CONNECTOR
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
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
setText
public void setText(java.lang.String text)
Set the label for the visual. Informs any property change listeners
- Parameters:
text - the label
getText
public java.lang.String getText()
Get the visual's label
- Returns:
- a
String value
setStatic
public void setStatic()
Set the static version of the icon
setAnimated
public void setAnimated()
Set the animated version of the icon
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
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
getStaticIcon
public javax.swing.ImageIcon getStaticIcon()
Returns the static icon
- Returns:
- an
ImageIcon value
getAnimatedIcon
public javax.swing.ImageIcon getAnimatedIcon()
Returns the animated icon
- Returns:
- an
ImageIcon value
setDisplayConnectors
public void setDisplayConnectors(boolean dc)
Turn on/off the connector points
- Parameters:
dc - a boolean value
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
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
paintComponent
public void paintComponent(java.awt.Graphics gx)
All Packages Class Hierarchy This Package Previous Next Index WEKA's home