From fdc0f9a9dfc7dabdc96bb830a079a353f160395c Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 18:57:41 +0000 Subject: Fixed some TODOs... git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@57 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../asit/pdfover/gui/controls/MainBarButton.java | 43 ++++++++++++++-------- .../pdfover/gui/controls/MainBarEndButton.java | 1 + .../pdfover/gui/controls/MainBarMiddleButton.java | 1 + .../gui/controls/MainBarRectangleButton.java | 1 + .../pdfover/gui/controls/MainBarStartButton.java | 1 + 5 files changed, 32 insertions(+), 15 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java index 37e4f85b..45a8d230 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java @@ -17,17 +17,12 @@ package at.asit.pdfover.gui.controls; // Imports import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; -import org.eclipse.swt.events.MouseMoveListener; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Region; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; @@ -37,7 +32,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * + * Main Bar Button implementation */ public abstract class MainBarButton extends Canvas { /** @@ -100,15 +95,16 @@ public abstract class MainBarButton extends Canvas { private Image image = null; /** - * @return the imgage + * Gets the image + * @return the image */ public Image getImage() { return this.image; } /** - * @param imgage - * the imgage to set + * Sets the Image + * @param image the imgage to set */ public void setImage(Image image) { this.image = image; @@ -140,6 +136,7 @@ public abstract class MainBarButton extends Canvas { } /** + * Gets the button text * @return the text */ public String getText() { @@ -147,8 +144,8 @@ public abstract class MainBarButton extends Canvas { } /** - * @param text - * the text to set + * Sets the text for the button + * @param text the text to set */ public void setText(String text) { this.text = text; @@ -157,9 +154,15 @@ public abstract class MainBarButton extends Canvas { /** * SLF4J Logger instance **/ + @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(MainBarButton.class); + /** + * Paint 3D style borders + * + * @param e + */ protected void paintBackground(PaintEvent e) { Point size = this.getSize(); @@ -185,20 +188,29 @@ public abstract class MainBarButton extends Canvas { } - private void paintControl(PaintEvent e) { + /** + * Main painting method + * @param e + */ + void paintControl(PaintEvent e) { this.paintBackground(e); this.paintButton(e); - this.paintBorderAndText(e); + this.paintText(e); } + /** + * paint the inner button + * @param e + */ protected void paintButton(PaintEvent e) { // could be overwritten by subclasses } /** + * Paint the text or image on the button * @param e */ - protected void paintBorderAndText(PaintEvent e) { + protected void paintText(PaintEvent e) { Point size = this.getSize(); int height = size.y - 2; @@ -227,7 +239,8 @@ public abstract class MainBarButton extends Canvas { } /** - * @return + * Gets the region of the button + * @return the button region */ protected abstract Region getCustomRegion(); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java index acbff332..923df73e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java @@ -38,6 +38,7 @@ public class MainBarEndButton extends MainBarButton { /** * SLF4J Logger instance **/ + @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(MainBarEndButton.class); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java index f46e7e42..5e64826f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java @@ -38,6 +38,7 @@ public class MainBarMiddleButton extends MainBarButton { /** * SLF4J Logger instance **/ + @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(MainBarMiddleButton.class); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java index 39392307..aff1fa7e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java @@ -40,6 +40,7 @@ public class MainBarRectangleButton extends MainBarButton { /** * SLF4J Logger instance **/ + @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(MainBarRectangleButton.class); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java index 9101e274..8cdafefa 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java @@ -38,6 +38,7 @@ public class MainBarStartButton extends MainBarButton { /** * SLF4J Logger instance **/ + @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(MainBarStartButton.class); -- cgit v1.2.3