diff options
Diffstat (limited to 'trunk/pdf-over-gui/src/main/java/at/asit')
2 files changed, 79 insertions, 75 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java index 48d3b0aa..10b44a61 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java @@ -29,8 +29,6 @@ import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; @@ -68,7 +66,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { Text txtOutputFolder; Combo cmbBKUAuswahl; Combo cmbLocaleAuswahl; - Combo cmbSigningLangAuswahl; String[] bkuStrings; Button btnAutomatischePositionierung; Scale sclTransparenz; @@ -81,7 +78,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { private Label lblTransparenzRechts; private Label lblTransparenzLinks; private Label lblTransparenz; - private Label lblSigningLanguage; /** * @param parent @@ -191,53 +187,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { } }); - Composite compSigningLanguageContainer = new Composite(this.grpSignatur, SWT.NONE); - FormData fd_compSigningLanguageContainer = new FormData(); - fd_compSigningLanguageContainer.left = new FormAttachment(0, 5); - fd_compSigningLanguageContainer.right = new FormAttachment(100, -5); - fd_compSigningLanguageContainer.top = new FormAttachment(this.sclTransparenz, 5); - compSigningLanguageContainer.setLayoutData(fd_compSigningLanguageContainer); - compSigningLanguageContainer.setLayout(new GridLayout(2, false)); - - this.lblSigningLanguage = new Label(compSigningLanguageContainer, SWT.READ_ONLY); - this.lblSigningLanguage.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, - false, false, 1, 1)); - - FontData[] fD_lblSigningLanguage = this.lblSigningLanguage.getFont() - .getFontData(); - fD_lblSigningLanguage[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.lblSigningLanguage.setFont(new Font(Display.getCurrent(), - fD_lblSigningLanguage[0])); - - this.cmbSigningLangAuswahl = new Combo(compSigningLanguageContainer, SWT.READ_ONLY); - this.cmbSigningLangAuswahl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, - true, false, 1, 1)); - - FontData[] fD_cmbSigningLangAuswahl = this.cmbSigningLangAuswahl.getFont() - .getFontData(); - fD_cmbSigningLangAuswahl[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.cmbSigningLangAuswahl.setFont(new Font(Display.getCurrent(), - fD_cmbSigningLangAuswahl[0])); - - String[] localeSignStrings = new String[Constants.SUPPORTED_LOCALES.length]; - for (int i = 0; i < Constants.SUPPORTED_LOCALES.length; ++i) { - localeSignStrings[i] = Constants.SUPPORTED_LOCALES[i].getDisplayLanguage(); - } - this.cmbSigningLangAuswahl.setItems(localeSignStrings); - this.cmbSigningLangAuswahl.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - Locale currentLocale = AdvancedConfigurationComposite.this.configurationContainer - .getSignLocale(); - Locale selectedLocale = Constants. - SUPPORTED_LOCALES[AdvancedConfigurationComposite.this.cmbSigningLangAuswahl - .getSelectionIndex()]; - if (!currentLocale.equals(selectedLocale)) { - performSignLocaleSelectionChanged(selectedLocale); - } - } - }); - this.grpBkuAuswahl = new Group(this, SWT.NONE); layout = new FormLayout(); layout.marginHeight = 10; @@ -508,29 +457,11 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { return 0; } - int getSignLocaleElementIndex(Locale locale) { - for (int i = 0; i < Constants.SUPPORTED_LOCALES.length; i++) { - if (Constants.SUPPORTED_LOCALES[i].equals(locale)) { - log.debug("Locale: " + locale + " IDX: " + i); //$NON-NLS-1$ //$NON-NLS-2$ - return i; - } - } - - log.warn("NO Locale match for " + locale); //$NON-NLS-1$ - return 0; - } - void performLocaleSelectionChanged(Locale selected) { log.debug("Selected Locale: " + selected); //$NON-NLS-1$ this.configurationContainer.setLocale(selected); this.cmbLocaleAuswahl.select(this.getLocaleElementIndex(selected)); } - - void performSignLocaleSelectionChanged(Locale selected) { - log.debug("Selected Sign Locale: " + selected); //$NON-NLS-1$ - this.configurationContainer.setSignLocale(selected); - this.cmbSigningLangAuswahl.select(this.getSignLocaleElementIndex(selected)); - } void performPositionSelection(boolean automatic) { log.debug("Selected Position: " + automatic); //$NON-NLS-1$ @@ -573,7 +504,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.sclTransparenz.setSelection(this.configurationContainer .getPlaceholderTransparency()); this.performLocaleSelectionChanged(this.configurationContainer.getLocale()); - this.performSignLocaleSelectionChanged(this.configurationContainer.getSignLocale()); } /* @@ -623,8 +553,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { .getString("advanced_config.SigPHTransparencyMax")); //$NON-NLS-1$ this.sclTransparenz.setToolTipText(Messages .getString("advanced_config.SigPHTransparencyTooltip")); //$NON-NLS-1$ - this.lblSigningLanguage.setText(Messages.getString("advanced_config.SigBlockLang")); //$NON-NLS-1$ - this.cmbSigningLangAuswahl.setToolTipText(Messages.getString("advanced_config.SigBlockLang_ToolTip")); //$NON-NLS-1$ this.grpBkuAuswahl.setText(Messages .getString("advanced_config.BKUSelection_Title")); //$NON-NLS-1$ diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index aaeafe9c..f455c586 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -18,6 +18,7 @@ package at.asit.pdfover.gui.composites; // Imports import java.awt.image.BufferedImage; import java.io.File; +import java.util.Locale; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.DND; @@ -45,6 +46,7 @@ import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; @@ -101,6 +103,9 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { Text txtSignatureNote; private Button btnSignatureNoteDefault; + private Group grpSignatureLang; + Combo cmbSignatureLang; + private Group grpProxy; private Label lblProxyHost; private Text txtProxyHost; @@ -387,10 +392,59 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.btnBrowseLogo.setFont(new Font(Display.getCurrent(), fD_btnBrowseEmblem[0])); + + this.grpSignatureLang = new Group(this, SWT.NONE); + FormData fd_grpSignatureLang = new FormData(); + fd_grpSignatureLang.right = new FormAttachment(100, -5); + fd_grpSignatureLang.top = new FormAttachment(this.grpLogo, 5); + fd_grpSignatureLang.left = new FormAttachment(0, 5); + this.grpSignatureLang.setLayoutData(fd_grpSignatureLang); + this.grpSignatureLang.setLayout(new FormLayout()); + + FontData[] fD_grpSignatureLang = this.grpSignatureLang.getFont() + .getFontData(); + fD_grpSignatureLang[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.grpSignatureLang.setFont(new Font(Display.getCurrent(), + fD_grpSignatureLang[0])); + + this.cmbSignatureLang = new Combo(this.grpSignatureLang, SWT.READ_ONLY); + FormData fd_cmbSignatureLang = new FormData(); + fd_cmbSignatureLang.left = new FormAttachment(0, 10); + fd_cmbSignatureLang.right = new FormAttachment(100, -10); + fd_cmbSignatureLang.top = new FormAttachment(0, 10); + fd_cmbSignatureLang.bottom = new FormAttachment(100, -10); + this.cmbSignatureLang.setLayoutData(fd_cmbSignatureLang); + + FontData[] fD_cmbSignatureLang = this.cmbSignatureLang.getFont() + .getFontData(); + fD_cmbSignatureLang[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.cmbSignatureLang.setFont(new Font(Display.getCurrent(), + fD_cmbSignatureLang[0])); + + String[] localeSignStrings = new String[Constants.SUPPORTED_LOCALES.length]; + for (int i = 0; i < Constants.SUPPORTED_LOCALES.length; ++i) { + localeSignStrings[i] = Constants.SUPPORTED_LOCALES[i].getDisplayLanguage(); + } + this.cmbSignatureLang.setItems(localeSignStrings); + this.cmbSignatureLang.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Locale currentLocale = SimpleConfigurationComposite.this.configurationContainer + .getSignLocale(); + Locale selectedLocale = Constants. + SUPPORTED_LOCALES[SimpleConfigurationComposite.this.cmbSignatureLang + .getSelectionIndex()]; + if (!currentLocale.equals(selectedLocale)) { + performSignatureLangSelectionChanged(selectedLocale); + } + } + }); + + this.grpSignatureNote = new Group(this, SWT.NONE); FormData fd_grpSignatureNote = new FormData(); fd_grpSignatureNote.right = new FormAttachment(100, -5); - fd_grpSignatureNote.top = new FormAttachment(this.grpLogo, 5); + fd_grpSignatureNote.top = new FormAttachment(this.grpSignatureLang, 5); fd_grpSignatureNote.left = new FormAttachment(0, 5); this.grpSignatureNote.setLayoutData(fd_grpSignatureNote); this.grpSignatureNote.setLayout(new GridLayout(2, false)); @@ -433,7 +487,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fD_txtSignatureNote[0])); this.txtSignatureNote.addFocusListener(new FocusAdapter() { - @Override public void focusLost(FocusEvent e) { processSignatureNoteChanged(); @@ -441,7 +494,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { }); this.txtSignatureNote.addTraverseListener(new TraverseListener() { - @Override public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_RETURN) { @@ -469,6 +521,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } }); + this.grpProxy = new Group(this, SWT.NONE); FormData fd_grpProxy = new FormData(); fd_grpProxy.right = new FormAttachment(100, -5); @@ -838,6 +891,24 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } } + int getLocaleElementIndex(Locale locale) { + for (int i = 0; i < Constants.SUPPORTED_LOCALES.length; i++) { + if (Constants.SUPPORTED_LOCALES[i].equals(locale)) { + log.debug("Locale: " + locale + " IDX: " + i); //$NON-NLS-1$ //$NON-NLS-2$ + return i; + } + } + + log.warn("NO Locale match for " + locale); //$NON-NLS-1$ + return 0; + } + + void performSignatureLangSelectionChanged(Locale selected) { + log.debug("Selected Sign Locale: " + selected); //$NON-NLS-1$ + this.configurationContainer.setSignLocale(selected); + this.cmbSignatureLang.select(this.getLocaleElementIndex(selected)); + } + /* * (non-Javadoc) * @@ -991,6 +1062,8 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } this.setVisibleImage(); + + this.performSignatureLangSelectionChanged(this.configurationContainer.getSignLocale()); } /* @@ -1048,6 +1121,9 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.btnSignatureNoteDefault.setText(Messages .getString("simple_config.Note_SetDefault")); //$NON-NLS-1$ + this.grpSignatureLang.setText(Messages.getString("advanced_config.SigBlockLang")); //$NON-NLS-1$ + this.cmbSignatureLang.setToolTipText(Messages.getString("advanced_config.SigBlockLang_ToolTip")); //$NON-NLS-1$ + this.grpProxy.setText(Messages.getString("simple_config.Proxy_Title")); //$NON-NLS-1$ this.lblProxyHost.setText(Messages.getString("simple_config.ProxyHost")); //$NON-NLS-1$ this.txtProxyHost.setToolTipText(Messages |