From 3fe8080081427838ef4e3f60ef50461c5aa2fbcf Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Wed, 19 Feb 2020 09:44:20 +0100 Subject: set selection when loading config --- .../gui/composites/AdvancedConfigurationComposite.java | 4 +--- .../at/asit/pdfover/gui/composites/OutputComposite.java | 3 +++ .../pdfover/gui/workflow/config/ConfigProviderImpl.java | 1 + .../java/at/asit/pdfover/gui/workflow/states/OpenState.java | 13 +++++++------ 4 files changed, 12 insertions(+), 9 deletions(-) (limited to 'pdf-over-gui/src') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java index 03a1d1c8..bbcf6b9c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java @@ -297,9 +297,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { AdvancedConfigurationComposite.this.btnEnablePlaceholderUsage.getSelection()); } }); - - ////---- - this.btnPlatzhalterVerwenden = new Button(this.grpPlaceholder, SWT.RADIO); FormData fd_btnPlatzhalterVerwenden = new FormData(); @@ -937,6 +934,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.btnPlatzhalterVerwenden.setEnabled(enable); this.btnSignatureFieldsUsage.setEnabled(enable); this.configurationContainer.setEnablePlaceholderUsage(enable); + this.btnEnablePlaceholderUsage.setSelection(enable); } void performPdfACompatSelection(boolean compat) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java index cd99df76..f879f82c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java @@ -465,6 +465,9 @@ public class OutputComposite extends StateComposite { this.btn_save.setText(Messages.getString("common.Save")); //$NON-NLS-1$ } + /** + * @param str + */ public void reReloadResources(String str) { this.lbl_success_message.setText(Messages.getString("output.success_message")); //$NON-NLS-1$ if (this.outputFile == null) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java index 4b225aaa..bd149cf7 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java @@ -1517,6 +1517,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, this.configurationOverlay.setEnablePlaceholderUsage(bool); } + @Override public boolean getEnablePlaceholderUsage() { return this.configurationOverlay.getEnablePlaceholderUsage(); } 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 147e2399..34ffcc16 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 @@ -17,13 +17,10 @@ package at.asit.pdfover.gui.workflow.states; import java.io.File; import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.List; -import java.util.Properties; - import org.apache.pdfbox.pdmodel.PDDocument; //Imports @@ -48,7 +45,6 @@ import at.gv.egiz.pdfas.lib.impl.pdfbox2.placeholder.SignatureFieldsExtractor; import at.gv.egiz.pdfas.lib.impl.pdfbox2.placeholder.SignaturePlaceholderExtractor; //import at.gv.egiz.pdfas.lib.impl.pdfbox2.placeholder. -import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.configuration.PropertiesConfigurationLayout; @@ -131,8 +127,13 @@ public class OpenState extends State { // open dialog and await user selection if (SWT.YES == dialog.open()) { - - if (fields.size() > 0) { + + 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$ -- cgit v1.2.3