summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java11
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java15
2 files changed, 15 insertions, 11 deletions
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
index bed41f4a..8cca67a0 100644
--- 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
@@ -69,9 +69,11 @@ public class BKUSelectionState extends State {
public void run() {
Status status = getStateMachine().getStatus();
State previousState = status.getPreviousState();
- if (!(previousState instanceof OpenState) &&
- !(previousState instanceof PositioningState) &&
- !(previousState instanceof BKUSelectionState)) {
+ if (!(
+ (previousState instanceof OpenState) ||
+ (previousState instanceof PositioningState) ||
+ (previousState instanceof BKUSelectionState)
+ )) {
status.setBKU(BKUs.NONE);
} else if(!(status.getPreviousState() instanceof BKUSelectionState)) {
ConfigProvider config = getStateMachine().getConfigProvider();
@@ -79,8 +81,7 @@ public class BKUSelectionState extends State {
}
if(status.getBKU() == BKUs.NONE) {
- BKUSelectionComposite selection = this
- .getSelectionComposite();
+ BKUSelectionComposite selection = this.getSelectionComposite();
getStateMachine().getGUIProvider().display(selection);
selection.layout();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java
index 1b734b32..0b0929dd 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java
@@ -81,10 +81,10 @@ public class OpenState extends State {
@Override
public void run() {
+ ConfigProvider config = getStateMachine().getConfigProvider();
Status status = getStateMachine().getStatus();
if (!(status.getPreviousState() instanceof PrepareConfigurationState)
&& !(status.getPreviousState() instanceof OpenState)) {
- ConfigProvider config = getStateMachine().getConfigProvider();
status.setBKU(config.getDefaultBKU());
status.setDocument(null);
status.setSignaturePosition(config.getDefaultSignaturePosition());
@@ -107,13 +107,16 @@ public class OpenState extends State {
// scan for signature placeholders
// - see if we want to scan for placeholders in the settings
- if (getStateMachine().getConfigProvider().getEnablePlaceholderUsage()) {
+ if (config.getEnablePlaceholderUsage()) {
try {
// - scan for placeholders
PDDocument pddocument = PDDocument.load(getStateMachine().getStatus().getDocument());
+ boolean useSignatureFields = config.getUseSignatureFields();
+ boolean useMarker = config.getUseMarker();
+ log.debug("Placeholder usage enabled. Signature fields: {}, QR Markers: {}", useSignatureFields, useMarker);
//first check the signature fields placeholder
- if (getStateMachine().getConfigProvider().getUseSignatureFields()) {
+ if (useSignatureFields) {
List<String> fields = SignatureFieldsAndPlaceHolderExtractor.findEmptySignatureFields(pddocument);
@@ -156,14 +159,13 @@ public class OpenState extends State {
}
}
// second check if qr code placeholder search is enabled
- } else if (getStateMachine().getConfigProvider().getUseMarker()) {
+ } else if (useMarker) {
SignaturePlaceholderData signaturePlaceholderData = SignatureFieldsAndPlaceHolderExtractor.getNextUnusedSignaturePlaceHolder(pddocument);
if (null != signaturePlaceholderData) {
- // create a dialog with ok and cancel buttons and a question
- // icon
+ // create a dialog with ok and cancel buttons and a question icon
MessageBox dialog = new MessageBox(getStateMachine().getGUIProvider().getMainShell(),
SWT.ICON_QUESTION | SWT.YES | SWT.NO);
dialog.setText(Messages.getString("dataSourceSelection.usePlaceholderTitle")); //$NON-NLS-1$
@@ -187,6 +189,7 @@ public class OpenState extends State {
} else {
getStateMachine().getStatus().setSearchForPlaceholderSignature(false);
}
+ // TODO: why does this use a different logic (via PositioningState) than the signature placeholders?
}
} else {