Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber.extensions.whiteboard
Class WhiteboardObjectJabberImpl

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.jabber.extensions.whiteboard.WhiteboardObjectJabberImpl
All Implemented Interfaces:
WhiteboardObject
Direct Known Subclasses:
WhiteboardObjectCircleJabberImpl, WhiteboardObjectImageJabberImpl, WhiteboardObjectLineJabberImpl, WhiteboardObjectPathJabberImpl, WhiteboardObjectPolygonJabberImpl, WhiteboardObjectPolyLineJabberImpl, WhiteboardObjectRectJabberImpl, WhiteboardObjectTextJabberImpl

public abstract class WhiteboardObjectJabberImpl
extends Object
implements WhiteboardObject

WhiteboardObjectJabberImpl

WhiteboardObjectJabberImpl are created through the WhiteboardSession session.

All WhiteboardObjectJabberImpl have whiteboard object id.

Author:
Julien Waechter

Field Summary
 
Fields inherited from interface net.java.sip.communicator.service.protocol.whiteboardobjects.WhiteboardObject
NAME
 
Constructor Summary
WhiteboardObjectJabberImpl()
          Default WhiteboardObjectJabberImpl constructor
WhiteboardObjectJabberImpl(String id, int thickness, int color)
          WhiteboardObjectJabberImpl constructor
 
Method Summary
protected  String colorToHex(Color color)
          Converts a color to a hexa color code
protected  String colorToHex(int color)
          Converts a int color to a hexa color code
 boolean equals(Object obj)
          Indicates whether some other WhiteboardObject is "equal to" this one.
protected  String generateID()
          Generate a String uniquely identifying this WhiteboardObject.
 int getColor()
          Returns an integer representing the color of this object.
 String getID()
          Returns a String uniquely identifying this WhiteboardObject.
 int getThickness()
          Returns an integer indicating the thickness (represented as number of pixels) of this whiteboard object (or its border).
 void setColor(int color)
          Sets the color of this whiteboard object (or rather it's border).
protected  void setID(String ID)
          Sets a String uniquely identifying this WhiteboardObject.
 void setThickness(int thickness)
          Sets the thickness (in pixels) of this whiteboard object.
abstract  String toXML()
          Returns the XML reppresentation of the PacketExtension.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WhiteboardObjectJabberImpl

public WhiteboardObjectJabberImpl()
Default WhiteboardObjectJabberImpl constructor


WhiteboardObjectJabberImpl

public WhiteboardObjectJabberImpl(String id,
                                  int thickness,
                                  int color)
WhiteboardObjectJabberImpl constructor

Parameters:
id - A String that uniquely identifies this WhiteboardObject.
thickness - An integer indicating the thickness (number of pixels).
color - The RGB value of the color of this object.
Method Detail

generateID

protected String generateID()
Generate a String uniquely identifying this WhiteboardObject.

Returns:
a String that uniquely identifies this WhiteboardObject.

getID

public String getID()
Returns a String uniquely identifying this WhiteboardObject.

Specified by:
getID in interface WhiteboardObject
Returns:
a String that uniquely identifies this WhiteboardObject.

setID

protected void setID(String ID)
Sets a String uniquely identifying this WhiteboardObject.

Parameters:
ID - a String that uniquely identifies this WhiteboardObject.

getThickness

public int getThickness()
Returns an integer indicating the thickness (represented as number of pixels) of this whiteboard object (or its border).

Specified by:
getThickness in interface WhiteboardObject
Returns:
the thickness (in pixels) of this object (or its border).

equals

public boolean equals(Object obj)
Indicates whether some other WhiteboardObject is "equal to" this one.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

getColor

public int getColor()
Returns an integer representing the color of this object. The return value uses standard RGB encoding: bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue.

Specified by:
getColor in interface WhiteboardObject
Returns:
the RGB value of the color of this object.

setColor

public void setColor(int color)
Sets the color of this whiteboard object (or rather it's border). The color parameter must be encoded with standard RGB encoding: bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue.

Specified by:
setColor in interface WhiteboardObject
Parameters:
color - the color that we'd like to set on this object (using standard RGB encoding).

colorToHex

protected String colorToHex(int color)
Converts a int color to a hexa color code

Parameters:
color - color
Returns:
hexa color code

colorToHex

protected String colorToHex(Color color)
Converts a color to a hexa color code

Parameters:
color - color
Returns:
hexa color code

setThickness

public void setThickness(int thickness)
Sets the thickness (in pixels) of this whiteboard object.

Specified by:
setThickness in interface WhiteboardObject
Parameters:
thickness - the number of pixels that this object (or its border) should be thick.

toXML

public abstract String toXML()
Returns the XML reppresentation of the PacketExtension.

Returns:
the packet extension as XML.
To do:
Implement this org.jivesoftware.smack.packet.PacketExtension method

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.