edu.gatech.cs2335.lemmings.gui
Class LComponent

java.lang.Object
  extended byedu.gatech.cs2335.lemmings.gui.LComponent
Direct Known Subclasses:
LContainer, LLeafComponent

public abstract class LComponent
extends java.lang.Object

The base component class, from which all of the more specific components, such as buttons, will be derived.

Version:
1.0
Author:
Vladimir Urazov

Constructor Summary
LComponent()
          Creates a new LComponent instance.
 
Method Summary
 void bringToTop()
          Brings the current component to the top of the z-order.
 boolean cleanUp()
          Performs all the necessary operations to clean up after the component.
protected abstract  void copy(LComponent component)
          Deep-copies self into the component passed in.
 java.awt.Rectangle getBounds()
          Returns the rectangle denoting the bounds of the component.
 LContainer getParent()
          Returns a pointer to the parent component of this one if there is one, or NULL if this component has no parent or is the root window.
 boolean initialize()
          Performs all of the initialization necessary for the component.
 boolean isActive()
          Returns true if the component has input focus, and false if it does not.
 boolean isComponentDirty()
          Returns true if the component is to be rerendered during the next frame.
 boolean isShown()
          Returns true if the component is visible, and false if it is not.
abstract  void makeDirty()
          Marks the component dirty.
abstract  void move(java.awt.Point offset)
          Moves the component by the offsets specified by the components of the point.
protected abstract  boolean paint(java.awt.Graphics g)
          Performs all of the necessary drawing for this control only.
abstract  boolean renderAll(java.awt.Graphics g)
          Calls paint on self and then all the children in z order.
 void setBounds(java.awt.Rectangle newBounds)
          Sets the new bounds of the component.
protected  void setDirty(boolean value)
          Sets the component's dirty value to the one passed in.
 void setParent(LContainer c)
          Sets a new parent for this component.
 void setPosition(java.awt.Point p)
          Sets the location of the top-left corner of the component to the desired coordinates.
 void setShown(boolean value)
          Sets the visibility of the component to the value passed in.
 void setSize(java.awt.Dimension d)
          Sets the size of the component.
protected  void setSize(int width, int height)
          Describe setSize method here.
protected  void updateDimensions()
          Updates the dimensions of the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LComponent

public LComponent()
Creates a new LComponent instance.

Method Detail

initialize

public boolean initialize()
Performs all of the initialization necessary for the component. Returns true if the initialization went through successfully and false if something went wrong.

Returns:
a boolean value

cleanUp

public boolean cleanUp()
Performs all the necessary operations to clean up after the component. Does *not* destroy the children of the component, however.

Returns:
a boolean value

getParent

public final LContainer getParent()
Returns a pointer to the parent component of this one if there is one, or NULL if this component has no parent or is the root window.

Returns:
a LComponent value

setParent

public final void setParent(LContainer c)
Sets a new parent for this component.

Parameters:
c - a LContainer value

isShown

public final boolean isShown()
Returns true if the component is visible, and false if it is not.

Returns:
a boolean value

setShown

public final void setShown(boolean value)
Sets the visibility of the component to the value passed in.

Parameters:
value - a boolean value

isComponentDirty

public final boolean isComponentDirty()
Returns true if the component is to be rerendered during the next frame.

Returns:
boolean

setDirty

protected final void setDirty(boolean value)
Sets the component's dirty value to the one passed in.

Parameters:
value - v

isActive

public final boolean isActive()
Returns true if the component has input focus, and false if it does not.

Returns:
a boolean value

bringToTop

public final void bringToTop()
Brings the current component to the top of the z-order. (It's children will still remain on top of it, however.)


getBounds

public final java.awt.Rectangle getBounds()
Returns the rectangle denoting the bounds of the component.

Returns:
a Rectangle value

setBounds

public final void setBounds(java.awt.Rectangle newBounds)
Sets the new bounds of the component. No error checking is performed beyond that the size of the rectangle should be meaningful.

Parameters:
newBounds - n

setPosition

public final void setPosition(java.awt.Point p)
Sets the location of the top-left corner of the component to the desired coordinates.

Parameters:
p - a Point value

setSize

public final void setSize(java.awt.Dimension d)
Sets the size of the component.

Parameters:
d - a Dimension value

setSize

protected final void setSize(int width,
                             int height)
Describe setSize method here.

Parameters:
width - an int value
height - an int value

updateDimensions

protected void updateDimensions()
Updates the dimensions of the component. This must *NOT* under any circumstances call the method setPosition() or setSize()!!!


makeDirty

public abstract void makeDirty()
Marks the component dirty.


move

public abstract void move(java.awt.Point offset)
Moves the component by the offsets specified by the components of the point.

Parameters:
offset - a Point value

renderAll

public abstract boolean renderAll(java.awt.Graphics g)
Calls paint on self and then all the children in z order.

Parameters:
g - a Graphics value
Returns:
a boolean value

copy

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

Parameters:
component - a LComponent value

paint

protected abstract 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.

Parameters:
g - a Graphics value
Returns:
a boolean value