diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2013-05-23 18:50:35 +0300 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2013-05-23 18:50:35 +0300 |
commit | b211c26d6c8f51a75d3b64b6092284c3847a3a8a (patch) | |
tree | a51b7d816a27f8db492cf9c44f998e2da8176635 /src/net/java/sip/communicator/plugin/whiteboard | |
parent | 24e81b82808681c6b5741b14048ef58c4e665e37 (diff) | |
download | jitsi-b211c26d6c8f51a75d3b64b6092284c3847a3a8a.zip jitsi-b211c26d6c8f51a75d3b64b6092284c3847a3a8a.tar.gz jitsi-b211c26d6c8f51a75d3b64b6092284c3847a3a8a.tar.bz2 |
Fixes warnings, removes trailing whitespace, adds @Override annotations.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/whiteboard')
15 files changed, 233 insertions, 173 deletions
diff --git a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java index b485b08..1caff86 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java @@ -51,15 +51,17 @@ public class WhiteboardMenuItem Resources.getImage ("plugin.whiteboard.MPEN_ICON")); } + @Override public void setCurrentContact (Contact contact) { } - + /** * Sets the current meta contact. * * @param metaContact the current meta contact */ + @Override public void setCurrentContact (MetaContact metaContact) { this.metaContact = metaContact; @@ -100,6 +102,7 @@ public class WhiteboardMenuItem * * @param metaGroup the current meta contact group */ + @Override public void setCurrentContactGroup (MetaContactGroup metaGroup) { } diff --git a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java index 31e6218..2aa4938 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java @@ -83,6 +83,7 @@ public class WhiteboardSessionManager new Thread () { + @Override public void run() { try diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/InvitationReceivedDialog.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/InvitationReceivedDialog.java index 729c795..1e363e7 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/InvitationReceivedDialog.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/InvitationReceivedDialog.java @@ -183,6 +183,7 @@ public class InvitationReceivedDialog this.dispose(); } + @Override protected void close(boolean isEscaped) { rejectButton.doClick(); diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFileFilter.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFileFilter.java index 1048984..5bbf9d2 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFileFilter.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFileFilter.java @@ -17,7 +17,7 @@ import net.java.sip.communicator.plugin.desktoputil.*; * @author Julien Waechter */ public class WhiteboardFileFilter extends SipCommFileFilter { - + /** * file extension */ @@ -26,7 +26,7 @@ public class WhiteboardFileFilter extends SipCommFileFilter { * file description */ private String description; - + /** * WhiteboardFileFilter constructor * @param ext extension @@ -36,7 +36,7 @@ public class WhiteboardFileFilter extends SipCommFileFilter { this.ext = ext; this.description = description; } - + /** * Tests the specified file, * returning true if the file is accepted, false otherwise. @@ -46,6 +46,7 @@ public class WhiteboardFileFilter extends SipCommFileFilter { * @param f file * @return true if file is accepted */ + @Override public boolean accept (File f) { if (f != null) { if (f.isDirectory ()) { @@ -58,11 +59,12 @@ public class WhiteboardFileFilter extends SipCommFileFilter { } return false; } - + /** * The description of this filter. For example: "JPG and GIF Images" * @return description */ + @Override public String getDescription () { return description; } @@ -73,7 +75,7 @@ public class WhiteboardFileFilter extends SipCommFileFilter { public String getExtension () { return ext; } - + /** * The extension of the file" * @param f File diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java index f307619..9aaa73a 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java @@ -218,7 +218,7 @@ public class WhiteboardFrame /** * List of WhiteboardShape */ - private List<WhiteboardShape> displayList = + private List<WhiteboardShape> displayList = new CopyOnWriteArrayList<WhiteboardShape>(); /** @@ -1223,21 +1223,21 @@ public class WhiteboardFrame { SipCommFileChooser chooser = GenericFileDialog.create( - WhiteboardFrame.this, - "Save file...", + WhiteboardFrame.this, + "Save file...", SipCommFileChooser.SAVE_FILE_OPERATION); - + //chooser.removeChoosableFileFilter(chooser.getAcceptAllFileFilter()); WhiteboardFileFilter filterJpg = new WhiteboardFileFilter("jpg", "JPEG Files (*.jpg)"); WhiteboardFileFilter filterPng = new WhiteboardFileFilter("png", "PNG Files (*.png)"); - + chooser.addFilter(filterJpg); chooser.addFilter(filterPng); - + File file = chooser.getFileFromDialog(); - + if (file != null) { try @@ -1655,8 +1655,8 @@ public class WhiteboardFrame * * @param e */ - /* not sure why this is here but it's never used. i am not deleting it - * though in case we decide to revive the whiteboard one day. and this + /* not sure why this is here but it's never used. i am not deleting it + * though in case we decide to revive the whiteboard one day. and this * appears necessary private void ellipseOperation(MouseEvent e) { @@ -2050,16 +2050,16 @@ public class WhiteboardFrame doneDrawing = true; SipCommFileChooser chooser = GenericFileDialog.create( - WhiteboardFrame.this, + WhiteboardFrame.this, "Choose image...", SipCommFileChooser.LOAD_FILE_OPERATION); - + File file = chooser.getFileFromDialog(); WhiteboardFileFilter filter = new WhiteboardFileFilter("jpg", "JPEG Files (*.jpg)"); - + chooser.addFilter(filter); - + if (file != null) { try @@ -2173,7 +2173,7 @@ public class WhiteboardFrame String t = (String) JOptionPane.showInputDialog(this, - "Please enter your text", "plugin.whiteboard.TEXT", + "Please enter your text", "plugin.whiteboard.TEXT", JOptionPane.QUESTION_MESSAGE, null, null, "plugin.whiteboard.TEXT"); @@ -2577,6 +2577,7 @@ public class WhiteboardFrame return this.session; } + @Override protected void close(boolean isEscaped) { } diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardPanel.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardPanel.java index 1d0a9ed..7f98c8c 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardPanel.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardPanel.java @@ -93,6 +93,7 @@ public class WhiteboardPanel * @see #paint * @see ComponentUI */ + @Override public void paintComponent(Graphics g) { super.paintComponent(g); @@ -201,11 +202,13 @@ public class WhiteboardPanel addMouseListener(new java.awt.event.MouseAdapter() { + @Override public void mousePressed(java.awt.event.MouseEvent evt) { formMousePressed(evt); } + @Override public void mouseReleased(java.awt.event.MouseEvent evt) { formMouseReleased(evt); diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShape.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShape.java index 9fd5e47..c6a5d67 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShape.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShape.java @@ -347,6 +347,7 @@ public abstract class WhiteboardShape implements WhiteboardObject * @return <code>true</code> if this object is the same as the obj * argument; <code>false</code> otherwise. */ + @Override public boolean equals (Object obj) { if(obj == null diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeCircle.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeCircle.java index cdedba0..372729f 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeCircle.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeCircle.java @@ -47,7 +47,7 @@ public class WhiteboardShapeCircle * Stores all selection points for this shape. */ private ArrayList<WhiteboardPoint> selectionPoints = new ArrayList<WhiteboardPoint>(); - + /** * WhiteboardShapeCircle constructor * @@ -71,7 +71,7 @@ public class WhiteboardShapeCircle * WhiteboardShapeCircle constructor * * @param id String that uniquely identifies this WhiteboardObject. - * @param thickness number of pixels that this object (or its border) + * @param thickness number of pixels that this object (or its border) * should be thick. * @param color WhiteboardShape's color (or rather it's border) * @param whiteboardPoint coordinates of this object. @@ -144,17 +144,17 @@ public class WhiteboardShapeCircle Point2D wy0 = new Point2D.Double (cx, cy - r); Point2D wx1 = new Point2D.Double (cx + r, cy); Point2D wy1 = new Point2D.Double (cx, cy + r); - + Point2D vx0 = w2v.transform (wx0, null); Point2D vy0 = w2v.transform (wy0, null); Point2D vx1 = w2v.transform (wx1, null); Point2D vy1 = w2v.transform (wy1, null); - + int ix = (int) vx0.getX (); int iy = (int) vy0.getY (); int iwidth = (int) vx1.getX () - ix; int iheight = (int) vy1.getY () - iy ; - + return new int[] {ix, iy, iwidth, iheight}; } @@ -164,12 +164,13 @@ public class WhiteboardShapeCircle * @param g graphics context * @param t 2D affine transform */ + @Override public void paintShape (Graphics2D g, AffineTransform t) { g.setStroke (new BasicStroke (this.getThickness (), BasicStroke.CAP_ROUND,BasicStroke.CAP_ROUND)); int[] view = getViewRect (t); - + if (fill) { g.fillOval (view[0], view[1], view[2], view[3]); @@ -186,6 +187,7 @@ public class WhiteboardShapeCircle * @param p coord point * @return true if shape contains p */ + @Override public boolean contains (Point2D p) { double cx = getWhiteboardPoint ().getX (); @@ -196,10 +198,11 @@ public class WhiteboardShapeCircle } /** * Tests if a point p is on a selection point. - * + * * @param p point * @return the nearest selection point */ + @Override public WhiteboardPoint getSelectionPoint (Point2D p) { WhiteboardPoint givenPoint = new WhiteboardPoint(p.getX(), p.getY()); @@ -214,6 +217,7 @@ public class WhiteboardShapeCircle * * @return list of selected points */ + @Override public List<WhiteboardPoint> getSelectionPoints () { return selectionPoints; @@ -224,6 +228,7 @@ public class WhiteboardShapeCircle * @param deltaX x coordinates * @param deltaY y coordinates */ + @Override public void translate (double deltaX, double deltaY) { double cx = getWhiteboardPoint ().getX (); @@ -234,14 +239,15 @@ public class WhiteboardShapeCircle this.recalculateSelectionPoints(); } - - + + /** * Translates a point from the shape * * @param deltaX x coordinate * @param deltaY y coordinate */ + @Override public void translateSelectedPoint (double deltaX, double deltaY) { WhiteboardPoint modifyPoint = getModifyPoint(); @@ -279,7 +285,7 @@ public class WhiteboardShapeCircle this.setModifyPoint(modifyPoint); this.recalculateSelectionPoints(); } - + /** * Returns the coordinates of this whiteboard object. * @@ -289,7 +295,7 @@ public class WhiteboardShapeCircle { return whiteboardPoint; } - + /** * Sets the coordinates of this whiteboard object. * @@ -299,7 +305,7 @@ public class WhiteboardShapeCircle { this.whiteboardPoint = whiteboardPoint; } - + /** * Returns the radius (in pixels) of this whiteboard circle. * @@ -309,7 +315,7 @@ public class WhiteboardShapeCircle { return this.radius; } - + /** * Sets the radius (in pixels) of this whiteboard circle. * @@ -319,7 +325,7 @@ public class WhiteboardShapeCircle { this.radius = radius; } - + /** * Returns the fill state of the WhiteboardObject. * @@ -329,7 +335,7 @@ public class WhiteboardShapeCircle { return this.fill; } - + /** * Sets the fill state of the WhiteboardObject. * True is filled, false is unfilled. @@ -340,7 +346,7 @@ public class WhiteboardShapeCircle { this.fill = fill; } - + /** * Specifies the background color for this object. The color parameter * must be encoded with standard RGB encoding: bits 24-31 are alpha, 16-23 @@ -353,7 +359,7 @@ public class WhiteboardShapeCircle { this.backColor = backColor; } - + /** * Returns an integer representing the background color of this object. The * return value uses standard RGB encoding: bits 24-31 are alpha, 16-23 are diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeImage.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeImage.java index 76b9ddd..dbcf852 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeImage.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeImage.java @@ -57,7 +57,7 @@ public class WhiteboardShapeImage * Stores all selection points for this shape. */ private ArrayList<WhiteboardPoint> selectionPoints = new ArrayList<WhiteboardPoint>(); - + /** * WhiteboardShapImage constructor * @@ -84,13 +84,14 @@ public class WhiteboardShapeImage this.recalculateSelectionPoints(); } - + /** * Code to paint this specific shape. * * @param g graphics context * @param t 2D affine transform */ + @Override public void paintShape (Graphics2D g, AffineTransform t) { Point2D w0 = new Point2D.Double ( whiteboardPoint.getX (), @@ -100,7 +101,7 @@ public class WhiteboardShapeImage int ix = (int) v0.getX (); int iy = (int) v0.getY (); - Point2D w1 = new Point2D.Double ( whiteboardPoint.getX () + width, + Point2D w1 = new Point2D.Double ( whiteboardPoint.getX () + width, whiteboardPoint.getY () + height); Point2D v1 = t.transform (w1, null); @@ -112,23 +113,25 @@ public class WhiteboardShapeImage g.drawImage (image, ix, iy, iwidth, iheight, null); } } - + /** * Returns the list of selected points. * * @return list of selected points */ + @Override public List<WhiteboardPoint> getSelectionPoints () { return selectionPoints; } - + /** * Tests if the shape contains a point. * * @param p coord point * @return true if shape contains p */ + @Override public boolean contains (Point2D p) { double x = whiteboardPoint.getX (); @@ -136,7 +139,7 @@ public class WhiteboardShapeImage Rectangle2D rect = new Rectangle2D.Double (x, y, width, height); return rect.contains (p); } - + /** * Returns the width (in pixels) of the WhiteboardObject. * @@ -146,7 +149,7 @@ public class WhiteboardShapeImage { return width; } - + /** * Sets the width (in pixels) of the WhiteboardObject. * @@ -156,7 +159,7 @@ public class WhiteboardShapeImage { this.width = width; } - + /** * Returns the height (in pixels) of the WhiteboardObject. * @@ -166,7 +169,7 @@ public class WhiteboardShapeImage { return height; } - + /** * Sets the width (in pixels) of the WhiteboardObject. * @@ -176,13 +179,14 @@ public class WhiteboardShapeImage { this.height = height; } - + /** * Translates the shape. * * @param deltaX x coord * @param deltaY y coord */ + @Override public void translate (double deltaX, double deltaY) { double cx = whiteboardPoint.getX (); @@ -193,13 +197,14 @@ public class WhiteboardShapeImage this.recalculateSelectionPoints(); } - + /** * Translates a point from the shape. * * @param deltaX x coordinate * @param deltaY y coordinate */ + @Override public void translateSelectedPoint (double deltaX, double deltaY) { WhiteboardPoint modifyPoint = getModifyPoint(); @@ -254,10 +259,11 @@ public class WhiteboardShapeImage /** * Tests if a point p is over a selection point. - * + * * @param p point * @return nearest selection point */ + @Override public WhiteboardPoint getSelectionPoint (Point2D p) { WhiteboardPoint givenPoint = new WhiteboardPoint(p.getX(), p.getY()); @@ -267,7 +273,7 @@ public class WhiteboardShapeImage return point; return null; } - + /** * Returns the coordinates of this whiteboard object. * @@ -277,7 +283,7 @@ public class WhiteboardShapeImage { return whiteboardPoint; } - + /** * Sets the coordinates of this whiteboard object. * @@ -287,7 +293,7 @@ public class WhiteboardShapeImage { this.whiteboardPoint = whiteboardPoint; } - + /** * Specifies an image that should be displayed as the background of this * object. @@ -296,12 +302,12 @@ public class WhiteboardShapeImage * displayed as the object background. */ public void setBackgroundImage (byte[] background) - { + { this.bytes = background; ImageIcon ii = new ImageIcon (this.bytes); this.image = ii.getImage (); } - + /** * Returns a binary array containing the image that should be displayed as * the background of this <tt>WhiteboardObject</tt>. diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeLine.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeLine.java index 25014bc..3298555 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeLine.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeLine.java @@ -34,7 +34,7 @@ public class WhiteboardShapeLine * The end coordinates for this line. */ private WhiteboardPoint endPoint; - + /** * WhiteboardShapeLine constructor. * @@ -55,7 +55,7 @@ public class WhiteboardShapeLine this.endPoint = endPoint; this.startPoint = startPoint; } - + /** * WhiteboardShapeLine constructor * @param id String that uniquely identifies this WhiteboardObject. @@ -71,23 +71,24 @@ public class WhiteboardShapeLine super (id); this.setThickness (t); setColor (c); - + Point2D v0 = new Point2D.Double (startPoint.getX (), startPoint.getY ()); Point2D w0 = v2w.transform (v0, null); - + this.startPoint = new WhiteboardPoint (w0.getX (), w0.getY ()); - + Point2D v1 = new Point2D.Double (endPoint.getX (), endPoint.getY ()); Point2D w1 = v2w.transform (v1, null); - + this.endPoint = new WhiteboardPoint (w1.getX (), w1.getY ()); } - + /** * Code to paint the specific shape * @param w2v 2D affine transform * @param g graphics context */ + @Override public void paintShape (Graphics2D g, AffineTransform w2v) { double x = startPoint.getX (); @@ -106,13 +107,14 @@ public class WhiteboardShapeLine g.drawLine (ix, iy, (int)v1.getX (), (int)v1.getY ()); } - + /** * Tests if the shape contains a point. * * @param p coord point * @return true if shape contains p */ + @Override public boolean contains (Point2D p) { double x = startPoint.getX (); @@ -125,12 +127,13 @@ public class WhiteboardShapeLine return line.intersects (p.getX (), p.getY (), 10, 10); } - + /** * Returns the list of selected points. * * @return list of selected points */ + @Override public List<WhiteboardPoint> getSelectionPoints () { ArrayList<WhiteboardPoint> selectionPoints = new ArrayList<WhiteboardPoint>(); @@ -140,13 +143,14 @@ public class WhiteboardShapeLine return selectionPoints; } - + /** * Translates the shape. * * @param deltaX x coordinate * @param deltaY y coordinate */ + @Override public void translate (double deltaX, double deltaY) { double x = startPoint.getX (); @@ -160,13 +164,14 @@ public class WhiteboardShapeLine startPoint = new WhiteboardPoint (x, y); endPoint = new WhiteboardPoint (xEnd, yEnd); } - + /** * Translates a point from the shape. * * @param deltaX x coordinate * @param deltaY y coordinate */ + @Override public void translateSelectedPoint (double deltaX, double deltaY) { if (getModifyPoint() == null) @@ -187,13 +192,14 @@ public class WhiteboardShapeLine this.setModifyPoint(endPoint); } } - + /** * Tests if a point p is over a selection point. - * + * * @param p point * @return nearest selection point */ + @Override public WhiteboardPoint getSelectionPoint (Point2D p) { WhiteboardPoint givenPoint = new WhiteboardPoint(p.getX(), p.getY()); @@ -215,7 +221,7 @@ public class WhiteboardShapeLine { return this.startPoint; } - + /** * Returns the coordinates of end point for the line * @@ -225,7 +231,7 @@ public class WhiteboardShapeLine { return this.endPoint; } - + /** * Sets the coordinates of start point for the line * @@ -235,7 +241,7 @@ public class WhiteboardShapeLine { this.startPoint = whiteboardPointStart; } - + /** * Sets the coordinates of end point for the line * diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePath.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePath.java index d8d8b6a..e6ed29a 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePath.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePath.java @@ -33,7 +33,7 @@ public class WhiteboardShapePath * WhiteboardShapePath constructor. * * @param id String that uniquely identifies this WhiteboardObject - * @param t number of pixels that this object (its border) + * @param t number of pixels that this object (its border) * should be thick. * @param c WhiteboardShapePath's color (or rather it's border) * @param points list of WhiteboardPoint. @@ -45,12 +45,12 @@ public class WhiteboardShapePath setColor (c.getRGB ()); this.points = new ArrayList<WhiteboardPoint>(points); } - + /** * WhiteboardShapePath constructor. * * @param id String that uniquely identifies this WhiteboardObject - * @param t number of pixels that this object (its border) + * @param t number of pixels that this object (its border) * @param c WhiteboardShapePath's color (it's border) * @param points list of points * @param v2w 2D affine transform @@ -61,7 +61,7 @@ public class WhiteboardShapePath super (id); this.setThickness (t); setColor (c.getRGB ()); - + this.points = new ArrayList<WhiteboardPoint>(); for (WhiteboardPoint p : points) { @@ -70,7 +70,7 @@ public class WhiteboardShapePath this.points.add (new WhiteboardPoint (w.getX (), w.getY ())); } } - + /** * Returns a list of all the <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. @@ -81,12 +81,13 @@ public class WhiteboardShapePath { return points; } - + /** * Returns the list of selected points. * * @return list of selected points */ + @Override public List<WhiteboardPoint> getSelectionPoints () { List<WhiteboardPoint> list = new ArrayList<WhiteboardPoint>(); @@ -95,12 +96,13 @@ public class WhiteboardShapePath list.add (new WhiteboardPoint (p.getX (), p.getY ())); return list; } - + /** * Code to paint the specific shape * @param g graphics context * @param t 2D affine transform */ + @Override public void paintShape (Graphics2D g, AffineTransform t) { g.setStroke (new BasicStroke (this.getThickness (), @@ -115,12 +117,12 @@ public class WhiteboardShapePath new Point2D.Double (startX, startY), null); Point2D p1 = t.transform ( new Point2D.Double (point.getX (), point.getY ()), null); - + int x0 = (int) p0.getX (); int y0 = (int) p0.getY (); int x1 = (int) p1.getX (); int y1 = (int) p1.getY (); - + if (i > 0) { g.drawLine (x0, y0, x1, y1); @@ -131,13 +133,14 @@ public class WhiteboardShapePath startY = point.getY (); } } - + /** * Tests if the shape contains a point. * * @param p coord point * @return true if shape contains p */ + @Override public boolean contains (Point2D p) { double startX = -1; @@ -146,7 +149,7 @@ public class WhiteboardShapePath for (int i = 0; i < size; i++) { WhiteboardPoint point = points.get (i); - + if (i > 0) { Line2D line = new Line2D.Double ( @@ -163,7 +166,7 @@ public class WhiteboardShapePath } return false; } - + /** * Sets the list of <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. @@ -175,13 +178,14 @@ public class WhiteboardShapePath { this.points = new ArrayList<WhiteboardPoint>(points); } - + /** * Translates the shape. * * @param deltaX x coordinate * @param deltaY y coordinate */ + @Override public void translate (double deltaX, double deltaY) { WhiteboardPoint point; @@ -193,13 +197,14 @@ public class WhiteboardShapePath point.getX () + deltaX, point.getY () + deltaY)); } } - + /** * Translates a point from the shape. * * @param deltaX x coordinate * @param deltaY y coordinate */ + @Override public void translateSelectedPoint (double deltaX, double deltaY) { if (getModifyPoint() == null) @@ -223,13 +228,14 @@ public class WhiteboardShapePath } } } - + /** * Tests if a point p is over a selection point. - * + * * @param p point * @return nearest selection point */ + @Override public WhiteboardPoint getSelectionPoint (Point2D p) { for (WhiteboardPoint point : points) diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolyLine.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolyLine.java index 2e22f77..723aa2e 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolyLine.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolyLine.java @@ -24,7 +24,7 @@ import net.java.sip.communicator.service.protocol.whiteboardobjects.*; public class WhiteboardShapePolyLine extends WhiteboardShape implements WhiteboardObjectPolyLine { - + /** * list of WhiteboardPoint */ @@ -33,12 +33,12 @@ public class WhiteboardShapePolyLine * True is filled, false is unfilled. */ private boolean fill = false; - + /** * WhiteboardShapePolyLine constructor. * * @param id String that uniquely identifies this WhiteboardObject - * @param thickness number of pixels that this object (or its border) + * @param thickness number of pixels that this object (or its border) * should be thick * @param color WhiteboardShapePolyLine's color (or rather it's border) * @param points list of WhiteboardPoint @@ -54,12 +54,12 @@ public class WhiteboardShapePolyLine this.initShape(thickness, color, points, fill); } - + /** * WhiteboardShapePolyLine constructor. * * @param id String that uniquely identifies this WhiteboardObject - * @param thickness number of pixels that this object (or its border) + * @param thickness number of pixels that this object (or its border) * should be thick * @param color WhiteboardShapePolyLine's color (or rather it's border) * @param m_points list of WhiteboardPoint @@ -92,7 +92,7 @@ public class WhiteboardShapePolyLine /** * Initializes this shape. * - * @param thickness number of pixels that this object (or its border) + * @param thickness number of pixels that this object (or its border) * should be thick * @param color WhiteboardShapePolyLine's color (or rather it's border) * @param points list of WhiteboardPoint @@ -120,7 +120,7 @@ public class WhiteboardShapePolyLine { return fill; } - + /** * Sets the fill state of the WhiteboardObject. * True is filled, false is unfilled. @@ -131,13 +131,14 @@ public class WhiteboardShapePolyLine { this.fill = fill; } - + /** * Code to paint the WhiteboardShapePolyLine. * * @param g graphics context * @param t 2D affine transform */ + @Override public void paintShape (Graphics2D g, AffineTransform t) { g.setStroke (new BasicStroke (this.getThickness (), @@ -151,12 +152,13 @@ public class WhiteboardShapePolyLine g.draw (createPoly (t)); } } - + /** * Returns the list of selected WhiteboardPoints * * @return list of selected WhiteboardPoints */ + @Override public List<WhiteboardPoint> getSelectionPoints () { List<WhiteboardPoint> list = new ArrayList<WhiteboardPoint>(); @@ -168,18 +170,19 @@ public class WhiteboardShapePolyLine } return list; } - + /** * Tests if the shape contains a point. - * + * * @param p coord point * @return true if shape contains p */ + @Override public boolean contains (Point2D p) { return createPolyWorld ().contains (p); } - + /** * Creates a GeneralPath with all the WhiteboardPoint. * This GeneralPath is used for display. @@ -205,10 +208,10 @@ public class WhiteboardShapePolyLine v = w2v.transform (w, null); polyline.lineTo ((int) v.getX (), (int) v.getY ()); } - + return polyline; } - + /** * Creates a GeneralPath with all the WhiteboardPoint. * This GeneralPath is used for the contains test. @@ -223,17 +226,17 @@ public class WhiteboardShapePolyLine return polyline; WhiteboardPoint start = points.get (0); polyline.moveTo ((float) start.getX (), (float) start.getY ()); - + WhiteboardPoint p; for (int i =0; i<points.size ();i++) { p = points.get (i); polyline.lineTo ((float) p.getX (), (float) p.getY ()); } - + return polyline; } - + /** * Returns a list of all the <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. @@ -244,7 +247,7 @@ public class WhiteboardShapePolyLine { return points; } - + /** * Sets the list of <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. @@ -256,21 +259,22 @@ public class WhiteboardShapePolyLine { this.points = new ArrayList<WhiteboardPoint> (points); } - + /** * Translates the shape. * * @param deltaX x coord * @param deltaY y coord */ + @Override public void translate (double deltaX, double deltaY) { WhiteboardPoint point ; for (int i =0; i<points.size ();i++) { point = points.get (i); - points.set (i, - new WhiteboardPoint(point.getX () + deltaX, + points.set (i, + new WhiteboardPoint(point.getX () + deltaX, point.getY () + deltaY)); } } @@ -280,6 +284,7 @@ public class WhiteboardShapePolyLine * @param deltaX x coordinate * @param deltaY y coordinate */ + @Override public void translateSelectedPoint (double deltaX, double deltaY) { if (getModifyPoint() == null) @@ -302,13 +307,14 @@ public class WhiteboardShapePolyLine } } } - + /** * Tests if a point p is over a selection point. - * + * * @param p point * @return nearest selection point */ + @Override public WhiteboardPoint getSelectionPoint (Point2D p) { WhiteboardPoint point; @@ -323,5 +329,5 @@ public class WhiteboardShapePolyLine } return null; } - + } diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolygon.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolygon.java index f8ac184..3e6875c 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolygon.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolygon.java @@ -25,7 +25,7 @@ import net.java.sip.communicator.service.protocol.whiteboardobjects.*; public class WhiteboardShapePolygon extends WhiteboardShape implements WhiteboardObjectPolygon { - + /** * list of WhiteboardPoint */ @@ -38,12 +38,12 @@ public class WhiteboardShapePolygon * The background color of this object */ private Color backgroundColor; - + /** * WhiteboardShapePolygon constructor. * * @param id String that uniquely identifies this WhiteboardObject - * @param thickness number of pixels that this object (or its border) + * @param thickness number of pixels that this object (or its border) * should be thick * @param color WhiteboardShapePolygon's color (or rather it's border) * @param points list of WhiteboardPoint @@ -59,12 +59,12 @@ public class WhiteboardShapePolygon this.initShape(thickness, color, points, fill); } - + /** * WhiteboardShapePolygon constructor. * * @param id String that uniquely identifies this WhiteboardObject - * @param t number of pixels that this object (or its border) + * @param t number of pixels that this object (or its border) * should be thick * @param c WhiteboardShapePolygon's color (or rather it's border) * @param m_points list of WhiteboardPoint @@ -96,7 +96,7 @@ public class WhiteboardShapePolygon /** * Initializes this shape. * - * @param thickness number of pixels that this object (or its border) + * @param thickness number of pixels that this object (or its border) * should be thick * @param color WhiteboardShapePolygon's color (or rather it's border) * @param points list of WhiteboardPoint @@ -123,7 +123,7 @@ public class WhiteboardShapePolygon { return fill; } - + /** * Sets the fill state of the WhiteboardObject. * True is filled, false is unfilled. @@ -134,13 +134,14 @@ public class WhiteboardShapePolygon { this.fill = fill; } - + /** * Code to paint the WhiteboardShapePolygon. * * @param g graphics context * @param t 2D affine transform */ + @Override public void paintShape (Graphics2D g, AffineTransform t) { g.setStroke (new BasicStroke (this.getThickness (), @@ -154,12 +155,13 @@ public class WhiteboardShapePolygon g.draw (createPoly (t)); } } - + /** * Returns the list of selected WhiteboardPoints. * * @return list of selected WhiteboardPoints */ + @Override public List<WhiteboardPoint> getSelectionPoints () { return points; @@ -171,11 +173,12 @@ public class WhiteboardShapePolygon * @param p coord point * @return true if shape contains p */ + @Override public boolean contains (Point2D p) { return createPolyWorld ().contains (p); } - + /** * Creates a GeneralPath with all the WhiteboardPoint. * This GeneralPath is used for display. @@ -189,12 +192,12 @@ public class WhiteboardShapePolygon GeneralPath.WIND_EVEN_ODD, points.size ()); if(points.size ()<=0) return polygon; - + WhiteboardPoint start = points.get (0); Point2D w = new Point2D.Double (start.getX (), start.getY ()); Point2D v = w2v.transform (w, null); polygon.moveTo ((int) v.getX (), (int) v.getY ()); - + WhiteboardPoint p; for (int i =0; i<points.size ();i++) { @@ -203,11 +206,11 @@ public class WhiteboardShapePolygon v = w2v.transform (w, null); polygon.lineTo ((int) v.getX (), (int) v.getY ()); } - + polygon.closePath (); return polygon; } - + /** * Creates a GeneralPath with all the WhiteboardPoint. * This GeneralPath is used for the contains test. @@ -220,21 +223,21 @@ public class WhiteboardShapePolygon GeneralPath.WIND_EVEN_ODD, points.size ()); if(points.size ()<=0) return polygon; - + WhiteboardPoint start = points.get (0); polygon.moveTo ((float) start.getX (), (float) start.getY ()); - + WhiteboardPoint p; for (int i =0; i<points.size ();i++) { p = points.get (i); polygon.lineTo ((float) p.getX (), (float) p.getY ()); } - + polygon.closePath (); return polygon; } - + /** * Returns a list of all the <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. @@ -245,7 +248,7 @@ public class WhiteboardShapePolygon { return points; } - + /** * Sets the list of <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. @@ -257,13 +260,14 @@ public class WhiteboardShapePolygon { this.points = new ArrayList<WhiteboardPoint>(points); } - + /** * Translates the shape. * * @param deltaX x coord * @param deltaY y coord */ + @Override public void translate (double deltaX, double deltaY) { WhiteboardPoint point ; @@ -275,13 +279,14 @@ public class WhiteboardShapePolygon point.getY () + deltaY)); } } - + /** * Translates a point from the shape. * * @param deltaX x coord * @param deltaY y coord */ + @Override public void translateSelectedPoint (double deltaX, double deltaY) { if (getModifyPoint() == null) @@ -307,10 +312,11 @@ public class WhiteboardShapePolygon /** * Tests if a point p is over a selection point. - * + * * @param p point * @return nearest selection point */ + @Override public WhiteboardPoint getSelectionPoint (Point2D p) { WhiteboardPoint point; @@ -339,7 +345,7 @@ public class WhiteboardShapePolygon { this.backgroundColor = Color.getColor ("", backColor); } - + /** * Returns an integer representing the background color of this object. The * return value uses standard RGB encoding: bits 24-31 are alpha, 16-23 are diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeRect.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeRect.java index b503e67..5e1a3f2 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeRect.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeRect.java @@ -58,7 +58,7 @@ public class WhiteboardShapeRect * WhiteboardShapeRect constructor. * * @param id String that uniquely identifies this WhiteboardObject - * @param thickness number of pixels that this object (or its border) + * @param thickness number of pixels that this object (or its border) * should be thick * @param color WhiteboardShapeRect's color (or rather it's border) * @param point coordinates of this object. @@ -78,12 +78,12 @@ public class WhiteboardShapeRect this.initShape(thickness, color, point, width, height, fill); } - + /** * WhiteboardShapeRect constructor. - * + * * @param id String that uniquely identifies this WhiteboardShapeRect - * @param thickness number of pixels that this object (or its border) + * @param thickness number of pixels that this object (or its border) * should be thick * @param color WhiteboardShapeRect's color (or rather it's border) * @param point coordinates of this object. @@ -121,11 +121,11 @@ public class WhiteboardShapeRect this.initShape(thickness, color, point, transformedWidth, transformedHeight, fill); } - + /** * Initializes this shape. * - * @param thickness number of pixels that this object (or its border) + * @param thickness number of pixels that this object (or its border) * should be thick * @param color WhiteboardShapeRect's color (or rather it's border) * @param point coordinates of this object. @@ -159,7 +159,7 @@ public class WhiteboardShapeRect { return height; } - + /** * Sets the width (in pixels) of the WhiteboardShapeRect. * @@ -169,7 +169,7 @@ public class WhiteboardShapeRect { this.height = height; } - + /** * Returns the fill state of the WhiteboardShapeRect. * @@ -179,7 +179,7 @@ public class WhiteboardShapeRect { return fill; } - + /** * Sets the fill state of the WhiteboardShapeRect. * True is filled, false is unfilled. @@ -190,13 +190,14 @@ public class WhiteboardShapeRect { this.fill = fill; } - + /** * Code to paint the WhiteboardShapeRect. * * @param g graphics context * @param t 2D affine transformation */ + @Override public void paintShape (Graphics2D g, AffineTransform t) { double x = point.getX (); @@ -227,12 +228,13 @@ public class WhiteboardShapeRect g.drawRect (x0, y0, xWidth, yHeight); } } - + /** * Returns the list of selected points. * * @return list of selected points */ + @Override public List<WhiteboardPoint> getSelectionPoints () { return selectionPoints; @@ -243,20 +245,22 @@ public class WhiteboardShapeRect * @param p coord point * @return true if shape contains p */ + @Override public boolean contains (Point2D p) { Rectangle2D rect = new Rectangle2D.Double ( point.getX (), point.getY (), width, height); return rect.contains (p); } - - + + /** * Translates the shape. * * @param deltaX x coordinate * @param deltaY y coordinate */ + @Override public void translate (double deltaX, double deltaY) { double x = point.getX (); @@ -269,13 +273,14 @@ public class WhiteboardShapeRect this.recalculateSelectionPoints(); } - + /** * Translates a point from the shape. * * @param deltaX x coordinate * @param deltaY y coordinate */ + @Override public void translateSelectedPoint (double deltaX, double deltaY) { WhiteboardPoint modifyPoint = getModifyPoint(); @@ -327,13 +332,14 @@ public class WhiteboardShapeRect this.setModifyPoint(modifyPoint); this.recalculateSelectionPoints(); } - + /** * Tests if a point p is over a selection point. - * + * * @param p point * @return nearest selection point */ + @Override public WhiteboardPoint getSelectionPoint (Point2D p) { WhiteboardPoint givenPoint = new WhiteboardPoint(p.getX(), p.getY()); @@ -343,7 +349,7 @@ public class WhiteboardShapeRect return point; return null; } - + /** * Returns the coordinates of this whiteboard object. * @@ -353,7 +359,7 @@ public class WhiteboardShapeRect { return this.point; } - + /** * Sets the coordinates of this whiteboard object. * @@ -363,7 +369,7 @@ public class WhiteboardShapeRect { this.point = whiteboardPoint; } - + /** * Gets the width (in pixels) of the WhiteboardObject. * @@ -373,7 +379,7 @@ public class WhiteboardShapeRect { return this.width; } - + /** * Sets the width (in pixels) of the WhiteboardObject. * @@ -383,7 +389,7 @@ public class WhiteboardShapeRect { this.width = width; } - + /** * Specifies the background color for this object. The color parameter * must be encoded with standard RGB encoding: bits 24-31 are alpha, 16-23 @@ -396,7 +402,7 @@ public class WhiteboardShapeRect { this.backgroundColor = Color.getColor ("", color); } - + /** * Returns an integer representing the background color of this object. The * return value uses standard RGB encoding: bits 24-31 are alpha, 16-23 are diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeText.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeText.java index 6169088..da7672a 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeText.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeText.java @@ -76,7 +76,7 @@ public class WhiteboardShapeText this.initShape(color, point, size, text); } - + /** * WhiteboardShapeText constructor. * @@ -135,23 +135,25 @@ public class WhiteboardShapeText * @param g graphics context * @param t 2D affine transform */ + @Override public void paintShape (Graphics2D g, AffineTransform t) { g.setFont (getFont ()); Point2D p = t.transform ( new Point2D.Double (point.getX (), point.getY ()), null); g.drawString (text, (int) p.getX (), (int) p.getY ()); - + FontMetrics fontMetrics = g.getFontMetrics (); textWidth = fontMetrics.stringWidth (text); textActualHeight = fontMetrics.getAscent () - fontMetrics.getDescent (); } - + /** * Gets the list of selected points. * * @return list of selected points */ + @Override public List<WhiteboardPoint> getSelectionPoints () { List<WhiteboardPoint> list = new ArrayList<WhiteboardPoint>(); @@ -159,8 +161,8 @@ public class WhiteboardShapeText return list; } - - + + /** * Returns the WhiteboardObjectText's text. * @@ -170,7 +172,7 @@ public class WhiteboardShapeText { return text; } - + /** * Sets the WhiteboardObjectText's text. * @@ -180,7 +182,7 @@ public class WhiteboardShapeText { this.text = text; } - + /** * Returns the current WhiteboardObjectText's font. * @@ -190,13 +192,14 @@ public class WhiteboardShapeText { return new Font (getFontName (), Font.BOLD, getFontSize ()); } - + /** * Tests if the shape contains a point. * * @param p coord point * @return true if shape contains p */ + @Override public boolean contains (Point2D p) { Rectangle2D rect = new Rectangle2D.Double ( @@ -204,13 +207,14 @@ public class WhiteboardShapeText textWidth, textActualHeight); return rect.contains (p); } - + /** * Translates the shape. * * @param deltaX x coordinate * @param deltaY y coordinate */ + @Override public void translate (double deltaX, double deltaY) { double x = point.getX (); @@ -219,14 +223,15 @@ public class WhiteboardShapeText y += deltaY; this.point = new WhiteboardPoint (x, y); } - - + + /** * Translates a point from the shape. * * @param deltaX x coordinate * @param deltaY y coordinate */ + @Override public void translateSelectedPoint (double deltaX, double deltaY) { if (getModifyPoint() == null) @@ -243,10 +248,11 @@ public class WhiteboardShapeText /** * Tests if a point p is over a selection point. - * + * * @param p point * @return nearest selection point */ + @Override public WhiteboardPoint getSelectionPoint (Point2D p) { WhiteboardPoint givenPoint = new WhiteboardPoint(p.getX(), p.getY()); @@ -256,7 +262,7 @@ public class WhiteboardShapeText return null; } - + /** * Returns the coordinates of this whiteboard object. * @@ -266,7 +272,7 @@ public class WhiteboardShapeText { return this.point; } - + /** * Sets the coordinates of this whiteboard object. * @@ -276,7 +282,7 @@ public class WhiteboardShapeText { this.point = whiteboardPoint; } - + /** * Returns the WhiteboardObjectText's font size. * @@ -286,7 +292,7 @@ public class WhiteboardShapeText { return this.fontSize; } - + /** * Sets the WhiteboardObjectText's font size. * @@ -296,7 +302,7 @@ public class WhiteboardShapeText { this.fontSize = fontSize; } - + /** * Returns the WhiteboardObjectText's font name. * (By default Dialog) @@ -307,7 +313,7 @@ public class WhiteboardShapeText { return this.fontName; } - + /** * Sets the WhiteboardObjectText's font name. * |