Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes
Class WhiteboardShape

java.lang.Object
  extended by net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes.WhiteboardShape
All Implemented Interfaces:
WhiteboardObject
Direct Known Subclasses:
WhiteboardShapeCircle, WhiteboardShapeImage, WhiteboardShapeLine, WhiteboardShapePath, WhiteboardShapePolygon, WhiteboardShapePolyLine, WhiteboardShapeRect, WhiteboardShapeText

public abstract class WhiteboardShape
extends Object
implements WhiteboardObject

Abstract WhiteboardShape (Shape for the WhitheboardFrame)

Author:
Julien Waechter

Field Summary
 
Fields inherited from interface net.java.sip.communicator.service.protocol.whiteboardobjects.WhiteboardObject
NAME
 
Constructor Summary
WhiteboardShape(String id)
          WhiteboardShape constructor
 
Method Summary
abstract  boolean contains(Point2D p)
          method to test if the shape contains a point
 void drawSelectedPoint(Graphics g, AffineTransform t, WhiteboardPoint point, Color color)
          Draw a point on the shape
 boolean equals(Object obj)
          Indicates whether some other WhiteboardShape is "equal to" this one.
 int getColor()
          Returns an integer representing the color of this object.
 String getID()
          Returns a String uniquely identifying this WhiteboardShape.
 WhiteboardPoint getModifyPoint()
          The last selected for modification point.
 float getOpacity()
          Returns WhiteboardShape's opacity
abstract  WhiteboardPoint getSelectionPoint(Point2D p)
          Returns a selection point contained in this WhiteboardShape, which corresponds to the given point (i.e.
abstract  List<WhiteboardPoint> getSelectionPoints()
          Returns the list of selected points
 int getThickness()
          Returns an integer indicating the thickness (represented as number of pixels) of this whiteboard shape (or its border).
 boolean isSelected()
          Returns true if the Shape is selected
 void paint(Graphics g, AffineTransform t)
          Code when shape is preselected
abstract  void paintShape(Graphics2D g, AffineTransform t)
          Code to paint the specific shape
 void preselect(Graphics g, AffineTransform t)
          Draws selection points when a shape is preselected.
 void select(Graphics g, AffineTransform t)
          Code when shape is selected
 void setColor(Color color)
          Sets color of the WhiteboardShape (or rather it's border)
 void setColor(int color)
          Sets the color of this whiteboard shape (or rather it's border).
 void setID(String id)
          Sets a new identification for this WhiteboardShape
 void setModifyPoint(WhiteboardPoint point)
          Sets the point from which a modification could start.
 void setOpacity(float opacity)
          Sets WhiteboardShape's opacity
 void setSelected(boolean selected)
          Sets selected the shape
 void setThickness(int thickness)
          Sets the thickness (in pixels) of this whiteboard shape.
abstract  void translate(double deltaX, double deltaY)
          Translates the shape
abstract  void translateSelectedPoint(double deltaX, double deltaY)
          Translates the shape point at p
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WhiteboardShape

public WhiteboardShape(String id)
WhiteboardShape constructor

Parameters:
id - String that uniquely identifies this WhiteboardObject.
Method Detail

paint

public void paint(Graphics g,
                  AffineTransform t)
Code when shape is preselected

Parameters:
g - graphics context
t - 2D affine transform

paintShape

public abstract void paintShape(Graphics2D g,
                                AffineTransform t)
Code to paint the specific shape

Parameters:
g - graphics context
t - 2D affine transform

contains

public abstract boolean contains(Point2D p)
method to test if the shape contains a point

Parameters:
p - coord point
Returns:
true if shape contains p

setColor

public void setColor(Color color)
Sets color of the WhiteboardShape (or rather it's border)

Parameters:
color - color shape

getOpacity

public float getOpacity()
Returns WhiteboardShape's opacity

Returns:
current WhiteboardShape's opacity

setOpacity

public void setOpacity(float opacity)
Sets WhiteboardShape's opacity

Parameters:
opacity - opacity of the shape

isSelected

public boolean isSelected()
Returns true if the Shape is selected

Returns:
true if the Shape is selected

setSelected

public void setSelected(boolean selected)
Sets selected the shape

Parameters:
selected - true for select the shape

setModifyPoint

public void setModifyPoint(WhiteboardPoint point)
Sets the point from which a modification could start.

Parameters:
point - the point from which a modification could start.

getModifyPoint

public WhiteboardPoint getModifyPoint()
The last selected for modification point.

Returns:
the last selected for modification point.

select

public void select(Graphics g,
                   AffineTransform t)
Code when shape is selected

Parameters:
g - graphics context
t - 2D affine transform

preselect

public void preselect(Graphics g,
                      AffineTransform t)
Draws selection points when a shape is preselected.

Parameters:
g - graphics context
t - 2D affine transform

drawSelectedPoint

public void drawSelectedPoint(Graphics g,
                              AffineTransform t,
                              WhiteboardPoint point,
                              Color color)
Draw a point on the shape

Parameters:
g - graphics context
t - 2D affine transform
point - point coord for the 2D affine transform
color - color for the point

getSelectionPoints

public abstract List<WhiteboardPoint> getSelectionPoints()
Returns the list of selected points

Returns:
list of selected points

translate

public abstract void translate(double deltaX,
                               double deltaY)
Translates the shape

Parameters:
deltaX - x coord
deltaY - y coord

translateSelectedPoint

public abstract void translateSelectedPoint(double deltaX,
                                            double deltaY)
Translates the shape point at p

Parameters:
deltaX - x coord
deltaY - y coord

getID

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

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

setID

public void setID(String id)
Sets a new identification for this WhiteboardShape

Parameters:
id - a String that uniquely identifies this WhiteboardShape.

getThickness

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

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

setThickness

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

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

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 shape (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).

equals

public boolean equals(Object obj)
Indicates whether some other WhiteboardShape 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.

getSelectionPoint

public abstract WhiteboardPoint getSelectionPoint(Point2D p)
Returns a selection point contained in this WhiteboardShape, which corresponds to the given point (i.e. is in a near radius close to it).

Parameters:
p - point to check
Returns:
the nearest selection point

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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