diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-06 13:30:22 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-06 13:30:22 +0200 |
commit | 29fe91f5aa066a4b78fbf805ff5059bf0c78154f (patch) | |
tree | 83dc2bed02a69c68271465aea3607694b72d22d9 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java | |
parent | 7b2231cb46f1b43e5d92a15e16294b58985fef9d (diff) | |
download | pdf-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/java/at/asit/pdfover/gui/workflow/Status.java')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java | 200 |
1 files changed, 104 insertions, 96 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; + } } |