uk.ac.lancs.relate.gateways.devices
Class TrackableDevice

java.lang.Object
  extended by uk.ac.lancs.relate.trigger.Trackable
      extended by uk.ac.lancs.relate.gateways.devices.TrackableDevice
Direct Known Subclasses:
DisplayDevice, KeyboardDevice, MouseDevice, PrinterDevice, WorkstationDevice

public class TrackableDevice
extends Trackable

This class models an abstract Device. A Device represents the generic controller of a physical device supported by the RelatedGateways application. It has a GatewayController which is the visual representation of a physical device. Concrete devices have to extend this class in order to add their own core logic and behaviour. The concrete devices are in charge of implementing, providing and registering their own services.

Author:
Dominique Guinard and Sara Streng
Personal Homepage

Constructor Summary
TrackableDevice(java.lang.String name, int width, int height, Location l, java.lang.String host, GatewayApplication app, javax.swing.ImageIcon iconicRepresentation)
          Creates a new Device used by the gateway application, standard constructor.
 
Method Summary
 void addService(Service service)
          Add a Service to the ones provided by this Device
protected  void createServices()
          Method used by a Device to create the Services it provides
 GatewayApplication getApplication()
          Returns the gateway application this device belongs to.
 GatewayController getController()
          Returns the gateway controller for this device.
 int getHeight()
          Returns the height of the device (y).
 java.lang.String getHostname()
          This method gets the hostname of the Device.
 javax.swing.ImageIcon getIconicRepresentation()
           
 Location getLocation()
          Returns the device's location (coordinates of the center of the device).
 java.lang.String getName()
          Gets the device's name.
 java.lang.String getServiceDescription()
          This method packs the human-readable description of all the services offered by this provider in a string.
 java.util.ArrayList<Service> getServices()
          Gets all the Services provided by this Device.
 java.lang.String getTooltipMessage()
          Returns the message that is shown when the mouse hovers above the gateway.
 int getWidth()
          Returns the width of the device (x).
 void setController(GatewayController controller)
          Sets the gateway controller for this device.
 void setHostname(java.lang.String hostname)
          This method gets the hostname of the Device.
 void setLocation(Location location)
          Sets the device's location (coordinates of the center of the device).
protected  void setName(java.lang.String name)
          Sets the device's name.
 void setServices(java.util.ArrayList<Service> services)
          Sets all the Services provided by this Device.
 void setTooltipMessage(java.lang.String m)
          Sets the message that is shown when the mouse hovers above the gateway.
 
Methods inherited from class uk.ac.lancs.relate.trigger.Trackable
getDirectionTo, getDistanceTo, getId, getMotion, getOrientation, hasBackTo, isCloserThan, isFacing, isLeftOf, isMoving, isMovingAway, isMovingTowards, isRightOf, setMotion, setOrientation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrackableDevice

public TrackableDevice(java.lang.String name,
                       int width,
                       int height,
                       Location l,
                       java.lang.String host,
                       GatewayApplication app,
                       javax.swing.ImageIcon iconicRepresentation)
Creates a new Device used by the gateway application, standard constructor.

Parameters:
name - unique id
width - width of the device (x)
height - height of the device (y)
l - location (coordinates of the center of the device)
Method Detail

getLocation

public Location getLocation()
Returns the device's location (coordinates of the center of the device).

Overrides:
getLocation in class Trackable
Returns:
location

setLocation

public void setLocation(Location location)
Sets the device's location (coordinates of the center of the device).

Overrides:
setLocation in class Trackable
Parameters:
location - device's location

getHeight

public int getHeight()
Returns the height of the device (y).

Returns:
height of the device (y)

getWidth

public int getWidth()
Returns the width of the device (x).

Returns:
width of the device (x)

getController

public GatewayController getController()
Returns the gateway controller for this device.

Returns:
gateway controller for this device

setController

public void setController(GatewayController controller)
Sets the gateway controller for this device.

Parameters:
controller - gateway controller for this device

getHostname

public java.lang.String getHostname()
This method gets the hostname of the Device.


setHostname

public void setHostname(java.lang.String hostname)
This method gets the hostname of the Device.

Parameters:
hostname - Hostname of the Device (e.g. ip address or hostname)

getServices

public java.util.ArrayList<Service> getServices()
Gets all the Services provided by this Device.


setServices

public void setServices(java.util.ArrayList<Service> services)
Sets all the Services provided by this Device.


getName

public java.lang.String getName()
Gets the device's name. (Supposed to be a user friendly short description.)


setName

protected void setName(java.lang.String name)
Sets the device's name. (Supposed to be a user friendly short description.)


addService

public void addService(Service service)
Add a Service to the ones provided by this Device


createServices

protected void createServices()
Method used by a Device to create the Services it provides


getApplication

public GatewayApplication getApplication()
Returns the gateway application this device belongs to.

Returns:
gateway application

getTooltipMessage

public java.lang.String getTooltipMessage()
Returns the message that is shown when the mouse hovers above the gateway.

Returns:
tooltip message containing a human-readable description of the services.

setTooltipMessage

public void setTooltipMessage(java.lang.String m)
Sets the message that is shown when the mouse hovers above the gateway.

Parameters:
tooltipMessage - tooltip message

getIconicRepresentation

public javax.swing.ImageIcon getIconicRepresentation()

getServiceDescription

public java.lang.String getServiceDescription()
This method packs the human-readable description of all the services offered by this provider in a string.

Returns:
a string containing a human-readable description of the services