weka.gui.beans

## Class BeanInstance

- java.lang.Object
- - weka.gui.beans.BeanInstance

- All Implemented Interfaces:
    java.io.Serializable

      public class BeanInstance
      extends java.lang.Object
      implements java.io.Serializable

  Class that manages a set of beans.
  Since:
    1.0
  Version:
    $Revision: 10221 $
  Author:
    Mark Hall
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `BEAN_EXECUTING`
    `static int` | `IDLE` class variable holding all the beans

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BeanInstance(javax.swing.JComponent container, java.lang.Object bean, int x, int y, java.lang.Integer... tab)` Creates a new `BeanInstance` instance.
    `BeanInstance(javax.swing.JComponent container, java.lang.String beanName, int x, int y, java.lang.Integer... tab)` Creates a new `BeanInstance` instance given the fully qualified name of the bean

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addAllBeansToContainer(javax.swing.JComponent container, java.lang.Integer... tab)` Adds all beans to the supplied component
    `void` | `addBean(javax.swing.JComponent container, java.lang.Integer... tab)` Adds this bean to the global list of beans and to the supplied container.
    `static void` | `addBeanInstances(java.util.Vector<java.lang.Object> beanInstances, javax.swing.JComponent container)` Adds the supplied collection of beans to the end of the list of collections and to the JComponent container (if not null)
    `static void` | `appendBeans(javax.swing.JComponent container, java.util.Vector<java.lang.Object> beans, int tab)`
    `static BeanInstance` | `findInstance(java.awt.Point p, java.lang.Integer... tab)` Looks for a bean (if any) whose bounds contain the supplied point
    `static BeanInstance` | `findInstance(java.lang.String beanName, java.lang.Integer... tab)` Search for a named bean in the indexed flow
    `static java.util.Vector<java.lang.Object>` | `findInstances(java.awt.Rectangle boundingBox, java.lang.Integer... tab)` Looks for all beans (if any) located within the supplied bounding box.
    `java.lang.Object` | `getBean()` Gets the bean encapsulated in this instance
    `static java.util.Vector<java.lang.Object>` | `getBeanInstances(java.lang.Integer... tab)` Return the list of displayed beans
    `int` | `getHeight()` Gets the height of this bean
    `static java.util.List<BeanInstance>` | `getStartPoints(java.lang.Integer... tab)` Returns a list of start points (if any) in the indexed flow
    `int` | `getWidth()` Gets the width of this bean
    `int` | `getX()` Gets the x coordinate of this bean
    `int` | `getY()` Gets the y coordinate of this bean
    `static void` | `init()` Sets up just a single collection of bean instances in the first element of the list.
    `static void` | `paintLabels(java.awt.Graphics gx, java.lang.Integer... tab)` Renders the textual labels for the beans.
    `static void` | `removeAllBeansFromContainer(javax.swing.JComponent container, java.lang.Integer... tab)` Removes all beans from containing component
    `void` | `removeBean(javax.swing.JComponent container, java.lang.Integer... tab)` Remove this bean from the list of beans and from the containing component
    `static void` | `removeBeanInstances(javax.swing.JComponent container, java.lang.Integer tab)` Remove the vector of bean instances from the supplied index in the list of collections.
    `static void` | `setBeanInstances(java.util.Vector<java.lang.Object> beanInstances, javax.swing.JComponent container, java.lang.Integer... tab)` Adds the supplied collection of beans at the supplied index in the list of collections.
    `void` | `setX(int newX)` Sets the x coordinate of this bean
    `void` | `setXY(int newX, int newY)` Set the x and y coordinates of this bean
    `void` | `setY(int newY)` Sets the y coordinate of this bean

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### IDLE

          public static final int IDLE

      class variable holding all the beans
      See Also:
        Constant Field Values

    - #### BEAN_EXECUTING

          public static final int BEAN_EXECUTING

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### BeanInstance

          public BeanInstance(javax.swing.JComponent container,
                              java.lang.Object bean,
                              int x,
                              int y,
                              java.lang.Integer... tab)

      Creates a new `BeanInstance` instance.
      Parameters:
        `container` - a `JComponent` to add the bean to
        `bean` - the bean to add
        `x` - the x coordinate of the bean
        `y` - the y coordinate of the bean

    - #### BeanInstance

          public BeanInstance(javax.swing.JComponent container,
                              java.lang.String beanName,
                              int x,
                              int y,
                              java.lang.Integer... tab)

      Creates a new `BeanInstance` instance given the fully qualified name of the bean
      Parameters:
        `container` - a `JComponent` to add the bean to
        `beanName` - the fully qualified name of the bean
        `x` - the x coordinate of the bean
        `y` - th y coordinate of the bean

  - ### Method Detail

    - #### init

          public static void init()

      Sets up just a single collection of bean instances in the first element of the list. This is useful for clients that are using XMLBeans to load beans.

    - #### removeAllBeansFromContainer

          public static void removeAllBeansFromContainer(javax.swing.JComponent container,
                                                         java.lang.Integer... tab)

      Removes all beans from containing component
      Parameters:
        `container` - a `JComponent` value

    - #### addAllBeansToContainer

          public static void addAllBeansToContainer(javax.swing.JComponent container,
                                                    java.lang.Integer... tab)

      Adds all beans to the supplied component
      Parameters:
        `container` - a `JComponent` value

    - #### getBeanInstances

          public static java.util.Vector<java.lang.Object> getBeanInstances(java.lang.Integer... tab)

      Return the list of displayed beans
      Parameters:
        `tab` - varargs parameter specifying the index of the collection of beans to return - if omitted then the first (i.e. primary) collection of beans is returned
      Returns:
        a vector of beans

    - #### setBeanInstances

          public static void setBeanInstances(java.util.Vector<java.lang.Object> beanInstances,
                                              javax.swing.JComponent container,
                                              java.lang.Integer... tab)

      Adds the supplied collection of beans at the supplied index in the list of collections. If the index is not supplied then the primary collection is set (i.e. index 0). Also adds the beans to the supplied JComponent container (if not null)
      Parameters:
        `beanInstances` - a `Vector` value
        `container` - a `JComponent` value

    - #### addBeanInstances

          public static void addBeanInstances(java.util.Vector<java.lang.Object> beanInstances,
                                              javax.swing.JComponent container)

      Adds the supplied collection of beans to the end of the list of collections and to the JComponent container (if not null)
      Parameters:
        `beanInstances` - the vector of bean instances to add
        `container` -

    - #### removeBeanInstances

          public static void removeBeanInstances(javax.swing.JComponent container,
                                                 java.lang.Integer tab)

      Remove the vector of bean instances from the supplied index in the list of collections.
      Parameters:
        `tab` - the index of the vector of beans to remove.

    - #### paintLabels

          public static void paintLabels(java.awt.Graphics gx,
                                         java.lang.Integer... tab)

      Renders the textual labels for the beans.
      Parameters:
        `gx` - a `Graphics` object on which to render the labels

    - #### getStartPoints

          public static java.util.List<BeanInstance> getStartPoints(java.lang.Integer... tab)

      Returns a list of start points (if any) in the indexed flow
      Parameters:
        `tab` - varargs integer index of the flow to search for start points. Defaults to 0 if not supplied.
      Returns:
        a list of BeanInstances who's beans implement Startable

    - #### findInstance

          public static BeanInstance findInstance(java.lang.String beanName,
                                                  java.lang.Integer... tab)

      Search for a named bean in the indexed flow
      Parameters:
        `beanName` - the name of the bean to look for
        `tab` - varargs integer index of the flow to search in
      Returns:
        a matching BeanInstance or null if no match was found

    - #### findInstance

          public static BeanInstance findInstance(java.awt.Point p,
                                                  java.lang.Integer... tab)

      Looks for a bean (if any) whose bounds contain the supplied point
      Parameters:
        `p` - a point
      Returns:
        a bean that contains the supplied point or null if no bean contains the point

    - #### findInstances

          public static java.util.Vector<java.lang.Object> findInstances(java.awt.Rectangle boundingBox,
                                                                         java.lang.Integer... tab)

      Looks for all beans (if any) located within the supplied bounding box. Also adjusts the bounding box to be a tight fit around all contained beans
      Parameters:
        `boundingBox` - the bounding rectangle
      Returns:
        a Vector of BeanInstances

    - #### removeBean

          public void removeBean(javax.swing.JComponent container,
                                 java.lang.Integer... tab)

      Remove this bean from the list of beans and from the containing component
      Parameters:
        `container` - the `JComponent` that holds the bean

    - #### appendBeans

          public static void appendBeans(javax.swing.JComponent container,
                                         java.util.Vector<java.lang.Object> beans,
                                         int tab)

    - #### addBean

          public void addBean(javax.swing.JComponent container,
                              java.lang.Integer... tab)

      Adds this bean to the global list of beans and to the supplied container. The constructor calls this method, so a client should not need to unless they have called removeBean and then wish to have it added again.
      Parameters:
        `container` - the Component on which this BeanInstance will be displayed

    - #### getBean

          public java.lang.Object getBean()

      Gets the bean encapsulated in this instance
      Returns:
        an `Object` value

    - #### getX

          public int getX()

      Gets the x coordinate of this bean
      Returns:
        an `int` value

    - #### getY

          public int getY()

      Gets the y coordinate of this bean
      Returns:
        an `int` value

    - #### getWidth

          public int getWidth()

      Gets the width of this bean
      Returns:
        an `int` value

    - #### getHeight

          public int getHeight()

      Gets the height of this bean
      Returns:
        an `int` value

    - #### setXY

          public void setXY(int newX,
                            int newY)

      Set the x and y coordinates of this bean
      Parameters:
        `newX` - the x coordinate
        `newY` - the y coordinate

    - #### setX

          public void setX(int newX)

      Sets the x coordinate of this bean
      Parameters:
        `newX` - an `int` value

    - #### setY

          public void setY(int newY)

      Sets the y coordinate of this bean
      Parameters:
        `newY` - an `int` value