From 7b9387fd576cea39d5a430312536d3723fdfeeed Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 18:54:16 +0000 Subject: Code houskeeping Tagged some string constants as NON-NLS Changed visibility of some logger instances for inner classes Added qualifier for access of class variables Organised imports Removed unused loggers git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@30 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../main/java/at/asit/pdfover/gui/MainWindow.java | 10 +++---- .../gui/composites/DataSourceSelectComposite.java | 34 ++++++++++++---------- .../pdfover/gui/composites/ErrorComposite.java | 20 ++++++------- .../pdfover/gui/composites/OutputComposite.java | 20 ++++++------- .../gui/composites/PositioningComposite.java | 13 ++------- .../pdfover/gui/composites/StateComposite.java | 2 -- .../pdfover/gui/composites/WaitingComposite.java | 17 +++-------- .../pdfover/gui/workflow/states/LocalBKUState.java | 8 ++--- 8 files changed, 55 insertions(+), 69 deletions(-) (limited to 'pdf-over-gui/src') 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 706064bd..ccf95cca 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 @@ -230,7 +230,7 @@ public class MainWindow { fd_config.bottom = new FormAttachment(100, 0); this.btn_config.setLayoutData(fd_config); this.btn_config.setText("Config ..."); - buttonMap.put(Buttons.CONFIG, btn_config); + this.buttonMap.put(Buttons.CONFIG, this.btn_config); this.btn_open = new Button(composite, SWT.NONE); FormData fd_open = new FormData(); @@ -241,7 +241,7 @@ public class MainWindow { this.btn_open.setLayoutData(fd_open); this.btn_open.setText("Open ..."); this.btn_open.addSelectionListener(new DataSourceSelectionListener()); - buttonMap.put(Buttons.OPEN, btn_open); + this.buttonMap.put(Buttons.OPEN, this.btn_open); this.btn_position = new Button(composite, SWT.NONE); FormData fd_position = new FormData(); @@ -252,7 +252,7 @@ public class MainWindow { this.btn_position.setLayoutData(fd_position); this.btn_position.setText("Positon ..."); this.btn_position.addSelectionListener(new PositionSelectionListener()); - buttonMap.put(Buttons.POSITION, btn_position); + this.buttonMap.put(Buttons.POSITION, this.btn_position); this.btn_sign = new Button(composite, SWT.NONE); FormData fd_sign = new FormData(); @@ -262,7 +262,7 @@ public class MainWindow { fd_sign.bottom = new FormAttachment(100, 0); this.btn_sign.setLayoutData(fd_sign); this.btn_sign.setText("Sign ..."); - buttonMap.put(Buttons.SIGN, btn_sign); + this.buttonMap.put(Buttons.SIGN, this.btn_sign); this.container = new Composite(getShell(), SWT.BORDER | SWT.RESIZE); FormData fd_composite_1 = new FormData(); @@ -299,7 +299,7 @@ public class MainWindow { boolean active = behavior.getActive(button); boolean enabled = behavior.getEnabled(button); - Button theButton = buttonMap.get(button); + Button theButton = this.buttonMap.get(button); if (theButton != null) { theButton.setEnabled(enabled); 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 44b2574b..b68ffa03 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 @@ -18,13 +18,15 @@ package at.asit.pdfover.gui.composites; // Imports import java.io.File; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Label; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DropTarget; +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.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; @@ -32,12 +34,14 @@ import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.SWT; -import org.eclipse.swt.dnd.*; -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.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import at.asit.pdfover.gui.workflow.StateMachineImpl; import at.asit.pdfover.gui.workflow.states.State; /** @@ -60,7 +64,7 @@ public class DataSourceSelectComposite extends StateComposite { @Override public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(DataSourceSelectComposite.this.getShell(), SWT.OPEN); - dialog.setFilterExtensions(new String[] {"*.pdf"}); + dialog.setFilterExtensions(new String[] {"*.pdf"}); //$NON-NLS-1$ dialog.setFilterNames(new String[] {"PDF Dateien"}); String fileName = dialog.open(); File file = null; @@ -81,7 +85,7 @@ public class DataSourceSelectComposite extends StateComposite { /** * SFL4J Logger instance **/ - private static final Logger log = LoggerFactory + static final Logger log = LoggerFactory .getLogger(DataSourceSelectComposite.class); /** @@ -155,7 +159,7 @@ public class DataSourceSelectComposite extends StateComposite { File file = new File(files[0]); if(!file.exists()) { - log.error("File: " + files[0] + " doesnot exists!"); + log.error("File: " + files[0] + " does not exist!"); return; } DataSourceSelectComposite.this.setSelected(file); 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 6963c6f6..38b0f877 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 @@ -25,8 +25,7 @@ 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.slf4j.Logger; -import org.slf4j.LoggerFactory; + import at.asit.pdfover.gui.workflow.states.State; /** @@ -37,6 +36,12 @@ public class ErrorComposite extends StateComposite { * */ private final class OkSelectionListener implements SelectionListener { + /** + * + */ + public OkSelectionListener() { + } + @Override public void widgetSelected(SelectionEvent e) { ErrorComposite.this.userOk = true; @@ -49,20 +54,14 @@ public class ErrorComposite extends StateComposite { } } - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory - .getLogger(ErrorComposite.class); - boolean userOk = false; /** * Checks if the user has clicked OK - * @return + * @return whether the user has clicked OK */ public boolean isUserOk() { - return userOk; + return this.userOk; } private Exception exception; @@ -80,6 +79,7 @@ public class ErrorComposite extends StateComposite { * Create the composite. * @param parent * @param style + * @param state */ public ErrorComposite(Composite parent, int style, State state) { super(parent, style, state); 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 860cd095..6c79ed01 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 @@ -17,7 +17,6 @@ package at.asit.pdfover.gui.composites; // Imports import java.awt.Desktop; -import org.eclipse.swt.widgets.FileDialog; import java.io.File; import java.io.FileOutputStream; @@ -29,6 +28,7 @@ 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.FileDialog; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,9 +39,15 @@ import at.asit.pdfover.signator.DocumentSource; * GUI component for Output State */ public class OutputComposite extends StateComposite { - + /** - * Selection Listner for save button + * SLF4J Logger instance + **/ + static final Logger log = LoggerFactory + .getLogger(OutputComposite.class); + + /** + * SelectionListener for save button */ private final class SaveSelectionListener implements SelectionListener { @@ -56,7 +62,7 @@ public class OutputComposite extends StateComposite { public void widgetSelected(SelectionEvent e) { try { FileDialog save = new FileDialog(OutputComposite.this.getShell(), SWT.SAVE | SWT.NATIVE); - save.setFilterExtensions(new String[] {"*.pdf"}); + save.setFilterExtensions(new String[] {"*.pdf"}); //$NON-NLS-1$ save.setFilterNames(new String[] {"PDF Dateien"}); String target = save.open(); @@ -132,12 +138,6 @@ public class OutputComposite extends StateComposite { } } - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory - .getLogger(OutputComposite.class); - File savedFile = null; private DocumentSource signedDocument; 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 d641af62..e101d281 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 @@ -22,8 +22,6 @@ import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.workflow.states.State; import at.asit.pdfover.signator.SignaturePosition; @@ -59,17 +57,11 @@ public class PositioningComposite extends StateComposite { } } - /** - * SFL4J Logger instance - **/ - private static final Logger log = LoggerFactory - .getLogger(PositioningComposite.class); - private SignaturePosition position = null; /** - * Gets the Position - * @return + * Gets the position of the signature + * @return the SignaturePosition */ public SignaturePosition getPosition() { return this.position; @@ -87,6 +79,7 @@ public class PositioningComposite extends StateComposite { * Create the composite. * @param parent * @param style + * @param state */ public PositioningComposite(Composite parent, int style, State state) { super(parent, style, state); 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 0b21e3aa..dcc82394 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 @@ -17,8 +17,6 @@ package at.asit.pdfover.gui.composites; // Imports import org.eclipse.swt.widgets.Composite; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.workflow.states.State; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingComposite.java index 4101e924..1b609dc9 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingComposite.java @@ -16,28 +16,19 @@ package at.asit.pdfover.gui.composites; // Imports -import org.eclipse.swt.widgets.Composite; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.eclipse.swt.widgets.ProgressBar; import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.ProgressBar; -import at.asit.pdfover.gui.workflow.StateMachineImpl; import at.asit.pdfover.gui.workflow.states.State; /** * */ public class WaitingComposite extends StateComposite { - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory - .getLogger(WaitingComposite.class); - /** * Create the composite. * @param parent diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java index ccb411be..c1586d45 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java @@ -16,15 +16,15 @@ package at.asit.pdfover.gui.workflow.states; // Imports -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.commons.codec.binary.Base64; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.PostMethod; -import at.asit.pdfover.gui.MainWindowBehavior; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import at.asit.pdfover.gui.MainWindow.Buttons; +import at.asit.pdfover.gui.MainWindowBehavior; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; import at.asit.pdfover.signator.SLRequest; -- cgit v1.2.3