diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-09 15:21:21 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-09 15:21:21 +0200 |
commit | 43948381eee2eafae4865a087d87a898c4a9b97d (patch) | |
tree | 8f06c6aceeec537e1bf53c0f28fef87a21802465 /pdf-over-gui | |
parent | 8736033b6460b2f88b22d85fe01276c3cee68235 (diff) | |
download | pdf-over-43948381eee2eafae4865a087d87a898c4a9b97d.tar.gz pdf-over-43948381eee2eafae4865a087d87a898c4a9b97d.tar.bz2 pdf-over-43948381eee2eafae4865a087d87a898c4a9b97d.zip |
remove need to call AnchorSetter::set
(in SWTUtils)
Diffstat (limited to 'pdf-over-gui')
14 files changed, 137 insertions, 130 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java index c5d94102..79600265 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java @@ -255,7 +255,7 @@ public class MainWindow { this.mainbar.setLayoutData(this.mainBarFormData); this.btn_config = new MainBarRectangleButton(this.mainbar, SWT.NONE); - SWTUtils.anchor(btn_config).bottom(100).right(0,50).top(0).left(0).set(); + SWTUtils.anchor(btn_config).bottom(100).right(0,50).top(0).left(0); SWTUtils.setLocalizedText(btn_config, "main.configuration"); SWTUtils.setLocalizedToolTipText(btn_config, "main.configuration"); this.btn_config.addMouseListener(new MouseAdapter() { @@ -277,10 +277,10 @@ public class MainWindow { Composite mainbarContainer = new Composite(this.mainbar, SWT.NONE); mainbarContainer.setLayout(new FormLayout()); - SWTUtils.anchor(mainbarContainer).left(btn_config).right(100).top(0).bottom(100).set(); + SWTUtils.anchor(mainbarContainer).left(btn_config).right(100).top(0).bottom(100); this.btn_open = new MainBarStartButton(mainbarContainer, SWT.NONE); - SWTUtils.anchor(btn_open).left(0).right(27, (MainBarButton.SplitFactor / 2)).top(0).bottom(100).set(); + SWTUtils.anchor(btn_open).left(0).right(27, (MainBarButton.SplitFactor / 2)).top(0).bottom(100); SWTUtils.setLocalizedText(btn_open, "common.open"); SWTUtils.setLocalizedToolTipText(btn_open, "common.open"); this.btn_open.addMouseListener(new MouseAdapter() { @@ -297,7 +297,7 @@ public class MainWindow { this.buttonMap.put(Buttons.OPEN, this.btn_open); this.btn_position = new MainBarMiddleButton(mainbarContainer, SWT.NONE); - SWTUtils.anchor(btn_position).left(27, -1 * (MainBarButton.SplitFactor / 2)).right(54, (MainBarButton.SplitFactor / 2)).top(0).bottom(100).set(); + SWTUtils.anchor(btn_position).left(27, -1 * (MainBarButton.SplitFactor / 2)).right(54, (MainBarButton.SplitFactor / 2)).top(0).bottom(100); SWTUtils.setLocalizedText(btn_position, "main.position"); SWTUtils.setLocalizedToolTipText(btn_position, "main.position"); this.btn_position.addMouseListener(new MouseAdapter() { @@ -310,7 +310,7 @@ public class MainWindow { this.buttonMap.put(Buttons.POSITION, this.btn_position); this.btn_sign = new MainBarMiddleButton(mainbarContainer, SWT.NONE); - SWTUtils.anchor(btn_sign).left(54, -1 * (MainBarButton.SplitFactor / 2)).right(81, (MainBarButton.SplitFactor / 2)).top(0).bottom(100).set(); + SWTUtils.anchor(btn_sign).left(54, -1 * (MainBarButton.SplitFactor / 2)).right(81, (MainBarButton.SplitFactor / 2)).top(0).bottom(100); SWTUtils.setLocalizedText(btn_sign, "main.signature"); SWTUtils.setLocalizedToolTipText(btn_sign, "main.signature"); this.btn_sign.addMouseListener(new MouseAdapter() { @@ -323,7 +323,7 @@ public class MainWindow { this.buttonMap.put(Buttons.SIGN, this.btn_sign); this.btn_end = new MainBarEndButton(mainbarContainer, SWT.NONE); - SWTUtils.anchor(btn_end).left(81, -1 * (MainBarButton.SplitFactor / 2)).right(100).top(0).bottom(100).set(); + SWTUtils.anchor(btn_end).left(81, -1 * (MainBarButton.SplitFactor / 2)).right(100).top(0).bottom(100); SWTUtils.setLocalizedText(btn_end, "main.done"); SWTUtils.setLocalizedToolTipText(btn_end, "main.done"); this.buttonMap.put(Buttons.FINAL, this.btn_end); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java index c02ebd40..58d2ee43 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java @@ -135,7 +135,7 @@ public class BKUSelectionComposite extends StateComposite { public void setKeystoreEnabled(boolean enabled) { if (enabled) { this.btnKS = new Button(this, SWT.NONE); - SWTUtils.anchor(this.btnKS).top(this.btnCard, 10).left(this.btnMobile, 0, SWT.LEFT).right(this.btnCard, 0, SWT.RIGHT).set(); + SWTUtils.anchor(this.btnKS).top(this.btnCard, 10).left(this.btnMobile, 0, SWT.LEFT).right(this.btnCard, 0, SWT.RIGHT); this.btnKS.addSelectionListener(new KSSelectionListener()); reloadResources(); @@ -157,7 +157,7 @@ public class BKUSelectionComposite extends StateComposite { this.setLayout(new FormLayout()); ClickableCanvas cc_mobile = new ClickableCanvas(this, SWT.NATIVE | SWT.RESIZE); - SWTUtils.anchor(cc_mobile).right(50, -5).top(40, -20).set(); + SWTUtils.anchor(cc_mobile).right(50, -5).top(40, -20); Image mobile = new Image(getDisplay(), new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_MOBILE))); cc_mobile.setImage(mobile); SWTUtils.setFontHeight(cc_mobile, Constants.TEXT_SIZE_BUTTON); @@ -170,7 +170,7 @@ public class BKUSelectionComposite extends StateComposite { }); ClickableCanvas cc_karte = new ClickableCanvas(this, SWT.NATIVE | SWT.RESIZE); - SWTUtils.anchor(cc_karte).left(50, 5).top(40, -20).set(); + SWTUtils.anchor(cc_karte).left(50, 5).top(40, -20); Image karte = new Image(getDisplay(), new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_CARD))); cc_karte.setImage(karte); SWTUtils.setFontHeight(cc_karte, Constants.TEXT_SIZE_BUTTON); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index 63e7b6dd..1f676951 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -163,7 +163,7 @@ public class ConfigurationComposite extends StateComposite { this.containerComposite = new Composite(this, SWT.FILL | SWT.RESIZE); this.tabFolder = new TabFolder(this.containerComposite, SWT.NONE); - SWTUtils.anchor(tabFolder).bottom(100, -5).right(100, -5).top(0, 5).left(0, 5).set(); + SWTUtils.anchor(tabFolder).bottom(100, -5).right(100, -5).top(0, 5).left(0, 5); SWTUtils.setFontHeight(tabFolder, Constants.TEXT_SIZE_NORMAL); this.simpleTabItem = new TabItem(this.tabFolder, SWT.NONE); @@ -203,7 +203,7 @@ public class ConfigurationComposite extends StateComposite { this.tabFolder.setSelection(this.simpleTabItem); this.btnSpeichern = new Button(this, SWT.NONE); - SWTUtils.anchor(btnSpeichern).right(100, -5).bottom(100).set(); + SWTUtils.anchor(btnSpeichern).right(100, -5).bottom(100); SWTUtils.setFontHeight(btnSpeichern, Constants.TEXT_SIZE_BUTTON); this.btnSpeichern.addSelectionListener(new SelectionAdapter() { @Override @@ -217,7 +217,7 @@ public class ConfigurationComposite extends StateComposite { }); this.btnAbbrechen = new Button(this, SWT.NONE); - SWTUtils.anchor(btnAbbrechen).right(btnSpeichern, -10).bottom(btnSpeichern, 0, SWT.BOTTOM).set(); + SWTUtils.anchor(btnAbbrechen).right(btnSpeichern, -10).bottom(btnSpeichern, 0, SWT.BOTTOM); SWTUtils.setFontHeight(btnAbbrechen, Constants.TEXT_SIZE_BUTTON); this.btnAbbrechen.addSelectionListener(new SelectionAdapter() { @Override @@ -228,7 +228,7 @@ public class ConfigurationComposite extends StateComposite { } }); - SWTUtils.anchor(containerComposite).top(0, 5).bottom(btnSpeichern, -10).left(0, 5).right(100, -5).set(); + SWTUtils.anchor(containerComposite).top(0, 5).bottom(btnSpeichern, -10).left(0, 5).right(100, -5); this.containerComposite.setLayout(this.compositeStack); this.compositeStack.topControl = this.tabFolder; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java index c7f8b483..78d7a45a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java @@ -163,7 +163,7 @@ public class DataSourceSelectComposite extends StateComposite { // Color back = new Color(Display.getCurrent(), 77, 190, 250); this.drop_area = new Composite(this, SWT.RESIZE); - SWTUtils.anchor(drop_area).left(0, 30).right(100, -30).top(0, 30).bottom(100, -30).set(); + SWTUtils.anchor(drop_area).left(0, 30).right(100, -30).top(0, 30).bottom(100, -30); this.drop_area.setLayout(new FormLayout()); this.drop_area.addPaintListener(new PaintListener() { @@ -244,15 +244,15 @@ public class DataSourceSelectComposite extends StateComposite { this.lbl_drag = new Label(this.drop_area, SWT.NONE | SWT.RESIZE ); this.lbl_drag2 = new Label(this.drop_area, SWT.NONE | SWT.RESIZE ); - SWTUtils.anchor(lbl_drag).left(0, 10).right(100, -10).bottom(lbl_drag2, -10).set(); - SWTUtils.anchor(lbl_drag2).left(0, 10).right(100, -10).top(50, -10).set(); + SWTUtils.anchor(lbl_drag).left(0, 10).right(100, -10).bottom(lbl_drag2, -10); + SWTUtils.anchor(lbl_drag2).left(0, 10).right(100, -10).top(50, -10); SWTUtils.setFontHeight(lbl_drag, Constants.TEXT_SIZE_BIG); SWTUtils.setFontHeight(lbl_drag2, Constants.TEXT_SIZE_NORMAL); this.lbl_drag.setAlignment(SWT.CENTER); this.lbl_drag2.setAlignment(SWT.CENTER); this.btn_open = new Button(this.drop_area, SWT.NATIVE | SWT.RESIZE); - SWTUtils.anchor(btn_open).left(lbl_drag2, 0, SWT.CENTER).top(lbl_drag2, 10).set(); + SWTUtils.anchor(btn_open).left(lbl_drag2, 0, SWT.CENTER).top(lbl_drag2, 10); SWTUtils.setFontHeight(btn_open, Constants.TEXT_SIZE_BUTTON); reloadResources(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java index df4d7a97..427daefd 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java @@ -168,44 +168,44 @@ public class MobileBKUEnterNumberComposite extends StateComposite { 10, 10);
});
containerComposite.setLayout(new FormLayout());
- SWTUtils.anchor(containerComposite).top(50, -120).bottom(50, 120).left(50, -200).right(50, 200).set();
+ SWTUtils.anchor(containerComposite).top(50, -120).bottom(50, 120).left(50, -200).right(50, 200);
this.txt_number = new Text(containerComposite, SWT.SINGLE | SWT.NATIVE | SWT.BORDER);
- SWTUtils.anchor(txt_number).bottom(50, -10).left(50, 10).right(100, -20).set();
+ SWTUtils.anchor(txt_number).bottom(50, -10).left(50, 10).right(100, -20);
this.txt_number.setEditable(true);
this.lbl_number = new Label(containerComposite, SWT.NATIVE);
this.lbl_number.setAlignment(SWT.RIGHT);
- SWTUtils.anchor(lbl_number).bottom(50, -10).right(50, -10).set();
+ SWTUtils.anchor(lbl_number).bottom(50, -10).right(50, -10);
ImageData mobileIconData = new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_MOBILE));
Image mobileIcon = new Image(getDisplay(), mobileIconData);
Label lbl_image = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lbl_image).top(20, -1 * (mobileIconData.width / 2)).bottom(20, mobileIconData.width / 2).left(0, 10).width(mobileIconData.width).set();
+ SWTUtils.anchor(lbl_image).top(20, -1 * (mobileIconData.width / 2)).bottom(20, mobileIconData.width / 2).left(0, 10).width(mobileIconData.width);
lbl_image.setImage(mobileIcon);
this.txt_password = new Text(containerComposite, SWT.SINGLE | SWT.PASSWORD | SWT.BORDER | SWT.NATIVE);
- SWTUtils.anchor(txt_password).top(50, 10).left(50, 10).right(100, -20).set();
+ SWTUtils.anchor(txt_password).top(50, 10).left(50, 10).right(100, -20);
this.txt_password.setEditable(true);
this.lbl_password = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lbl_password).top(50, 10).right(50, -10).set();
+ SWTUtils.anchor(lbl_password).top(50, 10).right(50, -10);
this.lbl_password.setAlignment(SWT.RIGHT);
this.btn_ok = new Button(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(btn_ok).bottom(100, -20).right(100, -20).set();
+ SWTUtils.anchor(btn_ok).bottom(100, -20).right(100, -20);
this.btn_ok.addSelectionListener(this.okListener);
this.btn_cancel = new Button(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(btn_cancel).bottom(100, -20).right(btn_ok, -10).set();
+ SWTUtils.anchor(btn_cancel).bottom(100, -20).right(btn_ok, -10);
this.btn_cancel.addSelectionListener(this.cancelListener);
this.lbl_error = new Label(containerComposite, SWT.WRAP | SWT.NATIVE );
- SWTUtils.anchor(lbl_error).bottom(103, -20).left(5, 0).right(btn_cancel, -10).set();
+ SWTUtils.anchor(lbl_error).bottom(103, -20).left(5, 0).right(btn_cancel, -10);
this.btn_remember = new Button(containerComposite, SWT.CHECK);
- SWTUtils.anchor(btn_remember).right(100, -10).top(0, 5).set();
+ SWTUtils.anchor(btn_remember).right(100, -10).top(0, 5);
}
@Override
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java index ce3a23bf..7fe40ffe 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java @@ -323,29 +323,29 @@ public class MobileBKUEnterTANComposite extends StateComposite { }
});
containerComposite.setLayout(new FormLayout());
- SWTUtils.anchor(containerComposite).top(50, -120).bottom(50, 120).left(50, -200).right(50, 200).set();
+ SWTUtils.anchor(containerComposite).top(50, -120).bottom(50, 120).left(50, -200).right(50, 200);
this.lblRefValLabel = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lblRefValLabel).right(50, -10).bottom(50,-10).set();
+ SWTUtils.anchor(lblRefValLabel).right(50, -10).bottom(50,-10);
SWTUtils.setLocalizedText(lblRefValLabel, "tanEnter.ReferenceValue");
this.lblRefValLabel.setAlignment(SWT.RIGHT);
ImageData mobileIcon = new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_MOBILE));
Label lbl_image = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lbl_image).top(50, -1 * (mobileIcon.width / 2)).bottom(50, mobileIcon.width / 2).left(0, 10).width(mobileIcon.width).set();
+ SWTUtils.anchor(lbl_image).top(50, -1 * (mobileIcon.width / 2)).bottom(50, mobileIcon.width / 2).left(0, 10).width(mobileIcon.width);
lbl_image.setImage(new Image(getDisplay(), mobileIcon));
this.lblRefVal = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lblRefVal).left(50,10).right(100,-20).bottom(50,-10).set();
+ SWTUtils.anchor(lblRefVal).left(50,10).right(100,-20).bottom(50,-10);
this.lblRefVal.setText("");
this.lblTan = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lblTan).right(50,-10).top(50,10).set();
+ SWTUtils.anchor(lblTan).right(50,-10).top(50,10);
SWTUtils.setLocalizedText(lblTan, "tanEnter.TAN");
this.lblTan.setAlignment(SWT.RIGHT);
this.txt_tan = new Text(containerComposite, SWT.BORDER | SWT.NATIVE);
- SWTUtils.anchor(txt_tan).left(50,10).right(100,-20).top(50,10).set();
+ SWTUtils.anchor(txt_tan).left(50,10).right(100,-20).top(50,10);
this.txt_tan.setEditable(true);
this.txt_tan.addTraverseListener(new TraverseListener() {
@@ -375,24 +375,24 @@ public class MobileBKUEnterTANComposite extends StateComposite { });
Link lnk_sig_data = new Link(containerComposite, SWT.NATIVE | SWT.RESIZE);
- SWTUtils.anchor(lnk_sig_data).right(100,-20).top(0,20).set();
+ SWTUtils.anchor(lnk_sig_data).right(100,-20).top(0,20);
lnk_sig_data.setEnabled(true);
lnk_sig_data.addSelectionListener(new ShowSignatureDataListener());
SWTUtils.setLocalizedText(lnk_sig_data, "mobileBKU.show");
SWTUtils.setLocalizedToolTipText(lnk_sig_data, "mobileBKU.show_tooltip");
this.btn_ok = new Button(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(btn_ok).right(100,-20).bottom(100,-20).set();
+ SWTUtils.anchor(btn_ok).right(100,-20).bottom(100,-20);
SWTUtils.setLocalizedText(btn_ok, "common.Ok");
this.btn_ok.addSelectionListener(new OkSelectionListener());
this.btn_cancel = new Button(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(btn_cancel).right(btn_ok, -20).bottom(100, -20).set();
+ SWTUtils.anchor(btn_cancel).right(btn_ok, -20).bottom(100, -20);
SWTUtils.setLocalizedText(btn_cancel, "common.Cancel");
this.btn_cancel.addSelectionListener(new CancelSelectionListener());
this.lblTries = new Label(containerComposite, SWT.WRAP | SWT.NATIVE);
- SWTUtils.anchor(lblTries).right(btn_cancel, -10).bottom(100, -20).set();
+ SWTUtils.anchor(lblTries).right(btn_cancel, -10).bottom(100, -20);
}
@Override
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUFingerprintComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUFingerprintComposite.java index 7980a033..8b764b29 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUFingerprintComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUFingerprintComposite.java @@ -244,7 +244,7 @@ public class MobileBKUFingerprintComposite extends StateComposite { setLayout(new FormLayout());
final Composite containerComposite = new Composite(this, SWT.NATIVE);
- SWTUtils.anchor(containerComposite).top(50, -140).bottom(50, 140).left(50, -200).right(50, 200).set();
+ SWTUtils.anchor(containerComposite).top(50, -140).bottom(50, 140).left(50, -200).right(50, 200);
containerComposite.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
@@ -260,36 +260,36 @@ public class MobileBKUFingerprintComposite extends StateComposite { });
this.lblRefValLabel = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lblRefValLabel).right(50, -10).top(30, -10).set();
+ SWTUtils.anchor(lblRefValLabel).right(50, -10).top(30, -10);
this.lblRefValLabel.setAlignment(SWT.RIGHT);
ImageData mobileIcon = new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_MOBILE));
Label lbl_image = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lbl_image).top(50, -1 * (mobileIcon.width / 2)).bottom(50, mobileIcon.width / 2).left(0, 10).width(mobileIcon.width).set();
+ SWTUtils.anchor(lbl_image).top(50, -1 * (mobileIcon.width / 2)).bottom(50, mobileIcon.width / 2).left(0, 10).width(mobileIcon.width);
lbl_image.setImage(new Image(getDisplay(), mobileIcon));
this.lblRefVal = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lblRefVal).left(50, 10).right(100, -20).top(30, -10).set();
+ SWTUtils.anchor(lblRefVal).left(50, 10).right(100, -20).top(30, -10);
this.lblFPLabel = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lblFPLabel).left(25, 10).top(lblRefValLabel, 10).set();
+ SWTUtils.anchor(lblFPLabel).left(25, 10).top(lblRefValLabel, 10);
this.lblFPLabel.setAlignment(SWT.LEFT);
this.lnk_sig_data = new Link(containerComposite, SWT.NATIVE | SWT.RESIZE);
- SWTUtils.anchor(lnk_sig_data).right(100, -20).top(0, 20).set();
+ SWTUtils.anchor(lnk_sig_data).right(100, -20).top(0, 20);
this.lnk_sig_data.setEnabled(true);
this.lnk_sig_data.addSelectionListener(new ShowSignatureDataListener());
this.btn_cancel = new Button(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(btn_cancel).right(100, -20).bottom(100, -20).set();
+ SWTUtils.anchor(btn_cancel).right(100, -20).bottom(100, -20);
this.btn_cancel.addSelectionListener(new CancelSelectionListener());
this.btn_sms = new Button(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(btn_sms).right(btn_cancel, -20).bottom(100, -20).set();
+ SWTUtils.anchor(btn_sms).right(btn_cancel, -20).bottom(100, -20);
this.btn_sms.addSelectionListener(new SMSSelectionListener());
this.lblError = new Label(containerComposite, SWT.WRAP | SWT.NATIVE);
- SWTUtils.anchor(lblError).right(btn_sms, -10).bottom(100, -20).set();
+ SWTUtils.anchor(lblError).right(btn_sms, -10).bottom(100, -20);
reloadResources();
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java index 88ee12c4..c91ccc06 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java @@ -274,7 +274,7 @@ public class MobileBKUQRComposite extends StateComposite { setLayout(new FormLayout());
final Composite containerComposite = new Composite(this, SWT.NATIVE);
- SWTUtils.anchor(containerComposite).top(50, -140).bottom(50, 140).left(50, -200).right(50, 200).set();
+ SWTUtils.anchor(containerComposite).top(50, -140).bottom(50, 140).left(50, -200).right(50, 200);
containerComposite.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
@@ -291,41 +291,41 @@ public class MobileBKUQRComposite extends StateComposite { containerComposite.setLayout(new FormLayout());
this.lblRefValLabel = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lblRefValLabel).right(50, -10).top(30, -10).set();
+ SWTUtils.anchor(lblRefValLabel).right(50, -10).top(30, -10);
this.lblRefValLabel.setAlignment(SWT.RIGHT);
ImageData mobileIcon = new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_MOBILE));
Label lbl_image = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lbl_image).top(50, -1 * (mobileIcon.width / 2)).bottom(50, mobileIcon.width / 2).left(0, 10).width(mobileIcon.width).set();
+ SWTUtils.anchor(lbl_image).top(50, -1 * (mobileIcon.width / 2)).bottom(50, mobileIcon.width / 2).left(0, 10).width(mobileIcon.width);
lbl_image.setImage(new Image(getDisplay(), mobileIcon));
this.lblRefVal = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lblRefVal).left(50, 10).right(100, -20).top(30, -10).set();
+ SWTUtils.anchor(lblRefVal).left(50, 10).right(100, -20).top(30, -10);
this.lblQRLabel = new Label(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(lblQRLabel).right(50, -10).top(lblRefValLabel, 10).set();
+ SWTUtils.anchor(lblQRLabel).right(50, -10).top(lblRefValLabel, 10);
this.lblQRLabel.setAlignment(SWT.RIGHT);
this.lblQR = new Label(containerComposite, SWT.NATIVE);
this.lblQR.addListener(SWT.Resize, (e) -> { updateQRImage(); });
this.lnk_sig_data = new Link(containerComposite, SWT.NATIVE | SWT.RESIZE);
- SWTUtils.anchor(lnk_sig_data).right(100, -20).top(0, 20).set();
+ SWTUtils.anchor(lnk_sig_data).right(100, -20).top(0, 20);
this.lnk_sig_data.setEnabled(true);
this.lnk_sig_data.addSelectionListener(new ShowSignatureDataListener());
this.btn_cancel = new Button(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(btn_cancel).right(100, -20).bottom(100, -5).set();
+ SWTUtils.anchor(btn_cancel).right(100, -20).bottom(100, -5);
this.btn_cancel.addSelectionListener(new CancelSelectionListener());
this.btn_sms = new Button(containerComposite, SWT.NATIVE);
- SWTUtils.anchor(btn_sms).right(btn_cancel, -20).bottom(100, -5).set();
+ SWTUtils.anchor(btn_sms).right(btn_cancel, -20).bottom(100, -5);
this.btn_sms.addSelectionListener(new SMSSelectionListener());
- SWTUtils.anchor(lblQR).left(50, 10).right(100, -20).top(lblRefVal, 10).bottom(btn_sms, -10).set();
+ SWTUtils.anchor(lblQR).left(50, 10).right(100, -20).top(lblRefVal, 10).bottom(btn_sms, -10);
this.lblError = new Label(containerComposite, SWT.WRAP | SWT.NATIVE);
- SWTUtils.anchor(lblError).right(btn_sms, -10).bottom(100, -20).set();
+ SWTUtils.anchor(lblError).right(btn_sms, -10).bottom(100, -20);
reloadResources();
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java index e74c4e92..7a08f12c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java @@ -79,21 +79,21 @@ public class PositioningComposite extends StateComposite { this.setLayout(new FormLayout()); this.bottomBar = new Composite(this, SWT.NONE); - SWTUtils.anchor(bottomBar).left(0).right(100).bottom(100).set(); + SWTUtils.anchor(bottomBar).left(0).right(100).bottom(100); this.bottomBar.setLayout(new FormLayout()); this.btnSign = new Button(this.bottomBar, SWT.PUSH); - SWTUtils.anchor(btnSign).right(100).top(0).set(); + SWTUtils.anchor(btnSign).right(100).top(0); this.getShell().setDefaultButton(this.btnSign); this.btnNewPage = new Button(this.bottomBar, SWT.TOGGLE); - SWTUtils.anchor(btnNewPage).right(btnSign).top(0).set(); + SWTUtils.anchor(btnNewPage).right(btnSign).top(0); this.lblPage = new Label(this.bottomBar, SWT.CENTER); - SWTUtils.anchor(lblPage).left(0).right(btnNewPage, 5).bottom(100).set(); + SWTUtils.anchor(lblPage).left(0).right(btnNewPage, 5).bottom(100); this.mainArea = new Composite(this, SWT.EMBEDDED | SWT.V_SCROLL); - SWTUtils.anchor(mainArea).left(0).right(100).top(0).bottom(bottomBar, -5).set(); + SWTUtils.anchor(mainArea).left(0).right(100).top(0).bottom(bottomBar, -5); this.scrollbar = this.mainArea.getVerticalBar(); this.frame = SWT_AWT.new_Frame(this.mainArea); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java index 01f4e885..825a6187 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java @@ -42,25 +42,25 @@ public class AboutComposite extends ConfigurationCompositeBase { setLayout(new FormLayout()); this.lnkAbout = new Link(this, SWT.WRAP); - SWTUtils.anchor(lnkAbout).top(0,5).right(100,-5).left(0,5).set(); + SWTUtils.anchor(lnkAbout).top(0,5).right(100,-5).left(0,5); SWTUtils.setFontHeight(lnkAbout, Constants.TEXT_SIZE_NORMAL); this.lblDataProtection = new Label(this, SWT.WRAP); - SWTUtils.anchor(lblDataProtection).top(lnkAbout, 15).left(0,5).right(100,-5).set(); + SWTUtils.anchor(lblDataProtection).top(lnkAbout, 15).left(0,5).right(100,-5); SWTUtils.setFontHeight(lblDataProtection, Constants.TEXT_SIZE_BIG); SWTUtils.setFontStyle(lblDataProtection, SWT.BOLD); this.lnkDataProtection = new Link(this, SWT.WRAP); - SWTUtils.anchor(lnkDataProtection).top(lblDataProtection,10).left(0,5).right(100,-5).set(); + SWTUtils.anchor(lnkDataProtection).top(lblDataProtection,10).left(0,5).right(100,-5); SWTUtils.setFontHeight(lnkDataProtection, Constants.TEXT_SIZE_NORMAL); this.btnUpdateCheck = new Button(this, SWT.CHECK); - SWTUtils.anchor(btnUpdateCheck).bottom(100,-5).left(0,5).set(); + SWTUtils.anchor(btnUpdateCheck).bottom(100,-5).left(0,5); SWTUtils.setFontHeight(btnUpdateCheck, Constants.TEXT_SIZE_BUTTON); SWTUtils.addSelectionListener(btnUpdateCheck, e -> { this.configurationContainer.updateCheck = btnUpdateCheck.getSelection(); }); this.btnOpenLogDirectory = new Button(this, SWT.NONE); - SWTUtils.anchor(btnOpenLogDirectory).bottom(100, -5).right(100, -5).set(); + SWTUtils.anchor(btnOpenLogDirectory).bottom(100, -5).right(100, -5); SWTUtils.setFontHeight(btnOpenLogDirectory, Constants.TEXT_SIZE_BUTTON); this.lnkAbout.addSelectionListener(new SelectionAdapter() { 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 1983206f..6d68bb4c 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 @@ -121,61 +121,61 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { this.grpLocaleAuswahl = new Group(this, SWT.NONE); this.grpLocaleAuswahl.setLayout(STANDARD_LAYOUT); - SWTUtils.anchor(grpLocaleAuswahl).top(0, 5).left(0,5).right(100,-5).set(); + SWTUtils.anchor(grpLocaleAuswahl).top(0, 5).left(0,5).right(100,-5); SWTUtils.setFontHeight(grpLocaleAuswahl, Constants.TEXT_SIZE_NORMAL); this.grpSignatur = new Group(this, SWT.NONE); this.grpSignatur.setLayout(STANDARD_LAYOUT); - SWTUtils.anchor(grpSignatur).top(grpLocaleAuswahl,5).right(100,-5).left(0,5).set(); + SWTUtils.anchor(grpSignatur).top(grpLocaleAuswahl,5).right(100,-5).left(0,5); SWTUtils.setFontHeight(grpSignatur, Constants.TEXT_SIZE_NORMAL); this.grpPlaceholder = new Group(this, SWT.NONE); this.grpPlaceholder.setLayout(STANDARD_LAYOUT); - SWTUtils.anchor(grpPlaceholder).top(grpSignatur, 5).left(0,5).right(100,-5).set(); + SWTUtils.anchor(grpPlaceholder).top(grpSignatur, 5).left(0,5).right(100,-5); SWTUtils.setFontHeight(grpPlaceholder, Constants.TEXT_SIZE_NORMAL); this.grpBkuAuswahl = new Group(this, SWT.NONE); this.grpBkuAuswahl.setLayout(STANDARD_LAYOUT); - SWTUtils.anchor(grpBkuAuswahl).top(grpPlaceholder, 5).left(0,5).right(100,-5).set(); + SWTUtils.anchor(grpBkuAuswahl).top(grpPlaceholder, 5).left(0,5).right(100,-5); SWTUtils.setFontHeight(grpBkuAuswahl, Constants.TEXT_SIZE_NORMAL); this.grpSpeicherort = new Group(this, SWT.NONE); grpSpeicherort.setLayout(new GridLayout(3, false)); - SWTUtils.anchor(grpSpeicherort).left(0,5).top(grpBkuAuswahl, 5).right(100,-5).set(); + SWTUtils.anchor(grpSpeicherort).left(0,5).top(grpBkuAuswahl, 5).right(100,-5); SWTUtils.setFontHeight(grpSpeicherort, Constants.TEXT_SIZE_NORMAL); this.grpProxy = new Group(this, SWT.NONE); - SWTUtils.anchor(grpProxy).right(100,-5).top(grpSpeicherort, 5).left(0,5).set(); + SWTUtils.anchor(grpProxy).right(100,-5).top(grpSpeicherort, 5).left(0,5); this.grpProxy.setLayout(new GridLayout(2, false)); SWTUtils.setFontHeight(grpProxy, Constants.TEXT_SIZE_NORMAL); this.btnAutomatischePositionierung = new Button(this.grpSignatur, SWT.CHECK); - SWTUtils.anchor(btnAutomatischePositionierung).right(100,-5).top(0).left(0,5).set(); + SWTUtils.anchor(btnAutomatischePositionierung).right(100,-5).top(0).left(0,5); SWTUtils.setFontHeight(btnAutomatischePositionierung, Constants.TEXT_SIZE_BUTTON); SWTUtils.addSelectionListener(btnAutomatischePositionierung, e -> { performPositionSelection(btnAutomatischePositionierung.getSelection()); }); this.btnPdfACompat = new Button(this.grpSignatur, SWT.CHECK); - SWTUtils.anchor(btnPdfACompat).right(100,-5).top(btnAutomatischePositionierung, 5).left(0,5).set(); + SWTUtils.anchor(btnPdfACompat).right(100,-5).top(btnAutomatischePositionierung, 5).left(0,5); SWTUtils.setFontHeight(btnPdfACompat, Constants.TEXT_SIZE_BUTTON); SWTUtils.addSelectionListener(btnPdfACompat, e -> { performPdfACompatSelection(btnPdfACompat.getSelection()); }); this.btnEnablePlaceholderUsage = new Button(this.grpPlaceholder, SWT.CHECK); - SWTUtils.anchor(btnEnablePlaceholderUsage).top(0,5).left(0,5).right(100,-5).set(); + SWTUtils.anchor(btnEnablePlaceholderUsage).top(0,5).left(0,5).right(100,-5); SWTUtils.setFontHeight(btnEnablePlaceholderUsage, Constants.TEXT_SIZE_BUTTON); SWTUtils.addSelectionListener(btnEnablePlaceholderUsage, e -> { performEnableUsePlaceholder(btnEnablePlaceholderUsage.getSelection()); }); this.btnPlatzhalterVerwenden = new Button(this.grpPlaceholder, SWT.RADIO); - SWTUtils.anchor(btnPlatzhalterVerwenden).right(100,-5).top(btnEnablePlaceholderUsage,5).left(0,5).set(); + SWTUtils.anchor(btnPlatzhalterVerwenden).right(100,-5).top(btnEnablePlaceholderUsage,5).left(0,5); SWTUtils.setFontHeight(btnPlatzhalterVerwenden, Constants.TEXT_SIZE_BUTTON); SWTUtils.addSelectionListener(btnPlatzhalterVerwenden, e -> { performUseMarkerSelection(btnPlatzhalterVerwenden.getSelection()); }); this.btnSignatureFieldsUsage = new Button(this.grpPlaceholder, SWT.RADIO); - SWTUtils.anchor(btnSignatureFieldsUsage).right(100,-5).top(btnPlatzhalterVerwenden, 5).left(0,5).set(); + SWTUtils.anchor(btnSignatureFieldsUsage).right(100,-5).top(btnPlatzhalterVerwenden, 5).left(0,5); SWTUtils.setFontHeight(btnSignatureFieldsUsage, Constants.TEXT_SIZE_BUTTON); SWTUtils.addSelectionListener(btnSignatureFieldsUsage, e -> { performUseSignatureFieldsSelection(btnSignatureFieldsUsage.getSelection()); }); this.cmbBKUAuswahl = new Combo(this.grpBkuAuswahl, SWT.READ_ONLY); - SWTUtils.anchor(cmbBKUAuswahl).right(100,-5).top(0).left(0,5).set(); + SWTUtils.anchor(cmbBKUAuswahl).right(100,-5).top(0).left(0,5); SWTUtils.setFontHeight(cmbBKUAuswahl, Constants.TEXT_SIZE_NORMAL); SWTUtils.disableEventDefault(cmbBKUAuswahl, SWT.MouseVerticalWheel); @@ -190,7 +190,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { }); this.btnKeystoreEnabled = new Button(this.grpBkuAuswahl, SWT.CHECK); - SWTUtils.anchor(btnKeystoreEnabled).right(100,-5).top(cmbBKUAuswahl,5).left(0,5).set(); + SWTUtils.anchor(btnKeystoreEnabled).right(100,-5).top(cmbBKUAuswahl,5).left(0,5); SWTUtils.setFontHeight(btnKeystoreEnabled, Constants.TEXT_SIZE_BUTTON); SWTUtils.addSelectionListener(btnKeystoreEnabled, e -> { performKeystoreEnabledSelection(btnKeystoreEnabled.getSelection()); }); @@ -251,7 +251,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { }); this.cmbLocaleAuswahl = new Combo(this.grpLocaleAuswahl, SWT.READ_ONLY); - SWTUtils.anchor(cmbLocaleAuswahl).right(100,-5).top(0).left(0,5).set(); + SWTUtils.anchor(cmbLocaleAuswahl).right(100,-5).top(0).left(0,5); SWTUtils.setFontHeight(cmbLocaleAuswahl, Constants.TEXT_SIZE_NORMAL);; this.cmbLocaleAuswahl.setItems(Arrays.stream(Constants.SUPPORTED_LOCALES).map(l -> l.getDisplayLanguage()).toArray(String[]::new)); SWTUtils.disableEventDefault(cmbLocaleAuswahl, SWT.MouseVerticalWheel); @@ -278,11 +278,11 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { compProxyHostContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); this.txtProxyHost = new Text(compProxyHostContainer, SWT.BORDER); - SWTUtils.anchor(txtProxyHost).right(100,-42).top(0).left(0,5).set(); + SWTUtils.anchor(txtProxyHost).right(100,-42).top(0).left(0,5); SWTUtils.setFontHeight(txtProxyHost, Constants.TEXT_SIZE_NORMAL); this.proxyHostErrorMarker = new ErrorMarker(compProxyHostContainer, SWT.NONE, ""); - SWTUtils.anchor(proxyHostErrorMarker).left(100,-32).right(100).top(0).bottom(0,32).set(); + SWTUtils.anchor(proxyHostErrorMarker).left(100,-32).right(100).top(0).bottom(0,32); this.proxyHostErrorMarker.setVisible(false); this.txtProxyHost.addFocusListener(new FocusAdapter() { @@ -307,7 +307,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { compProxyPortContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); this.txtProxyPort = new Text(compProxyPortContainer, SWT.BORDER); - SWTUtils.anchor(txtProxyPort).top(0,0).left(0,5).right(100,-42).set(); + SWTUtils.anchor(txtProxyPort).top(0,0).left(0,5).right(100,-42); SWTUtils.setFontHeight(txtProxyPort, Constants.TEXT_SIZE_NORMAL); this.txtProxyPort.addTraverseListener(e -> { @@ -317,7 +317,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { }); this.txtProxyPortErrorMarker = new ErrorMarker(compProxyPortContainer, SWT.NONE, ""); - SWTUtils.anchor(txtProxyPortErrorMarker).left(100,-32).right(100).top(0).bottom(0,32).set(); + SWTUtils.anchor(txtProxyPortErrorMarker).left(100,-32).right(100).top(0).bottom(0,32); this.txtProxyPortErrorMarker.setVisible(false); this.txtProxyPort.addFocusListener(new FocusAdapter() { 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 e8e4470b..19eba137 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 @@ -112,11 +112,11 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { layout.marginWidth = 5; this.grpKeystore.setLayout(layout); - SWTUtils.anchor(grpKeystore).top(0,5).left(0,5).right(100,-5).set(); + SWTUtils.anchor(grpKeystore).top(0,5).left(0,5).right(100,-5); SWTUtils.setFontHeight(this.grpKeystore, Constants.TEXT_SIZE_NORMAL); this.lblKeystoreFile = new Label(this.grpKeystore, SWT.NONE); - SWTUtils.anchor(lblKeystoreFile).top(0).left(0,5).set(); + SWTUtils.anchor(lblKeystoreFile).top(0).left(0,5); FormData fd_lblKeystoreFile = new FormData(); fd_lblKeystoreFile.top = new FormAttachment(0); fd_lblKeystoreFile.left = new FormAttachment(0, 5); @@ -127,54 +127,54 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { this.btnBrowse = new Button(grpKeystore, SWT.NONE); SWTUtils.setFontHeight(txtKeystoreFile, Constants.TEXT_SIZE_NORMAL); SWTUtils.setFontHeight(btnBrowse, Constants.TEXT_SIZE_BUTTON); - SWTUtils.anchor(txtKeystoreFile).top(lblKeystoreFile, 5).left(0,15).right(btnBrowse,-5).set(); - SWTUtils.anchor(btnBrowse).top(lblKeystoreFile, 5).right(100,-5).set(); + SWTUtils.anchor(txtKeystoreFile).top(lblKeystoreFile, 5).left(0,15).right(btnBrowse,-5); + SWTUtils.anchor(btnBrowse).top(lblKeystoreFile, 5).right(100,-5); this.lblKeystoreType = new Label(grpKeystore, SWT.NONE); - SWTUtils.anchor(lblKeystoreType).top(txtKeystoreFile, 5).left(0,5).set(); + SWTUtils.anchor(lblKeystoreType).top(txtKeystoreFile, 5).left(0,5); SWTUtils.setFontHeight(lblKeystoreType, Constants.TEXT_SIZE_NORMAL); this.btnLoad = new Button(this.grpKeystore, SWT.NONE); - SWTUtils.anchor(btnLoad).top(lblKeystoreType, 5).right(100,-5).set(); + SWTUtils.anchor(btnLoad).top(lblKeystoreType, 5).right(100,-5); SWTUtils.setFontHeight(btnLoad, Constants.TEXT_SIZE_BUTTON); this.cmbKeystoreType = new Combo(grpKeystore, SWT.READ_ONLY); - SWTUtils.anchor(cmbKeystoreType).top(lblKeystoreType, 5).left(0,15).right(btnLoad, -5).set(); + SWTUtils.anchor(cmbKeystoreType).top(lblKeystoreType, 5).left(0,15).right(btnLoad, -5); SWTUtils.setFontHeight(cmbKeystoreType, Constants.TEXT_SIZE_NORMAL); SWTUtils.disableEventDefault(cmbKeystoreType, SWT.MouseVerticalWheel); this.lblKeystoreAlias = new Label(grpKeystore, SWT.NONE); - SWTUtils.anchor(lblKeystoreAlias).top(cmbKeystoreType, 5).left(0, 5).set(); + SWTUtils.anchor(lblKeystoreAlias).top(cmbKeystoreType, 5).left(0, 5); SWTUtils.setFontHeight(lblKeystoreAlias, Constants.TEXT_SIZE_NORMAL); this.cmbKeystoreAlias = new Combo(grpKeystore, SWT.NONE); - SWTUtils.anchor(cmbKeystoreAlias).top(lblKeystoreAlias, 5).left(0,15).right(100,-5).set(); + SWTUtils.anchor(cmbKeystoreAlias).top(lblKeystoreAlias, 5).left(0,15).right(100,-5); SWTUtils.setFontHeight(cmbKeystoreAlias, Constants.TEXT_SIZE_NORMAL); SWTUtils.disableEventDefault(cmbKeystoreAlias, SWT.MouseVerticalWheel); this.lblKeystorePassStoreType = new Label(this.grpKeystore, SWT.NONE); - SWTUtils.anchor(lblKeystorePassStoreType).top(cmbKeystoreAlias, 5).left(0,5).set(); + SWTUtils.anchor(lblKeystorePassStoreType).top(cmbKeystoreAlias, 5).left(0,5); SWTUtils.setFontHeight(lblKeystorePassStoreType, Constants.TEXT_SIZE_NORMAL); this.cmbKeystorePassStoreType = new Combo(grpKeystore, SWT.READ_ONLY); - SWTUtils.anchor(cmbKeystorePassStoreType).top(lblKeystorePassStoreType, 5).left(0,15).right(100,-5).set(); + SWTUtils.anchor(cmbKeystorePassStoreType).top(lblKeystorePassStoreType, 5).left(0,15).right(100,-5); SWTUtils.setFontHeight(cmbKeystorePassStoreType, Constants.TEXT_SIZE_NORMAL); SWTUtils.disableEventDefault(cmbKeystorePassStoreType, SWT.MouseVerticalWheel); this.lblKeystoreStorePass = new Label(grpKeystore, SWT.NONE); - SWTUtils.anchor(lblKeystoreStorePass).top(cmbKeystorePassStoreType, 5).left(0,5).set(); + SWTUtils.anchor(lblKeystoreStorePass).top(cmbKeystorePassStoreType, 5).left(0,5); SWTUtils.setFontHeight(lblKeystoreStorePass, Constants.TEXT_SIZE_NORMAL); this.txtKeystoreStorePass = new Text(grpKeystore, SWT.BORDER | SWT.PASSWORD); - SWTUtils.anchor(txtKeystoreStorePass).right(100, -5).top(lblKeystoreStorePass, 5).left(0,15).set(); + SWTUtils.anchor(txtKeystoreStorePass).right(100, -5).top(lblKeystoreStorePass, 5).left(0,15); SWTUtils.setFontHeight(txtKeystoreStorePass, Constants.TEXT_SIZE_NORMAL); this.lblKeystoreKeyPass = new Label(grpKeystore, SWT.NONE); - SWTUtils.anchor(lblKeystoreKeyPass).top(txtKeystoreStorePass, 5).left(0,5).set(); + SWTUtils.anchor(lblKeystoreKeyPass).top(txtKeystoreStorePass, 5).left(0,5); SWTUtils.setFontHeight(lblKeystoreKeyPass, Constants.TEXT_SIZE_NORMAL); this.txtKeystoreKeyPass = new Text(grpKeystore, SWT.BORDER | SWT.PASSWORD); - SWTUtils.anchor(txtKeystoreKeyPass).top(lblKeystoreKeyPass, 5).left(0,15).right(100,-5).set(); + SWTUtils.anchor(txtKeystoreKeyPass).top(lblKeystoreKeyPass, 5).left(0,15).right(100,-5); SWTUtils.setFontHeight(txtKeystoreKeyPass, Constants.TEXT_SIZE_NORMAL); this.txtKeystoreFile.addFocusListener(new FocusAdapter() { 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 64657eb6..01a63fbf 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 @@ -124,7 +124,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { setLayout(new FormLayout()); this.grpHandySignatur = new Group(this, SWT.NONE | SWT.RESIZE); - SWTUtils.anchor(grpHandySignatur).right(100,-5).left(0,5).top(0,5).set(); + SWTUtils.anchor(grpHandySignatur).right(100,-5).left(0,5).top(0,5); grpHandySignatur.setLayout(new GridLayout(2, false)); SWTUtils.setFontHeight(grpHandySignatur, Constants.TEXT_SIZE_NORMAL); @@ -137,12 +137,12 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { compMobileNumerContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); this.txtMobileNumber = new Text(compMobileNumerContainer, SWT.BORDER | SWT.RESIZE); - SWTUtils.anchor(txtMobileNumber).left(0,5).right(100,-42).top(0).set(); + SWTUtils.anchor(txtMobileNumber).left(0,5).right(100,-42).top(0); SWTUtils.setFontHeight(txtMobileNumber, Constants.TEXT_SIZE_NORMAL); this.txtMobileNumberErrorMarker = new ErrorMarker(compMobileNumerContainer, SWT.NONE, ""); this.txtMobileNumberErrorMarker.setVisible(false); - SWTUtils.anchor(txtMobileNumberErrorMarker).left(100,-32).right(100).top(0).bottom(0,32).set(); + SWTUtils.anchor(txtMobileNumberErrorMarker).left(100,-32).right(100).top(0).bottom(0,32); this.txtMobileNumber.addTraverseListener(e -> { if (e.detail == SWT.TRAVERSE_RETURN) { @@ -158,12 +158,12 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { }); this.grpSignatureProfile = new Group(this, SWT.NONE); - SWTUtils.anchor(grpSignatureProfile).right(100,-5).left(0,5).top(grpHandySignatur, 5).set(); + SWTUtils.anchor(grpSignatureProfile).right(100,-5).left(0,5).top(grpHandySignatur, 5); this.grpSignatureProfile.setLayout(new FormLayout()); SWTUtils.setFontHeight(grpSignatureProfile, Constants.TEXT_SIZE_NORMAL); this.cmbSignatureProfiles = new Combo(this.grpSignatureProfile, SWT.READ_ONLY); - SWTUtils.anchor(cmbSignatureProfiles).left(0,10).right(100,-10).top(0,10).bottom(100,-10).set(); + SWTUtils.anchor(cmbSignatureProfiles).left(0,10).right(100,-10).top(0,10).bottom(100,-10); SWTUtils.setFontHeight(cmbSignatureProfiles, Constants.TEXT_SIZE_NORMAL); SWTUtils.disableEventDefault(cmbSignatureProfiles, SWT.MouseVerticalWheel); this.cmbSignatureProfiles.addSelectionListener(new SelectionAdapter() { @@ -179,12 +179,12 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { }); this.grpSignatureLang = new Group(this, SWT.NONE); - SWTUtils.anchor(grpSignatureLang).right(100,-5).top(grpSignatureProfile, 5).left(0,5).set(); + SWTUtils.anchor(grpSignatureLang).right(100,-5).top(grpSignatureProfile, 5).left(0,5); this.grpSignatureLang.setLayout(new FormLayout()); SWTUtils.setFontHeight(grpSignatureLang, Constants.TEXT_SIZE_NORMAL); this.cmbSignatureLang = new Combo(this.grpSignatureLang, SWT.READ_ONLY); - SWTUtils.anchor(cmbSignatureLang).left(0,10).right(100,-10).top(0,10).bottom(100,-10).set(); + SWTUtils.anchor(cmbSignatureLang).left(0,10).right(100,-10).top(0,10).bottom(100,-10); SWTUtils.setFontHeight(cmbSignatureLang, Constants.TEXT_SIZE_NORMAL); SWTUtils.disableEventDefault(cmbSignatureLang, SWT.MouseVerticalWheel); this.cmbSignatureLang.setItems(Arrays.stream(Constants.SUPPORTED_LOCALES).map(l -> l.getDisplayLanguage()).toArray(String[]::new)); @@ -201,7 +201,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { }); this.grpSignatureNote = new Group(this, SWT.NONE); - SWTUtils.anchor(grpSignatureNote).right(100,-5).top(grpSignatureLang,5).left(0,5).set(); + SWTUtils.anchor(grpSignatureNote).right(100,-5).top(grpSignatureLang,5).left(0,5); this.grpSignatureNote.setLayout(new GridLayout(2, false)); SWTUtils.setFontHeight(grpSignatureNote, Constants.TEXT_SIZE_NORMAL); @@ -220,7 +220,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { compSignatureNoteContainer.setLayout(new FormLayout()); this.txtSignatureNote = new Text(compSignatureNoteContainer, SWT.BORDER); - SWTUtils.anchor(txtSignatureNote).top(0,0).left(0,5).right(100,-42).set(); + SWTUtils.anchor(txtSignatureNote).top(0,0).left(0,5).right(100,-42); SWTUtils.setFontHeight(txtSignatureNote, Constants.TEXT_SIZE_NORMAL); this.txtSignatureNote.addFocusListener(new FocusAdapter() { @@ -241,7 +241,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { compSignatureNoteButtonContainer.setLayout(new FormLayout()); this.btnSignatureNoteDefault = new Button(compSignatureNoteButtonContainer, SWT.NONE); - SWTUtils.anchor(btnSignatureNoteDefault).top(0,0).right(100,-42).set(); + SWTUtils.anchor(btnSignatureNoteDefault).top(0,0).right(100,-42); SWTUtils.setFontHeight(btnSignatureNoteDefault, Constants.TEXT_SIZE_BUTTON); this.btnSignatureNoteDefault.addSelectionListener(new SelectionAdapter() { @Override @@ -251,22 +251,22 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { }); this.grpLogoOnlyTargetSize = new Group(this, SWT.NONE); - SWTUtils.anchor(grpLogoOnlyTargetSize).left(0,5).right(100,-5).top(grpSignatureProfile,5).set(); + SWTUtils.anchor(grpLogoOnlyTargetSize).left(0,5).right(100,-5).top(grpSignatureProfile,5); this.grpLogoOnlyTargetSize.setLayout(new FormLayout()); SWTUtils.setFontHeight(grpLogoOnlyTargetSize, Constants.TEXT_SIZE_NORMAL); Label lblLOTSLeft = new Label(this.grpLogoOnlyTargetSize, SWT.HORIZONTAL); - SWTUtils.anchor(lblLOTSLeft).top(0, 5).left(0, 15).set(); + SWTUtils.anchor(lblLOTSLeft).top(0, 5).left(0, 15); lblLOTSLeft.setText("1cm"); SWTUtils.setFontHeight(lblLOTSLeft, Constants.TEXT_SIZE_NORMAL); Label lblLOTSRight = new Label(this.grpLogoOnlyTargetSize, SWT.HORIZONTAL); - SWTUtils.anchor(lblLOTSRight).top(0,5).right(100, -5).set(); + SWTUtils.anchor(lblLOTSRight).top(0,5).right(100, -5); lblLOTSRight.setText("20cm"); SWTUtils.setFontHeight(lblLOTSRight, Constants.TEXT_SIZE_NORMAL); this.sclLogoOnlyTargetSize = new Scale(this.grpLogoOnlyTargetSize, SWT.HORIZONTAL); - SWTUtils.anchor(sclLogoOnlyTargetSize).top(0,5).left(lblLOTSLeft,5).right(lblLOTSRight,-5).set(); + SWTUtils.anchor(sclLogoOnlyTargetSize).top(0,5).left(lblLOTSLeft,5).right(lblLOTSRight,-5); sclLogoOnlyTargetSize.setMinimum(10); sclLogoOnlyTargetSize.setMaximum(200); sclLogoOnlyTargetSize.setIncrement(1); @@ -279,30 +279,30 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { }); this.lblLogoOnlyTargetSizeCurrentValue = new Label(this.grpLogoOnlyTargetSize, SWT.HORIZONTAL); - SWTUtils.anchor(lblLogoOnlyTargetSizeCurrentValue).top(sclLogoOnlyTargetSize, 5).left(0,5).right(100,-5).set(); + SWTUtils.anchor(lblLogoOnlyTargetSizeCurrentValue).top(sclLogoOnlyTargetSize, 5).left(0,5).right(100,-5); lblLogoOnlyTargetSizeCurrentValue.setAlignment(SWT.CENTER); SWTUtils.setFontHeight(lblLogoOnlyTargetSizeCurrentValue, Constants.TEXT_SIZE_NORMAL); this.grpPreview = new Group(this, SWT.NONE); - SWTUtils.anchor(grpPreview).left(0,5).right(100,-5).top(grpSignatureNote, 5).height(250).set(); + SWTUtils.anchor(grpPreview).left(0,5).right(100,-5).top(grpSignatureNote, 5).height(250); this.grpPreview.setLayout(new FormLayout()); SWTUtils.setFontHeight(grpPreview, Constants.TEXT_SIZE_NORMAL); Composite containerComposite = new Composite(this.grpPreview, SWT.NONE); - SWTUtils.anchor(containerComposite).left(0).right(100).top(0).bottom(100).set(); + SWTUtils.anchor(containerComposite).left(0).right(100).top(0).bottom(100); containerComposite.setLayout(new FormLayout()); this.btnBrowseLogo = new Button(containerComposite, SWT.NONE); - SWTUtils.anchor(btnBrowseLogo).top(0,5).right(50,-5).set(); + SWTUtils.anchor(btnBrowseLogo).top(0,5).right(50,-5); SWTUtils.setFontHeight(btnBrowseLogo, Constants.TEXT_SIZE_BUTTON); this.btnClearImage = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btnClearImage).top(0,5).left(50, 5).set(); + SWTUtils.anchor(btnClearImage).top(0,5).left(50, 5); SWTUtils.setFontHeight(btnClearImage, Constants.TEXT_SIZE_BUTTON); this.btnClearImage.setEnabled(false); this.cSigPreview = new Canvas(containerComposite, SWT.RESIZE); - SWTUtils.anchor(cSigPreview).left(0, 5).right(100,-5).top(btnBrowseLogo,5).bottom(100,-5).set(); + SWTUtils.anchor(cSigPreview).left(0, 5).right(100,-5).top(btnBrowseLogo,5).bottom(100,-5); SWTUtils.setFontHeight(cSigPreview, Constants.TEXT_SIZE_NORMAL); this.cSigPreview.addPaintListener(e -> SimpleConfigurationComposite.this.paintSignaturePreview(e)); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java index a95cd7f5..980710e3 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java @@ -78,18 +78,24 @@ public final class SWTUtils { public static class AnchorSetter { private final Control c; - private final FormData fd = new FormData(); - private boolean didSet = false; - private AnchorSetter(Control c) { this.c = c; } - - @Override - protected void finalize() { - if (!didSet) - log.warn("AnchorSetter: you did not call set()!"); + private final FormData fd; + private AnchorSetter(Control c, boolean isNew) + { + this.c = c; + if (isNew) { + this.fd = new FormData(); + this.c.setLayoutData(this.fd); + } else { + Object layoutData = this.c.getLayoutData(); + try { + this.fd = (FormData)layoutData; + } catch (ClassCastException e) { + log.error("Tried to reanchor() object with layout data of type {} (not FormData)", layoutData.getClass().getSimpleName(), e); + throw new RuntimeException("Invalid reanchor() use"); + } + } } - public void set() { this.c.setLayoutData(this.fd); didSet = true; } - public AnchorSetter height(int h) { fd.height = h; return this; } public AnchorSetter width(int w) { fd.width = w; return this; } @@ -122,7 +128,8 @@ public final class SWTUtils { public AnchorSetter bottom(int num, int offset) { return bottom(new FormAttachment(num, offset)); } public AnchorSetter bottom(int num) { return bottom(new FormAttachment(num)); } } - public static AnchorSetter anchor(Control c) { return new AnchorSetter(c); } + public static AnchorSetter anchor(Control c) { return new AnchorSetter(c, true); } + public static AnchorSetter reanchor(Control c) { return new AnchorSetter(c, false); } /** * functional-interface wrapper around swtObj.addSelectionListener |