Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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

java.lang.Object
  extended by net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes.WhiteboardShape
      extended by net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes.WhiteboardShapeText
All Implemented Interfaces:
WhiteboardObject, WhiteboardObjectText

public class WhiteboardShapeText
extends WhiteboardShape
implements WhiteboardObjectText

A WhiteboardShapeRect, in XML :

Author:
Julien Waechter

Field Summary
static int DEFAULT_FONT_SIZE
          A type string constant indicating the default font size of the text in this object.
 
Fields inherited from interface net.java.sip.communicator.service.protocol.whiteboardobjects.WhiteboardObjectText
NAME
 
Constructor Summary
WhiteboardShapeText(String id, Color color, WhiteboardPoint point, int size, String text)
          WhiteboardShapeText constructor.
WhiteboardShapeText(String id, Color color, WhiteboardPoint point, int size, String text, AffineTransform v2w)
          WhiteboardShapeText constructor.
 
Method Summary
 boolean contains(Point2D p)
          Tests if the shape contains a point.
 String getFontName()
          Returns the WhiteboardObjectText's font name.
 int getFontSize()
          Returns the WhiteboardObjectText's font size.
 WhiteboardPoint getSelectionPoint(Point2D p)
          Tests if a point p is over a selection point.
 List<WhiteboardPoint> getSelectionPoints()
          Gets the list of selected points.
 String getText()
          Returns the WhiteboardObjectText's text.
 WhiteboardPoint getWhiteboardPoint()
          Returns the coordinates of this whiteboard object.
 void paintShape(Graphics2D g, AffineTransform t)
          Code to paint the WhiteboardShapeText.
 void setFontName(String fontName)
          Sets the WhiteboardObjectText's font name.
 void setFontSize(int fontSize)
          Sets the WhiteboardObjectText's font size.
 void setText(String text)
          Sets the WhiteboardObjectText's text.
 void setWhiteboardPoint(WhiteboardPoint whiteboardPoint)
          Sets the coordinates of this whiteboard object.
 void translate(double deltaX, double deltaY)
          Translates the shape.
 void translateSelectedPoint(double deltaX, double deltaY)
          Translates a point from the shape.
 
Methods inherited from class net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes.WhiteboardShape
drawSelectedPoint, equals, getColor, getID, getModifyPoint, getOpacity, getThickness, isSelected, paint, preselect, select, setColor, setColor, setID, setModifyPoint, setOpacity, setSelected, setThickness
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.java.sip.communicator.service.protocol.whiteboardobjects.WhiteboardObject
getColor, getID, getThickness, setColor, setThickness
 

Field Detail

DEFAULT_FONT_SIZE

public static int DEFAULT_FONT_SIZE
A type string constant indicating the default font size of the text in this object.

Constructor Detail

WhiteboardShapeText

public WhiteboardShapeText(String id,
                           Color color,
                           WhiteboardPoint point,
                           int size,
                           String text)
WhiteboardShapeText constructor.

Parameters:
id - String that uniquely identifies this WhiteboardObject
color - font's color
point - coordinates of this object
size - font size
text - WhiteboardObjectText's text

WhiteboardShapeText

public WhiteboardShapeText(String id,
                           Color color,
                           WhiteboardPoint point,
                           int size,
                           String text,
                           AffineTransform v2w)
WhiteboardShapeText constructor.

Parameters:
id - String that uniquely identifies this WhiteboardObject
color - font's color
point - coordinates of this object.
size - font size
text - WhiteboardObjectText's text
v2w - 2D affine transformation
Method Detail

paintShape

public void paintShape(Graphics2D g,
                       AffineTransform t)
Code to paint the WhiteboardShapeText.

Specified by:
paintShape in class WhiteboardShape
Parameters:
g - graphics context
t - 2D affine transform

getSelectionPoints

public List<WhiteboardPoint> getSelectionPoints()
Gets the list of selected points.

Specified by:
getSelectionPoints in class WhiteboardShape
Returns:
list of selected points

getText

public String getText()
Returns the WhiteboardObjectText's text.

Specified by:
getText in interface WhiteboardObjectText
Returns:
the WhiteboardObjectText's text.

setText

public void setText(String text)
Sets the WhiteboardObjectText's text.

Specified by:
setText in interface WhiteboardObjectText
Parameters:
text - the new WhiteboardObjectText's text.

contains

public boolean contains(Point2D p)
Tests if the shape contains a point.

Specified by:
contains in class WhiteboardShape
Parameters:
p - coord point
Returns:
true if shape contains p

translate

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

Specified by:
translate in class WhiteboardShape
Parameters:
deltaX - x coordinate
deltaY - y coordinate

translateSelectedPoint

public void translateSelectedPoint(double deltaX,
                                   double deltaY)
Translates a point from the shape.

Specified by:
translateSelectedPoint in class WhiteboardShape
Parameters:
deltaX - x coordinate
deltaY - y coordinate

getSelectionPoint

public WhiteboardPoint getSelectionPoint(Point2D p)
Tests if a point p is over a selection point.

Specified by:
getSelectionPoint in class WhiteboardShape
Parameters:
p - point
Returns:
nearest selection point

getWhiteboardPoint

public WhiteboardPoint getWhiteboardPoint()
Returns the coordinates of this whiteboard object.

Specified by:
getWhiteboardPoint in interface WhiteboardObjectText
Returns:
the coordinates of this object.

setWhiteboardPoint

public void setWhiteboardPoint(WhiteboardPoint whiteboardPoint)
Sets the coordinates of this whiteboard object.

Specified by:
setWhiteboardPoint in interface WhiteboardObjectText
Parameters:
whiteboardPoint - the coordinates of this object.

getFontSize

public int getFontSize()
Returns the WhiteboardObjectText's font size.

Specified by:
getFontSize in interface WhiteboardObjectText
Returns:
the WhiteboardObjectText's font size.

setFontSize

public void setFontSize(int fontSize)
Sets the WhiteboardObjectText's font size.

Specified by:
setFontSize in interface WhiteboardObjectText
Parameters:
fontSize - the new WhiteboardObjectText's font size.

getFontName

public String getFontName()
Returns the WhiteboardObjectText's font name. (By default Dialog)

Specified by:
getFontName in interface WhiteboardObjectText
Returns:
the new WhiteboardObjectText's font name.

setFontName

public void setFontName(String fontName)
Sets the WhiteboardObjectText's font name.

Specified by:
setFontName in interface WhiteboardObjectText
Parameters:
fontName - the new WhiteboardObjectText's font name.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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