webmngr.web
Class DefaultMapElement

java.lang.Object
  |
  +--webmngr.web.DefaultMapElement
All Implemented Interfaces:
MapElement
Direct Known Subclasses:
CompositeMapElement, ManagedElement, MapImage, MapLabel, MapLine

public abstract class DefaultMapElement
extends java.lang.Object
implements MapElement

A DefautMapElement is any kind of element present in a Map. This class provides most of the necessary methods necessary to get and set properties of an element like this.

Since:
02/07/2000
Author:
Ayla Débora Dantas de Souza (ayla@dsc.ufpb.br),
Rodrigo Rebouças de Almeida (rodrigor@dsc.ufpb.br)

Field Summary
static int BACKGROUND
           
static int BOTTOM
           
static int CRITIC_HIGH
           
static int CRITIC_LITTLE
           
static int CRITIC_MAXIMUM
           
static int CRITIC_MEDIUM
           
static int CRITIC_MINIMAL
           
static int CRITIC_NONE
           
protected  int criticality
           
protected static java.lang.String DEFAULT_ID
           
protected  java.awt.Dimension dimension
           
protected  int drawPlane
           
protected  java.lang.String id
           
protected static int idCount
           
protected  java.awt.image.ImageObserver imgObserver
           
protected  java.lang.String link
           
protected  java.util.List mapElements
           
static int MIDDLE
           
protected  MapElement parent
           
protected  MapPoint position
           
protected  int status
           
static int STATUS_DOWN
           
static int STATUS_INDEFINITE
           
static int STATUS_UP
           
protected static java.awt.image.ImageObserver tmpObs
           
static int TOP
           
protected  boolean visited
           
 
Constructor Summary
DefaultMapElement()
          Default Constructor
 
Method Summary
 void addLabel(MapLabel newElement)
          Adds a new MapLabel to the list of elements that are part of this DefaultMapElement
 void addManagedElement(ManagedElement newElement)
          Adds a new ManagedElement to the list of elements that are part of this DefaultMapElement
 void addMapElement(MapElement newElement)
          Adds a new MapElement to the list of elements that are part of this DefaultMapElement
 void addMapImage(MapImage newElement)
          Adds a new MapMapImage to the list of elements that are part of this DefaultMapElement
 void addMapLine(MapLine newElement)
          Adds a new MapLine to the list of elements that are part of this DefaultMapElement
 void addSubMap(NetMap newElement)
          Adds a new MapSubMap to the list of elements that are part of this DefaultMapElement
abstract  void draw(java.awt.Image map)
          Draws this MapElement on the map
 java.util.Vector getAllElements()
           
 int getCriticality()
          Gets the criticality of this element which tells how much it is important and if a problem with it deserves to be propagated
abstract  java.awt.Dimension getDimension()
          Returns the dimension of this MapElement's image
 int getDrawPlane()
          Gets this MapElement drawPlane, which identifies its priority at the moment at will be drawn
 java.lang.String getID()
          Gets the ID which identifies this specific MapElement
 java.awt.image.ImageObserver getImageObserver()
          Gets this MapElement ImageObserver
 java.lang.String getLink()
          Gets the Link to where this MapElement will take anyone who clicks on its image
 java.util.Iterator getMapElements()
          Returns the MapElements present in this DefaultMapElement
 MapElement getParent()
          Gets this MapElement's parent
 java.awt.Point getPixelPosition()
          Gets the exact location of this MapElement image on the screen in pixels, not in %
 MapPoint getPosition()
          Gets the relative location of this MapElement image in %
 int getStatus()
          Gets the Status of this element
 void setCriticality(int crit)
          Sets the criticality of this element which tells how much it is important and if a problem with it deserves to be propagated
 void setDefault(MapElement def)
          Sets a defaultMapElement whose properties will be transfered to this MapElement
 void setDrawPlane(int drawPlane)
          Sets the drawPlane of this MapElement, that is, the relative place where it must be drawn
 void setID(java.lang.String idValue)
          Sets this element ID, which identifies this specific MapElement
 void setImageObserver(java.awt.image.ImageObserver io)
          Sets this MapElement ImageObserver to be used at the moment it will be drawn
 void setLink(java.lang.String link)
          Sets the Link to where this MapElement will take anyone who clicks on its image
 void setParent(MapElement parent)
          Sets this mapElements parent, that is, the element where this mapElement must be drawn
 void setPosition(MapPoint position)
          Sets the position where this MapElement must be drawn relative to another one (in %)
 void setStatus(int value)
          Sets the Status of this element
 void setVisited(boolean value)
          Sets a new value for the boolean visited which tells if the Element was visited or not
 void setX(float x)
          Sets the X coordinate of this MapElement
 void setY(float y)
          Sets the Y coordinate of this MapElement
 boolean visited()
          Returns the MapElements present in this MapElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOTTOM

public static int BOTTOM

MIDDLE

public static int MIDDLE

TOP

public static int TOP

BACKGROUND

public static int BACKGROUND

CRITIC_NONE

public static final int CRITIC_NONE

CRITIC_MINIMAL

public static final int CRITIC_MINIMAL

CRITIC_LITTLE

public static final int CRITIC_LITTLE

CRITIC_MEDIUM

public static final int CRITIC_MEDIUM

CRITIC_HIGH

public static final int CRITIC_HIGH

CRITIC_MAXIMUM

public static final int CRITIC_MAXIMUM

STATUS_UP

public static final int STATUS_UP

STATUS_DOWN

public static final int STATUS_DOWN

STATUS_INDEFINITE

public static final int STATUS_INDEFINITE

visited

protected boolean visited

id

protected java.lang.String id

link

protected java.lang.String link

criticality

protected int criticality

dimension

protected java.awt.Dimension dimension

position

protected MapPoint position

status

protected int status

drawPlane

protected int drawPlane

mapElements

protected java.util.List mapElements

parent

protected MapElement parent

imgObserver

protected java.awt.image.ImageObserver imgObserver

tmpObs

protected static java.awt.image.ImageObserver tmpObs

DEFAULT_ID

protected static final java.lang.String DEFAULT_ID

idCount

protected static int idCount
Constructor Detail

DefaultMapElement

public DefaultMapElement()
Default Constructor
Method Detail

visited

public boolean visited()
Returns the MapElements present in this MapElement
Specified by:
visited in interface MapElement
Returns:
all MapElements from this DefaultMapElement

setVisited

public void setVisited(boolean value)
Sets a new value for the boolean visited which tells if the Element was visited or not
Specified by:
setVisited in interface MapElement
Parameters:
value - the new value of the boolean

getID

public java.lang.String getID()
Gets the ID which identifies this specific MapElement
Specified by:
getID in interface MapElement
Returns:
an string that represents this MapElement

setID

public void setID(java.lang.String idValue)
Sets this element ID, which identifies this specific MapElement
Parameters:
an - string that represents this MapElement

getLink

public java.lang.String getLink()
Gets the Link to where this MapElement will take anyone who clicks on its image
Specified by:
getLink in interface MapElement
Returns:
the Link expected

setLink

public void setLink(java.lang.String link)
Sets the Link to where this MapElement will take anyone who clicks on its image
Parameters:
the - new Link value

getCriticality

public int getCriticality()
Gets the criticality of this element which tells how much it is important and if a problem with it deserves to be propagated
Specified by:
getCriticality in interface MapElement
Returns:
criticality of the element

getAllElements

public java.util.Vector getAllElements()

setCriticality

public void setCriticality(int crit)
Sets the criticality of this element which tells how much it is important and if a problem with it deserves to be propagated
Parameters:
crit - the new value for this element criticality

getMapElements

public java.util.Iterator getMapElements()
Returns the MapElements present in this DefaultMapElement
Specified by:
getMapElements in interface MapElement
Returns:
all MapElements from this DefaultMapElement

addMapElement

public void addMapElement(MapElement newElement)
Adds a new MapElement to the list of elements that are part of this DefaultMapElement
Parameters:
newElement - the new MapElement to be added

addMapImage

public void addMapImage(MapImage newElement)
Adds a new MapMapImage to the list of elements that are part of this DefaultMapElement
Parameters:
newElement - the new MapImage to be added

addMapLine

public void addMapLine(MapLine newElement)
Adds a new MapLine to the list of elements that are part of this DefaultMapElement
Parameters:
newElement - the new MapLine to be added

addLabel

public void addLabel(MapLabel newElement)
Adds a new MapLabel to the list of elements that are part of this DefaultMapElement
Parameters:
newElement - the new MapLabel to be added

addSubMap

public void addSubMap(NetMap newElement)
Adds a new MapSubMap to the list of elements that are part of this DefaultMapElement
Parameters:
newElement - the new SubMap to be added

addManagedElement

public void addManagedElement(ManagedElement newElement)
Adds a new ManagedElement to the list of elements that are part of this DefaultMapElement
Parameters:
newElement - the new ManagedElement to be added

getDimension

public abstract java.awt.Dimension getDimension()
Returns the dimension of this MapElement's image
Specified by:
getDimension in interface MapElement
Returns:
the dimension of this element's image

getPosition

public MapPoint getPosition()
Gets the relative location of this MapElement image in %
Specified by:
getPosition in interface MapElement
Returns:
a point representing the position of this element's image in %

setPosition

public void setPosition(MapPoint position)
Sets the position where this MapElement must be drawn relative to another one (in %)
Parameters:
position - The relative point, in % coordinates

setX

public void setX(float x)
Sets the X coordinate of this MapElement
Parameters:
x - the x coordinate

setY

public void setY(float y)
Sets the Y coordinate of this MapElement
Parameters:
y - the y coordinate

getStatus

public int getStatus()
Gets the Status of this element
Specified by:
getStatus in interface MapElement
Returns:
a status value associated with this element

setStatus

public void setStatus(int value)
Sets the Status of this element
Parameters:
value - the new value for the status

getDrawPlane

public int getDrawPlane()
Gets this MapElement drawPlane, which identifies its priority at the moment at will be drawn
Specified by:
getDrawPlane in interface MapElement
Returns:
integer representing this mapElement drawPlane

setDrawPlane

public void setDrawPlane(int drawPlane)
Sets the drawPlane of this MapElement, that is, the relative place where it must be drawn
Parameters:
drawPlane - Integer representing this MapElement new draw Plane

getPixelPosition

public java.awt.Point getPixelPosition()
Gets the exact location of this MapElement image on the screen in pixels, not in %
Specified by:
getPixelPosition in interface MapElement
Returns:
a point representing the position of this element's image

draw

public abstract void draw(java.awt.Image map)
Draws this MapElement on the map
Specified by:
draw in interface MapElement
Parameters:
img - Source image
comp - A component, e.g, a frame, from where the image was obtained

setParent

public void setParent(MapElement parent)
Sets this mapElements parent, that is, the element where this mapElement must be drawn
Specified by:
setParent in interface MapElement
Parameters:
parent - this MapElement parent

setImageObserver

public void setImageObserver(java.awt.image.ImageObserver io)
Sets this MapElement ImageObserver to be used at the moment it will be drawn
Specified by:
setImageObserver in interface MapElement
Parameters:
io - ths mapElement ImageObserver

getImageObserver

public java.awt.image.ImageObserver getImageObserver()
Gets this MapElement ImageObserver
Returns:
this element's ImageObserver

getParent

public MapElement getParent()
Gets this MapElement's parent
Returns:
this element's parent

setDefault

public void setDefault(MapElement def)
Sets a defaultMapElement whose properties will be transfered to this MapElement
Parameters:
def - Default MapElement