From 2510d4deffa1634593600076e7d5446d2982c9bb Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 7 Nov 2012 11:16:01 +0100 Subject: + implemented localization configuration and on the fly resource reloading --- .../main/java/at/asit/pdfover/gui/MainWindow.java | 42 +- .../composites/AdvancedConfigurationComposite.java | 267 ++++-- .../gui/composites/BKUSelectionComposite.java | 29 +- .../gui/composites/ConfigurationComposite.java | 70 +- .../gui/composites/DataSourceSelectComposite.java | 13 +- .../composites/MobileBKUEnterNumberComposite.java | 42 +- .../gui/composites/MobileBKUEnterTANComposite.java | 29 +- .../pdfover/gui/composites/OutputComposite.java | 27 +- .../gui/composites/PositioningComposite.java | 23 +- .../composites/SimpleConfigurationComposite.java | 965 +++++++++++---------- .../pdfover/gui/composites/StateComposite.java | 5 + .../pdfover/gui/composites/WaitingComposite.java | 18 +- .../gui/workflow/ConfigurationContainer.java | 14 + .../gui/workflow/ConfigurationContainerImpl.java | 24 + .../at/asit/pdfover/gui/workflow/GUIProvider.java | 5 + .../pdfover/gui/workflow/StateMachineImpl.java | 8 + .../gui/workflow/states/ConfigurationUIState.java | 7 + 17 files changed, 1009 insertions(+), 579 deletions(-) (limited to 'trunk/pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java index a4798c28..8d633517 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java @@ -105,6 +105,8 @@ public class MainWindow { private Map buttonMap; + private MainBarEndButton btn_end; + /** * Default constructor * @@ -143,6 +145,7 @@ public class MainWindow { if (ctrl instanceof StateComposite) { if (!ctrl.isDisposed()) { ((StateComposite) ctrl).doLayout(); + ((StateComposite) ctrl).reloadResources(); } } } @@ -165,6 +168,35 @@ public class MainWindow { createContents(); } + /** + * Reload the localization + */ + public void reloadLocalization() { + getShell().setText(Messages.getString("main.title")); //$NON-NLS-1$ + this.btn_config.setText(Messages.getString("main.configuration")); //$NON-NLS-1$ + this.btn_config.setToolTipText(Messages.getString("main.configuration")); //$NON-NLS-1$ + this.btn_open.setText(Messages.getString("common.open")); //$NON-NLS-1$ + this.btn_open.setToolTipText(Messages.getString("common.open")); //$NON-NLS-1$ + + this.btn_position.setText(Messages.getString("main.position")); //$NON-NLS-1$ + this.btn_position.setToolTipText(Messages.getString("main.position")); //$NON-NLS-1$ + + + this.btn_sign.setText(Messages.getString("main.signature")); //$NON-NLS-1$ + this.btn_sign.setToolTipText(Messages.getString("main.signature")); //$NON-NLS-1$ + + + this.btn_end.setText(Messages.getString("main.done")); //$NON-NLS-1$ + this.btn_end.setToolTipText(Messages.getString("main.done")); //$NON-NLS-1$ + + Control ctrl = this.stack.topControl; + if (ctrl instanceof StateComposite) { + if (!ctrl.isDisposed()) { + ((StateComposite) ctrl).reloadResources(); + } + } + } + /** * Create contents of the window. */ @@ -293,16 +325,16 @@ public class MainWindow { }); this.buttonMap.put(Buttons.SIGN, this.btn_sign); - MainBarEndButton end = new MainBarEndButton(mainbarContainer, SWT.NONE); + this.btn_end = new MainBarEndButton(mainbarContainer, SWT.NONE); FormData fd_btn_end = new FormData(); fd_btn_end.left = new FormAttachment(81, -1 * (MainBarButton.SplitFactor / 2)); fd_btn_end.right = new FormAttachment(100); fd_btn_end.top = new FormAttachment(0); fd_btn_end.bottom = new FormAttachment(100); - end.setLayoutData(fd_btn_end); - end.setText(Messages.getString("main.done")); //$NON-NLS-1$ - end.setToolTipText(Messages.getString("main.done")); //$NON-NLS-1$ - this.buttonMap.put(Buttons.FINAL, end); + this.btn_end.setLayoutData(fd_btn_end); + this.btn_end.setText(Messages.getString("main.done")); //$NON-NLS-1$ + this.btn_end.setToolTipText(Messages.getString("main.done")); //$NON-NLS-1$ + this.buttonMap.put(Buttons.FINAL, this.btn_end); this.container = new Composite(getShell(), SWT.RESIZE); this.containerFormData = new FormData(); 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 05b16824..2f061402 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 @@ -17,6 +17,7 @@ package at.asit.pdfover.gui.composites; // Imports import java.io.File; +import java.util.Locale; import org.eclipse.swt.SWT; import org.eclipse.swt.events.FocusAdapter; @@ -46,6 +47,7 @@ import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.ErrorDialog.ERROR_BUTTONS; import at.asit.pdfover.gui.exceptions.OutputfolderDontExistException; import at.asit.pdfover.gui.exceptions.OutputfolderNotADirectoryException; +import at.asit.pdfover.gui.utils.LocaleSerializer; import at.asit.pdfover.gui.workflow.ConfigurationContainer; import at.asit.pdfover.gui.workflow.states.State; import at.asit.pdfover.signator.BKUs; @@ -64,9 +66,20 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { .getLogger(AdvancedConfigurationComposite.class); Text txtOutputFolder; Combo cmbBKUAuswahl; + Combo cmbLocaleAuswahl; String[] bkuStrings; + String[] localeStrings; Button btnAutomatischePositionierung; Scale sclTransparenz; + private Group grpSignatur; + private Group grpLocaleAuswahl; + private Button btnBrowse; + private Label lblDefaultOutputFolder; + private Group grpSpeicherort; + private Group grpBkuAuswahl; + private Label lblTransparenzRechts; + private Label lblTransparenzLinks; + private Label lblTransparenz; /** * @param parent @@ -79,25 +92,25 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { super(parent, style, state, container); setLayout(new FormLayout()); - Group grpSignatur = new Group(this, SWT.NONE); - grpSignatur.setText(Messages + this.grpSignatur = new Group(this, SWT.NONE); + this.grpSignatur.setText(Messages .getString("advanced_config.Signature_Title")); //$NON-NLS-1$ FormLayout layout = new FormLayout(); layout.marginHeight = 10; layout.marginWidth = 5; - grpSignatur.setLayout(layout); + this.grpSignatur.setLayout(layout); FormData fd_grpSignatur = new FormData(); fd_grpSignatur.top = new FormAttachment(0, 5); fd_grpSignatur.right = new FormAttachment(100, -5); fd_grpSignatur.left = new FormAttachment(0, 5); - grpSignatur.setLayoutData(fd_grpSignatur); + this.grpSignatur.setLayoutData(fd_grpSignatur); - FontData[] fD_grpSignaturPosition = grpSignatur.getFont().getFontData(); + FontData[] fD_grpSignaturPosition = this.grpSignatur.getFont().getFontData(); fD_grpSignaturPosition[0].setHeight(Constants.TEXT_SIZE_NORMAL); - grpSignatur.setFont(new Font(Display.getCurrent(), + this.grpSignatur.setFont(new Font(Display.getCurrent(), fD_grpSignaturPosition[0])); - this.btnAutomatischePositionierung = new Button(grpSignatur, SWT.CHECK); + this.btnAutomatischePositionierung = new Button(this.grpSignatur, SWT.CHECK); FormData fd_btnAutomatischePositionierung = new FormData(); fd_btnAutomatischePositionierung.right = new FormAttachment(100, -5); fd_btnAutomatischePositionierung.top = new FormAttachment(0); @@ -129,53 +142,53 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { }); log.debug(this.btnAutomatischePositionierung.getBounds().toString()); - Label lblTransparenz = new Label(grpSignatur, SWT.HORIZONTAL); + this.lblTransparenz = new Label(this.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 + this.lblTransparenz.setLayoutData(fd_lblTransparenz); + this.lblTransparenz.setText(Messages .getString("advanced_config.SigPHTransparency")); //$NON-NLS-1$ - FontData[] fD_lblTransparenz = lblTransparenz.getFont().getFontData(); + FontData[] fD_lblTransparenz = this.lblTransparenz.getFont().getFontData(); fD_lblTransparenz[0].setHeight(Constants.TEXT_SIZE_NORMAL); - lblTransparenz.setFont(new Font(Display.getCurrent(), + this.lblTransparenz.setFont(new Font(Display.getCurrent(), fD_lblTransparenz[0])); - Label lblTransparenzLinks = new Label(grpSignatur, SWT.HORIZONTAL); + this.lblTransparenzLinks = new Label(this.grpSignatur, SWT.HORIZONTAL); FormData fd_lblTransparenzLinks = new FormData(); - fd_lblTransparenzLinks.top = new FormAttachment(lblTransparenz, 5); + fd_lblTransparenzLinks.top = new FormAttachment(this.lblTransparenz, 5); fd_lblTransparenzLinks.left = new FormAttachment(0, 15); - lblTransparenzLinks.setLayoutData(fd_lblTransparenzLinks); - lblTransparenzLinks.setText(Messages + this.lblTransparenzLinks.setLayoutData(fd_lblTransparenzLinks); + this.lblTransparenzLinks.setText(Messages .getString("advanced_config.SigPHTransparencyMin")); //$NON-NLS-1$ - FontData[] fD_lblTransparenzLinks = lblTransparenzLinks.getFont() + FontData[] fD_lblTransparenzLinks = this.lblTransparenzLinks.getFont() .getFontData(); fD_lblTransparenzLinks[0].setHeight(Constants.TEXT_SIZE_NORMAL); - lblTransparenzLinks.setFont(new Font(Display.getCurrent(), + this.lblTransparenzLinks.setFont(new Font(Display.getCurrent(), fD_lblTransparenzLinks[0])); - Label lblTransparenzRechts = new Label(grpSignatur, SWT.HORIZONTAL); + this.lblTransparenzRechts = new Label(this.grpSignatur, SWT.HORIZONTAL); FormData fd_lblTransparenzRechts = new FormData(); - fd_lblTransparenzRechts.top = new FormAttachment(lblTransparenz, 5); + fd_lblTransparenzRechts.top = new FormAttachment(this.lblTransparenz, 5); fd_lblTransparenzRechts.right = new FormAttachment(100, -5); - lblTransparenzRechts.setLayoutData(fd_lblTransparenzRechts); - lblTransparenzRechts.setText(Messages + this.lblTransparenzRechts.setLayoutData(fd_lblTransparenzRechts); + this.lblTransparenzRechts.setText(Messages .getString("advanced_config.SigPHTransparencyMax")); //$NON-NLS-1$ - FontData[] fD_lblTransparenzRechts = lblTransparenzRechts.getFont() + FontData[] fD_lblTransparenzRechts = this.lblTransparenzRechts.getFont() .getFontData(); fD_lblTransparenzRechts[0].setHeight(Constants.TEXT_SIZE_NORMAL); - lblTransparenzRechts.setFont(new Font(Display.getCurrent(), + this.lblTransparenzRechts.setFont(new Font(Display.getCurrent(), fD_lblTransparenzRechts[0])); - this.sclTransparenz = new Scale(grpSignatur, SWT.HORIZONTAL); + this.sclTransparenz = new Scale(this.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); + fd_sldTransparenz.right = new FormAttachment(this.lblTransparenzRechts, -5); + fd_sldTransparenz.top = new FormAttachment(this.lblTransparenz, 5); + fd_sldTransparenz.left = new FormAttachment(this.lblTransparenzLinks, 5); this.sclTransparenz.setLayoutData(fd_sldTransparenz); this.sclTransparenz.setMinimum(0); this.sclTransparenz.setMaximum(255); @@ -189,25 +202,25 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { } }); - Group grpBkuAuswahl = new Group(this, SWT.NONE); - grpBkuAuswahl.setText(Messages + this.grpBkuAuswahl = new Group(this, SWT.NONE); + this.grpBkuAuswahl.setText(Messages .getString("advanced_config.BKUSelection_Title")); //$NON-NLS-1$ layout = new FormLayout(); layout.marginHeight = 10; layout.marginWidth = 5; - grpBkuAuswahl.setLayout(layout); + this.grpBkuAuswahl.setLayout(layout); FormData fd_grpBkuAuswahl = new FormData(); - fd_grpBkuAuswahl.top = new FormAttachment(grpSignatur, 5); + fd_grpBkuAuswahl.top = new FormAttachment(this.grpSignatur, 5); fd_grpBkuAuswahl.left = new FormAttachment(0, 5); fd_grpBkuAuswahl.right = new FormAttachment(100, -5); - grpBkuAuswahl.setLayoutData(fd_grpBkuAuswahl); + this.grpBkuAuswahl.setLayoutData(fd_grpBkuAuswahl); - FontData[] fD_grpBkuAuswahl = grpBkuAuswahl.getFont().getFontData(); + FontData[] fD_grpBkuAuswahl = this.grpBkuAuswahl.getFont().getFontData(); fD_grpBkuAuswahl[0].setHeight(Constants.TEXT_SIZE_NORMAL); - grpBkuAuswahl.setFont(new Font(Display.getCurrent(), + this.grpBkuAuswahl.setFont(new Font(Display.getCurrent(), fD_grpBkuAuswahl[0])); - this.cmbBKUAuswahl = new Combo(grpBkuAuswahl, SWT.READ_ONLY); + this.cmbBKUAuswahl = new Combo(this.grpBkuAuswahl, SWT.READ_ONLY); FormData fd_cmbBKUAuswahl = new FormData(); fd_cmbBKUAuswahl.right = new FormAttachment(100, -5); fd_cmbBKUAuswahl.top = new FormAttachment(0); @@ -251,41 +264,41 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { } }); - Group grpSpeicherort = new Group(this, SWT.NONE); - grpSpeicherort.setText(Messages + this.grpSpeicherort = new Group(this, SWT.NONE); + this.grpSpeicherort.setText(Messages .getString("advanced_config.OutputFolder_Title")); //$NON-NLS-1$ layout = new FormLayout(); layout.marginHeight = 10; layout.marginWidth = 5; - grpSpeicherort.setLayout(layout); + this.grpSpeicherort.setLayout(layout); FormData fd_grpSpeicherort = new FormData(); - fd_grpSpeicherort.top = new FormAttachment(grpBkuAuswahl, 5); + fd_grpSpeicherort.top = new FormAttachment(this.grpBkuAuswahl, 5); fd_grpSpeicherort.left = new FormAttachment(0, 5); fd_grpSpeicherort.right = new FormAttachment(100, -5); - grpSpeicherort.setLayoutData(fd_grpSpeicherort); + this.grpSpeicherort.setLayoutData(fd_grpSpeicherort); - FontData[] fD_grpSpeicherort = grpSpeicherort.getFont().getFontData(); + FontData[] fD_grpSpeicherort = this.grpSpeicherort.getFont().getFontData(); fD_grpSpeicherort[0].setHeight(Constants.TEXT_SIZE_NORMAL); - grpSpeicherort.setFont(new Font(Display.getCurrent(), + this.grpSpeicherort.setFont(new Font(Display.getCurrent(), fD_grpSpeicherort[0])); - Label lblDefaultOutputFolder = new Label(grpSpeicherort, SWT.NONE); + this.lblDefaultOutputFolder = new Label(this.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 + this.lblDefaultOutputFolder.setLayoutData(fd_lblDefaultOutputFolder); + this.lblDefaultOutputFolder.setText(Messages .getString("advanced_config.OutputFolder")); //$NON-NLS-1$ - FontData[] fD_lblDefaultOutputFolder = lblDefaultOutputFolder.getFont() + FontData[] fD_lblDefaultOutputFolder = this.lblDefaultOutputFolder.getFont() .getFontData(); fD_lblDefaultOutputFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); - lblDefaultOutputFolder.setFont(new Font(Display.getCurrent(), + this.lblDefaultOutputFolder.setFont(new Font(Display.getCurrent(), fD_lblDefaultOutputFolder[0])); - this.txtOutputFolder = new Text(grpSpeicherort, SWT.BORDER); + this.txtOutputFolder = new Text(this.grpSpeicherort, SWT.BORDER); FormData fd_text = new FormData(); - fd_text.top = new FormAttachment(lblDefaultOutputFolder, 5); + fd_text.top = new FormAttachment(this.lblDefaultOutputFolder, 5); fd_text.left = new FormAttachment(0, 15); this.txtOutputFolder.setLayoutData(fd_text); @@ -307,20 +320,20 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.txtOutputFolder.setToolTipText(Messages .getString("advanced_config.OutputFolder_ToolTip")); //$NON-NLS-1$ - Button btnBrowse = new Button(grpSpeicherort, SWT.NONE); - fd_text.right = new FormAttachment(btnBrowse, -5); + this.btnBrowse = new Button(this.grpSpeicherort, SWT.NONE); + fd_text.right = new FormAttachment(this.btnBrowse, -5); - FontData[] fD_btnBrowse = btnBrowse.getFont().getFontData(); + FontData[] fD_btnBrowse = this.btnBrowse.getFont().getFontData(); fD_btnBrowse[0].setHeight(Constants.TEXT_SIZE_BUTTON); - btnBrowse.setFont(new Font(Display.getCurrent(), fD_btnBrowse[0])); + this.btnBrowse.setFont(new Font(Display.getCurrent(), fD_btnBrowse[0])); FormData fd_btnBrowse = new FormData(); - fd_btnBrowse.top = new FormAttachment(lblDefaultOutputFolder, 5); + fd_btnBrowse.top = new FormAttachment(this.lblDefaultOutputFolder, 5); fd_btnBrowse.right = new FormAttachment(100, -5); - btnBrowse.setLayoutData(fd_btnBrowse); - btnBrowse.setText(Messages.getString("common.browse")); //$NON-NLS-1$ + this.btnBrowse.setLayoutData(fd_btnBrowse); + this.btnBrowse.setText(Messages.getString("common.browse")); //$NON-NLS-1$ - btnBrowse.addSelectionListener(new SelectionAdapter() { + this.btnBrowse.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -350,6 +363,64 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { } } }); + + this.grpLocaleAuswahl = new Group(this, SWT.NONE); + this.grpLocaleAuswahl.setText(Messages + .getString("advanced_config.LocaleSelection_Title")); //$NON-NLS-1$ + FormLayout layout_grpLocaleAuswahl = new FormLayout(); + layout_grpLocaleAuswahl.marginHeight = 10; + layout_grpLocaleAuswahl.marginWidth = 5; + this.grpLocaleAuswahl.setLayout(layout_grpLocaleAuswahl); + FormData fd_grpLocaleAuswahl = new FormData(); + fd_grpLocaleAuswahl.top = new FormAttachment(this.grpSpeicherort, 5); + fd_grpLocaleAuswahl.left = new FormAttachment(0, 5); + fd_grpLocaleAuswahl.right = new FormAttachment(100, -5); + this.grpLocaleAuswahl.setLayoutData(fd_grpLocaleAuswahl); + + FontData[] fD_grpLocaleAuswahl = this.grpLocaleAuswahl.getFont().getFontData(); + fD_grpLocaleAuswahl[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.grpLocaleAuswahl.setFont(new Font(Display.getCurrent(), + fD_grpLocaleAuswahl[0])); + + this.cmbLocaleAuswahl = new Combo(this.grpLocaleAuswahl, SWT.READ_ONLY); + FormData fd_cmbLocaleAuswahl = new FormData(); + fd_cmbLocaleAuswahl.right = new FormAttachment(100, -5); + fd_cmbLocaleAuswahl.top = new FormAttachment(0); + fd_cmbLocaleAuswahl.left = new FormAttachment(0, 5); + + FontData[] fD_cmbLocaleAuswahl = this.cmbLocaleAuswahl.getFont() + .getFontData(); + fD_cmbLocaleAuswahl[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.cmbLocaleAuswahl.setFont(new Font(Display.getCurrent(), + fD_cmbLocaleAuswahl[0])); + + this.localeStrings = new String[2]; + + this.localeStrings[0] = LocaleSerializer.getParseableString(Locale.ENGLISH); + this.localeStrings[1] = LocaleSerializer.getParseableString(Locale.GERMAN); + + this.cmbLocaleAuswahl.setItems(this.localeStrings); + + this.cmbLocaleAuswahl.setLayoutData(fd_cmbLocaleAuswahl); + + this.cmbLocaleAuswahl.setToolTipText(Messages + .getString("advanced_config.LocaleSelection_ToolTip")); //$NON-NLS-1$ + + this.cmbLocaleAuswahl.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + int selectionIndex = getLocaleElementIndex((AdvancedConfigurationComposite.this.configurationContainer + .getLocale())); + if (AdvancedConfigurationComposite.this.cmbLocaleAuswahl + .getSelectionIndex() != selectionIndex) { + selectionIndex = AdvancedConfigurationComposite.this.cmbLocaleAuswahl + .getSelectionIndex(); + performLocleSelectionChanged((AdvancedConfigurationComposite.this.cmbLocaleAuswahl + .getItem(selectionIndex))); + } + } + }); } /* @@ -383,6 +454,47 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { log.warn("NO BKU match for " + bkuName); //$NON-NLS-1$ return 0; } + + int getLocaleElementIndex(Locale locale) { + String lookup = LocaleSerializer.getParseableString(locale); + //String bkuName = Messages.getString(lookup); + + for (int i = 0; i < this.localeStrings.length; i++) { + if (this.localeStrings[i].equals(lookup)) { + log.debug("BKU: " + lookup + " IDX: " + i); //$NON-NLS-1$ //$NON-NLS-2$ + return i; + } + } + + log.warn("NO Locale match for " + lookup); //$NON-NLS-1$ + return 0; + } + + void performLocleSelectionChanged(String selected) { + try { + Locale locale = LocaleSerializer.parseFromString(selected); + if(locale != null) { + this.performLocaleSelectionChanged(locale); + } else { + log.error("Failed to parse LOCALE value: " + selected); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(getShell(), + Messages.getString("error.InvalidLocale"), ERROR_BUTTONS.OK); //$NON-NLS-1$ + dialog.open(); + } + } catch (Exception ex) { + log.error("Failed to parse LOCALE value: " + selected, ex); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(getShell(), + Messages.getString("error.InvalidLocale"), ERROR_BUTTONS.OK); //$NON-NLS-1$ + dialog.open(); + } + } + + void performLocaleSelectionChanged(Locale selected) { + log.debug("Selected Locale: " + selected.toString()); //$NON-NLS-1$ + this.configurationContainer.setLocale(selected); + this.cmbLocaleAuswahl.select(this.getLocaleElementIndex(selected)); + } + void performBKUSelectionChanged(BKUs selected) { log.debug("Selected BKU: " + selected.toString()); //$NON-NLS-1$ @@ -455,6 +567,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { .getAutomaticPosition()); this.sclTransparenz.setSelection(this.configurationContainer .getPlaceholderTransparency()); + this.performLocaleSelectionChanged(this.configurationContainer.getLocale()); } /* @@ -484,4 +597,42 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { case 1: } } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() + */ + @Override + public void reloadResources() { + this.grpSignatur.setText(Messages + .getString("advanced_config.Signature_Title")); //$NON-NLS-1$ + this.btnAutomatischePositionierung.setText(Messages + .getString("advanced_config.AutoPosition")); //$NON-NLS-1$ + this.cmbLocaleAuswahl.setToolTipText(Messages + .getString("advanced_config.LocaleSelection_ToolTip")); //$NON-NLS-1$ + + this.grpLocaleAuswahl.setText(Messages + .getString("advanced_config.LocaleSelection_Title")); //$NON-NLS-1$ + this.btnBrowse.setText(Messages.getString("common.browse")); //$NON-NLS-1$ + this.txtOutputFolder.setToolTipText(Messages + .getString("advanced_config.OutputFolder_ToolTip")); //$NON-NLS-1$ + this.lblDefaultOutputFolder.setText(Messages + .getString("advanced_config.OutputFolder")); //$NON-NLS-1$ + this.grpSpeicherort.setText(Messages + .getString("advanced_config.OutputFolder_Title")); //$NON-NLS-1$ + + this.cmbBKUAuswahl.setToolTipText(Messages + .getString("advanced_config.BKUSelection_ToolTip")); //$NON-NLS-1$ + + this.grpBkuAuswahl.setText(Messages + .getString("advanced_config.BKUSelection_Title")); //$NON-NLS-1$ + + this.lblTransparenzRechts.setText(Messages + .getString("advanced_config.SigPHTransparencyMax")); //$NON-NLS-1$ + + this.lblTransparenzLinks.setText(Messages + .getString("advanced_config.SigPHTransparencyMin")); //$NON-NLS-1$ + + this.lblTransparenz.setText(Messages + .getString("advanced_config.SigPHTransparency")); //$NON-NLS-1$ + } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java index 64c4d0a0..77bddf54 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java @@ -88,6 +88,10 @@ public class BKUSelectionComposite extends StateComposite { .getLogger(BKUSelectionComposite.class); private BKUs selected = BKUs.NONE; + + private Button btnMobile; + + private Button btnCard; /** * Gets selected BKU type @@ -156,25 +160,25 @@ public class BKUSelectionComposite extends StateComposite { btn_card.setImage(karte); - Button btnMobile = new Button(this, SWT.NONE); + this.btnMobile = new Button(this, SWT.NONE); FormData fd_btnMobile = new FormData(); fd_btnMobile.top = new FormAttachment(btn_mobile, 10); //fd_btnMobile.left = new FormAttachment(btn_mobile, 0); fd_btnMobile.right = new FormAttachment(50, -5); fd_btnMobile.width = btn_mobile.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; - btnMobile.setLayoutData(fd_btnMobile); - btnMobile.setText(Messages.getString("bku_selection.mobile")); //$NON-NLS-1$ - btnMobile.addSelectionListener(new MobileSelectionListener()); + this.btnMobile.setLayoutData(fd_btnMobile); + this.btnMobile.setText(Messages.getString("bku_selection.mobile")); //$NON-NLS-1$ + this.btnMobile.addSelectionListener(new MobileSelectionListener()); - Button btnCard = new Button(this, SWT.NONE); + this.btnCard = new Button(this, SWT.NONE); FormData fd_btnCard = new FormData(); fd_btnCard.top = new FormAttachment(btn_card, 10); //fd_btnMobile.left = new FormAttachment(btn_mobile, 0); fd_btnCard.left = new FormAttachment(50, 5); fd_btnCard.width = btn_card.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; - btnCard.setLayoutData(fd_btnCard); - btnCard.setText(Messages.getString("bku_selection.card")); //$NON-NLS-1$ - btnCard.addSelectionListener(new LocalSelectionListener()); + this.btnCard.setLayoutData(fd_btnCard); + this.btnCard.setText(Messages.getString("bku_selection.card")); //$NON-NLS-1$ + this.btnCard.addSelectionListener(new LocalSelectionListener()); //this.pack(); } @@ -190,4 +194,13 @@ public class BKUSelectionComposite extends StateComposite { public void doLayout() { this.layout(true, true); } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() + */ + @Override + public void reloadResources() { + this.btnMobile.setText(Messages.getString("bku_selection.mobile")); //$NON-NLS-1$ + this.btnCard.setText(Messages.getString("bku_selection.card")); //$NON-NLS-1$ + } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index f87604f0..9376c0ae 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -98,12 +98,12 @@ public class ConfigurationComposite extends StateComposite { fD_tabFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); tabFolder.setFont(new Font(Display.getCurrent(), fD_tabFolder[0])); - TabItem simpleTabItem = new TabItem(tabFolder, SWT.NONE); - simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$ + this.simpleTabItem = new TabItem(tabFolder, SWT.NONE); + this.simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$ ScrolledComposite simpleCompositeScr = new ScrolledComposite(tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); - simpleTabItem.setControl(simpleCompositeScr); + this.simpleTabItem.setControl(simpleCompositeScr); this.simpleConfigComposite = new SimpleConfigurationComposite( simpleCompositeScr, SWT.NONE, state, this.configurationContainer); @@ -113,12 +113,12 @@ public class ConfigurationComposite extends StateComposite { simpleCompositeScr.setMinSize(this.simpleConfigComposite.computeSize( SWT.DEFAULT, SWT.DEFAULT)); - TabItem advancedTabItem = new TabItem(tabFolder, SWT.NONE); - advancedTabItem.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$ + this.advancedTabItem = new TabItem(tabFolder, SWT.NONE); + this.advancedTabItem.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$ ScrolledComposite advancedCompositeScr = new ScrolledComposite( tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); - advancedTabItem.setControl(advancedCompositeScr); + this.advancedTabItem.setControl(advancedCompositeScr); this.advancedConfigComposite = new AdvancedConfigurationComposite( advancedCompositeScr, SWT.NONE, state, this.configurationContainer); @@ -128,14 +128,14 @@ public class ConfigurationComposite extends StateComposite { advancedCompositeScr.setMinSize(this.advancedConfigComposite .computeSize(SWT.DEFAULT, SWT.DEFAULT)); - tabFolder.setSelection(simpleTabItem); + tabFolder.setSelection(this.simpleTabItem); - Button btnSpeichern = new Button(this, SWT.NONE); + this.btnSpeichern = new Button(this, SWT.NONE); FormData fd_btnSpeichern = new FormData(); fd_btnSpeichern.right = new FormAttachment(100, -5); fd_btnSpeichern.bottom = new FormAttachment(100); - btnSpeichern.setLayoutData(fd_btnSpeichern); - btnSpeichern.addSelectionListener(new SelectionAdapter() { + this.btnSpeichern.setLayoutData(fd_btnSpeichern); + this.btnSpeichern.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (ConfigurationComposite.this.storeConfiguration()) { @@ -144,21 +144,21 @@ public class ConfigurationComposite extends StateComposite { } } }); - btnSpeichern.setText(Messages.getString("common.Save")); //$NON-NLS-1$ - this.getShell().setDefaultButton(btnSpeichern); + this.btnSpeichern.setText(Messages.getString("common.Save")); //$NON-NLS-1$ + this.getShell().setDefaultButton(this.btnSpeichern); - FontData[] fD_btnSpeichern = btnSpeichern.getFont().getFontData(); + FontData[] fD_btnSpeichern = this.btnSpeichern.getFont().getFontData(); fD_btnSpeichern[0].setHeight(Constants.TEXT_SIZE_BUTTON); - btnSpeichern + this.btnSpeichern .setFont(new Font(Display.getCurrent(), fD_btnSpeichern[0])); - Button btnAbbrechen = new Button(this, SWT.NONE); + this.btnAbbrechen = new Button(this, SWT.NONE); FormData fd_btnAbrechen = new FormData(); - fd_btnAbrechen.right = new FormAttachment(btnSpeichern, -10); - fd_btnAbrechen.bottom = new FormAttachment(btnSpeichern, 0, SWT.BOTTOM); - btnAbbrechen.setLayoutData(fd_btnAbrechen); - btnAbbrechen.setText(Messages.getString("common.Cancel")); //$NON-NLS-1$ - btnAbbrechen.addSelectionListener(new SelectionAdapter() { + fd_btnAbrechen.right = new FormAttachment(this.btnSpeichern, -10); + fd_btnAbrechen.bottom = new FormAttachment(this.btnSpeichern, 0, SWT.BOTTOM); + this.btnAbbrechen.setLayoutData(fd_btnAbrechen); + this.btnAbbrechen.setText(Messages.getString("common.Cancel")); //$NON-NLS-1$ + this.btnAbbrechen.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ConfigurationComposite.this.userDone = true; @@ -166,14 +166,14 @@ public class ConfigurationComposite extends StateComposite { } }); - FontData[] fD_btnAbbrechen = btnAbbrechen.getFont().getFontData(); + FontData[] fD_btnAbbrechen = this.btnAbbrechen.getFont().getFontData(); fD_btnAbbrechen[0].setHeight(Constants.TEXT_SIZE_BUTTON); - btnAbbrechen + this.btnAbbrechen .setFont(new Font(Display.getCurrent(), fD_btnAbbrechen[0])); FormData fd_composite = new FormData(); fd_composite.top = new FormAttachment(0, 5); - fd_composite.bottom = new FormAttachment(btnSpeichern, -10); + fd_composite.bottom = new FormAttachment(this.btnSpeichern, -10); fd_composite.left = new FormAttachment(0, 5); fd_composite.right = new FormAttachment(100, -5); this.containerComposite.setLayoutData(fd_composite); @@ -249,6 +249,14 @@ public class ConfigurationComposite extends StateComposite { */ boolean userDone = false; + private TabItem simpleTabItem; + + private TabItem advancedTabItem; + + private Button btnSpeichern; + + private Button btnAbbrechen; + /** * Sets the configuration manipulator * @@ -282,6 +290,8 @@ public class ConfigurationComposite extends StateComposite { this.configurationContainer.setSignatureNote( this.configProvider.getSigantureNote()); + this.configurationContainer.setLocale(this.configProvider.getConfigLocale()); + this.configurationContainer.setBKUSelection(this.configProvider .getDefaultBKU()); try { @@ -392,6 +402,8 @@ public class ConfigurationComposite extends StateComposite { this.configManipulator.setDefaultSignaturePosition(null); } + this.configManipulator.setLocale(this.configurationContainer.getLocale()); + this.configManipulator .setPlaceholderTransparency(this.configurationContainer .getPlaceholderTransparency()); @@ -428,6 +440,7 @@ public class ConfigurationComposite extends StateComposite { // return false; } } while (redo); + return status; } @@ -460,4 +473,15 @@ public class ConfigurationComposite extends StateComposite { ((StateComposite) ctrl).doLayout(); } } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() + */ + @Override + public void reloadResources() { + this.simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$ + this.advancedTabItem.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$ + this.btnSpeichern.setText(Messages.getString("common.Save")); //$NON-NLS-1$ + this.btnAbbrechen.setText(Messages.getString("common.Cancel")); //$NON-NLS-1$ + } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java index 17252457..90ecc0d7 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java @@ -291,7 +291,8 @@ public class DataSourceSelectComposite extends StateComposite { FontData[] fD2 = this.lbl_drag2.getFont().getFontData(); fD2[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.lbl_drag2.setFont(new Font(Display.getCurrent(), fD2[0])); - this.lbl_drag2.setText(Messages.getString("dataSourceSelection.DropLabel2")); //$NON-NLS-1$ + this.lbl_drag2.setText(Messages + .getString("dataSourceSelection.DropLabel2")); //$NON-NLS-1$ this.lbl_drag2.setAlignment(SWT.CENTER); this.btn_open = new Button(this.drop_area, SWT.NATIVE | SWT.RESIZE); @@ -385,4 +386,14 @@ public class DataSourceSelectComposite extends StateComposite { this.layout(true, true); this.drop_area.layout(true, true); } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() + */ + @Override + public void reloadResources() { + this.lbl_drag.setText(Messages.getString("dataSourceSelection.DropLabel")); //$NON-NLS-1$ + this.btn_open.setText(Messages.getString("dataSourceSelection.browse")); //$NON-NLS-1$ + this.lbl_drag2.setText(Messages.getString("dataSourceSelection.DropLabel2")); //$NON-NLS-1$ + } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java index 45fd3dff..c91f9397 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java @@ -141,6 +141,12 @@ public class MobileBKUEnterNumberComposite extends StateComposite { private Label lbl_error; + private Label lbl_password; + + private Label lbl_number; + + private Button btn_ok; + /** * @return the errorMessage */ @@ -209,15 +215,15 @@ public class MobileBKUEnterNumberComposite extends StateComposite { this.txt_number.setEditable(true); - Label lbl_number = new Label(containerComposite, SWT.NATIVE); - lbl_number.setAlignment(SWT.RIGHT); - lbl_number.setText(Messages.getString("mobileBKU.number")); //$NON-NLS-1$ + this.lbl_number = new Label(containerComposite, SWT.NATIVE); + this.lbl_number.setAlignment(SWT.RIGHT); + this.lbl_number.setText(Messages.getString("mobileBKU.number")); //$NON-NLS-1$ FormData fd_lbl_number = new FormData(); //fd_lbl_number.top = new FormAttachment(30, -15); fd_lbl_number.bottom = new FormAttachment(50, -10); //fd_lbl_number.left = new FormAttachment(0, 20); fd_lbl_number.right = new FormAttachment(50, -10); - lbl_number.setLayoutData(fd_lbl_number); + this.lbl_number.setLayoutData(fd_lbl_number); Label lbl_image = new Label(containerComposite, SWT.NATIVE); @@ -252,32 +258,32 @@ public class MobileBKUEnterNumberComposite extends StateComposite { } }); - Label lbl_password = new Label(containerComposite, SWT.NATIVE); - lbl_password.setAlignment(SWT.RIGHT); - lbl_password.setText(Messages.getString("mobileBKU.password")); //$NON-NLS-1$ + this.lbl_password = new Label(containerComposite, SWT.NATIVE); + this.lbl_password.setAlignment(SWT.RIGHT); + this.lbl_password.setText(Messages.getString("mobileBKU.password")); //$NON-NLS-1$ FormData fd_lbl_password = new FormData(); fd_lbl_password.top = new FormAttachment(50, 10); //fd_lbl_password.bottom = new FormAttachment(50, 15); //fd_lbl_password.left = new FormAttachment(0, 20); fd_lbl_password.right = new FormAttachment(50, -10); - lbl_password.setLayoutData(fd_lbl_password); + this.lbl_password.setLayoutData(fd_lbl_password); - Button btn_ok = new Button(containerComposite, SWT.NATIVE); - btn_ok.setText(Messages.getString("common.Ok")); //$NON-NLS-1$ + this.btn_ok = new Button(containerComposite, SWT.NATIVE); + this.btn_ok.setText(Messages.getString("common.Ok")); //$NON-NLS-1$ FormData fd_btn_ok = new FormData(); //fd_btn_ok.top = new FormAttachment(87, 0); fd_btn_ok.bottom = new FormAttachment(100, -20); fd_btn_ok.right = new FormAttachment(100, -20); fd_btn_ok.left = new FormAttachment(100, -70); - btn_ok.setLayoutData(fd_btn_ok); - btn_ok.addSelectionListener(new OkSelectionListener()); + this.btn_ok.setLayoutData(fd_btn_ok); + this.btn_ok.addSelectionListener(new OkSelectionListener()); this.lbl_error = new Label(containerComposite, SWT.WRAP | SWT.NATIVE); FormData fd_lbl_error = new FormData(); //fd_lbl_error.top = new FormAttachment(70, -15); fd_lbl_error.bottom = new FormAttachment(100, -20); //fd_lbl_error.left = new FormAttachment(15, 0); - fd_lbl_error.right = new FormAttachment(btn_ok, -10); + fd_lbl_error.right = new FormAttachment(this.btn_ok, -10); this.lbl_error.setLayoutData(fd_lbl_error); } @@ -339,4 +345,14 @@ public class MobileBKUEnterNumberComposite extends StateComposite { } } + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() + */ + @Override + public void reloadResources() { + this.lbl_number.setText(Messages.getString("mobileBKU.number")); //$NON-NLS-1$ + this.lbl_password.setText(Messages.getString("mobileBKU.password")); //$NON-NLS-1$ + this.btn_ok.setText(Messages.getString("common.Ok")); //$NON-NLS-1$ + } + } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java index fcd7084f..3d88ad0e 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java @@ -128,6 +128,10 @@ public class MobileBKUEnterTANComposite extends StateComposite { String tan; private Label lbl_tries; + + private Label lblVergleichswert; + + private Label lblTan; /** * @return the vergleichswert @@ -205,15 +209,15 @@ public class MobileBKUEnterTANComposite extends StateComposite { containerComposite.setLayoutData(fd_containerComposite); - Label lblVergleichswert = new Label(containerComposite, SWT.NATIVE); - lblVergleichswert.setAlignment(SWT.RIGHT); + this.lblVergleichswert = new Label(containerComposite, SWT.NATIVE); + this.lblVergleichswert.setAlignment(SWT.RIGHT); FormData fd_lblVergleichswert = new FormData(); //fd_lblVergleichswert.left = new FormAttachment(0, 20); fd_lblVergleichswert.right = new FormAttachment(50, -10); //fd_lblVergleichswert.top = new FormAttachment(30, -15); fd_lblVergleichswert.bottom = new FormAttachment(50, -10); - lblVergleichswert.setLayoutData(fd_lblVergleichswert); - lblVergleichswert.setText(Messages.getString("tanEnter.ReferenceValue")); //$NON-NLS-1$ + this.lblVergleichswert.setLayoutData(fd_lblVergleichswert); + this.lblVergleichswert.setText(Messages.getString("tanEnter.ReferenceValue")); //$NON-NLS-1$ Label lbl_image = new Label(containerComposite, SWT.NATIVE); @@ -237,15 +241,15 @@ public class MobileBKUEnterTANComposite extends StateComposite { this.lblvergleich.setLayoutData(fd_lblvergleich); this.lblvergleich.setText(""); //$NON-NLS-1$ - Label lblTan = new Label(containerComposite, SWT.NATIVE); - lblTan.setAlignment(SWT.RIGHT); + this.lblTan = new Label(containerComposite, SWT.NATIVE); + this.lblTan.setAlignment(SWT.RIGHT); FormData fd_lblTan = new FormData(); //fd_lblTan.left = new FormAttachment(0, 20); fd_lblTan.right = new FormAttachment(50, -10); fd_lblTan.top = new FormAttachment(50, 10); //fd_lblTan.bottom = new FormAttachment(50, 15); - lblTan.setLayoutData(fd_lblTan); - lblTan.setText(Messages.getString("tanEnter.TAN")); //$NON-NLS-1$ + this.lblTan.setLayoutData(fd_lblTan); + this.lblTan.setText(Messages.getString("tanEnter.TAN")); //$NON-NLS-1$ this.txt_tan = new Text(containerComposite, SWT.BORDER | SWT.NATIVE); FormData fd_text = new FormData(); @@ -314,4 +318,13 @@ public class MobileBKUEnterTANComposite extends StateComposite { // Nothing to do } + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() + */ + @Override + public void reloadResources() { + this.lblVergleichswert.setText(Messages.getString("tanEnter.ReferenceValue")); //$NON-NLS-1$ + this.lblTan.setText(Messages.getString("tanEnter.TAN")); //$NON-NLS-1$ + } + } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java index a9ea31d2..aa134242 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java @@ -249,26 +249,26 @@ public class OutputComposite extends StateComposite { this.setLayout(new FormLayout()); - Label lbl_success_message = new Label(this, SWT.NATIVE | SWT.RESIZE); + this.lbl_success_message = new Label(this, SWT.NATIVE | SWT.RESIZE); FormData fd_lbl_success_message = new FormData(); fd_lbl_success_message.top = new FormAttachment(40, 0); fd_lbl_success_message.left = new FormAttachment(0); fd_lbl_success_message.right = new FormAttachment(100); - lbl_success_message.setLayoutData(fd_lbl_success_message); - lbl_success_message.setAlignment(SWT.CENTER); - lbl_success_message.setText(Messages + this.lbl_success_message.setLayoutData(fd_lbl_success_message); + this.lbl_success_message.setAlignment(SWT.CENTER); + this.lbl_success_message.setText(Messages .getString("output.success_message")); //$NON-NLS-1$ - FontData[] fD1 = lbl_success_message.getFont().getFontData(); + FontData[] fD1 = this.lbl_success_message.getFont().getFontData(); fD1[0].setHeight(Constants.TEXT_SIZE_BIG); - lbl_success_message.setFont(new Font(Display.getCurrent(), fD1[0])); + this.lbl_success_message.setFont(new Font(Display.getCurrent(), fD1[0])); this.lnk_saved_file = new Link(this, SWT.NATIVE | SWT.RESIZE); this.lnk_saved_file.setText(Messages .getString("output.link_save_message")); //$NON-NLS-1$ FormData fd_lnk_saved_file = new FormData(); - fd_lnk_saved_file.top = new FormAttachment(lbl_success_message, 10); - fd_lnk_saved_file.left = new FormAttachment(lbl_success_message, 0, + fd_lnk_saved_file.top = new FormAttachment(this.lbl_success_message, 10); + fd_lnk_saved_file.left = new FormAttachment(this.lbl_success_message, 0, SWT.CENTER); // fd_lnk_saved_file.right = new FormAttachment(100); this.lnk_saved_file.setLayoutData(fd_lnk_saved_file); @@ -336,6 +336,8 @@ public class OutputComposite extends StateComposite { private Button btn_save; + private Label lbl_success_message; + /* * (non-Javadoc) * @@ -355,4 +357,13 @@ public class OutputComposite extends StateComposite { } } + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() + */ + @Override + public void reloadResources() { + this.lbl_success_message.setText(Messages + .getString("output.success_message")); //$NON-NLS-1$ + } + } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java index c7e1b7b7..e00c9253 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java @@ -101,14 +101,14 @@ public class PositioningComposite extends StateComposite { bottomBar.setLayoutData(fd_bottomBar); bottomBar.setLayout(new FormLayout()); - Button btnSign = new Button(bottomBar, SWT.PUSH); - btnSign.setText(Messages.getString("positioning.sign")); //$NON-NLS-1$ + this.btnSign = new Button(bottomBar, SWT.PUSH); + this.btnSign.setText(Messages.getString("positioning.sign")); //$NON-NLS-1$ FormData fd_btnSign = new FormData(); fd_btnSign.right = new FormAttachment(100); fd_btnSign.top = new FormAttachment(0); - btnSign.setLayoutData(fd_btnSign); - this.getShell().setDefaultButton(btnSign); - btnSign.addSelectionListener(new SelectionAdapter() { + this.btnSign.setLayoutData(fd_btnSign); + this.getShell().setDefaultButton(this.btnSign); + this.btnSign.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PositioningComposite.this.setFinalPosition(); @@ -118,7 +118,7 @@ public class PositioningComposite extends StateComposite { this.btnNewPage = new Button(bottomBar, SWT.TOGGLE); this.btnNewPage.setText(Messages.getString("positioning.newPage")); //$NON-NLS-1$ FormData fd_btnNewPage = new FormData(); - fd_btnNewPage.right = new FormAttachment(btnSign); + fd_btnNewPage.right = new FormAttachment(this.btnSign); fd_btnNewPage.top = new FormAttachment(0); this.btnNewPage.setLayoutData(fd_btnNewPage); this.btnNewPage.addSelectionListener(new SelectionAdapter() { @@ -316,6 +316,8 @@ public class PositioningComposite extends StateComposite { } }; + private Button btnSign; + void showPage(int page) { final int previousPage = this.currentPage; this.currentPage = page; @@ -410,4 +412,13 @@ public class PositioningComposite extends StateComposite { public SignaturePosition getPosition() { return this.position; } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() + */ + @Override + public void reloadResources() { + this.btnNewPage.setText(Messages.getString("positioning.newPage")); //$NON-NLS-1$ + this.btnSign.setText(Messages.getString("positioning.sign")); //$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 902d3435..f8ccc207 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 @@ -86,462 +86,478 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { super(parent, style, state, container); setLayout(new FormLayout()); - Group grpHandySignatur = new Group(this, SWT.NONE | SWT.RESIZE); + this.grpHandySignatur = new Group(this, SWT.NONE | SWT.RESIZE); FormData fd_grpHandySignatur = new FormData(); fd_grpHandySignatur.right = new FormAttachment(100, -5); fd_grpHandySignatur.left = new FormAttachment(0, 5); fd_grpHandySignatur.top = new FormAttachment(0, 5); - grpHandySignatur.setLayoutData(fd_grpHandySignatur); - grpHandySignatur.setLayout(new GridLayout(2, false)); - grpHandySignatur.setText(Messages + this.grpHandySignatur.setLayoutData(fd_grpHandySignatur); + this.grpHandySignatur.setLayout(new GridLayout(2, false)); + this.grpHandySignatur.setText(Messages .getString("simple_config.MobileBKU_Title")); //$NON-NLS-1$ - FontData[] fD_grpHandySignatur = grpHandySignatur.getFont() + FontData[] fD_grpHandySignatur = this.grpHandySignatur.getFont() .getFontData(); fD_grpHandySignatur[0].setHeight(Constants.TEXT_SIZE_NORMAL); - grpHandySignatur.setFont(new Font(Display.getCurrent(), + this.grpHandySignatur.setFont(new Font(Display.getCurrent(), fD_grpHandySignatur[0])); - - Label lblMobileNumber = new Label(grpHandySignatur, SWT.NONE - | SWT.RESIZE); - lblMobileNumber.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, - false, 1, 1)); - lblMobileNumber - .setText(Messages.getString("simple_config.PhoneNumber")); //$NON-NLS-1$ - - FontData[] fD_lblMobileNumber = lblMobileNumber.getFont().getFontData(); - fD_lblMobileNumber[0].setHeight(Constants.TEXT_SIZE_NORMAL); - lblMobileNumber.setFont(new Font(Display.getCurrent(), - fD_lblMobileNumber[0])); - - Composite composite_2 = new Composite(grpHandySignatur, SWT.NONE); - composite_2.setLayout(new FormLayout()); - composite_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, - 1, 1)); - - this.txtMobileNumber = new Text(composite_2, SWT.BORDER | SWT.RESIZE); - this.fd_txtMobileNumber = new FormData(); - this.fd_txtMobileNumber.top = new FormAttachment(0); - this.fd_txtMobileNumber.left = new FormAttachment(0, 5); - this.fd_txtMobileNumber.bottom = new FormAttachment(100); - this.fd_txtMobileNumber.right = new FormAttachment(100, -42); - this.txtMobileNumber.setLayoutData(this.fd_txtMobileNumber); - this.txtMobileNumber.setToolTipText(Messages.getString("simple_config.ExampleNumber_ToolTip")); //$NON-NLS-1$ - - this.txtMobileNumberErrorMarker = new ErrorMarker(composite_2, - SWT.NATIVE, null, "", this.txtMobileNumber); //$NON-NLS-1$ - this.txtMobileNumberErrorMarker.setVisible(false); - this.fd_txtMobileNumberErrorMarker = new FormData(); - this.fd_txtMobileNumberErrorMarker.top = new FormAttachment(0); - this.fd_txtMobileNumberErrorMarker.left = new FormAttachment(100, -32); - this.fd_txtMobileNumberErrorMarker.bottom = new FormAttachment(100); - this.fd_txtMobileNumberErrorMarker.right = new FormAttachment(100); - this.txtMobileNumberErrorMarker - .setLayoutData(this.fd_txtMobileNumberErrorMarker); - - FontData[] fD_txtMobileNumber = this.txtMobileNumber.getFont() - .getFontData(); - fD_txtMobileNumber[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.txtMobileNumber.setFont(new Font(Display.getCurrent(), - fD_txtMobileNumber[0])); - - this.txtMobileNumber.addTraverseListener(new TraverseListener() { - - @Override - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_RETURN) { - processNumberChanged(); - } - } - }); - - this.txtMobileNumber.setMessage(Messages - .getString("simple_config.ExampleNumber")); //$NON-NLS-1$ - - this.txtMobileNumber.addFocusListener(new FocusAdapter() { - - @Override - public void focusLost(FocusEvent e) { + + this.lblMobileNumber = new Label(this.grpHandySignatur, SWT.NONE + | SWT.RESIZE); + this.lblMobileNumber.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, + false, false, 1, 1)); + this.lblMobileNumber.setText(Messages + .getString("simple_config.PhoneNumber")); //$NON-NLS-1$ + + FontData[] fD_lblMobileNumber = this.lblMobileNumber.getFont() + .getFontData(); + fD_lblMobileNumber[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.lblMobileNumber.setFont(new Font(Display.getCurrent(), + fD_lblMobileNumber[0])); + + Composite composite_2 = new Composite(this.grpHandySignatur, SWT.NONE); + composite_2.setLayout(new FormLayout()); + composite_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, + 1, 1)); + + this.txtMobileNumber = new Text(composite_2, SWT.BORDER | SWT.RESIZE); + this.fd_txtMobileNumber = new FormData(); + this.fd_txtMobileNumber.top = new FormAttachment(0); + this.fd_txtMobileNumber.left = new FormAttachment(0, 5); + this.fd_txtMobileNumber.bottom = new FormAttachment(100); + this.fd_txtMobileNumber.right = new FormAttachment(100, -42); + this.txtMobileNumber.setLayoutData(this.fd_txtMobileNumber); + this.txtMobileNumber.setToolTipText(Messages + .getString("simple_config.ExampleNumber_ToolTip")); //$NON-NLS-1$ + + this.txtMobileNumberErrorMarker = new ErrorMarker(composite_2, + SWT.NATIVE, null, "", this.txtMobileNumber); //$NON-NLS-1$ + this.txtMobileNumberErrorMarker.setVisible(false); + this.fd_txtMobileNumberErrorMarker = new FormData(); + this.fd_txtMobileNumberErrorMarker.top = new FormAttachment(0); + this.fd_txtMobileNumberErrorMarker.left = new FormAttachment(100, -32); + this.fd_txtMobileNumberErrorMarker.bottom = new FormAttachment(100); + this.fd_txtMobileNumberErrorMarker.right = new FormAttachment(100); + this.txtMobileNumberErrorMarker + .setLayoutData(this.fd_txtMobileNumberErrorMarker); + + FontData[] fD_txtMobileNumber = this.txtMobileNumber.getFont() + .getFontData(); + fD_txtMobileNumber[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.txtMobileNumber.setFont(new Font(Display.getCurrent(), + fD_txtMobileNumber[0])); + + this.txtMobileNumber.addTraverseListener(new TraverseListener() { + + @Override + public void keyTraversed(TraverseEvent e) { + if (e.detail == SWT.TRAVERSE_RETURN) { processNumberChanged(); } - }); + } + }); + + this.txtMobileNumber.setMessage(Messages + .getString("simple_config.ExampleNumber")); //$NON-NLS-1$ - Group grpBildmarke = new Group(this, SWT.NONE); + this.txtMobileNumber.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent e) { + processNumberChanged(); + } + }); + + this.grpBildmarke = new Group(this, SWT.NONE); FormData fd_grpBildmarke = new FormData(); fd_grpBildmarke.left = new FormAttachment(0, 5); fd_grpBildmarke.right = new FormAttachment(100, -5); - fd_grpBildmarke.top = new FormAttachment(grpHandySignatur, 5); - grpBildmarke.setLayoutData(fd_grpBildmarke); - grpBildmarke.setLayout(new FormLayout()); - grpBildmarke.setText(Messages.getString("simple_config.Emblem_Title")); //$NON-NLS-1$ + fd_grpBildmarke.top = new FormAttachment(this.grpHandySignatur, 5); + this.grpBildmarke.setLayoutData(fd_grpBildmarke); + this.grpBildmarke.setLayout(new FormLayout()); + this.grpBildmarke.setText(Messages + .getString("simple_config.Emblem_Title")); //$NON-NLS-1$ - FontData[] fD_grpBildmarke = grpBildmarke.getFont().getFontData(); + FontData[] fD_grpBildmarke = this.grpBildmarke.getFont().getFontData(); fD_grpBildmarke[0].setHeight(Constants.TEXT_SIZE_NORMAL); - grpBildmarke - .setFont(new Font(Display.getCurrent(), fD_grpBildmarke[0])); - - Composite containerComposite = new Composite(grpBildmarke, SWT.NONE); - containerComposite.setLayout(new FormLayout()); - FormData fd_containerComposite = new FormData(); - fd_containerComposite.left = new FormAttachment(0); - fd_containerComposite.right = new FormAttachment(100); - fd_containerComposite.top = new FormAttachment(0); - fd_containerComposite.bottom = new FormAttachment(100); - containerComposite.setLayoutData(fd_containerComposite); - - Composite controlComposite = new Composite(containerComposite, SWT.NONE); - controlComposite.setLayout(new FormLayout()); - FormData fd_controlComposite = new FormData(); - fd_controlComposite.left = new FormAttachment(0, 20); - fd_controlComposite.right = new FormAttachment(0, 300); - fd_controlComposite.top = new FormAttachment(0, 20); - fd_controlComposite.bottom = new FormAttachment(100, -20); - controlComposite.setLayoutData(fd_controlComposite); - controlComposite.addPaintListener(new PaintListener() { - - @Override - public void paintControl(PaintEvent e) { - // e.gc.setForeground(); - e.gc.setForeground(Constants.DROP_BORDER_COLOR); - e.gc.setLineWidth(3); - e.gc.setLineStyle(SWT.LINE_DASH); - e.gc.drawRoundRectangle(e.x, e.y, e.width - 2, e.height - 2, - 10, 10); - } - }); - - this.lblEmblem = new Label(containerComposite, SWT.RESIZE); - - Button btnBrowseEmblem = new Button(controlComposite, SWT.NONE); - - Label lbl_drop = new Label(controlComposite, SWT.NATIVE); - - this.lbl_logo = new Label(controlComposite, SWT.NATIVE); - this.lbl_logo.setAlignment(SWT.CENTER); - FormData fd_lbl_logo = new FormData(); - fd_lbl_logo.left = new FormAttachment(0, 20); - fd_lbl_logo.right = new FormAttachment(100, -20); - fd_lbl_logo.top = new FormAttachment(0, 20); - fd_lbl_logo.bottom = new FormAttachment(lbl_drop, -20); - - this.lbl_logo.setLayoutData(fd_lbl_logo); - - - lbl_drop.setText(Messages.getString("simple_config.EmblemEmpty")); //$NON-NLS-1$ - this.btnClearImage = new Button(controlComposite, SWT.NATIVE); - - FormData fd_lbl_drop = new FormData(); - fd_lbl_drop.left = new FormAttachment(0, 20); - fd_lbl_drop.right = new FormAttachment(100, -20); - //fd_lbl_drop.top = new FormAttachment(50, -20); - fd_lbl_drop.bottom = new FormAttachment(btnBrowseEmblem, -20); - - lbl_drop.setLayoutData(fd_lbl_drop); - - FormData fd_lblEmblem = new FormData(); - fd_lblEmblem.left = new FormAttachment(controlComposite, 20); - fd_lblEmblem.right = new FormAttachment(100, -20); - fd_lblEmblem.top = new FormAttachment(0, 20); - fd_lblEmblem.bottom = new FormAttachment(100, -20); - - this.lblEmblem.setLayoutData(fd_lblEmblem); - this.lblEmblem.setAlignment(SWT.CENTER); - - this.lblEmblem.addListener(SWT.Resize, new Listener() { - - @Override - public void handleEvent(Event event) { - SimpleConfigurationComposite.this.recalculateEmblemSize(); - } - }); - - FontData[] fD_lblEmblem = this.lblEmblem.getFont().getFontData(); - fD_lblEmblem[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.lblEmblem.setFont(new Font(Display.getCurrent(), fD_lblEmblem[0])); - - DropTarget dnd_target = new DropTarget(controlComposite, - DND.DROP_DEFAULT | DND.DROP_COPY); - final FileTransfer fileTransfer = FileTransfer.getInstance(); - Transfer[] types = new Transfer[] { fileTransfer }; - dnd_target.setTransfer(types); - - dnd_target.addDropListener(new DropTargetAdapter() { - @Override - public void drop(DropTargetEvent event) { - if (fileTransfer.isSupportedType(event.currentDataType)) { - String[] files = (String[]) event.data; - if (files.length > 0) { - // Only taking first file ... - File file = new File(files[0]); - if (!file.exists()) { - log.error("File: " + files[0] + " does not exist!"); //$NON-NLS-1$//$NON-NLS-2$ - return; - } - processEmblemChanged(file.getAbsolutePath()); + this.grpBildmarke.setFont(new Font(Display.getCurrent(), + fD_grpBildmarke[0])); + + Composite containerComposite = new Composite(this.grpBildmarke, + SWT.NONE); + containerComposite.setLayout(new FormLayout()); + FormData fd_containerComposite = new FormData(); + fd_containerComposite.left = new FormAttachment(0); + fd_containerComposite.right = new FormAttachment(100); + fd_containerComposite.top = new FormAttachment(0); + fd_containerComposite.bottom = new FormAttachment(100); + containerComposite.setLayoutData(fd_containerComposite); + + Composite controlComposite = new Composite(containerComposite, SWT.NONE); + controlComposite.setLayout(new FormLayout()); + FormData fd_controlComposite = new FormData(); + fd_controlComposite.left = new FormAttachment(0, 20); + fd_controlComposite.right = new FormAttachment(0, 300); + fd_controlComposite.top = new FormAttachment(0, 20); + fd_controlComposite.bottom = new FormAttachment(100, -20); + controlComposite.setLayoutData(fd_controlComposite); + controlComposite.addPaintListener(new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + // e.gc.setForeground(); + e.gc.setForeground(Constants.DROP_BORDER_COLOR); + e.gc.setLineWidth(3); + e.gc.setLineStyle(SWT.LINE_DASH); + e.gc.drawRoundRectangle(e.x, e.y, e.width - 2, e.height - 2, + 10, 10); + } + }); + + this.lblEmblem = new Label(containerComposite, SWT.RESIZE); + + this.btnBrowseEmblem = new Button(controlComposite, SWT.NONE); + + this.lbl_drop = new Label(controlComposite, SWT.NATIVE); + + this.lbl_logo = new Label(controlComposite, SWT.NATIVE); + this.lbl_logo.setAlignment(SWT.CENTER); + FormData fd_lbl_logo = new FormData(); + fd_lbl_logo.left = new FormAttachment(0, 20); + fd_lbl_logo.right = new FormAttachment(100, -20); + fd_lbl_logo.top = new FormAttachment(0, 20); + fd_lbl_logo.bottom = new FormAttachment(this.lbl_drop, -20); + + this.lbl_logo.setLayoutData(fd_lbl_logo); + + this.lbl_drop.setText(Messages.getString("simple_config.EmblemEmpty")); //$NON-NLS-1$ + this.btnClearImage = new Button(controlComposite, SWT.NATIVE); + + FormData fd_lbl_drop = new FormData(); + fd_lbl_drop.left = new FormAttachment(0, 20); + fd_lbl_drop.right = new FormAttachment(100, -20); + // fd_lbl_drop.top = new FormAttachment(50, -20); + fd_lbl_drop.bottom = new FormAttachment(this.btnBrowseEmblem, -20); + + this.lbl_drop.setLayoutData(fd_lbl_drop); + + FormData fd_lblEmblem = new FormData(); + fd_lblEmblem.left = new FormAttachment(controlComposite, 20); + fd_lblEmblem.right = new FormAttachment(100, -20); + fd_lblEmblem.top = new FormAttachment(0, 20); + fd_lblEmblem.bottom = new FormAttachment(100, -20); + + this.lblEmblem.setLayoutData(fd_lblEmblem); + this.lblEmblem.setAlignment(SWT.CENTER); + + this.lblEmblem.addListener(SWT.Resize, new Listener() { + + @Override + public void handleEvent(Event event) { + SimpleConfigurationComposite.this.recalculateEmblemSize(); + } + }); + + FontData[] fD_lblEmblem = this.lblEmblem.getFont().getFontData(); + fD_lblEmblem[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.lblEmblem.setFont(new Font(Display.getCurrent(), fD_lblEmblem[0])); + + DropTarget dnd_target = new DropTarget(controlComposite, + DND.DROP_DEFAULT | DND.DROP_COPY); + final FileTransfer fileTransfer = FileTransfer.getInstance(); + Transfer[] types = new Transfer[] { fileTransfer }; + dnd_target.setTransfer(types); + + dnd_target.addDropListener(new DropTargetAdapter() { + @Override + public void drop(DropTargetEvent event) { + if (fileTransfer.isSupportedType(event.currentDataType)) { + String[] files = (String[]) event.data; + if (files.length > 0) { + // Only taking first file ... + File file = new File(files[0]); + if (!file.exists()) { + log.error("File: " + files[0] + " does not exist!"); //$NON-NLS-1$//$NON-NLS-2$ + return; } + processEmblemChanged(file.getAbsolutePath()); } } - - @Override - public void dragOperationChanged(DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) { - if ((event.operations & DND.DROP_COPY) != 0) { - event.detail = DND.DROP_COPY; - } else { - event.detail = DND.DROP_NONE; - } + } + + @Override + public void dragOperationChanged(DropTargetEvent event) { + if (event.detail == DND.DROP_DEFAULT) { + if ((event.operations & DND.DROP_COPY) != 0) { + event.detail = DND.DROP_COPY; + } else { + event.detail = DND.DROP_NONE; } } - - @Override - public void dragEnter(DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) { - if ((event.operations & DND.DROP_COPY) != 0) { - event.detail = DND.DROP_COPY; - } else { - event.detail = DND.DROP_NONE; - } - } - // Only drop one item! - if (event.dataTypes.length > 1) { + } + + @Override + public void dragEnter(DropTargetEvent event) { + if (event.detail == DND.DROP_DEFAULT) { + if ((event.operations & DND.DROP_COPY) != 0) { + event.detail = DND.DROP_COPY; + } else { event.detail = DND.DROP_NONE; - return; } - // will accept text but prefer to have files dropped - for (int i = 0; i < event.dataTypes.length; i++) { - if (fileTransfer.isSupportedType(event.dataTypes[i])) { - event.currentDataType = event.dataTypes[i]; - // files should only be copied - if (event.detail != DND.DROP_COPY) { - event.detail = DND.DROP_NONE; - } - break; + } + // Only drop one item! + if (event.dataTypes.length > 1) { + event.detail = DND.DROP_NONE; + return; + } + // will accept text but prefer to have files dropped + for (int i = 0; i < event.dataTypes.length; i++) { + if (fileTransfer.isSupportedType(event.dataTypes[i])) { + event.currentDataType = event.dataTypes[i]; + // files should only be copied + if (event.detail != DND.DROP_COPY) { + event.detail = DND.DROP_NONE; } + break; } } - }); - - this.btnClearImage.setText(Messages - .getString("simple_config.ClearEmblem")); //$NON-NLS-1$ - this.btnClearImage.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - SimpleConfigurationComposite.this.processEmblemChanged(null); - } - }); - - FontData[] fD_btnUseImage = this.btnClearImage.getFont().getFontData(); - fD_btnUseImage[0].setHeight(Constants.TEXT_SIZE_BUTTON); - this.btnClearImage.setFont(new Font(Display.getCurrent(), - fD_btnUseImage[0])); - - FormData fd_btnUseImage = new FormData(); - - fd_btnUseImage.bottom = new FormAttachment(100, -20); - fd_btnUseImage.right = new FormAttachment(btnBrowseEmblem, -10); - - this.btnClearImage.setLayoutData(fd_btnUseImage); - - FormData fd_btnBrowseEmblem = new FormData(); - - fd_btnBrowseEmblem.bottom = new FormAttachment(100, -20); - fd_btnBrowseEmblem.right = new FormAttachment(100, -20); - - btnBrowseEmblem.setLayoutData(fd_btnBrowseEmblem); - btnBrowseEmblem.addSelectionListener(new ImageFileBrowser()); - btnBrowseEmblem.setText(Messages.getString("common.browse")); //$NON-NLS-1$ - - FontData[] fD_btnBrowseEmblem = btnBrowseEmblem.getFont().getFontData(); - fD_btnBrowseEmblem[0].setHeight(Constants.TEXT_SIZE_BUTTON); - btnBrowseEmblem.setFont(new Font(Display.getCurrent(), - fD_btnBrowseEmblem[0])); - - Group grpProxy = new Group(this, SWT.NONE); + } + }); + + this.btnClearImage.setText(Messages + .getString("simple_config.ClearEmblem")); //$NON-NLS-1$ + this.btnClearImage.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + SimpleConfigurationComposite.this.processEmblemChanged(null); + } + }); + + FontData[] fD_btnUseImage = this.btnClearImage.getFont().getFontData(); + fD_btnUseImage[0].setHeight(Constants.TEXT_SIZE_BUTTON); + this.btnClearImage.setFont(new Font(Display.getCurrent(), + fD_btnUseImage[0])); + + FormData fd_btnUseImage = new FormData(); + + fd_btnUseImage.bottom = new FormAttachment(100, -20); + fd_btnUseImage.right = new FormAttachment(this.btnBrowseEmblem, -10); + + this.btnClearImage.setLayoutData(fd_btnUseImage); + + FormData fd_btnBrowseEmblem = new FormData(); + + fd_btnBrowseEmblem.bottom = new FormAttachment(100, -20); + fd_btnBrowseEmblem.right = new FormAttachment(100, -20); + + this.btnBrowseEmblem.setLayoutData(fd_btnBrowseEmblem); + this.btnBrowseEmblem.addSelectionListener(new ImageFileBrowser()); + this.btnBrowseEmblem.setText(Messages.getString("common.browse")); //$NON-NLS-1$ + + FontData[] fD_btnBrowseEmblem = this.btnBrowseEmblem.getFont() + .getFontData(); + fD_btnBrowseEmblem[0].setHeight(Constants.TEXT_SIZE_BUTTON); + this.btnBrowseEmblem.setFont(new Font(Display.getCurrent(), + fD_btnBrowseEmblem[0])); + + this.grpProxy = new Group(this, SWT.NONE); FormData fd_grpProxy = new FormData(); fd_grpProxy.right = new FormAttachment(100, -5); - fd_grpProxy.top = new FormAttachment(grpBildmarke, 5); + fd_grpProxy.top = new FormAttachment(this.grpBildmarke, 5); fd_grpProxy.left = new FormAttachment(0, 5); - grpProxy.setLayoutData(fd_grpProxy); - grpProxy.setLayout(new GridLayout(2, false)); - grpProxy.setText(Messages.getString("simple_config.Proxy_Title")); //$NON-NLS-1$ + this.grpProxy.setLayoutData(fd_grpProxy); + this.grpProxy.setLayout(new GridLayout(2, false)); + this.grpProxy.setText(Messages.getString("simple_config.Proxy_Title")); //$NON-NLS-1$ - FontData[] fD_grpProxy = grpProxy.getFont().getFontData(); + FontData[] fD_grpProxy = this.grpProxy.getFont().getFontData(); fD_grpProxy[0].setHeight(Constants.TEXT_SIZE_NORMAL); - grpProxy.setFont(new Font(Display.getCurrent(), fD_grpProxy[0])); - - Label lblNewLabel = new Label(grpProxy, SWT.NONE); - GridData gd_lblNewLabel = new GridData(SWT.LEFT, SWT.CENTER, false, - false, 1, 1); - gd_lblNewLabel.widthHint = 66; - lblNewLabel.setLayoutData(gd_lblNewLabel); - lblNewLabel.setBounds(0, 0, 57, 15); - lblNewLabel.setText(Messages.getString("simple_config.ProxyHost")); //$NON-NLS-1$ - - FontData[] fD_lblNewLabel = lblNewLabel.getFont().getFontData(); - fD_lblNewLabel[0].setHeight(Constants.TEXT_SIZE_NORMAL); - lblNewLabel.setFont(new Font(Display.getCurrent(), fD_lblNewLabel[0])); - - Composite composite = new Composite(grpProxy, SWT.NONE); - composite.setLayout(new FormLayout()); - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, - 1, 1)); - this.txtProxyHost = new Text(composite, SWT.BORDER); - FormData fd_txtProxyHost = new FormData(); - fd_txtProxyHost.right = new FormAttachment(100, -42); - fd_txtProxyHost.bottom = new FormAttachment(100); - fd_txtProxyHost.top = new FormAttachment(0); - fd_txtProxyHost.left = new FormAttachment(0, 5); - - FontData[] fD_txtProxyHost = this.txtProxyHost.getFont().getFontData(); - fD_txtProxyHost[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.txtProxyHost.setFont(new Font(Display.getCurrent(), - fD_txtProxyHost[0])); - - this.proxyHostErrorMarker = new ErrorMarker(composite, SWT.NONE, null, - "", this.txtProxyHost); //$NON-NLS-1$ - - FormData fd_marker = new FormData(); - fd_marker.right = new FormAttachment(100, -32); - fd_marker.bottom = new FormAttachment(100); - fd_marker.top = new FormAttachment(0); - - this.proxyHostErrorMarker.setLayoutData(fd_marker); - this.proxyHostErrorMarker.setVisible(false); - this.txtProxyHost.setLayoutData(fd_txtProxyHost); - this.txtProxyHost.setToolTipText(Messages.getString("simple_config.ProxyHost_ToolTip")); //$NON-NLS-1$ - this.txtProxyHost.setMessage(Messages - .getString("simple_config.ProxyHostTemplate")); //$NON-NLS-1$ - - this.txtProxyHost.addFocusListener(new FocusAdapter() { - - @Override - public void focusLost(FocusEvent e) { + this.grpProxy.setFont(new Font(Display.getCurrent(), fD_grpProxy[0])); + + this.lblNewLabel = new Label(this.grpProxy, SWT.NONE); + GridData gd_lblNewLabel = new GridData(SWT.LEFT, SWT.CENTER, false, + false, 1, 1); + gd_lblNewLabel.widthHint = 66; + this.lblNewLabel.setLayoutData(gd_lblNewLabel); + this.lblNewLabel.setBounds(0, 0, 57, 15); + this.lblNewLabel.setText(Messages.getString("simple_config.ProxyHost")); //$NON-NLS-1$ + + FontData[] fD_lblNewLabel = this.lblNewLabel.getFont().getFontData(); + fD_lblNewLabel[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.lblNewLabel.setFont(new Font(Display.getCurrent(), + fD_lblNewLabel[0])); + + Composite composite = new Composite(this.grpProxy, SWT.NONE); + composite.setLayout(new FormLayout()); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, + 1, 1)); + this.txtProxyHost = new Text(composite, SWT.BORDER); + FormData fd_txtProxyHost = new FormData(); + fd_txtProxyHost.right = new FormAttachment(100, -42); + fd_txtProxyHost.bottom = new FormAttachment(100); + fd_txtProxyHost.top = new FormAttachment(0); + fd_txtProxyHost.left = new FormAttachment(0, 5); + + FontData[] fD_txtProxyHost = this.txtProxyHost.getFont().getFontData(); + fD_txtProxyHost[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.txtProxyHost.setFont(new Font(Display.getCurrent(), + fD_txtProxyHost[0])); + + this.proxyHostErrorMarker = new ErrorMarker(composite, SWT.NONE, null, + "", this.txtProxyHost); //$NON-NLS-1$ + + FormData fd_marker = new FormData(); + fd_marker.right = new FormAttachment(100, -32); + fd_marker.bottom = new FormAttachment(100); + fd_marker.top = new FormAttachment(0); + + this.proxyHostErrorMarker.setLayoutData(fd_marker); + this.proxyHostErrorMarker.setVisible(false); + this.txtProxyHost.setLayoutData(fd_txtProxyHost); + this.txtProxyHost.setToolTipText(Messages + .getString("simple_config.ProxyHost_ToolTip")); //$NON-NLS-1$ + this.txtProxyHost.setMessage(Messages + .getString("simple_config.ProxyHostTemplate")); //$NON-NLS-1$ + + this.txtProxyHost.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent e) { + processProxyHostChanged(); + } + }); + + this.txtProxyHost.addTraverseListener(new TraverseListener() { + + @Override + public void keyTraversed(TraverseEvent e) { + if (e.detail == SWT.TRAVERSE_RETURN) { processProxyHostChanged(); } - }); - - this.txtProxyHost.addTraverseListener(new TraverseListener() { - - @Override - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_RETURN) { - processProxyHostChanged(); - } - } - }); - - Label lblNewLabel_1 = new Label(grpProxy, SWT.NONE); - lblNewLabel_1.setBounds(0, 0, 57, 15); - lblNewLabel_1.setText(Messages.getString("simple_config.ProxyPort")); //$NON-NLS-1$ - - FontData[] fD_lblNewLabel_1 = lblNewLabel_1.getFont().getFontData(); - fD_lblNewLabel_1[0].setHeight(Constants.TEXT_SIZE_NORMAL); - lblNewLabel_1.setFont(new Font(Display.getCurrent(), - fD_lblNewLabel_1[0])); - - Composite composite_1 = new Composite(grpProxy, SWT.NONE); - composite_1.setLayout(new FormLayout()); - composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, - 1, 1)); - - this.txtProxyPort = new Text(composite_1, SWT.BORDER); - this.fd_txtProxyPort = new FormData(); - this.fd_txtProxyPort.top = new FormAttachment(0, 0); - this.fd_txtProxyPort.left = new FormAttachment(0, 5); - this.fd_txtProxyPort.right = new FormAttachment(100, -42); - this.fd_txtProxyPort.bottom = new FormAttachment(100); - this.txtProxyPort.setLayoutData(this.fd_txtProxyPort); - this.txtProxyPort.setToolTipText(Messages.getString("simple_config.ProxyPort_ToolTip")); //$NON-NLS-1$ - - FontData[] fD_txtProxyPort = this.txtProxyPort.getFont().getFontData(); - fD_txtProxyPort[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.txtProxyPort.setFont(new Font(Display.getCurrent(), - fD_txtProxyPort[0])); - - this.txtProxyPort.addTraverseListener(new TraverseListener() { - - @Override - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_RETURN) { - processProxyPortChanged(); - } - } - }); - - this.txtProxyPortErrorMarker = new ErrorMarker(composite_1, SWT.NATIVE, - null, "", this.txtProxyPort); //$NON-NLS-1$ - this.fd_txtProxyPortErrorMarker = new FormData(); - this.fd_txtProxyPortErrorMarker.top = new FormAttachment(0); - this.fd_txtProxyPortErrorMarker.left = new FormAttachment(100, -32); - this.fd_txtProxyPortErrorMarker.bottom = new FormAttachment(100); - this.txtProxyPortErrorMarker - .setLayoutData(this.fd_txtProxyPortErrorMarker); - this.txtProxyPortErrorMarker.setVisible(false); - - this.txtProxyPort.setMessage(Messages - .getString("simple_config.ProxyPortTemplate")); //$NON-NLS-1$ - - this.txtProxyPort.addFocusListener(new FocusAdapter() { - - @Override - public void focusLost(FocusEvent e) { + } + }); + + this.lblNewLabel_1 = new Label(this.grpProxy, SWT.NONE); + this.lblNewLabel_1.setBounds(0, 0, 57, 15); + this.lblNewLabel_1.setText(Messages + .getString("simple_config.ProxyPort")); //$NON-NLS-1$ + + FontData[] fD_lblNewLabel_1 = this.lblNewLabel_1.getFont() + .getFontData(); + fD_lblNewLabel_1[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.lblNewLabel_1.setFont(new Font(Display.getCurrent(), + fD_lblNewLabel_1[0])); + + Composite composite_1 = new Composite(this.grpProxy, SWT.NONE); + composite_1.setLayout(new FormLayout()); + composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, + 1, 1)); + + this.txtProxyPort = new Text(composite_1, SWT.BORDER); + this.fd_txtProxyPort = new FormData(); + this.fd_txtProxyPort.top = new FormAttachment(0, 0); + this.fd_txtProxyPort.left = new FormAttachment(0, 5); + this.fd_txtProxyPort.right = new FormAttachment(100, -42); + this.fd_txtProxyPort.bottom = new FormAttachment(100); + this.txtProxyPort.setLayoutData(this.fd_txtProxyPort); + this.txtProxyPort.setToolTipText(Messages + .getString("simple_config.ProxyPort_ToolTip")); //$NON-NLS-1$ + + FontData[] fD_txtProxyPort = this.txtProxyPort.getFont().getFontData(); + fD_txtProxyPort[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.txtProxyPort.setFont(new Font(Display.getCurrent(), + fD_txtProxyPort[0])); + + this.txtProxyPort.addTraverseListener(new TraverseListener() { + + @Override + public void keyTraversed(TraverseEvent e) { + if (e.detail == SWT.TRAVERSE_RETURN) { processProxyPortChanged(); } - }); + } + }); + + this.txtProxyPortErrorMarker = new ErrorMarker(composite_1, SWT.NATIVE, + null, "", this.txtProxyPort); //$NON-NLS-1$ + this.fd_txtProxyPortErrorMarker = new FormData(); + this.fd_txtProxyPortErrorMarker.top = new FormAttachment(0); + this.fd_txtProxyPortErrorMarker.left = new FormAttachment(100, -32); + this.fd_txtProxyPortErrorMarker.bottom = new FormAttachment(100); + this.txtProxyPortErrorMarker + .setLayoutData(this.fd_txtProxyPortErrorMarker); + this.txtProxyPortErrorMarker.setVisible(false); + + this.txtProxyPort.setMessage(Messages + .getString("simple_config.ProxyPortTemplate")); //$NON-NLS-1$ - Group grpSignatureNote = new Group(this, SWT.NONE); + this.txtProxyPort.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent e) { + processProxyPortChanged(); + } + }); + + this.grpSignatureNote = new Group(this, SWT.NONE); FormData fd_grpSignatureNote = new FormData(); fd_grpSignatureNote.right = new FormAttachment(100, -5); - fd_grpSignatureNote.top = new FormAttachment(grpProxy, 5); + fd_grpSignatureNote.top = new FormAttachment(this.grpProxy, 5); fd_grpSignatureNote.left = new FormAttachment(0, 5); - grpSignatureNote.setLayoutData(fd_grpSignatureNote); - grpSignatureNote.setLayout(new GridLayout(2, false)); - grpSignatureNote.setText(Messages.getString("simple_config.Note_Title")); //$NON-NLS-1$ + this.grpSignatureNote.setLayoutData(fd_grpSignatureNote); + this.grpSignatureNote.setLayout(new GridLayout(2, false)); + this.grpSignatureNote.setText(Messages + .getString("simple_config.Note_Title")); //$NON-NLS-1$ - FontData[] fD_grpSignatureNote = grpSignatureNote.getFont().getFontData(); + FontData[] fD_grpSignatureNote = this.grpSignatureNote.getFont() + .getFontData(); fD_grpSignatureNote[0].setHeight(Constants.TEXT_SIZE_NORMAL); - grpSignatureNote.setFont(new Font(Display.getCurrent(), fD_grpSignatureNote[0])); - - Label lblSignatureNote = new Label(grpSignatureNote, SWT.NONE); - GridData gd_lblSignatureNote = new GridData(SWT.LEFT, SWT.CENTER, false, - false, 1, 1); - gd_lblSignatureNote.widthHint = 66; - lblSignatureNote.setLayoutData(gd_lblSignatureNote); - lblSignatureNote.setBounds(0, 0, 57, 15); - lblSignatureNote.setText(Messages.getString("simple_config.Note")); //$NON-NLS-1$ - - FontData[] fD_lblSignatureNote = lblSignatureNote.getFont().getFontData(); - fD_lblSignatureNote[0].setHeight(Constants.TEXT_SIZE_NORMAL); - lblSignatureNote.setFont(new Font(Display.getCurrent(), fD_lblSignatureNote[0])); - - this.txtSignatureNote = new Text(grpSignatureNote, SWT.BORDER); - this.txtSignatureNote.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, - 1, 1)); - this.txtSignatureNote.setToolTipText(Messages.getString("simple_config.Note_Tooltip")); //$NON-NLS-1$ - - FontData[] fD_txtSignatureNote = this.txtProxyHost.getFont().getFontData(); - fD_txtSignatureNote[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.txtSignatureNote.setFont(new Font(Display.getCurrent(), - fD_txtSignatureNote[0])); - - this.txtSignatureNote.addFocusListener(new FocusAdapter() { - - @Override - public void focusLost(FocusEvent e) { - processSignatureNoteChanged(); - } - }); + this.grpSignatureNote.setFont(new Font(Display.getCurrent(), + fD_grpSignatureNote[0])); + + this.lblSignatureNote = new Label(this.grpSignatureNote, SWT.NONE); + GridData gd_lblSignatureNote = new GridData(SWT.LEFT, SWT.CENTER, + false, false, 1, 1); + gd_lblSignatureNote.widthHint = 66; + this.lblSignatureNote.setLayoutData(gd_lblSignatureNote); + this.lblSignatureNote.setBounds(0, 0, 57, 15); + this.lblSignatureNote.setText(Messages.getString("simple_config.Note")); //$NON-NLS-1$ + + FontData[] fD_lblSignatureNote = this.lblSignatureNote.getFont() + .getFontData(); + fD_lblSignatureNote[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.lblSignatureNote.setFont(new Font(Display.getCurrent(), + fD_lblSignatureNote[0])); - this.txtSignatureNote.addTraverseListener(new TraverseListener() { + this.txtSignatureNote = new Text(this.grpSignatureNote, SWT.BORDER); + this.txtSignatureNote.setLayoutData(new GridData(SWT.FILL, SWT.FILL, + true, false, 1, 1)); + this.txtSignatureNote.setToolTipText(Messages + .getString("simple_config.Note_Tooltip")); //$NON-NLS-1$ - @Override - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_RETURN) { - processSignatureNoteChanged(); - } + FontData[] fD_txtSignatureNote = this.txtProxyHost.getFont() + .getFontData(); + fD_txtSignatureNote[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.txtSignatureNote.setFont(new Font(Display.getCurrent(), + fD_txtSignatureNote[0])); + + this.txtSignatureNote.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent e) { + processSignatureNoteChanged(); + } + }); + + this.txtSignatureNote.addTraverseListener(new TraverseListener() { + + @Override + public void keyTraversed(TraverseEvent e) { + if (e.detail == SWT.TRAVERSE_RETURN) { + processSignatureNoteChanged(); } - }); + } + }); this.addListener(SWT.Resize, new Listener() { @@ -592,13 +608,14 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog( SimpleConfigurationComposite.this.getShell(), SWT.OPEN); - dialog.setFilterExtensions(new String[] { "*.jpg;*.png;*.gif", "*.jpg", "*.png", "*.gif", "*" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + dialog.setFilterExtensions(new String[] { + "*.jpg;*.png;*.gif", "*.jpg", "*.png", "*.gif", "*" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ dialog.setFilterNames(new String[] { Messages.getString("common.ImageExtension_Description"), //$NON-NLS-1$ Messages.getString("common.JPGExtension_Description"), //$NON-NLS-1$ Messages.getString("common.PNGExtension_Description"), //$NON-NLS-1$ Messages.getString("common.GIFExtension_Description"), //$NON-NLS-1$ - Messages.getString("common.AllExtension_Description")}); //$NON-NLS-1$ + Messages.getString("common.AllExtension_Description") }); //$NON-NLS-1$ String fileName = dialog.open(); File file = null; if (fileName != null) { @@ -628,7 +645,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.recalculateEmblemSize(this.origEmblem, this.lblEmblem); this.recalculateEmblemSize(this.origlogo, this.lbl_logo); } - + void recalculateEmblemSize(Image image, Label parent) { if (image != null) { @@ -676,16 +693,20 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { betterFactor = 1.0f; } - BufferedImage awt_image = ImageConverter.convertToAWT(image.getImageData()); - - java.awt.Image scaled_awt = awt_image.getScaledInstance((int) (width * betterFactor), - (int) (height * betterFactor), java.awt.Image.SCALE_SMOOTH); - - BufferedImage scaled_buffered = new BufferedImage((int) (width * betterFactor), + BufferedImage awt_image = ImageConverter.convertToAWT(image + .getImageData()); + + java.awt.Image scaled_awt = awt_image.getScaledInstance( + (int) (width * betterFactor), + (int) (height * betterFactor), java.awt.Image.SCALE_SMOOTH); + + BufferedImage scaled_buffered = new BufferedImage( + (int) (width * betterFactor), (int) (height * betterFactor), BufferedImage.TYPE_INT_RGB); scaled_buffered.getGraphics().drawImage(scaled_awt, 0, 0, null); - - Image emblem = new Image(this.getDisplay(), ImageConverter.convertToSWT(scaled_buffered)); + + Image emblem = new Image(this.getDisplay(), + ImageConverter.convertToSWT(scaled_buffered)); Image old = parent.getImage(); @@ -723,13 +744,15 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { String image = this.configurationContainer.getEmblem(); ImageData img = null; ImageData logo = null; - + try { if (image == null || image.trim().equals("")) { //$NON-NLS-1$ if (this.signer != null) { - img = ImageConverter.convertToSWT((BufferedImage) this.signer - .getPDFSigner().newParameter().getPlaceholder()); + img = ImageConverter + .convertToSWT((BufferedImage) this.signer + .getPDFSigner().newParameter() + .getPlaceholder()); } } else { if (this.signer != null) { @@ -752,7 +775,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } else { this.origEmblem = null; } - + if (logo != null) { this.origlogo = new Image(this.getDisplay(), logo); } else { @@ -767,7 +790,8 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { setEmblemFile(filename); } catch (Exception ex) { log.error("processEmblemChanged: ", ex); //$NON-NLS-1$ - ErrorDialog dialog = new ErrorDialog(getShell(), + ErrorDialog dialog = new ErrorDialog( + getShell(), Messages.getString("error.FailedToLoadEmblem"), ERROR_BUTTONS.OK); //$NON-NLS-1$ dialog.open(); } @@ -787,14 +811,17 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#signerChanged() + /* + * (non-Javadoc) + * + * @see + * at.asit.pdfover.gui.composites.BaseConfigurationComposite#signerChanged() */ @Override protected void signerChanged() { this.setVisibleImage(); } - + /** * @throws InvalidNumberException */ @@ -819,7 +846,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { log.error("processProxyHost: ", ex); //$NON-NLS-1$ } } - + void processSignatureNoteChanged() { String note = this.txtSignatureNote.getText(); this.configurationContainer.setSignatureNote(note); @@ -894,6 +921,16 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { ErrorMarker txtProxyPortErrorMarker; Button btnClearImage; private Label lbl_logo; + private Group grpHandySignatur; + private Label lblMobileNumber; + private Group grpBildmarke; + private Label lbl_drop; + private Button btnBrowseEmblem; + private Group grpProxy; + private Label lblNewLabel; + private Label lblNewLabel_1; + private Label lblSignatureNote; + private Group grpSignatureNote; /* * (non-Javadoc) @@ -942,17 +979,17 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } String note = this.configurationContainer.getSignatureNote(); - + if (note != null) { this.txtSignatureNote.setText(note); } - + String host = this.configurationContainer.getProxyHost(); if (host != null) { this.txtProxyHost.setText(host); } - + this.setVisibleImage(); } @@ -966,17 +1003,55 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { @Override public void validateSettings(int resumeFrom) throws Exception { switch (resumeFrom) { - case 0: - this.plainMobileNumberSetter(); - // Fall through - case 1: - this.plainProxyHostSetter(); - // Fall through - case 2: - this.plainProxyPortSetter(); - case 3: - this.processSignatureNoteChanged(); + case 0: + this.plainMobileNumberSetter(); + // Fall through + case 1: + this.plainProxyHostSetter(); + // Fall through + case 2: + this.plainProxyPortSetter(); + case 3: + this.processSignatureNoteChanged(); } - //this.plainEmblemSetter(this.emblemFile); + // this.plainEmblemSetter(this.emblemFile); + } + + /* + * (non-Javadoc) + * + * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() + */ + @Override + public void reloadResources() { + this.grpHandySignatur.setText(Messages + .getString("simple_config.MobileBKU_Title")); //$NON-NLS-1$ + this.lblMobileNumber.setText(Messages + .getString("simple_config.PhoneNumber")); //$NON-NLS-1$ + this.txtMobileNumber.setToolTipText(Messages + .getString("simple_config.ExampleNumber_ToolTip")); //$NON-NLS-1$ + this.txtMobileNumber.setMessage(Messages + .getString("simple_config.ExampleNumber")); //$NON-NLS-1$ + this.grpBildmarke.setText(Messages + .getString("simple_config.Emblem_Title")); //$NON-NLS-1$ + this.lbl_drop.setText(Messages.getString("simple_config.EmblemEmpty")); //$NON-NLS-1$ + this.btnClearImage.setText(Messages + .getString("simple_config.ClearEmblem")); //$NON-NLS-1$ + this.btnBrowseEmblem.setText(Messages.getString("common.browse")); //$NON-NLS-1$ + this.grpProxy.setText(Messages.getString("simple_config.Proxy_Title")); //$NON-NLS-1$ + this.lblNewLabel.setText(Messages.getString("simple_config.ProxyHost")); //$NON-NLS-1$ + this.txtProxyHost.setToolTipText(Messages + .getString("simple_config.ProxyHost_ToolTip")); //$NON-NLS-1$ + this.lblNewLabel_1.setText(Messages + .getString("simple_config.ProxyPort")); //$NON-NLS-1$ + this.txtProxyPort.setToolTipText(Messages + .getString("simple_config.ProxyPort_ToolTip")); //$NON-NLS-1$ + this.txtProxyPort.setMessage(Messages + .getString("simple_config.ProxyPortTemplate")); //$NON-NLS-1$ + this.grpSignatureNote.setText(Messages + .getString("simple_config.Note_Title")); //$NON-NLS-1$ + this.lblSignatureNote.setText(Messages.getString("simple_config.Note")); //$NON-NLS-1$ + this.txtSignatureNote.setToolTipText(Messages + .getString("simple_config.Note_Tooltip")); //$NON-NLS-1$ } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java index c7d69c92..31aed38d 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java @@ -47,4 +47,9 @@ public abstract class StateComposite extends Composite { * (SWT layout(...) only layouts children no grandchildren!) */ public abstract void doLayout(); + + /** + * Reloads the localizeable resources + */ + public abstract void reloadResources(); } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingComposite.java index b9b74149..ab62c8d0 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingComposite.java @@ -31,6 +31,8 @@ import at.asit.pdfover.gui.workflow.states.State; * */ public class WaitingComposite extends StateComposite { + private Label lbl_description; + /** * Create the composite. * @param parent @@ -41,14 +43,14 @@ public class WaitingComposite extends StateComposite { super(parent, style, state); setLayout(new FormLayout()); - Label lbl_description = new Label(this, SWT.NATIVE); + this.lbl_description = new Label(this, SWT.NATIVE); FormData fd_lbl_description = new FormData(); fd_lbl_description.bottom = new FormAttachment(50, -10); fd_lbl_description.left = new FormAttachment(0, +10); fd_lbl_description.right = new FormAttachment(100, -10); - lbl_description.setLayoutData(fd_lbl_description); - lbl_description.setAlignment(SWT.CENTER); - lbl_description.setText(Messages.getString("waiting.message")); //$NON-NLS-1$ + this.lbl_description.setLayoutData(fd_lbl_description); + this.lbl_description.setAlignment(SWT.CENTER); + this.lbl_description.setText(Messages.getString("waiting.message")); //$NON-NLS-1$ ProgressBar progressBar = new ProgressBar(this, SWT.HORIZONTAL | SWT.INDETERMINATE); FormData fd_progressBar = new FormData(); @@ -71,4 +73,12 @@ public class WaitingComposite extends StateComposite { public void doLayout() { // Nothing to do here } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() + */ + @Override + public void reloadResources() { + this.lbl_description.setText(Messages.getString("waiting.message")); //$NON-NLS-1$ + } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainer.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainer.java index 0c4e1065..9d4d2ccc 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainer.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainer.java @@ -15,6 +15,8 @@ */ package at.asit.pdfover.gui.workflow; +import java.util.Locale; + import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.exceptions.InvalidNumberException; import at.asit.pdfover.gui.exceptions.InvalidPortException; @@ -141,4 +143,16 @@ public interface ConfigurationContainer { * @param folder the default output folder */ public void setOutputFolder(String folder); + + /** + * Sets the locale + * @param locale the locale + */ + public void setLocale(Locale locale); + + /** + * Gets the locale + * @return the locale + */ + public Locale getLocale(); } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainerImpl.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainerImpl.java index 2cf03444..b5565963 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainerImpl.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainerImpl.java @@ -18,6 +18,7 @@ package at.asit.pdfover.gui.workflow; // Imports import java.io.File; import java.io.FileNotFoundException; +import java.util.Locale; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; @@ -68,6 +69,11 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { */ protected int proxyPort = -1; + /** + * Holds the locale + */ + protected Locale locale = null; + /** * Holds the output folder */ @@ -279,5 +285,23 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { public void setSignatureNote(String note) { this.signatureNote = note; } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setLocale(java.util.Locale) + */ + @Override + public void setLocale(Locale locale) { + this.locale = locale; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getLocale() + */ + @Override + public Locale getLocale() { + return this.locale; + } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/GUIProvider.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/GUIProvider.java index 39aab13d..f18b4ef1 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/GUIProvider.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/GUIProvider.java @@ -45,4 +45,9 @@ public interface GUIProvider { * @return the main window shell */ public Shell getMainShell(); + + /** + * Reloads the resources on active gui components + */ + public void reloadResources(); } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java index 8ef85bd1..2575fd91 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java @@ -352,4 +352,12 @@ public class StateMachineImpl implements StateMachine, GUIProvider { return this.shell; } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.GUIProvider#reloadResources() + */ + @Override + public void reloadResources() { + this.mainWindow.reloadLocalization(); + } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java index d8ddc403..57a7aa9b 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java @@ -73,6 +73,7 @@ public class ConfigurationUIState extends State { if(config.isUserDone()) { + this.reloadResources(); this.setNextState(status.getPreviousState()); } } @@ -98,4 +99,10 @@ public class ConfigurationUIState extends State { behavior.setMainBarVisible(false); } + /** + * Triggers to reload the resources + */ + public void reloadResources() { + this.stateMachine.getGUIProvider().reloadResources(); + } } -- cgit v1.2.3