Package weka.gui.beans
Class BeanInstance
java.lang.Object
weka.gui.beans.BeanInstance
- All Implemented Interfaces:
Serializable
Class that manages a set of beans.
- Since:
- 1.0
- Version:
- $Revision: 10221 $
- Author:
- Mark Hall
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
class variable holding all the beans -
Constructor Summary
ConstructorDescriptionBeanInstance
(JComponent container, Object bean, int x, int y, Integer... tab) Creates a newBeanInstance
instance.BeanInstance
(JComponent container, String beanName, int x, int y, Integer... tab) Creates a newBeanInstance
instance given the fully qualified name of the bean -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addAllBeansToContainer
(JComponent container, Integer... tab) Adds all beans to the supplied componentvoid
addBean
(JComponent container, Integer... tab) Adds this bean to the global list of beans and to the supplied container.static void
addBeanInstances
(Vector<Object> beanInstances, 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
(JComponent container, Vector<Object> beans, int tab) static BeanInstance
findInstance
(Point p, Integer... tab) Looks for a bean (if any) whose bounds contain the supplied pointstatic BeanInstance
findInstance
(String beanName, Integer... tab) Search for a named bean in the indexed flowfindInstances
(Rectangle boundingBox, Integer... tab) Looks for all beans (if any) located within the supplied bounding box.getBean()
Gets the bean encapsulated in this instancegetBeanInstances
(Integer... tab) Return the list of displayed beansint
Gets the height of this beanstatic List<BeanInstance>
getStartPoints
(Integer... tab) Returns a list of start points (if any) in the indexed flowint
getWidth()
Gets the width of this beanint
getX()
Gets the x coordinate of this beanint
getY()
Gets the y coordinate of this beanstatic void
init()
Sets up just a single collection of bean instances in the first element of the list.static void
paintLabels
(Graphics gx, Integer... tab) Renders the textual labels for the beans.static void
removeAllBeansFromContainer
(JComponent container, Integer... tab) Removes all beans from containing componentvoid
removeBean
(JComponent container, Integer... tab) Remove this bean from the list of beans and from the containing componentstatic void
removeBeanInstances
(JComponent container, Integer tab) Remove the vector of bean instances from the supplied index in the list of collections.static void
setBeanInstances
(Vector<Object> beanInstances, JComponent container, 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 beanvoid
setXY
(int newX, int newY) Set the x and y coordinates of this beanvoid
setY
(int newY) Sets the y coordinate of this bean
-
Field Details
-
IDLE
public static final int IDLEclass variable holding all the beans- See Also:
-
BEAN_EXECUTING
public static final int BEAN_EXECUTING- See Also:
-
-
Constructor Details
-
BeanInstance
Creates a newBeanInstance
instance.- Parameters:
container
- aJComponent
to add the bean tobean
- the bean to addx
- the x coordinate of the beany
- the y coordinate of the bean
-
BeanInstance
Creates a newBeanInstance
instance given the fully qualified name of the bean- Parameters:
container
- aJComponent
to add the bean tobeanName
- the fully qualified name of the beanx
- the x coordinate of the beany
- th y coordinate of the bean
-
-
Method Details
-
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
Removes all beans from containing component- Parameters:
container
- aJComponent
value
-
addAllBeansToContainer
Adds all beans to the supplied component- Parameters:
container
- aJComponent
value
-
getBeanInstances
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(Vector<Object> beanInstances, JComponent container, 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
- aVector
valuecontainer
- aJComponent
value
-
addBeanInstances
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 addcontainer
-
-
removeBeanInstances
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
Renders the textual labels for the beans.- Parameters:
gx
- aGraphics
object on which to render the labels
-
getStartPoints
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
Search for a named bean in the indexed flow- Parameters:
beanName
- the name of the bean to look fortab
- varargs integer index of the flow to search in- Returns:
- a matching BeanInstance or null if no match was found
-
findInstance
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
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
Remove this bean from the list of beans and from the containing component- Parameters:
container
- theJComponent
that holds the bean
-
appendBeans
-
addBean
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
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 coordinatenewY
- the y coordinate
-
setX
public void setX(int newX) Sets the x coordinate of this bean- Parameters:
newX
- anint
value
-
setY
public void setY(int newY) Sets the y coordinate of this bean- Parameters:
newY
- anint
value
-