summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main/java')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java33
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ErrorComposite.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java5
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java43
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java1
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java1
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java1
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java1
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java10
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java20
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java2
21 files changed, 96 insertions, 87 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java
index 0e78e507..d95bb466 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java
@@ -50,12 +50,13 @@ import org.eclipse.swt.layout.FormAttachment;
public class ConfigurationComposite extends StateComposite {
/**
- *
+ * Configuration Mode selection listener
*/
private final class ConfigurationModeSelectionListener implements
SelectionListener {
+
/**
- *
+ * Constructor
*/
public ConfigurationModeSelectionListener() {
// Nothing to do
@@ -100,22 +101,50 @@ public class ConfigurationComposite extends StateComposite {
private static final Logger log = LoggerFactory
.getLogger(ConfigurationComposite.class);
+ /**
+ * configuration manipulator
+ */
ConfigManipulator configManipulator = null;
+ /**
+ * configuration provider
+ */
ConfigProvider configProvider = null;
+ /**
+ * current base configuration composite
+ */
BaseConfigurationComposite configComposite;
+ /**
+ * configuration container
+ * Keeps state for current configuration changes
+ */
ConfigurationContainer configurationContainer = new ConfigurationContainerImpl();
+ /**
+ * The stack layout
+ */
StackLayout compositeStack = new StackLayout();
+ /**
+ * SWT style
+ */
int style;
+ /**
+ * base configuration container
+ */
Composite containerComposite;
+ /**
+ * checks wether the user is done
+ */
boolean userDone = false;
+ /**
+ * Button advanced
+ */
Button btnAdvanced;
/**
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 afa7be3e..8146a02d 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
@@ -195,7 +195,7 @@ public class DataSourceSelectComposite extends StateComposite {
}
});
- final Label lbl_drag = new Label(this.drop_area, SWT.NONE | SWT.RESIZE);
+ final Label lbl_drag = new Label(this.drop_area, SWT.NONE | SWT.RESIZE );
this.fd_lbl_drag = new FormData();
this.fd_lbl_drag.left = new FormAttachment(0, 10);
this.fd_lbl_drag.right = new FormAttachment(100, -10);
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 f8a6fbcb..c85d046e 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
@@ -114,7 +114,7 @@ public class ErrorComposite extends StateComposite {
*/
@Override
public void doLayout() {
- // TODO Auto-generated method stub
+ // Nothing to do
}
}
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 595ca1bd..6552c3d5 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
@@ -99,8 +99,7 @@ public class MobileBKUEnterNumberComposite extends StateComposite {
*/
@Override
public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
+ // Nothing to do here
}
}
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 95184775..ff8d5c63 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
@@ -61,8 +61,6 @@ public class MobileBKUEnterTANComposite extends StateComposite {
return;
}
- // TODO: Check TAN!
-
MobileBKUEnterTANComposite.this.tan = tan;
MobileBKUEnterTANComposite.this.setUserAck(true);
MobileBKUEnterTANComposite.this.state.updateStateMachine();
@@ -227,8 +225,7 @@ public class MobileBKUEnterTANComposite extends StateComposite {
*/
@Override
public void doLayout() {
- // TODO Auto-generated method stub
-
+ // 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 26e5480c..afa2a2e7 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
@@ -32,6 +32,7 @@ import org.eclipse.swt.widgets.FileDialog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.workflow.states.State;
import at.asit.pdfover.signator.DocumentSource;
@@ -116,7 +117,9 @@ public class OutputComposite extends StateComposite {
return;
}
} else {
- // TODO: Handle exception ...
+ log.error("OutputComposite:OpenSelectionListener:widgetSelected -> source is null!!"); //$NON-NLS-1$
+ ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE, "Failed to get signed document.", "");
+ dialog.open();
}
} catch (Exception ex) {
log.error("OpenSelectionListener: ", ex); //$NON-NLS-1$
@@ -200,8 +203,7 @@ public class OutputComposite extends StateComposite {
*/
@Override
public void doLayout() {
- // TODO Auto-generated method stub
-
+ // Nothing to do
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java
index 3830d6cf..a0977b9e 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java
@@ -54,6 +54,7 @@ import org.eclipse.swt.widgets.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.controls.ErrorMarker;
import at.asit.pdfover.gui.exceptions.InvalidEmblemFile;
import at.asit.pdfover.gui.exceptions.InvalidNumberException;
@@ -75,7 +76,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
*
*/
public ImageFileBrowser() {
- // TODO Auto-generated constructor stub
+ // Nothing to do
}
@Override
@@ -224,8 +225,9 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
// String filename = this.txtEmblemFile.getText();
plainEmblemSetter(filename);
} catch (Exception ex) {
- // TODO: Show error message!
log.error("processEmblemChanged: ", ex); //$NON-NLS-1$
+ ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE, "Failed to load the emblem", ex);
+ dialog.open();
}
}
@@ -244,7 +246,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
this.txtMobileNumberErrorMarker.setVisible(false);
plainMobileNumberSetter();
} catch (Exception ex) {
- // TODO: Show error message!
this.txtMobileNumberErrorMarker.setVisible(true);
this.txtMobileNumberErrorMarker
.setToolTipText("Phone number is invalid! Please provide in the form: +43676123456789");
@@ -271,7 +272,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
this.proxyHostErrorMarker.setVisible(false);
plainProxyHostSetter();
} catch (Exception ex) {
- // TODO: Show error message!
this.proxyHostErrorMarker.setVisible(true);
this.proxyHostErrorMarker.setToolTipText(ex.getMessage());
log.error("processProxyHost: ", ex); //$NON-NLS-1$
@@ -291,7 +291,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
this.txtProxyPortErrorMarker.setVisible(false);
plainProxyPortSetter();
} catch (Exception ex) {
- // TODO: Show error message!
this.txtProxyPortErrorMarker.setVisible(true);
this.txtProxyPortErrorMarker.setToolTipText(ex.getMessage());
log.error("processProxyPort: ", ex); //$NON-NLS-1$
@@ -513,8 +512,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
SimpleConfigurationComposite.this.configurationContainer
.setEmblem(null);
} catch (InvalidEmblemFile e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
+ log.error("THIS EXCEPTION IS IMPOSSIBLE! ", e1); //$NON-NLS-1$
}
}
}
@@ -729,8 +727,9 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
this.setEmblemFileInternal(emblemFile, true);
this.btnUseImage.setSelection(true);
} catch (Exception e1) {
- // TODO Auto-generated catch block
log.error("Failed to load emblem: ", e1); //$NON-NLS-1$
+ ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE, "Failed to load emblem.", e1);
+ dialog.open();
}
}
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);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java
index 1adc45a4..4850a313 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java
@@ -25,8 +25,6 @@ import at.asit.pdfover.signator.SignaturePosition;
*
*/
public interface ConfigProvider {
- //TODO: define interface for config provider ....
-
/**
* Regex for parsing signature position
*/
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java
index 90b2fba9..ece1cf7f 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java
@@ -18,6 +18,7 @@ package at.asit.pdfover.gui.workflow;
//Imports
import java.lang.reflect.Constructor;
+import org.eclipse.swt.SWTException;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -25,6 +26,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.MainWindow;
+import at.asit.pdfover.gui.workflow.states.ErrorState;
import at.asit.pdfover.gui.workflow.states.PrepareConfigurationState;
import at.asit.pdfover.gui.workflow.states.State;
@@ -84,7 +86,9 @@ public class StateMachineImpl implements StateMachine, GUIProvider {
current.run();
} catch (Exception e) {
log.error("StateMachine update: ", e); //$NON-NLS-1$
- // TODO: GOTO generic error state!
+ ErrorState errorState = new ErrorState(this);
+ errorState.setException(e);
+ jumpToState(errorState);
}
if (this.exit) {
@@ -203,10 +207,6 @@ public class StateMachineImpl implements StateMachine, GUIProvider {
this.createMainWindow();
}
- if (this.container == null) {
- // TODO throw Exception...
- }
-
return this.container;
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java
index af648dfd..dd240616 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java
@@ -100,8 +100,7 @@ public class ErrorState extends State {
*/
@Override
public void updateMainWindowBehavior() {
- // TODO Auto-generated method stub
-
+ // Stay in previous state behavior
}
/**
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 ca0e164c..9962d968 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
@@ -20,11 +20,14 @@ 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 org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
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.controls.ErrorDialog;
import at.asit.pdfover.gui.workflow.StateMachine;
import at.asit.pdfover.gui.workflow.Status;
import at.asit.pdfover.signator.SLRequest;
@@ -86,7 +89,7 @@ public class LocalBKUState extends State {
log.debug("SL REQUEST: " + sl_request); //$NON-NLS-1$
method.addParameter("XMLRequest", sl_request); //$NON-NLS-1$
-
+
int returnCode = client.executeMethod(method);
if(returnCode == HttpStatus.SC_OK)
@@ -115,13 +118,12 @@ public class LocalBKUState extends State {
SLResponse slResponse = new SLResponse(response, server, userAgent, signatureLayout);
this.state.signingState.setSignatureResponse(slResponse);
} else {
- // TODO: Create HTTP exception
this.state.threadException = new HttpException(method.getResponseBodyAsString());
}
} catch (Exception e) {
log.error("SignLocalBKUThread: ", e); //$NON-NLS-1$
- // TODO: Is local BKU running?
+ //
this.state.threadException = e;
} finally {
this.state.stateMachine.invokeUpdate();
@@ -168,17 +170,13 @@ public class LocalBKUState extends State {
}
if(this.threadException != null) {
- ErrorState error = new ErrorState(this.stateMachine);
- error.setException(this.threadException);
- this.setNextState(error);
+ ErrorDialog dialog = new ErrorDialog(Display.getCurrent().getActiveShell(), SWT.NONE, "Please check if a local BKU is running", this.threadException);
+ dialog.open();
+ this.threadException = null;
+ this.run();
return;
}
- if(!this.signingState.hasSignatureResponse()) {
- // The thread should set the response or the thread exception!!!
- // TODO: Jump to error state!
- }
-
// OK
this.setNextState(new SigningState(this.stateMachine));
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
index 2ebc3f39..a1748287 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
@@ -66,8 +66,6 @@ public class OutputState extends State {
@Override
public void run() {
- // TODO Preform output operations ... end workflow
-
Status status = this.stateMachine.getStatus();
if (status.getSignResult() != null) {
@@ -97,20 +95,7 @@ public class OutputState extends State {
}
}
- /*
- * DocumentSource signedDocument =
- * status.getSignResult().getSignedDocument();
- *
- * FileOutputStream output; try { output = new FileOutputStream(new
- * File("/tmp/test.pdf"));
- * output.write(signedDocument.getByteArray(), 0,
- * signedDocument.getByteArray().length); output.close(); } catch
- * (IOException e) { // TODO Auto-generated catch block
- * e.printStackTrace(); }
- */
}
-
- // this.stateMachine.exit();
}
/*
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
index 88acc84b..af6cc3bd 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
@@ -76,8 +76,6 @@ public class PrepareSigningState extends State {
this.state.signatureParameter.setSignatureDevice(status.getBKU());
this.state.signatureParameter.setSignaturePosition(status.getSignaturePosition());
- // TODO: Fill library specific signature Parameters ...
-
if(configuration.getDefaultEmblem() != null && !configuration.getDefaultEmblem().equals("")) { //$NON-NLS-1$
this.state.signatureParameter.setEmblem(new FileNameEmlbem(configuration.getDefaultEmblem()));
}
@@ -145,11 +143,6 @@ public class PrepareSigningState extends State {
return;
}
- if(this.signingState == null || this.signingState.getSignatureRequest() == null) {
- // This shouldnot happen!! PrepareDocumentThread allready performed, either we have a valid signingState or an exception!!
- // TODO: Jump to error state!
- }
-
// We got the Request set it into status and move on to next state ...
status.setSigningState(this.signingState);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
index 20813f00..413f125c 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
@@ -89,12 +89,7 @@ public class SigningState extends State {
this.setNextState(error);
return;
}
-
- if(status.getSignResult() == null) {
- // The thread should set the threadException or create a valid signResult
- // TODO: Jump to error state
- }
-
+
this.setNextState(new OutputState(this.stateMachine));
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java
index a1868462..ee984e96 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java
@@ -67,11 +67,9 @@ public class ATrustHelper {
if (endidx > startidx) {
return data.substring(startidx, endidx);
}
- // TODO: throw proper exception
log.error("extracting Tag: end tag not valid!: " + start + " ... " + end); //$NON-NLS-1$//$NON-NLS-2$
throw new Exception("end tag not available!"); //$NON-NLS-1$
}
- // TODO: throw proper exception
log.error("extracting Tag: start tag not valid!: " + start + " ... " + end); //$NON-NLS-1$//$NON-NLS-2$
throw new Exception("start tag not available!"); //$NON-NLS-1$
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
index bd2f5b53..fb52fce8 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
@@ -77,7 +77,7 @@ public class PostSLRequestThread implements Runnable {
PostMethod method = new PostMethod(url);
method.addParameter("XMLRequest", sl_request); //$NON-NLS-1$
-
+
int returnCode = client.executeMethod(method);
String redirectLocation = null;