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: 7059 $
- Author:
- Mark Hall
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBeanInstance(JComponent container, Object bean, int x, int y) Creates a newBeanInstanceinstance.BeanInstance(JComponent container, String beanName, int x, int y) Creates a newBeanInstanceinstance given the fully qualified name of the bean -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddAllBeansToContainer(JComponent container) Adds all beans to the supplied componentvoidaddBean(JComponent container) Adds this bean to the global list of beans and to the supplied container.static BeanInstanceLooks for a bean (if any) whose bounds contain the supplied pointstatic VectorfindInstances(Rectangle boundingBox) Looks for all beans (if any) located within the supplied bounding box.getBean()Gets the bean encapsulated in this instancestatic VectorReturn the list of displayed beansintGets the height of this beanintgetWidth()Gets the width of this beanintgetX()Gets the x coordinate of this beanintgetY()Gets the y coordinate of this beanstatic voidpaintLabels(Graphics gx) Renders the textual labels for the beans.static voidremoveAllBeansFromContainer(JComponent container) Removes all beans from containing componentvoidremoveBean(JComponent container) Remove this bean from the list of beans and from the containing componentstatic voidreset(JComponent container) Reset the list of beansstatic voidsetBeanInstances(Vector beanInstances, JComponent container) DescribesetBeanInstancesmethod here.voidsetX(int newX) Sets the x coordinate of this beanvoidsetXY(int newX, int newY) Set the x and y coordinates of this beanvoidsetY(int newY) Sets the y coordinate of this bean
-
Field Details
-
IDLE
public static final int IDLE- See Also:
-
BEAN_EXECUTING
public static final int BEAN_EXECUTING- See Also:
-
-
Constructor Details
-
BeanInstance
Creates a newBeanInstanceinstance.- Parameters:
container- aJComponentto add the bean tobean- the bean to addx- the x coordinate of the beany- the y coordinate of the bean
-
BeanInstance
Creates a newBeanInstanceinstance given the fully qualified name of the bean- Parameters:
container- aJComponentto 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
-
reset
Reset the list of beans -
removeAllBeansFromContainer
Removes all beans from containing component- Parameters:
container- aJComponentvalue
-
addAllBeansToContainer
Adds all beans to the supplied component- Parameters:
container- aJComponentvalue
-
getBeanInstances
Return the list of displayed beans- Returns:
- a vector of beans
-
setBeanInstances
DescribesetBeanInstancesmethod here.- Parameters:
beanInstances- aVectorvaluecontainer- aJComponentvalue
-
paintLabels
Renders the textual labels for the beans.- Parameters:
gx- aGraphicsobject on which to render the labels
-
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- theJComponentthat holds the bean
-
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
Objectvalue
-
getX
public int getX()Gets the x coordinate of this bean- Returns:
- an
intvalue
-
getY
public int getY()Gets the y coordinate of this bean- Returns:
- an
intvalue
-
getWidth
public int getWidth()Gets the width of this bean- Returns:
- an
intvalue
-
getHeight
public int getHeight()Gets the height of this bean- Returns:
- an
intvalue
-
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- anintvalue
-
setY
public void setY(int newY) Sets the y coordinate of this bean- Parameters:
newY- anintvalue
-