summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-06 13:30:22 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-06 13:30:22 +0200
commit29fe91f5aa066a4b78fbf805ff5059bf0c78154f (patch)
tree83dc2bed02a69c68271465aea3607694b72d22d9 /pdf-over-gui/src/main
parent7b2231cb46f1b43e5d92a15e16294b58985fef9d (diff)
downloadpdf-over-29fe91f5aa066a4b78fbf805ff5059bf0c78154f.tar.gz
pdf-over-29fe91f5aa066a4b78fbf805ff5059bf0c78154f.tar.bz2
pdf-over-29fe91f5aa066a4b78fbf805ff5059bf0c78154f.zip
it's interface hunting season
Diffstat (limited to 'pdf-over-gui/src/main')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java200
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StatusImpl.java206
2 files changed, 104 insertions, 302 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java
index 177b2f39..14d917d0 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java
@@ -15,8 +15,12 @@
*/
package at.asit.pdfover.gui.workflow;
+// Imports
import java.io.File;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import at.asit.pdfover.gui.MainWindowBehavior;
import at.asit.pdfover.gui.workflow.states.State;
import at.asit.pdfover.signator.BKUs;
@@ -24,100 +28,104 @@ import at.asit.pdfover.signator.SignResult;
import at.asit.pdfover.signator.SignaturePosition;
import at.asit.pdfover.signator.SigningState;
-/**
- * Interface for persistent status of state machine
- */
-public interface Status {
- /**
- * Sets the document
- * @param document the document
- */
- public void setDocument(File document);
-
- /**
- * Gets the document
- * @return the document
- */
- public File getDocument();
-
- /**
- * Sets the signature position
- * @param position the position
- */
- public void setSignaturePosition(SignaturePosition position);
-
- /**
- * Gets the signature position
- * @return the signature position
- */
- public SignaturePosition getSignaturePosition();
-
- /**
- * Sets the selected BKU
- * @param bku the selected BKU
- */
- public void setBKU(BKUs bku);
-
- /**
- * Gets the selected BKU
- * @return the selected BKU
- */
- public BKUs getBKU();
-
- /**
- * Gets the current state
- * @return the current state
- */
- public State getCurrentState();
-
- /**
- * Gets the main window behavior
- * @return the main window behavior
- */
- public MainWindowBehavior getBehavior();
-
- /**
- * Gets the previous State
- * @return the previous State
- */
- public State getPreviousState();
-
- /**
- * Gets the signing state
- * @return the signing state
- */
- public SigningState getSigningState();
-
- /**
- * Sets the signing state
- * @param state the signing state
- */
- public void setSigningState(SigningState state);
-
- /**
- * Sets the sign result
- * @param signResult
- */
- public void setSignResult(SignResult signResult);
-
- /**
- * Gets the sign Result
- * @return the sign result
- */
- public SignResult getSignResult();
-
- /**
- * Checks if search for placeholder signature-flag is on.
- *
- * @return true, if is search for placeholder signature
- */
- public boolean isSearchForPlaceholderSignature();
-
- /**
- * Sets the search for placeholder signature-flag.
- *
- * @param value
- * the new search for placeholder signature
- */
- public void setSearchForPlaceholderSignature(boolean value);
+public class Status {
+ private static final Logger log = LoggerFactory.getLogger(Status.class);
+
+ private File document = null;
+
+ private SignaturePosition signaturePosition = null;
+
+ private BKUs bku = BKUs.NONE;
+
+ private State currentState = null;
+
+ private State previousState = null;
+
+ private SigningState signingState = null;
+
+ private SignResult signResult = null;
+
+ private MainWindowBehavior behavior;
+
+ private boolean searchForPlacehoderSignature = false;
+
+ public Status() {
+ this.behavior = new MainWindowBehavior();
+ }
+
+ public State getCurrentState() {
+ return this.currentState;
+ }
+
+ public void setCurrentState(State currentState) {
+ //if (this.previousState == this.currentState)
+ // log.error("Changing to same state? " + this.currentState);
+
+ if (this.previousState != this.currentState)
+ {
+ //Reference to previous state will be lost - perform cleanup
+ log.debug("Changing from " + this.currentState + " to " + currentState); //
+ log.debug("Cleaning up " + this.previousState);
+ this.previousState.cleanUp();
+ }
+
+ this.previousState = this.currentState;
+ this.currentState = currentState;
+ }
+
+ public State getPreviousState() {
+ return this.previousState;
+ }
+
+ public void setDocument(File document) {
+ this.document = document;
+ }
+
+ public File getDocument() {
+ return this.document;
+ }
+
+ public void setSignaturePosition(SignaturePosition position) {
+ this.signaturePosition = position;
+ }
+
+ public SignaturePosition getSignaturePosition() {
+ return this.signaturePosition;
+ }
+
+ public void setBKU(BKUs bku) {
+ this.bku = bku;
+ }
+
+ public BKUs getBKU() {
+ return this.bku;
+ }
+
+ public MainWindowBehavior getBehavior() {
+ return this.behavior;
+ }
+
+ public SigningState getSigningState() {
+ return this.signingState;
+ }
+
+ public void setSigningState(SigningState state) {
+ this.signingState = state;
+ }
+
+ public void setSignResult(SignResult signResult) {
+ this.signResult = signResult;
+ }
+
+ public SignResult getSignResult() {
+ return this.signResult;
+ }
+
+ public boolean isSearchForPlaceholderSignature() {
+ return this.searchForPlacehoderSignature;
+ }
+
+ public void setSearchForPlaceholderSignature(boolean value) {
+ this.searchForPlacehoderSignature = value;
+ }
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StatusImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StatusImpl.java
deleted file mode 100644
index 7fe71f1a..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StatusImpl.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * 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;
-
-// Imports
-import java.io.File;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import at.asit.pdfover.gui.MainWindowBehavior;
-import at.asit.pdfover.gui.workflow.states.State;
-import at.asit.pdfover.signator.BKUs;
-import at.asit.pdfover.signator.SignResult;
-import at.asit.pdfover.signator.SignaturePosition;
-import at.asit.pdfover.signator.SigningState;
-
-/**
- *
- */
-public class StatusImpl implements Status {
- /**
- * SLF4J Logger instance
- **/
- private static final Logger log = LoggerFactory.getLogger(StatusImpl.class);
-
- private File document = null;
-
- private SignaturePosition signaturePosition = null;
-
- private BKUs bku = BKUs.NONE;
-
- private State currentState = null;
-
- private State previousState = null;
-
- private SigningState signingState = null;
-
- private SignResult signResult = null;
-
- private MainWindowBehavior behavior;
-
- private boolean searchForPlacehoderSignature = false;
-
- /**
- * Constructor
- */
- public StatusImpl() {
- this.behavior = new MainWindowBehavior();
- }
-
- @Override
- public State getCurrentState() {
- return this.currentState;
- }
-
- /**
- * Changes the current state
- * @param currentState the current State
- */
- public void setCurrentState(State currentState) {
- //if (this.previousState == this.currentState)
- // log.error("Changing to same state? " + this.currentState);
-
- if (this.previousState != this.currentState)
- {
- //Reference to previous state will be lost - perform cleanup
- log.debug("Changing from " + this.currentState + " to " + currentState); //
- log.debug("Cleaning up " + this.previousState);
- this.previousState.cleanUp();
- }
-
- this.previousState = this.currentState;
- this.currentState = currentState;
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.Status#getPreviousState()
- */
- @Override
- public State getPreviousState() {
- return this.previousState;
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.Status#setDocument(java.io.File)
- */
- @Override
- public void setDocument(File document) {
- this.document = document;
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.Status#getDocument()
- */
- @Override
- public File getDocument() {
- return this.document;
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.Status#setSignaturePosition(at.asit.pdfover.signator.SignaturePosition)
- */
- @Override
- public void setSignaturePosition(SignaturePosition position) {
- this.signaturePosition = position;
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.Status#getSignaturePosition()
- */
- @Override
- public SignaturePosition getSignaturePosition() {
- return this.signaturePosition;
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.Status#setBKU(at.asit.pdfover.gui.workflow.states.BKUSelectionState.BKUs)
- */
- @Override
- public void setBKU(BKUs bku) {
- this.bku = bku;
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.Status#getBKU()
- */
- @Override
- public BKUs getBKU() {
- return this.bku;
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.Status#getBehavior()
- */
- @Override
- public MainWindowBehavior getBehavior() {
- return this.behavior;
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.Status#getSigningState()
- */
- @Override
- public SigningState getSigningState() {
- return this.signingState;
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.Status#setSigningState(at.asit.pdfover.signator.SigningState)
- */
- @Override
- public void setSigningState(SigningState state) {
- this.signingState = state;
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.Status#setSignResult(at.asit.pdfover.signator.SignResult)
- */
- @Override
- public void setSignResult(SignResult signResult) {
- this.signResult = signResult;
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.Status#getSignResult()
- */
- @Override
- public SignResult getSignResult() {
- return this.signResult;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see at.asit.pdfover.gui.workflow.Status#getConfiguration()
- */
- @Override
- public boolean isSearchForPlaceholderSignature() {
- return this.searchForPlacehoderSignature;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * at.asit.pdfover.gui.workflow.Status#setSearchForPlaceholderSignature(
- * boolean)
- */
- public void setSearchForPlaceholderSignature(boolean value) {
- this.searchForPlacehoderSignature = value;
- }
-}