summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:53:41 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:53:41 +0000
commit23ae1caefcf0cc99c2b90327afaff6376ecc552a (patch)
tree644167228a6b721760b1f024b3ddd94ede77c14e /pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java
parent7d6879d2f2ad32b79878567438bdb231cbc798d5 (diff)
downloadpdf-over-23ae1caefcf0cc99c2b90327afaff6376ecc552a.tar.gz
pdf-over-23ae1caefcf0cc99c2b90327afaff6376ecc552a.tar.bz2
pdf-over-23ae1caefcf0cc99c2b90327afaff6376ecc552a.zip
PDF-AS signature working with local BKU
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@26 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java116
1 files changed, 116 insertions, 0 deletions
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
new file mode 100644
index 00000000..e444fbf9
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2012 by A-SIT, Secure Information Technology Center Austria
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://joinup.ec.europa.eu/software/page/eupl
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ */
+package at.asit.pdfover.gui.workflow.states;
+
+// Imports
+import org.eclipse.swt.SWT;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.asit.pdfover.gui.composites.ErrorComposite;
+import at.asit.pdfover.gui.workflow.StateMachine;
+import at.asit.pdfover.gui.workflow.Status;
+
+/**
+ *
+ */
+public class ErrorState extends State {
+ /**
+ * @param stateMachine
+ */
+ public ErrorState(StateMachine stateMachine) {
+ super(stateMachine);
+ }
+
+ private Exception exception;
+
+ private boolean userInformed = false;
+
+ /**
+ * SLF4J Logger instance
+ **/
+ static final Logger log = LoggerFactory.getLogger(ErrorState.class);
+
+ private ErrorComposite errorComposite = null;
+
+ private ErrorComposite getComposite() {
+ if (this.errorComposite == null) {
+ this.errorComposite =
+ this.stateMachine.getGUIProvider().createComposite(ErrorComposite.class, SWT.RESIZE, this);
+ }
+
+ return this.errorComposite;
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.states.State#run()
+ */
+ @Override
+ public void run() {
+ Status status = this.stateMachine.getStatus();
+
+ if(this.errorComposite != null) {
+ this.userInformed = this.errorComposite.isUserOk();
+ }
+
+ if(this.exception != null && !this.userInformed) {
+ // Display Exception ....
+ ErrorComposite errorComposite = this.getComposite();
+ this.errorComposite.setException(this.exception);
+
+ this.userInformed = this.errorComposite.isUserOk();
+
+ this.stateMachine.getGUIProvider().display(errorComposite);
+ }
+
+ // TODO: Think should we do this? (possible infinity loop with exception ...)
+ this.setNextState(status.getPreviousState());
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.states.State#cleanUp()
+ */
+ @Override
+ public void cleanUp() {
+ // TODO
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.states.State#updateMainWindowBehavior()
+ */
+ @Override
+ public void updateMainWindowBehavior() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * Gets the Exception
+ * @return the exception
+ */
+ public Exception getException() {
+ return this.exception;
+ }
+
+ /**
+ * Sets the Exception
+ * @param exception the exception to set
+ */
+ public void setException(Exception exception) {
+ this.exception = exception;
+ }
+
+}