summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:51:24 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:51:24 +0000
commit782e41eee1f04f86bc895a95cd2d51353284987a (patch)
tree746d56e559d27f6a54a1ad63901dc5135d7128d2 /pdf-over-gui/src/main/java/at
parent5793f0dc194ae3519de7a12808d99aa2a555cd73 (diff)
downloadpdf-over-782e41eee1f04f86bc895a95cd2d51353284987a.tar.gz
pdf-over-782e41eee1f04f86bc895a95cd2d51353284987a.tar.bz2
pdf-over-782e41eee1f04f86bc895a95cd2d51353284987a.zip
Refactoring
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@11 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java17
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java13
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Workflow.java156
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/WorkflowState.java32
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java15
-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/PositioningState.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java14
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java15
11 files changed, 322 insertions, 0 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
new file mode 100644
index 00000000..c68a3f90
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
@@ -0,0 +1,17 @@
+package at.asit.pdfover.gui;
+
+import at.asit.pdfover.gui.workflow.Workflow;
+
+public class DeveloperMain {
+
+ /**
+ * Developer Main Entry point...
+ * @param args
+ */
+ public static void main(String[] args) {
+ Workflow flow = new Workflow(args);
+
+ flow.Start();
+ }
+
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java
new file mode 100644
index 00000000..2eb27630
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java
@@ -0,0 +1,13 @@
+package at.asit.pdfover.gui;
+
+public class Main {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Workflow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Workflow.java
new file mode 100644
index 00000000..bc0e290c
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Workflow.java
@@ -0,0 +1,156 @@
+package at.asit.pdfover.gui.workflow;
+
+import java.util.Properties;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import at.asit.pdfover.gui.workflow.states.PrepareConfigurationState;
+
+public class Workflow {
+ public Workflow(String[] cmdLineArgs) {
+ setCmdLineAargs(cmdLineArgs);
+ }
+
+ /**
+ * @uml.property name="state"
+ * @uml.associationEnd multiplicity="(1 1)" aggregation="shared"
+ * inverse="workflow1:at.asit.pdfover.gui.workflow.WorkflowState"
+ */
+ private WorkflowState state = new PrepareConfigurationState();
+
+ /**
+ * Getter of the property <tt>state</tt>
+ *
+ * @return Returns the state.
+ * @uml.property name="state"
+ */
+ public WorkflowState getState() {
+ return this.state;
+ }
+
+ private String[] cmdLineArgs = new String[] {};
+
+ /**
+ * sets the command line arguments
+ *
+ * @param cmdLineArgs
+ */
+ private void setCmdLineAargs(String[] cmdLineArgs) {
+ this.cmdLineArgs = cmdLineArgs;
+ }
+
+ /**
+ * Gets the command line arguments
+ *
+ * @return the command line arguments
+ */
+ public String[] GetCmdArgs() {
+ return this.cmdLineArgs;
+ }
+
+ private Properties persistentState = new Properties();
+
+ /**
+ * Gets the persistent state
+ *
+ * @return the persistent state
+ */
+ public Properties GetPersistentState() {
+ return this.persistentState;
+ }
+
+ /**
+ * Update Workflow logic and let state machine do its job...
+ */
+ public void Update() {
+ WorkflowState next = null;
+ do {
+ this.state.update(this);
+ next = this.state.nextState();
+ } while (next != null);
+ }
+
+ private Display display = null;
+
+ private Shell shell = null;
+
+ private Composite container = null;
+
+ private void CreateMainWindow() {
+ //TODO: Instantiate Main Window Class
+ this.display = Display.getDefault();
+ this.shell = new Shell();
+ this.shell.setSize(608, 340);
+ this.shell.setText("PDFOver 4.0!! :)");
+
+ this.container = new Composite(this.shell, SWT.NONE);
+ this.container.setBounds(20, 44, 572, 257);
+
+ this.shell.open();
+ this.shell.layout();
+ }
+
+ /**
+ * Gets the Shell for drawing the ui
+ *
+ * @return Composite
+ */
+ public Composite GetComposite() {
+ // TODO: implement
+ // Main window will be build on first call
+ // returns SWT Composite container for states to draw their GUI
+
+ if(this.container == null) {
+ this.CreateMainWindow();
+ }
+
+ if(this.container == null) {
+ // TODO throw Exception...
+ }
+
+ return this.container;
+ }
+
+ /**
+ * Only returns a shell if one was already created ...
+ *
+ * @return
+ */
+ private Shell NonCreatingGetShell() {
+ return this.shell;
+ }
+
+ /**
+ * Only returns a shell if one was already created ...
+ *
+ * @return
+ */
+ private Display NonCreatingGetDisplay() {
+ return this.display;
+ }
+
+ /**
+ * Workflow main entrance point
+ */
+ public void Start() {
+ // Call update to start processing ...
+ this.Update();
+
+ // if a user interaction is required we have a shell ...
+ Shell shell = this.NonCreatingGetShell();
+ Display display = this.NonCreatingGetDisplay();
+
+ if (shell != null && display != null) {
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ display.dispose();
+ }
+ }
+
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/WorkflowState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/WorkflowState.java
new file mode 100644
index 00000000..f9d10d08
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/WorkflowState.java
@@ -0,0 +1,32 @@
+package at.asit.pdfover.gui.workflow;
+
+/**
+ * Base state class
+ * @author afitzek
+ */
+public abstract class WorkflowState {
+
+ private WorkflowState _next = null;
+
+ /**
+ * Gets the next logical state or null if this their is no state transition
+ * @return the next state (or null)
+ */
+ public WorkflowState nextState() {
+ return this._next;
+ }
+
+ /**
+ * Sets the next logical state
+ * @param state
+ */
+ protected void setNextState(WorkflowState state) {
+ this._next = state;
+ }
+
+ /**
+ * Perform main logic for this state
+ * @param workflow
+ */
+ public abstract void update(Workflow workflow);
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java
new file mode 100644
index 00000000..657de4be
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java
@@ -0,0 +1,15 @@
+package at.asit.pdfover.gui.workflow.states;
+
+import at.asit.pdfover.gui.workflow.Workflow;
+import at.asit.pdfover.gui.workflow.WorkflowState;
+
+
+public class BKUSelectionState extends WorkflowState {
+
+ @Override
+ public void update(Workflow workflow) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java
new file mode 100644
index 00000000..11b8c4ae
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java
@@ -0,0 +1,15 @@
+package at.asit.pdfover.gui.workflow.states;
+
+import at.asit.pdfover.gui.workflow.Workflow;
+import at.asit.pdfover.gui.workflow.WorkflowState;
+
+
+public class DataSourceSelectionState extends WorkflowState {
+
+ @Override
+ public void update(Workflow workflow) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
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
new file mode 100644
index 00000000..a11364f2
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
@@ -0,0 +1,15 @@
+package at.asit.pdfover.gui.workflow.states;
+
+import at.asit.pdfover.gui.workflow.Workflow;
+import at.asit.pdfover.gui.workflow.WorkflowState;
+
+
+public class OutputState extends WorkflowState {
+
+ @Override
+ public void update(Workflow workflow) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java
new file mode 100644
index 00000000..c2b31247
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java
@@ -0,0 +1,15 @@
+package at.asit.pdfover.gui.workflow.states;
+
+import at.asit.pdfover.gui.workflow.Workflow;
+import at.asit.pdfover.gui.workflow.WorkflowState;
+
+
+public class PositioningState extends WorkflowState {
+
+ @Override
+ public void update(Workflow workflow) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
new file mode 100644
index 00000000..31d8a604
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
@@ -0,0 +1,14 @@
+package at.asit.pdfover.gui.workflow.states;
+
+import at.asit.pdfover.gui.workflow.Workflow;
+import at.asit.pdfover.gui.workflow.WorkflowState;
+
+
+public class PrepareConfigurationState extends WorkflowState {
+
+ @Override
+ public void update(Workflow workflow) {
+ // TODO Auto-generated method stub
+ }
+
+}
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
new file mode 100644
index 00000000..ba6e7dc4
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
@@ -0,0 +1,15 @@
+package at.asit.pdfover.gui.workflow.states;
+
+import at.asit.pdfover.gui.workflow.Workflow;
+import at.asit.pdfover.gui.workflow.WorkflowState;
+
+
+public class PrepareSigningState extends WorkflowState {
+
+ @Override
+ public void update(Workflow workflow) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
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
new file mode 100644
index 00000000..ed54d82f
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
@@ -0,0 +1,15 @@
+package at.asit.pdfover.gui.workflow.states;
+
+import at.asit.pdfover.gui.workflow.Workflow;
+import at.asit.pdfover.gui.workflow.WorkflowState;
+
+
+public class SigningState extends WorkflowState {
+
+ @Override
+ public void update(Workflow workflow) {
+ // TODO Auto-generated method stub
+
+ }
+
+}