summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:08:16 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:08:16 +0000
commit42b326277b1c5e559a415fe83ee9ae44f0de772f (patch)
tree419469c02b573e5fa383019f811e374973580af5 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java
parentac59f65187ba4a9666e90cdb34138bb873e627aa (diff)
downloadpdf-over-42b326277b1c5e559a415fe83ee9ae44f0de772f.tar.gz
pdf-over-42b326277b1c5e559a415fe83ee9ae44f0de772f.tar.bz2
pdf-over-42b326277b1c5e559a415fe83ee9ae44f0de772f.zip
Changed ErrorDialog to use SWT Messagebox for OS specific error messages
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@152 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java468
1 files changed, 264 insertions, 204 deletions
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 7cc49d18..e264aa48 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
@@ -16,6 +16,8 @@
package at.asit.pdfover.gui.composites;
// Imports
+import java.io.File;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
@@ -66,7 +68,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
* @param parent
* @param style
* @param state
- * @param container
+ * @param container
*/
public AdvancedConfigurationComposite(Composite parent, int style,
State state, ConfigurationContainer container) {
@@ -74,7 +76,8 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
setLayout(new FormLayout());
Group grpSignatur = new Group(this, SWT.NONE);
- grpSignatur.setText(Messages.getString("advanced_config.Signature_Title")); //$NON-NLS-1$
+ grpSignatur.setText(Messages
+ .getString("advanced_config.Signature_Title")); //$NON-NLS-1$
FormLayout layout = new FormLayout();
layout.marginHeight = 10;
layout.marginWidth = 5;
@@ -87,84 +90,100 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
FontData[] fD_grpSignaturPosition = grpSignatur.getFont().getFontData();
fD_grpSignaturPosition[0].setHeight(TEXT_SIZE_NORMAL);
- grpSignatur.setFont(new Font(Display.getCurrent(), fD_grpSignaturPosition[0]));
-
- this.btnAutomatischePositionierung = new Button(grpSignatur,
- SWT.CHECK);
- FormData fd_btnAutomatischePositionierung = new FormData();
- fd_btnAutomatischePositionierung.right = new FormAttachment(100, -5);
- fd_btnAutomatischePositionierung.top = new FormAttachment(0);
- fd_btnAutomatischePositionierung.left = new FormAttachment(0, 5);
- this.btnAutomatischePositionierung
- .setLayoutData(fd_btnAutomatischePositionierung);
- this.btnAutomatischePositionierung.setText(Messages.getString("advanced_config.AutoPosition")); //$NON-NLS-1$
-
- FontData[] fD_btnAutomatischePositionierung = this.btnAutomatischePositionierung.getFont().getFontData();
- fD_btnAutomatischePositionierung[0].setHeight(TEXT_SIZE_BUTTON);
- this.btnAutomatischePositionierung.setFont(new Font(Display.getCurrent(), fD_btnAutomatischePositionierung[0]));
-
- this.btnAutomatischePositionierung.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- AdvancedConfigurationComposite.this.performPositionSelection(
- AdvancedConfigurationComposite.this.btnAutomatischePositionierung.getSelection());
- }
- });
- log.debug(this.btnAutomatischePositionierung.getBounds().toString());
-
- Label lblTransparenz = new Label(grpSignatur, SWT.HORIZONTAL);
- FormData fd_lblTransparenz = new FormData();
- fd_lblTransparenz.top = new FormAttachment(this.btnAutomatischePositionierung, 5);
- fd_lblTransparenz.left = new FormAttachment(0, 5);
- lblTransparenz.setLayoutData(fd_lblTransparenz);
- lblTransparenz.setText(Messages.getString("advanced_config.SigPHTransparency")); //$NON-NLS-1$
-
- FontData[] fD_lblTransparenz = lblTransparenz.getFont().getFontData();
- fD_lblTransparenz[0].setHeight(TEXT_SIZE_NORMAL);
- lblTransparenz.setFont(new Font(Display.getCurrent(), fD_lblTransparenz[0]));
-
- Label lblTransparenzLinks = new Label(grpSignatur, SWT.HORIZONTAL);
- FormData fd_lblTransparenzLinks = new FormData();
- fd_lblTransparenzLinks.top = new FormAttachment(lblTransparenz, 5);
- fd_lblTransparenzLinks.left = new FormAttachment(0, 15);
- lblTransparenzLinks.setLayoutData(fd_lblTransparenzLinks);
- lblTransparenzLinks.setText(Messages.getString("advanced_config.SigPHTransparencyMin")); //$NON-NLS-1$
-
- FontData[] fD_lblTransparenzLinks = lblTransparenzLinks.getFont().getFontData();
- fD_lblTransparenzLinks[0].setHeight(TEXT_SIZE_NORMAL);
- lblTransparenzLinks.setFont(new Font(Display.getCurrent(), fD_lblTransparenzLinks[0]));
-
- Label lblTransparenzRechts = new Label(grpSignatur, SWT.HORIZONTAL);
- FormData fd_lblTransparenzRechts = new FormData();
- fd_lblTransparenzRechts.top = new FormAttachment(lblTransparenz, 5);
- fd_lblTransparenzRechts.right = new FormAttachment(100, -5);
- lblTransparenzRechts.setLayoutData(fd_lblTransparenzRechts);
- lblTransparenzRechts.setText(Messages.getString("advanced_config.SigPHTransparencyMax")); //$NON-NLS-1$
-
- FontData[] fD_lblTransparenzRechts = lblTransparenzRechts.getFont().getFontData();
- fD_lblTransparenzRechts[0].setHeight(TEXT_SIZE_NORMAL);
- lblTransparenzRechts.setFont(new Font(Display.getCurrent(), fD_lblTransparenzRechts[0]));
-
- this.sclTransparenz = new Scale(grpSignatur, SWT.HORIZONTAL);
- FormData fd_sldTransparenz = new FormData();
- fd_sldTransparenz.right = new FormAttachment(lblTransparenzRechts, -5);
- fd_sldTransparenz.top = new FormAttachment(lblTransparenz, 5);
- fd_sldTransparenz.left = new FormAttachment(lblTransparenzLinks, 5);
- this.sclTransparenz.setLayoutData(fd_sldTransparenz);
- this.sclTransparenz.setMinimum(0);
- this.sclTransparenz.setMaximum(255);
- this.sclTransparenz.setIncrement(1);
- this.sclTransparenz.setPageIncrement(10);
- this.sclTransparenz.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- performPlaceholderTransparency(AdvancedConfigurationComposite.this.sclTransparenz.getSelection());
- }
- });
+ grpSignatur.setFont(new Font(Display.getCurrent(),
+ fD_grpSignaturPosition[0]));
+
+ this.btnAutomatischePositionierung = new Button(grpSignatur, SWT.CHECK);
+ FormData fd_btnAutomatischePositionierung = new FormData();
+ fd_btnAutomatischePositionierung.right = new FormAttachment(100, -5);
+ fd_btnAutomatischePositionierung.top = new FormAttachment(0);
+ fd_btnAutomatischePositionierung.left = new FormAttachment(0, 5);
+ this.btnAutomatischePositionierung
+ .setLayoutData(fd_btnAutomatischePositionierung);
+ this.btnAutomatischePositionierung.setText(Messages
+ .getString("advanced_config.AutoPosition")); //$NON-NLS-1$
+
+ FontData[] fD_btnAutomatischePositionierung = this.btnAutomatischePositionierung
+ .getFont().getFontData();
+ fD_btnAutomatischePositionierung[0].setHeight(TEXT_SIZE_BUTTON);
+ this.btnAutomatischePositionierung.setFont(new Font(Display
+ .getCurrent(), fD_btnAutomatischePositionierung[0]));
+
+ this.btnAutomatischePositionierung
+ .addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ AdvancedConfigurationComposite.this
+ .performPositionSelection(AdvancedConfigurationComposite.this.btnAutomatischePositionierung
+ .getSelection());
+ }
+ });
+ log.debug(this.btnAutomatischePositionierung.getBounds().toString());
+
+ Label lblTransparenz = new Label(grpSignatur, SWT.HORIZONTAL);
+ FormData fd_lblTransparenz = new FormData();
+ fd_lblTransparenz.top = new FormAttachment(
+ this.btnAutomatischePositionierung, 5);
+ fd_lblTransparenz.left = new FormAttachment(0, 5);
+ lblTransparenz.setLayoutData(fd_lblTransparenz);
+ lblTransparenz.setText(Messages
+ .getString("advanced_config.SigPHTransparency")); //$NON-NLS-1$
+
+ FontData[] fD_lblTransparenz = lblTransparenz.getFont().getFontData();
+ fD_lblTransparenz[0].setHeight(TEXT_SIZE_NORMAL);
+ lblTransparenz.setFont(new Font(Display.getCurrent(),
+ fD_lblTransparenz[0]));
+
+ Label lblTransparenzLinks = new Label(grpSignatur, SWT.HORIZONTAL);
+ FormData fd_lblTransparenzLinks = new FormData();
+ fd_lblTransparenzLinks.top = new FormAttachment(lblTransparenz, 5);
+ fd_lblTransparenzLinks.left = new FormAttachment(0, 15);
+ lblTransparenzLinks.setLayoutData(fd_lblTransparenzLinks);
+ lblTransparenzLinks.setText(Messages
+ .getString("advanced_config.SigPHTransparencyMin")); //$NON-NLS-1$
+
+ FontData[] fD_lblTransparenzLinks = lblTransparenzLinks.getFont()
+ .getFontData();
+ fD_lblTransparenzLinks[0].setHeight(TEXT_SIZE_NORMAL);
+ lblTransparenzLinks.setFont(new Font(Display.getCurrent(),
+ fD_lblTransparenzLinks[0]));
+
+ Label lblTransparenzRechts = new Label(grpSignatur, SWT.HORIZONTAL);
+ FormData fd_lblTransparenzRechts = new FormData();
+ fd_lblTransparenzRechts.top = new FormAttachment(lblTransparenz, 5);
+ fd_lblTransparenzRechts.right = new FormAttachment(100, -5);
+ lblTransparenzRechts.setLayoutData(fd_lblTransparenzRechts);
+ lblTransparenzRechts.setText(Messages
+ .getString("advanced_config.SigPHTransparencyMax")); //$NON-NLS-1$
+
+ FontData[] fD_lblTransparenzRechts = lblTransparenzRechts.getFont()
+ .getFontData();
+ fD_lblTransparenzRechts[0].setHeight(TEXT_SIZE_NORMAL);
+ lblTransparenzRechts.setFont(new Font(Display.getCurrent(),
+ fD_lblTransparenzRechts[0]));
+
+ this.sclTransparenz = new Scale(grpSignatur, SWT.HORIZONTAL);
+ FormData fd_sldTransparenz = new FormData();
+ fd_sldTransparenz.right = new FormAttachment(lblTransparenzRechts, -5);
+ fd_sldTransparenz.top = new FormAttachment(lblTransparenz, 5);
+ fd_sldTransparenz.left = new FormAttachment(lblTransparenzLinks, 5);
+ this.sclTransparenz.setLayoutData(fd_sldTransparenz);
+ this.sclTransparenz.setMinimum(0);
+ this.sclTransparenz.setMaximum(255);
+ this.sclTransparenz.setIncrement(1);
+ this.sclTransparenz.setPageIncrement(10);
+ this.sclTransparenz.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ performPlaceholderTransparency(AdvancedConfigurationComposite.this.sclTransparenz
+ .getSelection());
+ }
+ });
Group grpBkuAuswahl = new Group(this, SWT.NONE);
- grpBkuAuswahl.setText(Messages.getString("advanced_config.BKUSelection_Title")); //$NON-NLS-1$
+ grpBkuAuswahl.setText(Messages
+ .getString("advanced_config.BKUSelection_Title")); //$NON-NLS-1$
layout = new FormLayout();
layout.marginHeight = 10;
layout.marginWidth = 5;
@@ -177,45 +196,53 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
FontData[] fD_grpBkuAuswahl = grpBkuAuswahl.getFont().getFontData();
fD_grpBkuAuswahl[0].setHeight(TEXT_SIZE_NORMAL);
- grpBkuAuswahl.setFont(new Font(Display.getCurrent(), fD_grpBkuAuswahl[0]));
-
- this.cmbBKUAuswahl = new Combo(grpBkuAuswahl, SWT.READ_ONLY);
- FormData fd_cmbBKUAuswahl = new FormData();
- fd_cmbBKUAuswahl.right = new FormAttachment(100, -5);
- fd_cmbBKUAuswahl.top = new FormAttachment(0);
- fd_cmbBKUAuswahl.left = new FormAttachment(0, 5);
-
- FontData[] fD_cmbBKUAuswahl = this.cmbBKUAuswahl.getFont().getFontData();
- fD_cmbBKUAuswahl[0].setHeight(TEXT_SIZE_NORMAL);
- this.cmbBKUAuswahl.setFont(new Font(Display.getCurrent(), fD_cmbBKUAuswahl[0]));
-
- int blen = BKUs.values().length;
-
- this.bkuStrings = new String[blen];
-
- for (int i = 0; i < blen; i++) {
- String lookup = "BKU." + BKUs.values()[i].toString(); //$NON-NLS-1$
- this.bkuStrings[i] = Messages.getString(lookup);
- }
-
- this.cmbBKUAuswahl.setItems(this.bkuStrings);
-
- this.cmbBKUAuswahl.setLayoutData(fd_cmbBKUAuswahl);
-
- this.cmbBKUAuswahl.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- int selectionIndex = getBKUElementIndex(AdvancedConfigurationComposite.this.configurationContainer.getBKUSelection());
- if(AdvancedConfigurationComposite.this.cmbBKUAuswahl.getSelectionIndex() != selectionIndex) {
- selectionIndex = AdvancedConfigurationComposite.this.cmbBKUAuswahl.getSelectionIndex();
- performBKUSelectionChanged(AdvancedConfigurationComposite.this.cmbBKUAuswahl.getItem(selectionIndex));
- }
+ grpBkuAuswahl.setFont(new Font(Display.getCurrent(),
+ fD_grpBkuAuswahl[0]));
+
+ this.cmbBKUAuswahl = new Combo(grpBkuAuswahl, SWT.READ_ONLY);
+ FormData fd_cmbBKUAuswahl = new FormData();
+ fd_cmbBKUAuswahl.right = new FormAttachment(100, -5);
+ fd_cmbBKUAuswahl.top = new FormAttachment(0);
+ fd_cmbBKUAuswahl.left = new FormAttachment(0, 5);
+
+ FontData[] fD_cmbBKUAuswahl = this.cmbBKUAuswahl.getFont()
+ .getFontData();
+ fD_cmbBKUAuswahl[0].setHeight(TEXT_SIZE_NORMAL);
+ this.cmbBKUAuswahl.setFont(new Font(Display.getCurrent(),
+ fD_cmbBKUAuswahl[0]));
+
+ int blen = BKUs.values().length;
+
+ this.bkuStrings = new String[blen];
+
+ for (int i = 0; i < blen; i++) {
+ String lookup = "BKU." + BKUs.values()[i].toString(); //$NON-NLS-1$
+ this.bkuStrings[i] = Messages.getString(lookup);
+ }
+
+ this.cmbBKUAuswahl.setItems(this.bkuStrings);
+
+ this.cmbBKUAuswahl.setLayoutData(fd_cmbBKUAuswahl);
+
+ this.cmbBKUAuswahl.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int selectionIndex = getBKUElementIndex(AdvancedConfigurationComposite.this.configurationContainer
+ .getBKUSelection());
+ if (AdvancedConfigurationComposite.this.cmbBKUAuswahl
+ .getSelectionIndex() != selectionIndex) {
+ selectionIndex = AdvancedConfigurationComposite.this.cmbBKUAuswahl
+ .getSelectionIndex();
+ performBKUSelectionChanged(AdvancedConfigurationComposite.this.cmbBKUAuswahl
+ .getItem(selectionIndex));
}
- });
+ }
+ });
Group grpSpeicherort = new Group(this, SWT.NONE);
- grpSpeicherort.setText(Messages.getString("advanced_config.OutputFolder_Title")); //$NON-NLS-1$
+ grpSpeicherort.setText(Messages
+ .getString("advanced_config.OutputFolder_Title")); //$NON-NLS-1$
layout = new FormLayout();
layout.marginHeight = 10;
layout.marginWidth = 5;
@@ -228,88 +255,100 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
FontData[] fD_grpSpeicherort = grpSpeicherort.getFont().getFontData();
fD_grpSpeicherort[0].setHeight(TEXT_SIZE_NORMAL);
- grpSpeicherort.setFont(new Font(Display.getCurrent(), fD_grpSpeicherort[0]));
-
- Label lblDefaultOutputFolder = new Label(grpSpeicherort, SWT.NONE);
- FormData fd_lblDefaultOutputFolder = new FormData();
- fd_lblDefaultOutputFolder.top = new FormAttachment(0);
- fd_lblDefaultOutputFolder.left = new FormAttachment(0, 5);
- lblDefaultOutputFolder.setLayoutData(fd_lblDefaultOutputFolder);
- lblDefaultOutputFolder.setText(Messages.getString("advanced_config.OutputFolder")); //$NON-NLS-1$
-
- FontData[] fD_lblDefaultOutputFolder = lblDefaultOutputFolder.getFont().getFontData();
- fD_lblDefaultOutputFolder[0].setHeight(TEXT_SIZE_NORMAL);
- lblDefaultOutputFolder.setFont(new Font(Display.getCurrent(), fD_lblDefaultOutputFolder[0]));
-
- this.txtOutputFolder = new Text(grpSpeicherort, SWT.BORDER);
- FormData fd_text = new FormData();
- fd_text.top = new FormAttachment(lblDefaultOutputFolder, 5);
- fd_text.left = new FormAttachment(0, 15);
- this.txtOutputFolder.setLayoutData(fd_text);
-
- FontData[] fD_txtOutputFolder = this.txtOutputFolder.getFont().getFontData();
- fD_txtOutputFolder[0].setHeight(TEXT_SIZE_NORMAL);
- this.txtOutputFolder.setFont(new Font(Display.getCurrent(), fD_txtOutputFolder[0]));
-
- this.txtOutputFolder.addFocusListener(new FocusAdapter() {
-
- @Override
- public void focusLost(FocusEvent e) {
- performOutputFolderChanged(AdvancedConfigurationComposite.this.txtOutputFolder.getText());
- }
- });
-
- Button btnBrowse = new Button(grpSpeicherort, SWT.NONE);
- fd_text.right = new FormAttachment(btnBrowse, -5);
-
- FontData[] fD_btnBrowse = btnBrowse.getFont().getFontData();
- fD_btnBrowse[0].setHeight(TEXT_SIZE_BUTTON);
- btnBrowse.setFont(new Font(Display.getCurrent(), fD_btnBrowse[0]));
-
- FormData fd_btnBrowse = new FormData();
- fd_btnBrowse.top = new FormAttachment(lblDefaultOutputFolder, 5);
- fd_btnBrowse.right = new FormAttachment(100, -5);
- btnBrowse.setLayoutData(fd_btnBrowse);
- btnBrowse.setText(Messages.getString("common.browse")); //$NON-NLS-1$
-
- btnBrowse.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- DirectoryDialog dlg = new DirectoryDialog(
- AdvancedConfigurationComposite.this.getShell());
-
- // Set the initial filter path according
- // to anything they've selected or typed in
- dlg.setFilterPath(AdvancedConfigurationComposite.this.txtOutputFolder
- .getText());
-
- // Change the title bar text
- dlg.setText(Messages.getString("advanced_config.OutputFolder.Dialog_Title")); //$NON-NLS-1$
-
- // Customizable message displayed in the dialog
- dlg.setMessage(Messages.getString("advanced_config.OutputFolder.Dialog")); //$NON-NLS-1$
-
- // Calling open() will open and run the dialog.
- // It will return the selected directory, or
- // null if user cancels
- String dir = dlg.open();
- if (dir != null) {
- // Set the text box to the new selection
- performOutputFolderChanged(dir);
- }
+ grpSpeicherort.setFont(new Font(Display.getCurrent(),
+ fD_grpSpeicherort[0]));
+
+ Label lblDefaultOutputFolder = new Label(grpSpeicherort, SWT.NONE);
+ FormData fd_lblDefaultOutputFolder = new FormData();
+ fd_lblDefaultOutputFolder.top = new FormAttachment(0);
+ fd_lblDefaultOutputFolder.left = new FormAttachment(0, 5);
+ lblDefaultOutputFolder.setLayoutData(fd_lblDefaultOutputFolder);
+ lblDefaultOutputFolder.setText(Messages
+ .getString("advanced_config.OutputFolder")); //$NON-NLS-1$
+
+ FontData[] fD_lblDefaultOutputFolder = lblDefaultOutputFolder.getFont()
+ .getFontData();
+ fD_lblDefaultOutputFolder[0].setHeight(TEXT_SIZE_NORMAL);
+ lblDefaultOutputFolder.setFont(new Font(Display.getCurrent(),
+ fD_lblDefaultOutputFolder[0]));
+
+ this.txtOutputFolder = new Text(grpSpeicherort, SWT.BORDER);
+ FormData fd_text = new FormData();
+ fd_text.top = new FormAttachment(lblDefaultOutputFolder, 5);
+ fd_text.left = new FormAttachment(0, 15);
+ this.txtOutputFolder.setLayoutData(fd_text);
+
+ FontData[] fD_txtOutputFolder = this.txtOutputFolder.getFont()
+ .getFontData();
+ fD_txtOutputFolder[0].setHeight(TEXT_SIZE_NORMAL);
+ this.txtOutputFolder.setFont(new Font(Display.getCurrent(),
+ fD_txtOutputFolder[0]));
+
+ this.txtOutputFolder.addFocusListener(new FocusAdapter() {
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ performOutputFolderChanged(AdvancedConfigurationComposite.this.txtOutputFolder
+ .getText());
+ }
+ });
+
+ Button btnBrowse = new Button(grpSpeicherort, SWT.NONE);
+ fd_text.right = new FormAttachment(btnBrowse, -5);
+
+ FontData[] fD_btnBrowse = btnBrowse.getFont().getFontData();
+ fD_btnBrowse[0].setHeight(TEXT_SIZE_BUTTON);
+ btnBrowse.setFont(new Font(Display.getCurrent(), fD_btnBrowse[0]));
+
+ FormData fd_btnBrowse = new FormData();
+ fd_btnBrowse.top = new FormAttachment(lblDefaultOutputFolder, 5);
+ fd_btnBrowse.right = new FormAttachment(100, -5);
+ btnBrowse.setLayoutData(fd_btnBrowse);
+ btnBrowse.setText(Messages.getString("common.browse")); //$NON-NLS-1$
+
+ btnBrowse.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog dlg = new DirectoryDialog(
+ AdvancedConfigurationComposite.this.getShell());
+
+ // Set the initial filter path according
+ // to anything they've selected or typed in
+ dlg.setFilterPath(AdvancedConfigurationComposite.this.txtOutputFolder
+ .getText());
+
+ // Change the title bar text
+ dlg.setText(Messages
+ .getString("advanced_config.OutputFolder.Dialog_Title")); //$NON-NLS-1$
+
+ // Customizable message displayed in the dialog
+ dlg.setMessage(Messages
+ .getString("advanced_config.OutputFolder.Dialog")); //$NON-NLS-1$
+
+ // Calling open() will open and run the dialog.
+ // It will return the selected directory, or
+ // null if user cancels
+ String dir = dlg.open();
+ if (dir != null) {
+ // Set the text box to the new selection
+ performOutputFolderChanged(dir);
}
- });
+ }
+ });
}
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#signerChanged()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.asit.pdfover.gui.composites.BaseConfigurationComposite#signerChanged()
*/
@Override
protected void signerChanged() {
// Nothing to do here (yet)
}
-
+
void performOutputFolderChanged(String foldername) {
log.debug("Selected Output folder: " + foldername); //$NON-NLS-1$
this.configurationContainer.setOutputFolder(foldername);
@@ -319,18 +358,18 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
int getBKUElementIndex(BKUs bku) {
String lookup = "BKU." + bku.toString(); //$NON-NLS-1$
String bkuName = Messages.getString(lookup);
-
- for(int i = 0; i < this.bkuStrings.length; i++) {
- if(this.bkuStrings[i].equals(bkuName)) {
+
+ for (int i = 0; i < this.bkuStrings.length; i++) {
+ if (this.bkuStrings[i].equals(bkuName)) {
log.debug("BKU: " + bkuName + " IDX: " + i); //$NON-NLS-1$ //$NON-NLS-2$
return i;
}
}
-
+
log.warn("NO BKU match for " + bkuName); //$NON-NLS-1$
return 0;
}
-
+
void performBKUSelectionChanged(BKUs selected) {
log.debug("Selected BKU: " + selected.toString()); //$NON-NLS-1$
this.configurationContainer.setBKUSelection(selected);
@@ -343,24 +382,24 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
this.performBKUSelectionChanged(bkuvalue);
} catch (Exception ex) {
log.error("Failed to parse BKU value: " + selected, ex); //$NON-NLS-1$
- ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE, Messages.getString("error.InvalidBKU"), ex, false); //$NON-NLS-1$
+ ErrorDialog dialog = new ErrorDialog(getShell(), Messages.getString("error.InvalidBKU"), false); //$NON-NLS-1$
dialog.open();
}
}
-
+
BKUs resolvBKU(String localizedBKU) {
int blen = BKUs.values().length;
for (int i = 0; i < blen; i++) {
String lookup = "BKU." + BKUs.values()[i].toString(); //$NON-NLS-1$
- if(Messages.getString(lookup).equals(localizedBKU)) {
+ if (Messages.getString(lookup).equals(localizedBKU)) {
return BKUs.values()[i];
}
}
return BKUs.NONE;
}
-
+
void performPositionSelection(boolean automatic) {
log.debug("Selected Position: " + automatic); //$NON-NLS-1$
this.configurationContainer.setAutomaticPosition(automatic);
@@ -391,20 +430,41 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
@Override
public void loadConfiguration() {
// load advanced settings
- this.performBKUSelectionChanged(this.configurationContainer.getBKUSelection());
+ this.performBKUSelectionChanged(this.configurationContainer
+ .getBKUSelection());
String outputFolder = this.configurationContainer.getOutputFolder();
- if(outputFolder != null) {
+ if (outputFolder != null) {
this.performOutputFolderChanged(outputFolder);
}
- this.performPositionSelection(this.configurationContainer.getAutomaticPosition());
- this.sclTransparenz.setSelection(this.configurationContainer.getPlaceholderTransparency());
+ this.performPositionSelection(this.configurationContainer
+ .getAutomaticPosition());
+ this.sclTransparenz.setSelection(this.configurationContainer
+ .getPlaceholderTransparency());
}
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#validateSettings()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.asit.pdfover.gui.composites.BaseConfigurationComposite#validateSettings
+ * ()
*/
@Override
public void validateSettings() throws Exception {
- // Nothing to do here (yet)
+
+ String foldername = this.configurationContainer.getOutputFolder();
+
+ if (foldername != null && !foldername.equals("")) {
+ File outputFolder = new File(foldername);
+ if (!outputFolder.exists()) {
+ throw new Exception("Path " + outputFolder.getAbsolutePath()
+ + " doesnot exists!");
+ }
+
+ if (!outputFolder.isDirectory()) {
+ throw new Exception("Path " + outputFolder.getAbsolutePath()
+ + " is not a directory!");
+ }
+ }
}
}