summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-03-23 15:53:46 +0100
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-03-23 15:53:46 +0100
commit43b187dfedcb41cac26026aceb3e6e1266a1e82d (patch)
tree6257d57f127652ddd225ace0eec3aac01e006d3e /pdf-over-gui/src/main/java
parent8c3b4dd6a684a6b3269d07de3e4f2fe79e88d6bc (diff)
downloadpdf-over-43b187dfedcb41cac26026aceb3e6e1266a1e82d.tar.gz
pdf-over-43b187dfedcb41cac26026aceb3e6e1266a1e82d.tar.bz2
pdf-over-43b187dfedcb41cac26026aceb3e6e1266a1e82d.zip
clean up signature placeholder selection handling
Diffstat (limited to 'pdf-over-gui/src/main/java')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java63
1 files changed, 34 insertions, 29 deletions
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 0b0929dd..f4d104d5 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
@@ -121,41 +121,46 @@ public class OpenState extends State {
List<String> fields = SignatureFieldsAndPlaceHolderExtractor.findEmptySignatureFields(pddocument);
if (fields.size() > 0) {
-
- // 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$
- dialog.setMessage(Messages.getString("dataSourceSelection.usePlaceholderText")); //$NON-NLS-1$
-
- // open dialog and await user selection
- if (SWT.YES == dialog.open()) {
-
- if (fields.size() == 1) {
- addPlaceholderSelectionToConfig(fields.get(0));
- this.setNextState(new BKUSelectionState(getStateMachine()));
- return;
+ while (true)
+ {
+ // 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 | SWT.CANCEL);
+ dialog.setText(Messages.getString("dataSourceSelection.usePlaceholderTitle")); //$NON-NLS-1$
+ dialog.setMessage(Messages.getString("dataSourceSelection.usePlaceholderText")); //$NON-NLS-1$
+
+ // open dialog and await user selection
+ int result = dialog.open();
+ if (result == SWT.YES) {
- } else if (fields.size() > 1) {
-
- PlaceholderSelectionGui gui = new PlaceholderSelectionGui(
- getStateMachine().getGUIProvider().getMainShell(), 65570, "text", //$NON-NLS-1$
- "select the fields", fields); //$NON-NLS-1$
- int res = gui.open();
- if (res != -1) {
- getStateMachine().getStatus().setSearchForPlaceholderSignature(true);
-
- addPlaceholderSelectionToConfig(fields.get(res));
+ if (fields.size() == 1) {
+ addPlaceholderSelectionToConfig(fields.get(0));
this.setNextState(new BKUSelectionState(getStateMachine()));
return;
-
+
+ } else if (fields.size() > 1) {
+
+ PlaceholderSelectionGui gui = new PlaceholderSelectionGui(
+ getStateMachine().getGUIProvider().getMainShell(), 65570, "text", //$NON-NLS-1$
+ "select the fields", fields); //$NON-NLS-1$
+ int res = gui.open();
+ if (res != -1) {
+ getStateMachine().getStatus().setSearchForPlaceholderSignature(true);
+ addPlaceholderSelectionToConfig(fields.get(res));
+ this.setNextState(new BKUSelectionState(getStateMachine()));
+ }
+ else
+ continue;
}
+
+ } else if (result == SWT.NO) {
getStateMachine().getStatus().setSearchForPlaceholderSignature(false);
+ } else {
+ status.setDocument(null);
+ return;
}
-
- } else {
- getStateMachine().getStatus().setSearchForPlaceholderSignature(false);
+ break;
}
}
// second check if qr code placeholder search is enabled