Package 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: 7059 $
- Author:
- Mark Hall
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
BEAN_EXECUTING
static int
IDLE
-
Constructor Summary
Constructors Constructor Description BeanInstance(javax.swing.JComponent container, java.lang.Object bean, int x, int y)
Creates a newBeanInstance
instance.BeanInstance(javax.swing.JComponent container, java.lang.String beanName, int x, int y)
Creates a newBeanInstance
instance given the fully qualified name of the bean
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addAllBeansToContainer(javax.swing.JComponent container)
Adds all beans to the supplied componentvoid
addBean(javax.swing.JComponent container)
Adds this bean to the global list of beans and to the supplied container.static BeanInstance
findInstance(java.awt.Point p)
Looks for a bean (if any) whose bounds contain the supplied pointstatic java.util.Vector
findInstances(java.awt.Rectangle boundingBox)
Looks for all beans (if any) located within the supplied bounding box.java.lang.Object
getBean()
Gets the bean encapsulated in this instancestatic java.util.Vector
getBeanInstances()
Return the list of displayed beansint
getHeight()
Gets the height of this beanint
getWidth()
Gets the width of this beanint
getX()
Gets the x coordinate of this beanint
getY()
Gets the y coordinate of this beanstatic void
paintLabels(java.awt.Graphics gx)
Renders the textual labels for the beans.static void
removeAllBeansFromContainer(javax.swing.JComponent container)
Removes all beans from containing componentvoid
removeBean(javax.swing.JComponent container)
Remove this bean from the list of beans and from the containing componentstatic void
reset(javax.swing.JComponent container)
Reset the list of beansstatic void
setBeanInstances(java.util.Vector beanInstances, javax.swing.JComponent container)
DescribesetBeanInstances
method here.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 Detail
-
IDLE
public static final int IDLE
- 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)
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
public BeanInstance(javax.swing.JComponent container, java.lang.String beanName, int x, int y)
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 Detail
-
reset
public static void reset(javax.swing.JComponent container)
Reset the list of beans
-
removeAllBeansFromContainer
public static void removeAllBeansFromContainer(javax.swing.JComponent container)
Removes all beans from containing component- Parameters:
container
- aJComponent
value
-
addAllBeansToContainer
public static void addAllBeansToContainer(javax.swing.JComponent container)
Adds all beans to the supplied component- Parameters:
container
- aJComponent
value
-
getBeanInstances
public static java.util.Vector getBeanInstances()
Return the list of displayed beans- Returns:
- a vector of beans
-
setBeanInstances
public static void setBeanInstances(java.util.Vector beanInstances, javax.swing.JComponent container)
DescribesetBeanInstances
method here.- Parameters:
beanInstances
- aVector
valuecontainer
- aJComponent
value
-
paintLabels
public static void paintLabels(java.awt.Graphics gx)
Renders the textual labels for the beans.- Parameters:
gx
- aGraphics
object on which to render the labels
-
findInstance
public static BeanInstance findInstance(java.awt.Point p)
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 findInstances(java.awt.Rectangle boundingBox)
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)
Remove this bean from the list of beans and from the containing component- Parameters:
container
- theJComponent
that holds the bean
-
addBean
public void addBean(javax.swing.JComponent container)
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 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
-
-