Class BeanVisual

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class BeanVisual extends JPanel
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: 13476 $
Author:
Mark Hall
See Also:
  • Field Details

  • Constructor Details

    • BeanVisual

      public BeanVisual(String visualName, String iconPath, String animatedIconPath)
      Constructor
      Parameters:
      visualName - name for the bean
      iconPath - path to the icon file
      animatedIconPath - path to the animated icon file
  • Method Details

    • scale

      public void scale(int factor)
      Reduce this BeanVisual's icon size by the given factor
      Parameters:
      factor - the factor by which to reduce the icon size by
    • scale

      public Image scale(double percent)
    • loadIcons

      public boolean loadIcons(String iconPath, 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(String text)
      Set the label for the visual. Informs any property change listeners
      Parameters:
      text - the label
    • getText

      public String getText()
      Get the visual's label
      Returns:
      a String value
    • setStatic

      @Deprecated public void setStatic()
      Deprecated.
      Set the static version of the icon. This method has been deprecated and now has no affect. A future version of the KnowledgeFlow application may orchestrate the display of which components are active graphically
    • setAnimated

      @Deprecated public void setAnimated()
      Deprecated.
      Set the animated version of the icon This method has been deprecated and now has no affect. A future version of the KnowledgeFlow application may orchestrate the display of which components are active graphically
    • getClosestConnectorPoint

      public Point getClosestConnectorPoint(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 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 ImageIcon getStaticIcon()
      Returns the static icon
      Returns:
      an ImageIcon value
    • getAnimatedIcon

      public ImageIcon getAnimatedIcon()
      Returns the animated icon
      Returns:
      an ImageIcon value
    • getIconPath

      public String getIconPath()
      returns the path for the icon
      Returns:
      the path for the icon
    • getAnimatedIconPath

      public String getAnimatedIconPath()
      returns the path for the animated icon
      Returns:
      the path for the animated icon
    • setDisplayConnectors

      public void setDisplayConnectors(boolean dc)
      Turn on/off the connector points
      Parameters:
      dc - a boolean value
    • setDisplayConnectors

      public void setDisplayConnectors(boolean dc, Color c)
      Turn on/off the connector points
      Parameters:
      dc - a boolean value
      c - the Color to use
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener pcl)
      Add a listener for property change events
      Overrides:
      addPropertyChangeListener in class Container
      Parameters:
      pcl - a PropertyChangeListener value
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener pcl)
      Remove a property change listener
      Overrides:
      removePropertyChangeListener in class Component
      Parameters:
      pcl - a PropertyChangeListener value
    • paintComponent

      public void paintComponent(Graphics gx)