From ae02de65e89817e4e5ef56e7e7c48ef1e15a8bd8 Mon Sep 17 00:00:00 2001 From: tkellner Date: Fri, 31 Jan 2014 13:42:35 +0000 Subject: Threading git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@500 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../pdfover/gui/composites/DataSourceSelectComposite.java | 1 + .../java/at/asit/pdfover/gui/workflow/StateMachineImpl.java | 11 ++++++----- .../at/asit/pdfover/gui/workflow/states/LocalBKUState.java | 2 +- .../asit/pdfover/gui/workflow/states/PrepareSigningState.java | 2 +- .../at/asit/pdfover/gui/workflow/states/SigningState.java | 2 +- .../main/java/at/asit/pdfover/gui/workflow/states/State.java | 4 ++-- 6 files changed, 12 insertions(+), 10 deletions(-) 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 5cbc71a7..9f07312b 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 @@ -202,6 +202,7 @@ public class DataSourceSelectComposite extends StateComposite { dnd_target.addDropListener(new DropTargetAdapter() { @Override public void drop(DropTargetEvent event) { + log.debug("Drop received: " + event); //$NON-NLS-1$ if (fileTransfer.isSupportedType(event.currentDataType)) { if (event.data == null) { log.error("Dropped file name was null"); //$NON-NLS-1$ 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 12d57d4d..a42191ff 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 @@ -68,7 +68,8 @@ public class StateMachineImpl implements StateMachine, GUIProvider { } /** - * Sets the workflow state this method should be used to let the user jump + * Sets the workflow state + * This method should be used to let the user jump * around between states. This Method also resets certain properties defined * by later states then state * @@ -77,14 +78,14 @@ public class StateMachineImpl implements StateMachine, GUIProvider { @Override public void jumpToState(State state) { this.status.setCurrentState(state); - this.update(); + this.invokeUpdate(); } /** - * Update Workflow logic and let state machine do its job... + * Update workflow logic and let state machine do its job... */ @Override - public void update() { + public synchronized void update() { State next = null; while (this.status.getCurrentState() != null) { State current = this.status.getCurrentState(); @@ -248,7 +249,7 @@ public class StateMachineImpl implements StateMachine, GUIProvider { */ public void start() { // Call update to start processing ... - this.update(); + update(); // if a user interaction is required we have a shell ... Shell shell = this.nonCreatingGetShell(); 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 66c0f061..4ca27896 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 @@ -170,7 +170,7 @@ public class LocalBKUState extends State { // this.state.threadException = e; } finally { - this.state.getStateMachine().invokeUpdate(); + this.state.updateStateMachine(); } } 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 fc020989..d64c1843 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 @@ -165,7 +165,7 @@ public class PrepareSigningState extends State { log.error("PrepareDocumentThread: ", e); //$NON-NLS-1$ this.state.threadException = e; } finally { - this.state.getStateMachine().invokeUpdate(); + this.state.updateStateMachine(); } } } 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 14e79a5c..ab77881a 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 @@ -59,7 +59,7 @@ public class SigningState extends State { log.error("FinishSignThread: ", e); //$NON-NLS-1$ this.state.threadException = e; } finally { - this.state.getStateMachine().invokeUpdate(); + this.state.updateStateMachine(); } } } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/State.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/State.java index 975e612f..54842137 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/State.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/State.java @@ -64,13 +64,13 @@ public abstract class State { * Perform status cleanup */ public abstract void cleanUp(); - + /** * Update the state machine */ public void updateStateMachine() { - this.stateMachine.update(); + this.stateMachine.invokeUpdate(); } /** -- cgit v1.2.3