edu.gatech.cs2335.lemmings.gui
Class JobContainer

java.lang.Object
  extended byedu.gatech.cs2335.lemmings.gui.LComponent
      extended byedu.gatech.cs2335.lemmings.gui.LContainer
          extended byedu.gatech.cs2335.lemmings.gui.JobContainer
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public final class JobContainer
extends LContainer
implements java.awt.event.ActionListener

Class JobContainer: The container for lemming job buttons. It will display them and align them nicely and stuff.

 Revision History:
     v1.0 (Apr. 10, 2004) - Created the JobContainer class
 

Version:
Version 1.0, Apr. 10, 2004
Author:
Vladimir Urazov

Field Summary
static int SPACING
          The number of pixels to put between the buttons.
static int X_AXIS
          Tells the container that the buttons should be arranged on the x-axis.
static int Y_AXIS
          Tells the container that the buttons should be arranged on the y-axis.
 
Constructor Summary
JobContainer(Level l)
          Creates a new JobContainer instance.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Describe actionPerformed method here.
 void addJobButton(java.lang.String jobId)
          Adds a job button for the job with the specified ID.
 void addJobSelectionListener(JobSelectionListener l)
          Adds an JobSelectionListener to the button.
protected  void copy(LComponent component)
          Deep-copies self into the component passed in.
protected  void fireJobSelected(JobSelectionEvent e)
          Notifies all listeners that have registered interest for notification on this event type.
 int getArrangement()
          Describe getArrangement method here.
protected  java.util.List getJobSelectionListeners()
          Returns the listeners for this button.
 Level getLevel()
          Describe getLevel method here.
protected  boolean paint(java.awt.Graphics g)
          Performs all of the necessary drawing for this control only.
protected  void rearrangeButtons()
          Rearranges all buttons.
 void removeJobSelectionListener(JobSelectionListener l)
          Removes an JobSelectionListener from the button.
 void setArrangement(int a)
          Describe setArrangment method here.
protected  void setJobSelectionListeners(java.util.List ll)
          Sets up the list of action listeners.
 void setLevel(Level l)
          Describe setLevel method here.
 void setSelectedButton(java.lang.String id)
          Selects the button with the spercified id.
 void updateButtons()
          Updates the buttons.
 
Methods inherited from class edu.gatech.cs2335.lemmings.gui.LContainer
addChild, clear, findActiveChild, findChildAtCoordinates, getChildren, makeDirty, move, removeChild, renderAll
 
Methods inherited from class edu.gatech.cs2335.lemmings.gui.LComponent
bringToTop, cleanUp, getBounds, getParent, initialize, isActive, isComponentDirty, isShown, setBounds, setDirty, setParent, setPosition, setShown, setSize, setSize, updateDimensions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

X_AXIS

public static final int X_AXIS
Tells the container that the buttons should be arranged on the x-axis.

See Also:
Constant Field Values

Y_AXIS

public static final int Y_AXIS
Tells the container that the buttons should be arranged on the y-axis.

See Also:
Constant Field Values

SPACING

public static final int SPACING
The number of pixels to put between the buttons.

See Also:
Constant Field Values
Constructor Detail

JobContainer

public JobContainer(Level l)
Creates a new JobContainer instance.

Parameters:
l - a Level value
Method Detail

addJobSelectionListener

public void addJobSelectionListener(JobSelectionListener l)
Adds an JobSelectionListener to the button.

Parameters:
l - the JobSelectionListener to be added.

removeJobSelectionListener

public void removeJobSelectionListener(JobSelectionListener l)
Removes an JobSelectionListener from the button. If the listener is the currently set JobSelection for the button, then the JobSelection is set to null.

Parameters:
l - the listener to be removed.

getJobSelectionListeners

protected java.util.List getJobSelectionListeners()
Returns the listeners for this button.

Returns:
a List value

setJobSelectionListeners

protected void setJobSelectionListeners(java.util.List ll)
Sets up the list of action listeners.

Parameters:
ll - a List value

fireJobSelected

protected void fireJobSelected(JobSelectionEvent e)
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the event parameter.

Parameters:
e - the JobSelectionEvent object.

getLevel

public Level getLevel()
Describe getLevel method here.

Returns:
a Level value

setLevel

public void setLevel(Level l)
Describe setLevel method here.

Parameters:
l - a Level value

getArrangement

public int getArrangement()
Describe getArrangement method here.

Returns:
an int value

setArrangement

public void setArrangement(int a)
Describe setArrangment method here.

Parameters:
a - an int value

addJobButton

public void addJobButton(java.lang.String jobId)
Adds a job button for the job with the specified ID.

Parameters:
jobId - a String value

rearrangeButtons

protected void rearrangeButtons()
Rearranges all buttons.


updateButtons

public void updateButtons()
Updates the buttons.


setSelectedButton

public void setSelectedButton(java.lang.String id)
Selects the button with the spercified id.

Parameters:
id - a String value

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Describe actionPerformed method here.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - an ActionEvent value

copy

protected void copy(LComponent component)
Deep-copies self into the component passed in.

Specified by:
copy in class LComponent
Parameters:
component - a LComponent value

paint

protected boolean paint(java.awt.Graphics g)
Performs all of the necessary drawing for this control only. The children will be taken care of separately. This method need not concern itself with them.

Specified by:
paint in class LComponent
Parameters:
g - a Graphics value
Returns:
a boolean value