summaryrefslogtreecommitdiff
path: root/trunk/pdf-over-gui/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/pdf-over-gui/src/main/java')
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java4
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/DataSourceSelectComposite.java159
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/MainWindow.java192
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/PositioningComposite.java63
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/StateComposite.java32
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Workflow.java79
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/WorkflowState.java12
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java9
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java54
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java9
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java33
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java9
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java9
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java9
14 files changed, 650 insertions, 23 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
index 7b883d0a..202d28f7 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
@@ -16,6 +16,7 @@
package at.asit.pdfover.gui;
//Imports
+import org.apache.log4j.BasicConfigurator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.workflow.Workflow;
@@ -36,6 +37,9 @@ public class DeveloperMain {
* @param args
*/
public static void main(String[] args) {
+
+ BasicConfigurator.configure();
+
Workflow flow = new Workflow(args);
flow.start();
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/DataSourceSelectComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/DataSourceSelectComposite.java
new file mode 100644
index 00000000..cffef8cc
--- /dev/null
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/DataSourceSelectComposite.java
@@ -0,0 +1,159 @@
+/*
+ * 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.components;
+
+// Imports
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+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;
+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 at.asit.pdfover.gui.workflow.Workflow;
+
+/**
+ *
+ *
+ */
+public class DataSourceSelectComposite extends Composite implements StateComposite {
+
+ /**
+ * SFL4J Logger instance
+ **/
+ private static final Logger log = LoggerFactory
+ .getLogger(DataSourceSelectComposite.class);
+
+ private Workflow workflow;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ * @param flow
+ */
+ public DataSourceSelectComposite(Composite parent, int style, Workflow flow) {
+ super(parent, style);
+
+ this.workflow = flow;
+
+ this.setLayout(new FormLayout());
+
+ Color back = new Color(Display.getCurrent(), 77, 190, 250);
+
+ this.drop_area = new Composite(this, SWT.RESIZE | SWT.BORDER_DASH);
+ FormData fd_drop_area = new FormData();
+ fd_drop_area.left = new FormAttachment(0, 0);
+ fd_drop_area.right = new FormAttachment(100, 0);
+ fd_drop_area.top = new FormAttachment(0, 0);
+ fd_drop_area.bottom = new FormAttachment(100, 0);
+ this.drop_area.setLayoutData(fd_drop_area);
+ this.drop_area.setLayout(new FormLayout());
+ this.drop_area.setBackground(back);
+
+ final Label lbl_drag = new Label(this.drop_area, SWT.NONE | SWT.RESIZE );
+ FormData fd_lbl_drag = new FormData();
+ fd_lbl_drag.left = new FormAttachment(5, 5);
+ fd_lbl_drag.right = new FormAttachment(100, -5);
+ fd_lbl_drag.top = new FormAttachment(5, 5);
+ fd_lbl_drag.bottom = new FormAttachment(55, -5);
+ lbl_drag.setLayoutData(fd_lbl_drag);
+ FontData[] fD = lbl_drag.getFont().getFontData();
+ fD[0].setHeight(18);
+ lbl_drag.setFont( new Font(Display.getCurrent(),fD[0]));
+ lbl_drag.setText("Drag and Drop");
+ lbl_drag.setAlignment(SWT.CENTER);
+ lbl_drag.setBackground(back);
+
+
+ Button btn_open = new Button(this.drop_area, SWT.NATIVE | SWT.RESIZE );
+ btn_open.setText("Choose file ...");
+ Point size = btn_open.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ FormData fd_btn_open = new FormData();
+ fd_btn_open.left = new FormAttachment(100, size.x * -1 - 10);
+ fd_btn_open.right = new FormAttachment(100, -5);
+ fd_btn_open.top = new FormAttachment(100, size.y * -1 - 10);
+ fd_btn_open.bottom = new FormAttachment(100, -5);
+ btn_open.setLayoutData(fd_btn_open);
+ btn_open.setBackground(back);
+
+ this.drop_area.pack();
+
+ /*Button btn = new Button(this, SWT.NATIVE);
+ btn.setBounds(50, 20, 100, 50);
+ btn.setText("Click Me");
+ btn.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent arg0) {
+ DataSourceSelectComposite.this.setPress(true);
+ DataSourceSelectComposite.this.workflow.update();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent arg0) {
+ // TODO Auto-generated method stub
+
+ }
+ });*/
+ }
+
+ private boolean press = false;
+
+ private Composite drop_area;
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ /**
+ * @return the press
+ */
+ public boolean isPress() {
+ return this.press;
+ }
+
+ /**
+ * @param press the press to set
+ */
+ public void setPress(boolean press) {
+ this.press = press;
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.components.StateComposite#doLayout()
+ */
+ @Override
+ public void doLayout() {
+ this.layout(true, true);
+ this.drop_area.layout(true, true);
+ }
+}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/MainWindow.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/MainWindow.java
new file mode 100644
index 00000000..704a2440
--- /dev/null
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/MainWindow.java
@@ -0,0 +1,192 @@
+/*
+ * 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.components;
+
+// Imports
+import javax.swing.GroupLayout;
+
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormAttachment;
+
+/**
+ * The Main Window of PDFOver 4.0
+ */
+public class MainWindow {
+
+ /**
+ * SFL4J Logger instance
+ **/
+ private static final Logger log = LoggerFactory.getLogger(MainWindow.class);
+ private Shell shell;
+ private CLabel lbl_status;
+ private Composite container;
+ private StackLayout stack;
+
+ /**
+ * Set current status (may be removed in production release)
+ * @param value
+ */
+ public void setStatus(String value) {
+ this.lbl_status.setText("[DEBUG]: Current workflow state: " + value);
+ }
+
+ /**
+ * Sets top level composite for stack layout
+ * @param ctrl
+ */
+ public void setTopControl(Control ctrl) {
+ log.debug("Top control: " + ctrl.toString());
+ this.stack.topControl = ctrl;
+ this.container.layout(true, true);
+ this.shell.layout(true, true);
+ // Note: SWT only layouts children! No grandchildren!
+ if(ctrl instanceof StateComposite) {
+ ((StateComposite)ctrl).doLayout();
+ }
+ }
+
+ /**
+ * Gets the container composite
+ * @return
+ */
+ public Composite getContainer() {
+ return this.container;
+ }
+
+ /**
+ * Entrance point for swt designer
+ * @param args
+ */
+ public static void main(String[] args) {
+ Display display = Display.getDefault();
+
+ MainWindow window = new MainWindow();
+
+ window.open();
+
+ window.getShell().open();
+ window.getShell().layout();
+ while (!window.getShell().isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ }
+
+ /**
+ * Open the window.
+ * @wbp.parser.entryPoint
+ */
+ public void open() {
+ createContents();
+ }
+
+ /**
+ * Create contents of the window.
+ */
+ protected void createContents() {
+ this.shell = new Shell();
+ getShell().setSize(450, 329);
+ getShell().setText("PDF OVER 4.0! :)");
+
+ getShell().setLayout(new FormLayout());
+
+
+
+ Composite composite = new Composite(getShell(), SWT.NONE);
+ FormData fd_composite = new FormData();
+ fd_composite.left = new FormAttachment(0, 5);
+ fd_composite.right = new FormAttachment(100, -5);
+ fd_composite.top = new FormAttachment(0, 5);
+ fd_composite.bottom = new FormAttachment(0, 40);
+ composite.setLayoutData(fd_composite);
+ composite.setLayout(new FormLayout());
+
+ Button btn_config = new Button(composite, SWT.NONE);
+ FormData fd_config = new FormData();
+ fd_config.left = new FormAttachment(0, 0);
+ fd_config.right = new FormAttachment(25, 0);
+ fd_config.top = new FormAttachment(0, 0);
+ fd_config.bottom = new FormAttachment(100, 0);
+ btn_config.setLayoutData(fd_config);
+ btn_config.setText("Config ...");
+
+ Button btn_open = new Button(composite, SWT.NONE);
+ FormData fd_open = new FormData();
+ fd_open.left = new FormAttachment(25, 0);
+ fd_open.right = new FormAttachment(50, 0);
+ fd_open.top = new FormAttachment(0, 0);
+ fd_open.bottom = new FormAttachment(100, 0);
+ btn_open.setLayoutData(fd_open);
+ btn_open.setText("Open ...");
+
+ Button btn_position = new Button(composite, SWT.NONE);
+ FormData fd_position = new FormData();
+ fd_position.left = new FormAttachment(50, 0);
+ fd_position.right = new FormAttachment(75, 0);
+ fd_position.top = new FormAttachment(0, 0);
+ fd_position.bottom = new FormAttachment(100, 0);
+ btn_position.setLayoutData(fd_position);
+ btn_position.setText("Positon ...");
+
+ Button btn_sign = new Button(composite, SWT.NONE);
+ FormData fd_sign = new FormData();
+ fd_sign.left = new FormAttachment(75, 0);
+ fd_sign.right = new FormAttachment(100, 0);
+ fd_sign.top = new FormAttachment(0, 0);
+ fd_sign.bottom = new FormAttachment(100, 0);
+ btn_sign.setLayoutData(fd_sign);
+ btn_sign.setText("Sign ...");
+
+ this.container = new Composite(getShell(), SWT.BORDER | SWT.RESIZE);
+ FormData fd_composite_1 = new FormData();
+ fd_composite_1.bottom = new FormAttachment(100, -25);
+ fd_composite_1.right = new FormAttachment(100, -5);
+ fd_composite_1.top = new FormAttachment(0, 45);
+ fd_composite_1.left = new FormAttachment(0, 5);
+ this.container.setLayoutData(fd_composite_1);
+ this.stack = new StackLayout();
+ this.container.setLayout(this.stack);
+
+ this.lbl_status = new CLabel(getShell(), SWT.NONE);
+ FormData fd_lblNewLabel = new FormData();
+ fd_lblNewLabel.right = new FormAttachment(100, -5);
+ fd_lblNewLabel.bottom = new FormAttachment(100, -5);
+ fd_lblNewLabel.top = new FormAttachment(100, -20);
+ fd_lblNewLabel.left = new FormAttachment(0, 5);
+ this.lbl_status.setLayoutData(fd_lblNewLabel);
+ this.lbl_status.setText("New Label");
+
+ }
+
+ /**
+ * @return the shell
+ */
+ public Shell getShell() {
+ return this.shell;
+ }
+}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/PositioningComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/PositioningComposite.java
new file mode 100644
index 00000000..79cbbc68
--- /dev/null
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/PositioningComposite.java
@@ -0,0 +1,63 @@
+/*
+ * 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.components;
+
+// Imports
+import org.eclipse.swt.SWT;
+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.Workflow;
+
+/**
+ *
+ *
+ */
+public class PositioningComposite extends Composite implements StateComposite {
+
+ /**
+ * SFL4J Logger instance
+ **/
+ private static final Logger log = LoggerFactory
+ .getLogger(PositioningComposite.class);
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public PositioningComposite(Composite parent, int style, Workflow workflow) {
+ super(parent, style);
+ Label test = new Label(this, SWT.NATIVE);
+ test.setBounds(10, 20, 100, 50);
+ test.setText("POSITIONING ----");
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.components.StateComposite#doLayout()
+ */
+ @Override
+ public void doLayout() {
+ this.layout(true, true);
+ }
+}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/StateComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/StateComposite.java
new file mode 100644
index 00000000..0bfd7b87
--- /dev/null
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/StateComposite.java
@@ -0,0 +1,32 @@
+/*
+ * 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.components;
+
+// Imports
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Composite interface for workflow state gui implementations
+ */
+public interface StateComposite {
+
+ /**
+ * Performs layout for all children in composite
+ * (SWT layout(...) only layouts children no grandchildren!)
+ */
+ public void doLayout();
+}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Workflow.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Workflow.java
index 9688a747..83fca283 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Workflow.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Workflow.java
@@ -21,25 +21,32 @@ import org.slf4j.LoggerFactory;
import java.util.Properties;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
+import at.asit.pdfover.gui.components.MainWindow;
import at.asit.pdfover.gui.workflow.states.PrepareConfigurationState;
/**
- * Workflow holds logical state of signing process and updates the current logical state
+ * Workflow holds logical state of signing process and updates the current
+ * logical state
*/
public class Workflow {
-
+
/**
* SFL4J Logger instance
**/
@SuppressWarnings("unused")
private static final Logger log = LoggerFactory.getLogger(Workflow.class);
-
+
/**
* Default constructor
+ *
* @param cmdLineArgs
*/
public Workflow(String[] cmdLineArgs) {
@@ -99,50 +106,82 @@ public class Workflow {
*/
public void update() {
WorkflowState next = null;
- do {
+ while (this.state != null) {
this.state.update(this);
next = this.state.nextState();
- } while (next != null);
+ if (next == this.state) {
+ break;
+ }
+ //this.state.hideGUI();
+ this.state = next;
+ }
+ if (this.state != null) {
+ this.setCurrentStateMessage(this.state.toString());
+ } else {
+ this.setCurrentStateMessage("");
+ }
}
private Display display = null;
-
+
private Shell shell = null;
-
+
private Composite container = null;
+
+ private MainWindow mainWindow = null;
+
+ private final StackLayout stack = new StackLayout();
+
+ /**
+ * Helper method for developing
+ * @param value
+ */
+ public void setCurrentStateMessage(String value) {
+ if(this.mainWindow != null) {
+ this.mainWindow.setStatus(value);
+ }
+ }
+ /**
+ * Used by active workflow state to show its own gui component
+ * @param ctrl
+ */
+ public void setTopControl(final Control ctrl) {
+ this.mainWindow.setTopControl(ctrl);
+ }
+
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.mainWindow = new MainWindow();
+
+ this.mainWindow.open();
+
+ this.shell = this.mainWindow.getShell();
+
+ this.container = this.mainWindow.getContainer();
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) {
+
+ if (this.container == null) {
this.createMainWindow();
}
-
- if(this.container == null) {
+
+ if (this.container == null) {
// TODO throw Exception...
}
-
+
return this.container;
}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/WorkflowState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/WorkflowState.java
index b5bb9e23..ed0c1fc2 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/WorkflowState.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/WorkflowState.java
@@ -33,6 +33,13 @@ public abstract class WorkflowState {
private WorkflowState _next = null;
/**
+ * Default Workflow State constructor
+ */
+ public WorkflowState() {
+ this._next = this;
+ }
+
+ /**
* Gets the next logical state or null if this their is no state transition
* @return the next state (or null)
*/
@@ -53,4 +60,9 @@ public abstract class WorkflowState {
* @param workflow
*/
public abstract void update(Workflow workflow);
+
+ /**
+ * Hide the GUI components created in the state
+ */
+ public abstract void hideGUI();
}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java
index e92128ac..07d63d09 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java
@@ -38,4 +38,13 @@ public class BKUSelectionState extends WorkflowState {
}
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.WorkflowState#hideGUI()
+ */
+ @Override
+ public void hideGUI() {
+ // TODO Auto-generated method stub
+
+ }
+
}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java
index 1458958f..223ba17d 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java
@@ -16,8 +16,14 @@
package at.asit.pdfover.gui.workflow.states;
//Imports
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
+import at.asit.pdfover.gui.components.DataSourceSelectComposite;
import at.asit.pdfover.gui.workflow.Workflow;
import at.asit.pdfover.gui.workflow.WorkflowState;
@@ -32,10 +38,56 @@ public class DataSourceSelectionState extends WorkflowState {
@SuppressWarnings("unused")
private static final Logger log = LoggerFactory.getLogger(DataSourceSelectionState.class);
+ private DataSourceSelectComposite selectionComposite = null;
+
+ private DataSourceSelectComposite getSelectionComposite(Workflow workflow) {
+ if(this.selectionComposite == null) {
+ this.selectionComposite = new DataSourceSelectComposite(workflow.getComposite(), SWT.RESIZE, workflow);
+ }
+
+ return this.selectionComposite;
+ }
+
@Override
public void update(Workflow workflow) {
- // TODO Auto-generated method stub
+ DataSourceSelectComposite selection = this.getSelectionComposite(workflow);
+
+ workflow.setTopControl(selection);
+ selection.layout();
+ if(selection.isPress()) {
+ this.setNextState(new PositioningState());
+ } else {
+ this.setNextState(this);
+ }
+ }
+
+ private void recursiveHide(Control ctrl) {
+ if(ctrl instanceof Composite) {
+ Composite comp = (Composite)ctrl;
+ Control[] childs = comp.getChildren();
+ for(int i = 0; i < childs.length; i++) {
+ this.recursiveHide(childs[i]);
+ }
+ }
+ ctrl.setVisible(false);
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.WorkflowState#hideGUI()
+ */
+ @Override
+ public void hideGUI() {
+ /*if(this.selectionComposite != null) {
+ Shell shell = this.selectionComposite.getShell();
+ Composite comp = this.selectionComposite.getParent();
+ recursiveHide(this.selectionComposite);
+ this.selectionComposite.layout();
+ //this.selectionComposite.setVisible(false);
+ comp.layout();
+ //shell.pack(true);
+ shell.layout(true);
+ }*/
}
}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
index 162fb051..44d9a55f 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
@@ -38,4 +38,13 @@ public class OutputState extends WorkflowState {
}
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.WorkflowState#hideGUI()
+ */
+ @Override
+ public void hideGUI() {
+ // TODO Auto-generated method stub
+
+ }
+
}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java
index 1d21aeca..b028cecc 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java
@@ -16,8 +16,12 @@
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.components.DataSourceSelectComposite;
+import at.asit.pdfover.gui.components.PositioningComposite;
import at.asit.pdfover.gui.workflow.Workflow;
import at.asit.pdfover.gui.workflow.WorkflowState;
@@ -30,12 +34,37 @@ public class PositioningState extends WorkflowState {
* SFL4J Logger instance
**/
@SuppressWarnings("unused")
- private static final Logger log = LoggerFactory.getLogger(PositioningState.class);
-
+ private static final Logger log = LoggerFactory
+ .getLogger(PositioningState.class);
+
+ private PositioningComposite positionComposite = null;
+
+ private PositioningComposite getPositioningComosite(Workflow workflow) {
+ if (this.positionComposite == null) {
+ this.positionComposite = new PositioningComposite(
+ workflow.getComposite(), SWT.NONE, workflow);
+ }
+
+ return this.positionComposite;
+ }
+
@Override
public void update(Workflow workflow) {
// TODO Auto-generated method stub
+ PositioningComposite position = this.getPositioningComosite(workflow);
+ workflow.setTopControl(position);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.asit.pdfover.gui.workflow.WorkflowState#hideGUI()
+ */
+ @Override
+ public void hideGUI() {
+ // TODO Auto-generated method stub
+
}
}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
index 3cde0e19..b90f38db 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
@@ -36,7 +36,16 @@ public class PrepareConfigurationState extends WorkflowState {
@Override
public void update(Workflow workflow) {
+ this.setNextState(new DataSourceSelectionState());
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.WorkflowState#hideGUI()
+ */
+ @Override
+ public void hideGUI() {
// TODO Auto-generated method stub
+
}
}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
index 8f627dbf..a18dc389 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
@@ -38,4 +38,13 @@ public class PrepareSigningState extends WorkflowState {
}
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.WorkflowState#hideGUI()
+ */
+ @Override
+ public void hideGUI() {
+ // TODO Auto-generated method stub
+
+ }
+
}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
index 2e052552..2305c1c6 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
@@ -38,4 +38,13 @@ public class SigningState extends WorkflowState {
}
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.WorkflowState#hideGUI()
+ */
+ @Override
+ public void hideGUI() {
+ // TODO Auto-generated method stub
+
+ }
+
}