diff options
Diffstat (limited to 'pdf-over-gui')
5 files changed, 114 insertions, 114 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java index 54f177b3..119c1607 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java @@ -64,7 +64,6 @@ public abstract class StateComposite extends Composite { fD[0].setHeight(height); Font font = new Font(c.getDisplay(), fD[0]); c.setFont(font); - font.dispose(); } public static void setFontStyle(Control c, int style) @@ -73,7 +72,6 @@ public abstract class StateComposite extends Composite { fD[0].setStyle(style); Font font = new Font(c.getDisplay(), fD[0]); c.setFont(font); - font.dispose(); } public static class AnchorSetter diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java index c2c1261b..1c894e5c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java @@ -46,6 +46,7 @@ import at.asit.pdfover.commons.Constants; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.commons.Profile; import at.asit.pdfover.gui.composites.ConfigurationComposite; +import at.asit.pdfover.gui.composites.StateComposite; import at.asit.pdfover.gui.controls.Dialog.BUTTONS; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.ErrorMarker; @@ -131,12 +132,12 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { layout.marginHeight = 10; layout.marginWidth = 5; this.grpSignatur.setLayout(layout); - ConfigurationCompositeBase.anchor(grpSignatur).top(0,5).right(100,-5).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(grpSignatur, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(grpSignatur).top(0,5).right(100,-5).left(0,5).set(); + StateComposite.setFontHeight(grpSignatur, Constants.TEXT_SIZE_NORMAL); this.btnAutomatischePositionierung = new Button(this.grpSignatur, SWT.CHECK); - ConfigurationCompositeBase.anchor(btnAutomatischePositionierung).right(100,-5).top(0).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(btnAutomatischePositionierung, Constants.TEXT_SIZE_BUTTON); + StateComposite.anchor(btnAutomatischePositionierung).right(100,-5).top(0).left(0,5).set(); + StateComposite.setFontHeight(btnAutomatischePositionierung, Constants.TEXT_SIZE_BUTTON); this.btnAutomatischePositionierung.addSelectionListener(new SelectionAdapter() { @Override @@ -147,8 +148,8 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { }); this.btnPdfACompat = new Button(this.grpSignatur, SWT.CHECK); - ConfigurationCompositeBase.anchor(btnPdfACompat).right(100,-5).top(btnAutomatischePositionierung, 5).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(btnPdfACompat, Constants.TEXT_SIZE_BUTTON); + StateComposite.anchor(btnPdfACompat).right(100,-5).top(btnAutomatischePositionierung, 5).left(0,5).set(); + StateComposite.setFontHeight(btnPdfACompat, Constants.TEXT_SIZE_BUTTON); this.btnPdfACompat.addSelectionListener(new SelectionAdapter() { @Override @@ -159,19 +160,19 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { }); this.lblTransparenz = new Label(this.grpSignatur, SWT.HORIZONTAL); - ConfigurationCompositeBase.anchor(lblTransparenz).top(btnPdfACompat, 5).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(lblTransparenz, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(lblTransparenz).top(btnPdfACompat, 5).left(0,5).set(); + StateComposite.setFontHeight(lblTransparenz, Constants.TEXT_SIZE_NORMAL); this.lblTransparenzLinks = new Label(this.grpSignatur, SWT.HORIZONTAL); - ConfigurationCompositeBase.anchor(lblTransparenzLinks).top(lblTransparenz, 5).left(0,15).set(); - ConfigurationCompositeBase.setFontHeight(lblTransparenzLinks, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(lblTransparenzLinks).top(lblTransparenz, 5).left(0,15).set(); + StateComposite.setFontHeight(lblTransparenzLinks, Constants.TEXT_SIZE_NORMAL); this.lblTransparenzRechts = new Label(this.grpSignatur, SWT.HORIZONTAL); - ConfigurationCompositeBase.anchor(lblTransparenzRechts).top(lblTransparenz, 5).right(100,-5).set(); - ConfigurationCompositeBase.setFontHeight(lblTransparenzRechts, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(lblTransparenzRechts).top(lblTransparenz, 5).right(100,-5).set(); + StateComposite.setFontHeight(lblTransparenzRechts, Constants.TEXT_SIZE_NORMAL); this.sclTransparenz = new Scale(this.grpSignatur, SWT.HORIZONTAL); - ConfigurationCompositeBase.anchor(sclTransparenz).right(lblTransparenzRechts, -5).top(lblTransparenz, 5).left(lblTransparenzLinks, 5).set(); + StateComposite.anchor(sclTransparenz).right(lblTransparenzRechts, -5).top(lblTransparenz, 5).left(lblTransparenzLinks, 5).set(); this.sclTransparenz.setMinimum(0); this.sclTransparenz.setMaximum(255); this.sclTransparenz.setIncrement(1); @@ -188,12 +189,12 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { layout_grpPlaceholder.marginHeight = 10; layout_grpPlaceholder.marginWidth = 5; this.grpPlaceholder.setLayout(layout_grpPlaceholder); - ConfigurationCompositeBase.anchor(grpPlaceholder).top(grpSignatur, 5).left(0,5).right(100,-5).set(); - ConfigurationCompositeBase.setFontHeight(grpPlaceholder, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(grpPlaceholder).top(grpSignatur, 5).left(0,5).right(100,-5).set(); + StateComposite.setFontHeight(grpPlaceholder, Constants.TEXT_SIZE_NORMAL); this.btnEnablePlaceholderUsage = new Button(this.grpPlaceholder, SWT.CHECK); - ConfigurationCompositeBase.anchor(btnEnablePlaceholderUsage).top(0,5).left(0,5).right(100,-5).set(); - ConfigurationCompositeBase.setFontHeight(btnEnablePlaceholderUsage, Constants.TEXT_SIZE_BUTTON); + StateComposite.anchor(btnEnablePlaceholderUsage).top(0,5).left(0,5).right(100,-5).set(); + StateComposite.setFontHeight(btnEnablePlaceholderUsage, Constants.TEXT_SIZE_BUTTON); this.btnEnablePlaceholderUsage.addSelectionListener(new SelectionAdapter() { @Override @@ -205,8 +206,8 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { }); this.btnPlatzhalterVerwenden = new Button(this.grpPlaceholder, SWT.RADIO); - ConfigurationCompositeBase.anchor(btnPlatzhalterVerwenden).right(100,-5).top(btnEnablePlaceholderUsage,5).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(btnPlatzhalterVerwenden, Constants.TEXT_SIZE_BUTTON); + StateComposite.anchor(btnPlatzhalterVerwenden).right(100,-5).top(btnEnablePlaceholderUsage,5).left(0,5).set(); + StateComposite.setFontHeight(btnPlatzhalterVerwenden, Constants.TEXT_SIZE_BUTTON); this.btnPlatzhalterVerwenden.addSelectionListener(new SelectionAdapter() { @Override @@ -217,8 +218,8 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { }); this.btnSignatureFieldsUsage = new Button(this.grpPlaceholder, SWT.RADIO); - ConfigurationCompositeBase.anchor(btnSignatureFieldsUsage).right(100,-5).top(btnPlatzhalterVerwenden, 5).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(btnSignatureFieldsUsage, Constants.TEXT_SIZE_BUTTON); + StateComposite.anchor(btnSignatureFieldsUsage).right(100,-5).top(btnPlatzhalterVerwenden, 5).left(0,5).set(); + StateComposite.setFontHeight(btnSignatureFieldsUsage, Constants.TEXT_SIZE_BUTTON); this.btnSignatureFieldsUsage.addSelectionListener(new SelectionAdapter() { @Override @@ -233,12 +234,12 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { layout.marginHeight = 10; layout.marginWidth = 5; this.grpBkuAuswahl.setLayout(layout); - ConfigurationCompositeBase.anchor(grpBkuAuswahl).top(grpPlaceholder, 5).left(0,5).right(100,-5).set(); - ConfigurationCompositeBase.setFontHeight(grpBkuAuswahl, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(grpBkuAuswahl).top(grpPlaceholder, 5).left(0,5).right(100,-5).set(); + StateComposite.setFontHeight(grpBkuAuswahl, Constants.TEXT_SIZE_NORMAL); this.cmbBKUAuswahl = new Combo(this.grpBkuAuswahl, SWT.READ_ONLY); - ConfigurationCompositeBase.anchor(cmbBKUAuswahl).right(100,-5).top(0).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(cmbBKUAuswahl, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(cmbBKUAuswahl).right(100,-5).top(0).left(0,5).set(); + StateComposite.setFontHeight(cmbBKUAuswahl, Constants.TEXT_SIZE_NORMAL); this.bkuStrings = Arrays.stream(BKUs.values()).map(s -> Messages.getString("BKU."+s)).collect(Collectors.toList()); this.cmbBKUAuswahl.setItems(bkuStrings.toArray(new String[0])); @@ -256,8 +257,8 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { }); this.btnKeystoreEnabled = new Button(this.grpBkuAuswahl, SWT.CHECK); - ConfigurationCompositeBase.anchor(btnKeystoreEnabled).right(100,-5).top(cmbBKUAuswahl,5).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(btnKeystoreEnabled, Constants.TEXT_SIZE_BUTTON); + StateComposite.anchor(btnKeystoreEnabled).right(100,-5).top(cmbBKUAuswahl,5).left(0,5).set(); + StateComposite.setFontHeight(btnKeystoreEnabled, Constants.TEXT_SIZE_BUTTON); this.btnKeystoreEnabled.addSelectionListener(new SelectionAdapter() { @Override @@ -269,15 +270,15 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { this.grpSpeicherort = new Group(this, SWT.NONE); grpSpeicherort.setLayout(new GridLayout(3, false)); - ConfigurationCompositeBase.anchor(grpSpeicherort).left(0,5).top(grpBkuAuswahl, 5).right(100,-5).set(); - ConfigurationCompositeBase.setFontHeight(grpSpeicherort, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(grpSpeicherort).left(0,5).top(grpBkuAuswahl, 5).right(100,-5).set(); + StateComposite.setFontHeight(grpSpeicherort, Constants.TEXT_SIZE_NORMAL); this.lblDefaultOutputFolder = new Label(this.grpSpeicherort, SWT.NONE); - ConfigurationCompositeBase.setFontHeight(lblDefaultOutputFolder, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(lblDefaultOutputFolder, Constants.TEXT_SIZE_NORMAL); this.txtOutputFolder = new Text(this.grpSpeicherort, SWT.BORDER); txtOutputFolder.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - ConfigurationCompositeBase.setFontHeight(txtOutputFolder, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(txtOutputFolder, Constants.TEXT_SIZE_NORMAL); this.txtOutputFolder.addFocusListener(new FocusAdapter() { @Override @@ -288,7 +289,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { this.btnBrowse = new Button(this.grpSpeicherort, SWT.NONE); btnBrowse.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); - ConfigurationCompositeBase.setFontHeight(btnBrowse, Constants.TEXT_SIZE_BUTTON); + StateComposite.setFontHeight(btnBrowse, Constants.TEXT_SIZE_BUTTON); this.btnBrowse.addSelectionListener(new SelectionAdapter() { @Override @@ -318,11 +319,11 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { this.lblSaveFilePostFix = new Label(this.grpSpeicherort, SWT.NONE); lblSaveFilePostFix.setText(Messages.getString("AdvancedConfigurationComposite.lblSaveFilePostFix.text")); - ConfigurationCompositeBase.setFontHeight(lblSaveFilePostFix, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(lblSaveFilePostFix, Constants.TEXT_SIZE_NORMAL); this.txtSaveFilePostFix = new Text(this.grpSpeicherort, SWT.BORDER); txtSaveFilePostFix.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - ConfigurationCompositeBase.setFontHeight(txtSaveFilePostFix, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(txtSaveFilePostFix, Constants.TEXT_SIZE_NORMAL); this.txtSaveFilePostFix.addFocusListener(new FocusAdapter() { @Override @@ -336,12 +337,12 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { layout_grpLocaleAuswahl.marginHeight = 10; layout_grpLocaleAuswahl.marginWidth = 5; this.grpLocaleAuswahl.setLayout(layout_grpLocaleAuswahl); - ConfigurationCompositeBase.anchor(grpLocaleAuswahl).top(grpSpeicherort, 5).left(0,5).right(100,-5).set(); - ConfigurationCompositeBase.setFontHeight(grpLocaleAuswahl, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(grpLocaleAuswahl).top(grpSpeicherort, 5).left(0,5).right(100,-5).set(); + StateComposite.setFontHeight(grpLocaleAuswahl, Constants.TEXT_SIZE_NORMAL); this.cmbLocaleAuswahl = new Combo(this.grpLocaleAuswahl, SWT.READ_ONLY); - ConfigurationCompositeBase.anchor(cmbLocaleAuswahl).right(100,-5).top(0).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(cmbLocaleAuswahl, Constants.TEXT_SIZE_NORMAL);; + StateComposite.anchor(cmbLocaleAuswahl).right(100,-5).top(0).left(0,5).set(); + StateComposite.setFontHeight(cmbLocaleAuswahl, Constants.TEXT_SIZE_NORMAL);; this.cmbLocaleAuswahl.setItems(Arrays.stream(Constants.SUPPORTED_LOCALES).map(l -> l.getDisplayLanguage()).toArray(String[]::new)); this.cmbLocaleAuswahl.addSelectionListener(new SelectionAdapter() { @@ -361,12 +362,12 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { layout_grpUpdateCheck.marginHeight = 10; layout_grpUpdateCheck.marginWidth = 5; this.grpUpdateCheck.setLayout(layout_grpUpdateCheck); - ConfigurationCompositeBase.anchor(grpUpdateCheck).top(grpLocaleAuswahl, 5).left(0,5).right(100,-5).set(); - ConfigurationCompositeBase.setFontHeight(grpUpdateCheck, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(grpUpdateCheck).top(grpLocaleAuswahl, 5).left(0,5).right(100,-5).set(); + StateComposite.setFontHeight(grpUpdateCheck, Constants.TEXT_SIZE_NORMAL); this.btnUpdateCheck = new Button(this.grpUpdateCheck, SWT.CHECK); - ConfigurationCompositeBase.anchor(btnUpdateCheck).right(100,-5).top(0).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(btnUpdateCheck, Constants.TEXT_SIZE_BUTTON); + StateComposite.anchor(btnUpdateCheck).right(100,-5).top(0).left(0,5).set(); + StateComposite.setFontHeight(btnUpdateCheck, Constants.TEXT_SIZE_BUTTON); this.btnUpdateCheck.addSelectionListener(new SelectionAdapter() { @Override @@ -376,9 +377,9 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { }); this.grpProxy = new Group(this, SWT.NONE); - ConfigurationCompositeBase.anchor(grpProxy).right(100,-5).top(grpUpdateCheck, 5).left(0,5).set(); + StateComposite.anchor(grpProxy).right(100,-5).top(grpUpdateCheck, 5).left(0,5).set(); this.grpProxy.setLayout(new GridLayout(2, false)); - ConfigurationCompositeBase.setFontHeight(grpProxy, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(grpProxy, Constants.TEXT_SIZE_NORMAL); this.lblProxyHost = new Label(this.grpProxy, SWT.NONE); do { /* grid positioning */ @@ -387,18 +388,18 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { this.lblProxyHost.setLayoutData(gd_lblProxyHost); this.lblProxyHost.setBounds(0, 0, 57, 15); } while (false); - ConfigurationCompositeBase.setFontHeight(lblProxyHost, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(lblProxyHost, Constants.TEXT_SIZE_NORMAL); Composite compProxyHostContainer = new Composite(this.grpProxy, SWT.NONE); compProxyHostContainer.setLayout(new FormLayout()); compProxyHostContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); this.txtProxyHost = new Text(compProxyHostContainer, SWT.BORDER); - ConfigurationCompositeBase.anchor(txtProxyHost).right(100,-42).top(0).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(txtProxyHost, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(txtProxyHost).right(100,-42).top(0).left(0,5).set(); + StateComposite.setFontHeight(txtProxyHost, Constants.TEXT_SIZE_NORMAL); this.proxyHostErrorMarker = new ErrorMarker(compProxyHostContainer, SWT.NONE, ""); //$NON-NLS-1$ - ConfigurationCompositeBase.anchor(proxyHostErrorMarker).left(100,-32).right(100).top(0).bottom(0,32).set(); + StateComposite.anchor(proxyHostErrorMarker).left(100,-32).right(100).top(0).bottom(0,32).set(); this.proxyHostErrorMarker.setVisible(false); this.txtProxyHost.addFocusListener(new FocusAdapter() { @@ -416,15 +417,15 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { this.lblProxyPort = new Label(this.grpProxy, SWT.NONE); this.lblProxyPort.setBounds(0, 0, 57, 15); - ConfigurationCompositeBase.setFontHeight(lblProxyPort, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(lblProxyPort, Constants.TEXT_SIZE_NORMAL); Composite compProxyPortContainer = new Composite(this.grpProxy, SWT.NONE); compProxyPortContainer.setLayout(new FormLayout()); compProxyPortContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); this.txtProxyPort = new Text(compProxyPortContainer, SWT.BORDER); - ConfigurationCompositeBase.anchor(txtProxyPort).top(0,0).left(0,5).right(100,-42).set(); - ConfigurationCompositeBase.setFontHeight(txtProxyPort, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(txtProxyPort).top(0,0).left(0,5).right(100,-42).set(); + StateComposite.setFontHeight(txtProxyPort, Constants.TEXT_SIZE_NORMAL); this.txtProxyPort.addTraverseListener(e -> { if (e.detail == SWT.TRAVERSE_RETURN) { @@ -433,7 +434,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { }); this.txtProxyPortErrorMarker = new ErrorMarker(compProxyPortContainer, SWT.NONE, ""); //$NON-NLS-1$ - ConfigurationCompositeBase.anchor(txtProxyPortErrorMarker).left(100,-32).right(100).top(0).bottom(0,32).set(); + StateComposite.anchor(txtProxyPortErrorMarker).left(100,-32).right(100).top(0).bottom(0,32).set(); this.txtProxyPortErrorMarker.setVisible(false); this.txtProxyPort.addFocusListener(new FocusAdapter() { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java index c496efef..81011f5e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java @@ -17,7 +17,6 @@ package at.asit.pdfover.gui.composites.configuration; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; import at.asit.pdfover.gui.composites.StateComposite; import at.asit.pdfover.gui.workflow.PDFSigner; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java index 4108214d..afcca6ac 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java @@ -46,6 +46,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.commons.Constants; +import at.asit.pdfover.gui.composites.StateComposite; import at.asit.pdfover.gui.controls.Dialog.BUTTONS; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.exceptions.CantLoadKeystoreException; @@ -107,58 +108,58 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { layout.marginWidth = 5; this.grpKeystore.setLayout(layout); - ConfigurationCompositeBase.anchor(grpKeystore).top(0,5).left(0,5).right(100,-5).set(); - ConfigurationCompositeBase.setFontHeight(this.grpKeystore, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(grpKeystore).top(0,5).left(0,5).right(100,-5).set(); + StateComposite.setFontHeight(this.grpKeystore, Constants.TEXT_SIZE_NORMAL); this.lblKeystoreFile = new Label(this.grpKeystore, SWT.NONE); - ConfigurationCompositeBase.anchor(lblKeystoreFile).top(0).left(0,5).set(); + StateComposite.anchor(lblKeystoreFile).top(0).left(0,5).set(); FormData fd_lblKeystoreFile = new FormData(); fd_lblKeystoreFile.top = new FormAttachment(0); fd_lblKeystoreFile.left = new FormAttachment(0, 5); this.lblKeystoreFile.setLayoutData(fd_lblKeystoreFile); - ConfigurationCompositeBase.setFontHeight(lblKeystoreFile, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(lblKeystoreFile, Constants.TEXT_SIZE_NORMAL); this.txtKeystoreFile = new Text(grpKeystore, SWT.BORDER); this.btnBrowse = new Button(grpKeystore, SWT.NONE); - ConfigurationCompositeBase.setFontHeight(txtKeystoreFile, Constants.TEXT_SIZE_NORMAL); - ConfigurationCompositeBase.setFontHeight(btnBrowse, Constants.TEXT_SIZE_BUTTON); - ConfigurationCompositeBase.anchor(txtKeystoreFile).top(lblKeystoreFile, 5).left(0,15).right(btnBrowse,-5).set(); - ConfigurationCompositeBase.anchor(btnBrowse).top(lblKeystoreFile, 5).right(100,-5).set(); + StateComposite.setFontHeight(txtKeystoreFile, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(btnBrowse, Constants.TEXT_SIZE_BUTTON); + StateComposite.anchor(txtKeystoreFile).top(lblKeystoreFile, 5).left(0,15).right(btnBrowse,-5).set(); + StateComposite.anchor(btnBrowse).top(lblKeystoreFile, 5).right(100,-5).set(); this.lblKeystoreType = new Label(grpKeystore, SWT.NONE); - ConfigurationCompositeBase.anchor(lblKeystoreType).top(txtKeystoreFile, 5).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(lblKeystoreType, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(lblKeystoreType).top(txtKeystoreFile, 5).left(0,5).set(); + StateComposite.setFontHeight(lblKeystoreType, Constants.TEXT_SIZE_NORMAL); this.cmbKeystoreType = new Combo(grpKeystore, SWT.READ_ONLY); - ConfigurationCompositeBase.anchor(cmbKeystoreType).right(100, -5).top(lblKeystoreType, 5).left(0,15).set(); - ConfigurationCompositeBase.setFontHeight(cmbKeystoreType, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(cmbKeystoreType).right(100, -5).top(lblKeystoreType, 5).left(0,15).set(); + StateComposite.setFontHeight(cmbKeystoreType, Constants.TEXT_SIZE_NORMAL); this.lblKeystoreStorePass = new Label(this.grpKeystore, SWT.NONE); - ConfigurationCompositeBase.anchor(lblKeystoreStorePass).top(cmbKeystoreType, 5).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(lblKeystoreStorePass, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(lblKeystoreStorePass).top(cmbKeystoreType, 5).left(0,5).set(); + StateComposite.setFontHeight(lblKeystoreStorePass, Constants.TEXT_SIZE_NORMAL); this.txtKeystoreStorePass = new Text(this.grpKeystore, SWT.BORDER | SWT.PASSWORD); this.btnLoad = new Button(this.grpKeystore, SWT.NONE); - ConfigurationCompositeBase.anchor(txtKeystoreStorePass).top(lblKeystoreStorePass, 5).left(0,15).right(btnLoad, -5).set(); - ConfigurationCompositeBase.anchor(btnLoad).top(lblKeystoreStorePass, 5).right(100,-5).set(); - ConfigurationCompositeBase.setFontHeight(txtKeystoreStorePass, Constants.TEXT_SIZE_NORMAL); - ConfigurationCompositeBase.setFontHeight(btnLoad, Constants.TEXT_SIZE_BUTTON); + StateComposite.anchor(txtKeystoreStorePass).top(lblKeystoreStorePass, 5).left(0,15).right(btnLoad, -5).set(); + StateComposite.anchor(btnLoad).top(lblKeystoreStorePass, 5).right(100,-5).set(); + StateComposite.setFontHeight(txtKeystoreStorePass, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(btnLoad, Constants.TEXT_SIZE_BUTTON); this.lblKeystoreAlias = new Label(grpKeystore, SWT.NONE); - ConfigurationCompositeBase.anchor(lblKeystoreAlias).top(txtKeystoreStorePass, 5).left(0, 5).set(); - ConfigurationCompositeBase.setFontHeight(lblKeystoreAlias, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(lblKeystoreAlias).top(txtKeystoreStorePass, 5).left(0, 5).set(); + StateComposite.setFontHeight(lblKeystoreAlias, Constants.TEXT_SIZE_NORMAL); this.cmbKeystoreAlias = new Combo(grpKeystore, SWT.NONE); - ConfigurationCompositeBase.anchor(cmbKeystoreAlias).top(lblKeystoreAlias, 5).left(0,15).right(100,-5).set(); - ConfigurationCompositeBase.setFontHeight(cmbKeystoreAlias, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(cmbKeystoreAlias).top(lblKeystoreAlias, 5).left(0,15).right(100,-5).set(); + StateComposite.setFontHeight(cmbKeystoreAlias, Constants.TEXT_SIZE_NORMAL); this.lblKeystoreKeyPass = new Label(this.grpKeystore, SWT.NONE); - ConfigurationCompositeBase.anchor(lblKeystoreKeyPass).top(cmbKeystoreAlias, 5).left(0,5).set(); - ConfigurationCompositeBase.setFontHeight(lblKeystoreKeyPass, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(lblKeystoreKeyPass).top(cmbKeystoreAlias, 5).left(0,5).set(); + StateComposite.setFontHeight(lblKeystoreKeyPass, Constants.TEXT_SIZE_NORMAL); this.txtKeystoreKeyPass = new Text(this.grpKeystore, SWT.BORDER | SWT.PASSWORD); - ConfigurationCompositeBase.anchor(txtKeystoreKeyPass).top(lblKeystoreKeyPass, 5).left(0,15).right(100,-5).set(); - ConfigurationCompositeBase.setFontHeight(txtKeystoreKeyPass, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(txtKeystoreKeyPass).top(lblKeystoreKeyPass, 5).left(0,15).right(100,-5).set(); + StateComposite.setFontHeight(txtKeystoreKeyPass, Constants.TEXT_SIZE_NORMAL); this.txtKeystoreFile.addFocusListener(new FocusAdapter() { @Override diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java index fc844ef3..8a59ec80 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java @@ -57,6 +57,7 @@ import org.slf4j.LoggerFactory; import at.asit.pdfover.commons.Constants; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.commons.Profile; +import at.asit.pdfover.gui.composites.StateComposite; import at.asit.pdfover.gui.controls.Dialog.BUTTONS; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.ErrorMarker; @@ -125,25 +126,25 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { setLayout(new FormLayout()); this.grpHandySignatur = new Group(this, SWT.NONE | SWT.RESIZE); - ConfigurationCompositeBase.anchor(grpHandySignatur).right(100,-5).left(0,5).top(0,5).set(); + StateComposite.anchor(grpHandySignatur).right(100,-5).left(0,5).top(0,5).set(); grpHandySignatur.setLayout(new GridLayout(2, false)); - ConfigurationCompositeBase.setFontHeight(grpHandySignatur, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(grpHandySignatur, Constants.TEXT_SIZE_NORMAL); this.lblMobileNumber = new Label(grpHandySignatur, SWT.NONE | SWT.RESIZE); this.lblMobileNumber.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); - ConfigurationCompositeBase.setFontHeight(lblMobileNumber, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(lblMobileNumber, Constants.TEXT_SIZE_NORMAL); Composite compMobileNumerContainer = new Composite(this.grpHandySignatur, SWT.NONE); compMobileNumerContainer.setLayout(new FormLayout()); compMobileNumerContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); this.txtMobileNumber = new Text(compMobileNumerContainer, SWT.BORDER | SWT.RESIZE); - ConfigurationCompositeBase.anchor(txtMobileNumber).left(0,5).right(100,-42).top(0).set(); - ConfigurationCompositeBase.setFontHeight(txtMobileNumber, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(txtMobileNumber).left(0,5).right(100,-42).top(0).set(); + StateComposite.setFontHeight(txtMobileNumber, Constants.TEXT_SIZE_NORMAL); this.txtMobileNumberErrorMarker = new ErrorMarker(compMobileNumerContainer, SWT.NONE, ""); this.txtMobileNumberErrorMarker.setVisible(false); - ConfigurationCompositeBase.anchor(txtMobileNumberErrorMarker).left(100,-32).right(100).top(0).bottom(0,32).set(); + StateComposite.anchor(txtMobileNumberErrorMarker).left(100,-32).right(100).top(0).bottom(0,32).set(); this.txtMobileNumber.addTraverseListener(e -> { if (e.detail == SWT.TRAVERSE_RETURN) { @@ -159,13 +160,13 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { }); this.grpSignatureProfile = new Group(this, SWT.NONE); - ConfigurationCompositeBase.anchor(grpSignatureProfile).right(100,-5).left(0,5).top(grpHandySignatur, 5).set(); + StateComposite.anchor(grpSignatureProfile).right(100,-5).left(0,5).top(grpHandySignatur, 5).set(); this.grpSignatureProfile.setLayout(new FormLayout()); - ConfigurationCompositeBase.setFontHeight(grpSignatureProfile, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(grpSignatureProfile, Constants.TEXT_SIZE_NORMAL); this.cmbSignatureProfiles = new Combo(this.grpSignatureProfile, SWT.READ_ONLY); - ConfigurationCompositeBase.anchor(cmbSignatureProfiles).left(0,10).right(100,-10).top(0,10).bottom(100,-10).set(); - ConfigurationCompositeBase.setFontHeight(cmbSignatureProfiles, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(cmbSignatureProfiles).left(0,10).right(100,-10).top(0,10).bottom(100,-10).set(); + StateComposite.setFontHeight(cmbSignatureProfiles, Constants.TEXT_SIZE_NORMAL); this.cmbSignatureProfiles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -179,16 +180,16 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { }); this.grpLogo = new Group(this, SWT.NONE); - ConfigurationCompositeBase.anchor(grpLogo).left(0,5).right(100,-5).top(grpSignatureProfile, 5).set(); + StateComposite.anchor(grpLogo).left(0,5).right(100,-5).top(grpSignatureProfile, 5).set(); this.grpLogo.setLayout(new FormLayout()); - ConfigurationCompositeBase.setFontHeight(grpLogo, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(grpLogo, Constants.TEXT_SIZE_NORMAL); Composite containerComposite = new Composite(this.grpLogo, SWT.NONE); - ConfigurationCompositeBase.anchor(containerComposite).left(0).right(100).top(0).bottom(100).set(); + StateComposite.anchor(containerComposite).left(0).right(100).top(0).bottom(100).set(); containerComposite.setLayout(new FormLayout()); final Composite controlComposite = new Composite(containerComposite, SWT.NONE); - ConfigurationCompositeBase.anchor(controlComposite).left(0,20).right(0,300).top(0,20).bottom(100,-20).set(); + StateComposite.anchor(controlComposite).left(0,20).right(0,300).top(0,20).bottom(100,-20).set(); controlComposite.setLayout(new FormLayout()); controlComposite.addPaintListener(e -> { e.gc.setForeground(Constants.DROP_BORDER_COLOR); @@ -200,24 +201,24 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { }); this.cSigPreview = new Canvas(containerComposite, SWT.RESIZE); - ConfigurationCompositeBase.anchor(cSigPreview).left(controlComposite, 20).right(100,-20).top(0,20).bottom(100,-20).set(); - ConfigurationCompositeBase.setFontHeight(cSigPreview, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(cSigPreview).left(controlComposite, 20).right(100,-20).top(0,20).bottom(100,-20).set(); + StateComposite.setFontHeight(cSigPreview, Constants.TEXT_SIZE_NORMAL); this.cSigPreview.addPaintListener(e -> imagePaintControl(e, SimpleConfigurationComposite.this.sigPreview)); this.btnBrowseLogo = new Button(controlComposite, SWT.NONE); - ConfigurationCompositeBase.anchor(btnBrowseLogo).bottom(100,-20).right(100,-20).set(); - ConfigurationCompositeBase.setFontHeight(btnBrowseLogo, Constants.TEXT_SIZE_BUTTON); + StateComposite.anchor(btnBrowseLogo).bottom(100,-20).right(100,-20).set(); + StateComposite.setFontHeight(btnBrowseLogo, Constants.TEXT_SIZE_BUTTON); this.lblDropLogo = new Label(controlComposite, SWT.NATIVE | SWT.CENTER); - ConfigurationCompositeBase.anchor(lblDropLogo).left(0,20).right(100,-20).bottom(btnBrowseLogo,-20).set(); + StateComposite.anchor(lblDropLogo).left(0,20).right(100,-20).bottom(btnBrowseLogo,-20).set(); this.cLogo = new Canvas(controlComposite, SWT.NONE); - ConfigurationCompositeBase.anchor(cLogo).left(0,20).right(100,-20).top(0,20).bottom(lblDropLogo,-20).height(40).width(40).set(); + StateComposite.anchor(cLogo).left(0,20).right(100,-20).top(0,20).bottom(lblDropLogo,-20).height(40).width(40).set(); this.cLogo.addPaintListener(e -> imagePaintControl(e, SimpleConfigurationComposite.this.logo)); this.btnClearImage = new Button(controlComposite, SWT.NATIVE); - ConfigurationCompositeBase.anchor(btnClearImage).bottom(100,-20).right(btnBrowseLogo, -10).set(); - ConfigurationCompositeBase.setFontHeight(btnClearImage, Constants.TEXT_SIZE_BUTTON); + StateComposite.anchor(btnClearImage).bottom(100,-20).right(btnBrowseLogo, -10).set(); + StateComposite.setFontHeight(btnClearImage, Constants.TEXT_SIZE_BUTTON); DropTarget dnd_target = new DropTarget(controlComposite, DND.DROP_DEFAULT | DND.DROP_COPY); final FileTransfer fileTransfer = FileTransfer.getInstance(); @@ -291,13 +292,13 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { this.grpSignatureLang = new Group(this, SWT.NONE); - ConfigurationCompositeBase.anchor(grpSignatureLang).right(100,-5).top(grpLogo, 5).left(0,5).set(); + StateComposite.anchor(grpSignatureLang).right(100,-5).top(grpLogo, 5).left(0,5).set(); this.grpSignatureLang.setLayout(new FormLayout()); - ConfigurationCompositeBase.setFontHeight(grpSignatureLang, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(grpSignatureLang, Constants.TEXT_SIZE_NORMAL); this.cmbSignatureLang = new Combo(this.grpSignatureLang, SWT.READ_ONLY); - ConfigurationCompositeBase.anchor(cmbSignatureLang).left(0,10).right(100,-10).top(0,10).bottom(100,-10).set(); - ConfigurationCompositeBase.setFontHeight(cmbSignatureLang, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(cmbSignatureLang).left(0,10).right(100,-10).top(0,10).bottom(100,-10).set(); + StateComposite.setFontHeight(cmbSignatureLang, Constants.TEXT_SIZE_NORMAL); this.cmbSignatureLang.setItems(Arrays.stream(Constants.SUPPORTED_LOCALES).map(l -> l.getDisplayLanguage()).toArray(String[]::new)); this.cmbSignatureLang.addSelectionListener(new SelectionAdapter() { @@ -315,9 +316,9 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { }); this.grpSignatureNote = new Group(this, SWT.NONE); - ConfigurationCompositeBase.anchor(grpSignatureNote).right(100,-5).top(grpSignatureLang,5).left(0,5).set(); + StateComposite.anchor(grpSignatureNote).right(100,-5).top(grpSignatureLang,5).left(0,5).set(); this.grpSignatureNote.setLayout(new GridLayout(2, false)); - ConfigurationCompositeBase.setFontHeight(grpSignatureNote, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(grpSignatureNote, Constants.TEXT_SIZE_NORMAL); this.lblSignatureNote = new Label(this.grpSignatureNote, SWT.NONE); do { /* grid positioning */ @@ -327,15 +328,15 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { this.lblSignatureNote.setLayoutData(gd_lblSignatureNote); this.lblSignatureNote.setBounds(0, 0, 57, 15); } while (false); - ConfigurationCompositeBase.setFontHeight(lblSignatureNote, Constants.TEXT_SIZE_NORMAL); + StateComposite.setFontHeight(lblSignatureNote, Constants.TEXT_SIZE_NORMAL); Composite compSignatureNoteContainer = new Composite(this.grpSignatureNote, SWT.NONE); compSignatureNoteContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); compSignatureNoteContainer.setLayout(new FormLayout()); this.txtSignatureNote = new Text(compSignatureNoteContainer, SWT.BORDER); - ConfigurationCompositeBase.anchor(txtSignatureNote).top(0,0).left(0,5).right(100,-42).set(); - ConfigurationCompositeBase.setFontHeight(txtSignatureNote, Constants.TEXT_SIZE_NORMAL); + StateComposite.anchor(txtSignatureNote).top(0,0).left(0,5).right(100,-42).set(); + StateComposite.setFontHeight(txtSignatureNote, Constants.TEXT_SIZE_NORMAL); this.txtSignatureNote.addFocusListener(new FocusAdapter() { @Override @@ -355,8 +356,8 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { compSignatureNoteButtonContainer.setLayout(new FormLayout()); this.btnSignatureNoteDefault = new Button(compSignatureNoteButtonContainer, SWT.NONE); - ConfigurationCompositeBase.anchor(btnSignatureNoteDefault).top(0,0).right(100,-42).set(); - ConfigurationCompositeBase.setFontHeight(btnSignatureNoteDefault, Constants.TEXT_SIZE_BUTTON); + StateComposite.anchor(btnSignatureNoteDefault).top(0,0).right(100,-42).set(); + StateComposite.setFontHeight(btnSignatureNoteDefault, Constants.TEXT_SIZE_BUTTON); this.btnSignatureNoteDefault.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { |