From 2ffbf6be3efa295b5883c94b32f634218082d4a1 Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 18:55:00 +0000 Subject: replace Listeners with the corresponding Adapters git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@36 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../main/java/at/asit/pdfover/gui/MainWindow.java | 26 ++++++------------ .../gui/composites/BKUSelectionComposite.java | 24 ++++------------- .../gui/composites/DataSourceSelectComposite.java | 28 ++++++------------- .../pdfover/gui/composites/ErrorComposite.java | 11 +++----- .../composites/MobileBKUEnterNumberComposite.java | 23 +++++----------- .../gui/composites/MobileBKUEnterTANComposite.java | 31 ++++++++-------------- .../pdfover/gui/composites/OutputComposite.java | 26 +++++------------- .../gui/composites/PositioningComposite.java | 13 +++------ .../pdfover/gui/composites/StateComposite.java | 9 ++++--- 9 files changed, 57 insertions(+), 134 deletions(-) diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java index ccf95cca..8d5eb1f7 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java @@ -22,8 +22,8 @@ import java.util.Map; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CLabel; import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; @@ -48,12 +48,11 @@ public class MainWindow { /** * Selection Listener for Position Button */ - private final class PositionSelectionListener implements SelectionListener { + private final class PositionSelectionListener extends SelectionAdapter { /** - * Default constructor + * Empty constructor */ public PositionSelectionListener() { - // Nothing to do here } @Override @@ -61,23 +60,16 @@ public class MainWindow { MainWindow.this.stateMachine.jumpToState(new PositioningState( MainWindow.this.stateMachine)); } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // Nothing to do here - } } /** * Selection Listener for Open Button */ - private final class DataSourceSelectionListener implements - SelectionListener { + private final class DataSourceSelectionListener extends SelectionAdapter { /** - * Default constructor + * Empty constructor */ public DataSourceSelectionListener() { - // Nothing to do here } @Override @@ -86,11 +78,6 @@ public class MainWindow { .jumpToState(new OpenState( MainWindow.this.stateMachine)); } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // Nothing to do here - } } /** @@ -108,6 +95,9 @@ public class MainWindow { private Button btn_open; private Button btn_config; + /** + * Main bar Buttons + */ public enum Buttons { CONFIG, OPEN, POSITION, SIGN, FINAL } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java index 8b8f5b10..88156343 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java @@ -17,8 +17,8 @@ package at.asit.pdfover.gui.composites; // Imports import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; @@ -39,13 +39,11 @@ public class BKUSelectionComposite extends StateComposite { /** * Listener for local bku selection */ - private final class LocalSelectionListener implements SelectionListener { - + private final class LocalSelectionListener extends SelectionAdapter { /** - * Default constructor + * Empty constructor */ public LocalSelectionListener() { - // Nothing here } @Override @@ -53,23 +51,16 @@ public class BKUSelectionComposite extends StateComposite { log.debug("Setting BKU to LOCAL"); //$NON-NLS-1$ setSelected(BKUs.LOCAL); } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // Nothing here - } } /** * Listener for mobile bku selection */ - private final class MobileSelectionListener implements SelectionListener { - + private final class MobileSelectionListener extends SelectionAdapter { /** - * Default constructor + * Empty constructor */ public MobileSelectionListener() { - // Nothing here } @Override @@ -77,11 +68,6 @@ public class BKUSelectionComposite extends StateComposite { log.debug("Setting BKU to MOBILE"); //$NON-NLS-1$ setSelected(BKUs.MOBILE); } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // Nothing here - } } /** diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java index 18dcd9c2..91ac7d6d 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java @@ -21,8 +21,8 @@ import java.io.File; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.DropTarget; +import org.eclipse.swt.dnd.DropTargetAdapter; import org.eclipse.swt.dnd.DropTargetEvent; -import org.eclipse.swt.dnd.DropTargetListener; import org.eclipse.swt.dnd.FileTransfer; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.events.SelectionAdapter; @@ -54,6 +54,12 @@ public class DataSourceSelectComposite extends StateComposite { * */ private final class FileBrowseDialogListener extends SelectionAdapter { + /** + * Empty constructor + */ + public FileBrowseDialogListener() { + } + @Override public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(DataSourceSelectComposite.this.getShell(), SWT.OPEN); @@ -130,14 +136,7 @@ public class DataSourceSelectComposite extends StateComposite { Transfer[] types = new Transfer[] { fileTransfer }; dnd_target.setTransfer(types); - dnd_target.addDropListener(new DropTargetListener() { - - @Override - public void dropAccept(DropTargetEvent event) { - // TODO Auto-generated method stub - - } - + dnd_target.addDropListener(new DropTargetAdapter() { @Override public void drop(DropTargetEvent event) { if (fileTransfer.isSupportedType(event.currentDataType)){ @@ -155,12 +154,6 @@ public class DataSourceSelectComposite extends StateComposite { } } - @Override - public void dragOver(DropTargetEvent event) { - // TODO Auto-generated method stub - - } - @Override public void dragOperationChanged(DropTargetEvent event) { if (event.detail == DND.DROP_DEFAULT) { @@ -172,11 +165,6 @@ public class DataSourceSelectComposite extends StateComposite { } } - @Override - public void dragLeave(DropTargetEvent event) { - // No need to do anything here... - } - @Override public void dragEnter(DropTargetEvent event) { if (event.detail == DND.DROP_DEFAULT) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ErrorComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ErrorComposite.java index 93486894..f8a6fbcb 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ErrorComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ErrorComposite.java @@ -17,8 +17,8 @@ package at.asit.pdfover.gui.composites; // Imports import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; @@ -35,9 +35,9 @@ public class ErrorComposite extends StateComposite { /** * */ - private final class OkSelectionListener implements SelectionListener { + private final class OkSelectionListener extends SelectionAdapter { /** - * + * Empty constructor */ public OkSelectionListener() { } @@ -47,11 +47,6 @@ public class ErrorComposite extends StateComposite { ErrorComposite.this.userOk = true; ErrorComposite.this.state.updateStateMachine(); } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // Nothing to do - } } boolean userOk = false; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java index 45c0881b..44b38a11 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java @@ -20,6 +20,11 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; @@ -28,12 +33,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.workflow.states.State; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; /** * @@ -42,8 +41,7 @@ public class MobileBKUEnterNumberComposite extends StateComposite { /** * */ - private final class OkSelectionListener implements SelectionListener { - + private final class OkSelectionListener extends SelectionAdapter { /** * Regular expression for mobile phone numbers: * this allows the entrance of mobile numbers in the following formats: @@ -56,15 +54,13 @@ public class MobileBKUEnterNumberComposite extends StateComposite { private static final String NUMBER_REGEX = "^((\\+[\\d]{2})|(00[\\d]{2})|(0)|(10301))([1-9][\\d]+)$"; //$NON-NLS-1$ /** - * + * Empty constructor */ public OkSelectionListener() { - // Nothing to do here } @Override public void widgetSelected(SelectionEvent e) { - try { String number = MobileBKUEnterNumberComposite.this.txt_number .getText(); @@ -134,11 +130,6 @@ public class MobileBKUEnterNumberComposite extends StateComposite { } MobileBKUEnterNumberComposite.this.state.updateStateMachine(); } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // Nothing to do! - } } /** diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java index 0a23b947..95184775 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java @@ -16,24 +16,21 @@ package at.asit.pdfover.gui.composites; // Imports +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.workflow.states.State; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.layout.RowLayout; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormAttachment; - /** * */ @@ -41,12 +38,11 @@ public class MobileBKUEnterTANComposite extends StateComposite { /** * */ - private final class OkSelectionListener implements SelectionListener { + private final class OkSelectionListener extends SelectionAdapter { /** - * + * Empty constructor */ public OkSelectionListener() { - // Nothing to do } @Override @@ -71,11 +67,6 @@ public class MobileBKUEnterTANComposite extends StateComposite { MobileBKUEnterTANComposite.this.setUserAck(true); MobileBKUEnterTANComposite.this.state.updateStateMachine(); } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // Nothing to do - } } /** diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java index 6c79ed01..f6653da8 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java @@ -21,8 +21,8 @@ import java.io.File; import java.io.FileOutputStream; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; @@ -49,13 +49,11 @@ public class OutputComposite extends StateComposite { /** * SelectionListener for save button */ - private final class SaveSelectionListener implements SelectionListener { - + private final class SaveSelectionListener extends SelectionAdapter { /** - * Default constructor + * Empty constructor */ public SaveSelectionListener() { - // Nothing to do } @Override @@ -83,23 +81,16 @@ public class OutputComposite extends StateComposite { log.error("SaveSelectionListener: ", ex); //$NON-NLS-1$ } } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // Nothing todo - } } /** - * Selection Listner for open button + * Selection Listener for open button */ - private final class OpenSelectionListener implements SelectionListener { - + private final class OpenSelectionListener extends SelectionAdapter { /** - * Default constructor + * Empty constructor */ public OpenSelectionListener() { - // Nothing to do } @Override @@ -131,11 +122,6 @@ public class OutputComposite extends StateComposite { log.error("OpenSelectionListener: ", ex); //$NON-NLS-1$ } } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // Nothing todo - } } File savedFile = null; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java index e101d281..da18bb49 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java @@ -17,8 +17,8 @@ package at.asit.pdfover.gui.composites; // Imports import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; @@ -35,13 +35,11 @@ public class PositioningComposite extends StateComposite { /** * Selection listener when position was fixed */ - private final class PositionSelectedListener implements SelectionListener { - + private final class PositionSelectedListener extends SelectionAdapter { /** - * Default constructor + * Empty constructor */ public PositionSelectedListener() { - // Nothing to do } @Override @@ -50,11 +48,6 @@ public class PositioningComposite extends StateComposite { PositioningComposite.this.setPosition(new SignaturePosition()); // Setting auto position for testing PositioningComposite.this.state.updateStateMachine(); } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // Nothing to do - } } private SignaturePosition position = null; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java index dcc82394..f3d9e362 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java @@ -25,14 +25,17 @@ import at.asit.pdfover.gui.workflow.states.State; */ public abstract class StateComposite extends Composite { + /** + * Current State + */ protected State state; /** * The base class for state composites * - * @param parent - * @param style - * @param state + * @param parent The parent Composite + * @param style The Composite style + * @param state The current State */ public StateComposite(Composite parent, int style, State state) { super(parent, style); -- cgit v1.2.3