From 920aa71511071ba92b00467696537bf45f64fa47 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 3 Oct 2012 13:51:12 +0200 Subject: Fixed BKU cancel Bug --- .../main/java/at/asit/pdfover/gui/MainWindow.java | 19 +++++ ...ConfigurationUIState.java~Configuration Changes | 93 ++++++++++++++++++++++ .../pdfover/gui/workflow/states/OutputState.java | 3 + .../pdfover/gui/workflow/states/SigningState.java | 2 +- 4 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java~Configuration Changes (limited to 'trunk/pdf-over-gui/src') diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java index c291f31f..e904bc09 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java @@ -43,6 +43,7 @@ import at.asit.pdfover.gui.controls.MainBarMiddleButton; import at.asit.pdfover.gui.controls.MainBarRectangleButton; import at.asit.pdfover.gui.controls.MainBarStartButton; import at.asit.pdfover.gui.workflow.StateMachine; +import at.asit.pdfover.gui.workflow.states.BKUSelectionState; import at.asit.pdfover.gui.workflow.states.ConfigurationUIState; import at.asit.pdfover.gui.workflow.states.OpenState; import at.asit.pdfover.gui.workflow.states.PositioningState; @@ -302,6 +303,24 @@ public class MainWindow { this.btn_sign.setLayoutData(fd_btn_sign); this.btn_sign.setText(Messages.getString("main.signature")); //$NON-NLS-1$ this.btn_sign.setToolTipText(Messages.getString("main.signature")); //$NON-NLS-1$ + this.btn_sign.addMouseListener(new MouseListener() { + + @Override + public void mouseUp(MouseEvent e) { + MainWindow.this.stateMachine.jumpToState(new BKUSelectionState( + MainWindow.this.stateMachine)); + } + + @Override + public void mouseDown(MouseEvent e) { + // NOTHING TO DO HERE + } + + @Override + public void mouseDoubleClick(MouseEvent e) { + // NOTHING TO DO HERE + } + }); this.buttonMap.put(Buttons.SIGN, this.btn_sign); MainBarEndButton end = new MainBarEndButton(composite, SWT.NONE); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java~Configuration Changes b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java~Configuration Changes new file mode 100644 index 00000000..4b468ad8 --- /dev/null +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java~Configuration Changes @@ -0,0 +1,93 @@ +/* + * 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.ConfigurationComposite; +import at.asit.pdfover.gui.workflow.StateMachine; +import at.asit.pdfover.gui.workflow.Status; + +/** + * + */ +public class ConfigurationUIState extends State { + /** + * SLF4J Logger instance + **/ + private static final Logger log = LoggerFactory + .getLogger(ConfigurationUIState.class); + + + private ConfigurationComposite configurationComposite = null; + + private ConfigurationComposite getConfigurationComposite() { + if (this.configurationComposite == null) { + this.configurationComposite = + this.stateMachine.getGUIProvider().createComposite(ConfigurationComposite.class, SWT.RESIZE, this); + this.configurationComposite.setConfigManipulator(this.stateMachine.getConfigManipulator()); + } + + return this.configurationComposite; + } + + /** + * @param stateMachine + */ + public ConfigurationUIState(StateMachine stateMachine) { + super(stateMachine); + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.states.State#run() + */ + @Override + public void run() { + Status status = this.stateMachine.getStatus(); + + ConfigurationComposite config = this.getConfigurationComposite(); + + this.stateMachine.getGUIProvider().display(config); + + if(config.isUserDone()) + { + this.setNextState(status.getPreviousState()); + } + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.states.State#cleanUp() + */ + @Override + public void cleanUp() { + if(this.configurationComposite != null) + this.configurationComposite.dispose(); + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.states.State#updateMainWindowBehavior() + */ + @Override + public void updateMainWindowBehavior() { + // Leave the state as it is + } + +} 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 5213fec6..b5e14286 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 @@ -115,6 +115,9 @@ public class OutputState extends State { */ @Override public void cleanUp() { + + this.stateMachine.getStatus().setSignResult(null); + if (this.outputComposite != null) this.outputComposite.dispose(); } 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 6079893b..3b782119 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 @@ -91,7 +91,7 @@ public class SigningState extends State { SWT.NONE, Messages.getString("error.Signatur"), this.threadException, true); //$NON-NLS-1$ this.threadException = null; if(error.open()) { - this.stateMachine.update(); + this.setNextState(new BKUSelectionState(this.stateMachine)); } else { this.stateMachine.exit(); } -- cgit v1.2.3