public class BeanInstance extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static int |
BEAN_EXECUTING |
static int |
IDLE
class variable holding all the beans
|
Constructor and Description |
---|
BeanInstance(JComponent container,
Object bean,
int x,
int y,
Integer... tab)
Creates a new
BeanInstance instance. |
BeanInstance(JComponent container,
String beanName,
int x,
int y,
Integer... tab)
Creates a new
BeanInstance instance given the fully
qualified name of the bean |
Modifier and Type | Method and Description |
---|---|
static void |
addAllBeansToContainer(JComponent container,
Integer... tab)
Adds all beans to the supplied component
|
void |
addBean(JComponent container,
Integer... tab)
Adds this bean to the global list of beans and
to the supplied container.
|
static void |
addBeanInstances(Vector 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 beans,
int tab) |
static BeanInstance |
findInstance(Point p,
Integer... tab)
Looks for a bean (if any) whose bounds contain the supplied point
|
static Vector |
findInstances(Rectangle boundingBox,
Integer... tab)
Looks for all beans (if any) located within
the supplied bounding box.
|
Object |
getBean()
Gets the bean encapsulated in this instance
|
static Vector |
getBeanInstances(Integer... tab)
Return the list of displayed beans
|
int |
getHeight()
Gets the height of this bean
|
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(Graphics gx,
Integer... tab)
Renders the textual labels for the beans.
|
static void |
removeAllBeansFromContainer(JComponent container,
Integer... tab)
Removes all beans from containing component
|
void |
removeBean(JComponent container,
Integer... tab)
Remove this bean from the list of beans and from the containing component
|
static 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 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 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
|
public static final int IDLE
public static final int BEAN_EXECUTING
public BeanInstance(JComponent container, Object bean, int x, int y, Integer... tab)
BeanInstance
instance.container
- a JComponent
to add the bean tobean
- the bean to addx
- the x coordinate of the beany
- the y coordinate of the beanpublic BeanInstance(JComponent container, String beanName, int x, int y, Integer... tab)
BeanInstance
instance given the fully
qualified name of the beancontainer
- a JComponent
to add the bean tobeanName
- the fully qualified name of the beanx
- the x coordinate of the beany
- th y coordinate of the beanpublic static void init()
public static void removeAllBeansFromContainer(JComponent container, Integer... tab)
container
- a JComponent
valuepublic static void addAllBeansToContainer(JComponent container, Integer... tab)
container
- a JComponent
valuepublic static Vector getBeanInstances(Integer... tab)
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 returnedpublic static void setBeanInstances(Vector beanInstances, JComponent container, Integer... tab)
beanInstances
- a Vector
valuecontainer
- a JComponent
valuepublic static void addBeanInstances(Vector beanInstances, JComponent container)
beanInstances
- the vector of bean instances to addcontainer
- public static void removeBeanInstances(JComponent container, Integer tab)
tab
- the index of the vector of beans to remove.public static void paintLabels(Graphics gx, Integer... tab)
gx
- a Graphics
object on which to render
the labelspublic static BeanInstance findInstance(Point p, Integer... tab)
p
- a pointpublic static Vector findInstances(Rectangle boundingBox, Integer... tab)
boundingBox
- the bounding rectanglepublic void removeBean(JComponent container, Integer... tab)
container
- the JComponent
that holds the beanpublic static void appendBeans(JComponent container, Vector beans, int tab)
public void addBean(JComponent container, Integer... tab)
container
- the Component on which this
BeanInstance will be displayedpublic Object getBean()
Object
valuepublic int getX()
int
valuepublic int getY()
int
valuepublic int getWidth()
int
valuepublic int getHeight()
int
valuepublic void setXY(int newX, int newY)
newX
- the x coordinatenewY
- the y coordinatepublic void setX(int newX)
newX
- an int
valuepublic void setY(int newY)
newY
- an int
valueCopyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.