summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java48
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java85
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java95
3 files changed, 35 insertions, 193 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 c03306cf..4a95d791 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,15 +255,9 @@ public class MainWindow {
this.mainbar.setLayoutData(this.mainBarFormData);
this.btn_config = new MainBarRectangleButton(this.mainbar, SWT.NONE);
- FormData fd_btn_config = new FormData();
- fd_btn_config.bottom = new FormAttachment(100);
- fd_btn_config.right = new FormAttachment(0, 50);
- fd_btn_config.top = new FormAttachment(0);
- fd_btn_config.left = new FormAttachment(0);
- this.btn_config.setLayoutData(fd_btn_config);
+ SWTUtils.anchor(btn_config).bottom(100).right(0,50).top(0).left(0).set();
SWTUtils.setLocalizedText(btn_config, "main.configuration");
- this.btn_config
- .setToolTipText(Messages.getString("main.configuration"));
+ this.btn_config.setToolTipText(Messages.getString("main.configuration"));
this.btn_config.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
@@ -283,24 +277,13 @@ public class MainWindow {
Composite mainbarContainer = new Composite(this.mainbar, SWT.NONE);
mainbarContainer.setLayout(new FormLayout());
- FormData fd_mainbarContainer = new FormData();
- fd_mainbarContainer.left = new FormAttachment(this.btn_config);
- fd_mainbarContainer.right = new FormAttachment(100);
- fd_mainbarContainer.top = new FormAttachment(0);
- fd_mainbarContainer.bottom = new FormAttachment(100);
- mainbarContainer.setLayoutData(fd_mainbarContainer);
+ SWTUtils.anchor(mainbarContainer).left(btn_config).right(100).top(0).bottom(100).set();
this.btn_open = new MainBarStartButton(mainbarContainer, SWT.NONE);
- FormData fd_btn_open = new FormData();
- fd_btn_open.left = new FormAttachment(0);
- fd_btn_open.right = new FormAttachment(27, (MainBarButton.SplitFactor / 2));
- fd_btn_open.top = new FormAttachment(0);
- fd_btn_open.bottom = new FormAttachment(100);
- this.btn_open.setLayoutData(fd_btn_open);
+ SWTUtils.anchor(btn_open).left(0).right(27, (MainBarButton.SplitFactor / 2)).top(0).bottom(100).set();
SWTUtils.setLocalizedText(btn_open, "common.open");
this.btn_open.setToolTipText(Messages.getString("common.open"));
this.btn_open.addMouseListener(new MouseAdapter() {
-
@Override
public void mouseUp(MouseEvent e) {
if (MainWindow.this.stateMachine.status.getCurrentState() instanceof OpenState) {
@@ -314,16 +297,10 @@ public class MainWindow {
this.buttonMap.put(Buttons.OPEN, this.btn_open);
this.btn_position = new MainBarMiddleButton(mainbarContainer, SWT.NONE);
- FormData fd_btn_position = new FormData();
- fd_btn_position.left = new FormAttachment(27, -1 * (MainBarButton.SplitFactor / 2));
- fd_btn_position.right = new FormAttachment(54, (MainBarButton.SplitFactor / 2));
- fd_btn_position.top = new FormAttachment(0);
- fd_btn_position.bottom = new FormAttachment(100);
- this.btn_position.setLayoutData(fd_btn_position);
+ SWTUtils.anchor(btn_position).left(27, -1 * (MainBarButton.SplitFactor / 2)).right(54, (MainBarButton.SplitFactor / 2)).top(0).bottom(100).set();
SWTUtils.setLocalizedText(btn_position, "main.position");
this.btn_position.setToolTipText(Messages.getString("main.position"));
this.btn_position.addMouseListener(new MouseAdapter() {
-
@Override
public void mouseUp(MouseEvent e) {
MainWindow.this.stateMachine.jumpToState(new PositioningState(
@@ -333,16 +310,10 @@ public class MainWindow {
this.buttonMap.put(Buttons.POSITION, this.btn_position);
this.btn_sign = new MainBarMiddleButton(mainbarContainer, SWT.NONE);
- FormData fd_btn_sign = new FormData();
- fd_btn_sign.left = new FormAttachment(54, -1 * (MainBarButton.SplitFactor / 2));
- fd_btn_sign.right = new FormAttachment(81, (MainBarButton.SplitFactor / 2));
- fd_btn_sign.top = new FormAttachment(0);
- fd_btn_sign.bottom = new FormAttachment(100);
- this.btn_sign.setLayoutData(fd_btn_sign);
+ SWTUtils.anchor(btn_sign).left(54, -1 * (MainBarButton.SplitFactor / 2)).right(81, (MainBarButton.SplitFactor / 2)).top(0).bottom(100).set();
SWTUtils.setLocalizedText(btn_sign, "main.signature");
this.btn_sign.setToolTipText(Messages.getString("main.signature"));
this.btn_sign.addMouseListener(new MouseAdapter() {
-
@Override
public void mouseUp(MouseEvent e) {
MainWindow.this.stateMachine.jumpToState(new BKUSelectionState(
@@ -352,12 +323,7 @@ public class MainWindow {
this.buttonMap.put(Buttons.SIGN, this.btn_sign);
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);
- this.btn_end.setLayoutData(fd_btn_end);
+ SWTUtils.anchor(btn_end).left(81, -1 * (MainBarButton.SplitFactor / 2)).right(100).top(0).bottom(100).set();
SWTUtils.setLocalizedText(btn_end, "main.done");
this.btn_end.setToolTipText(Messages.getString("main.done"));
this.buttonMap.put(Buttons.FINAL, this.btn_end);
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 6803d742..c7f8b483 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
@@ -30,15 +30,10 @@ import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.slf4j.Logger;
@@ -168,12 +163,7 @@ public class DataSourceSelectComposite extends StateComposite {
// Color back = new Color(Display.getCurrent(), 77, 190, 250);
this.drop_area = new Composite(this, SWT.RESIZE);
- FormData fd_drop_area = new FormData();
- fd_drop_area.left = new FormAttachment(0, 30);
- fd_drop_area.right = new FormAttachment(100, -30);
- fd_drop_area.top = new FormAttachment(0, 30);
- fd_drop_area.bottom = new FormAttachment(100, -30);
- this.drop_area.setLayoutData(fd_drop_area);
+ SWTUtils.anchor(drop_area).left(0, 30).right(100, -30).top(0, 30).bottom(100, -30).set();
this.drop_area.setLayout(new FormLayout());
this.drop_area.addPaintListener(new PaintListener() {
@@ -252,71 +242,21 @@ public class DataSourceSelectComposite extends StateComposite {
}
});
- this.lbl_drag2 = new Label(this.drop_area, SWT.NONE | SWT.RESIZE );
-
this.lbl_drag = new Label(this.drop_area, SWT.NONE | SWT.RESIZE );
- this.fd_lbl_drag = new FormData();
- this.fd_lbl_drag.left = new FormAttachment(0, 10);
- this.fd_lbl_drag.right = new FormAttachment(100, -10);
- //this.fd_lbl_drag.top = new FormAttachment(40, -10);
- this.fd_lbl_drag.bottom = new FormAttachment(this.lbl_drag2, -10);
- this.lbl_drag.setLayoutData(this.fd_lbl_drag);
- FontData[] fD = this.lbl_drag.getFont().getFontData();
- fD[0].setHeight(Constants.TEXT_SIZE_BIG);
- this.lbl_drag.setFont(new Font(Display.getCurrent(), fD[0]));
- SWTUtils.setLocalizedText(lbl_drag, "dataSourceSelection.DropLabel");
+ 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.setFontHeight(lbl_drag, Constants.TEXT_SIZE_BIG);
+ SWTUtils.setFontHeight(lbl_drag2, Constants.TEXT_SIZE_NORMAL);
this.lbl_drag.setAlignment(SWT.CENTER);
-
-
- this.fd_lbl_drag2 = new FormData();
- this.fd_lbl_drag2.left = new FormAttachment(0, 10);
- this.fd_lbl_drag2.right = new FormAttachment(100, -10);
- this.fd_lbl_drag2.top = new FormAttachment(50, -10);
- // fd_lbl_drag.bottom = new FormAttachment(100, -10);
- this.lbl_drag2.setLayoutData(this.fd_lbl_drag2);
- FontData[] fD2 = this.lbl_drag2.getFont().getFontData();
- fD2[0].setHeight(Constants.TEXT_SIZE_NORMAL);
- this.lbl_drag2.setFont(new Font(Display.getCurrent(), fD2[0]));
- SWTUtils.setLocalizedText(lbl_drag2, "dataSourceSelection.DropLabel2");
this.lbl_drag2.setAlignment(SWT.CENTER);
this.btn_open = new Button(this.drop_area, SWT.NATIVE | SWT.RESIZE);
- SWTUtils.setLocalizedText(btn_open, "dataSourceSelection.browse");
-
- FontData[] fD_open = this.btn_open.getFont().getFontData();
- fD_open[0].setHeight(Constants.TEXT_SIZE_BUTTON);
- this.btn_open.setFont(new Font(Display.getCurrent(), fD_open[0]));
+ SWTUtils.anchor(btn_open).left(lbl_drag2, 0, SWT.CENTER).top(lbl_drag2, 10).set();
+ SWTUtils.setFontHeight(btn_open, Constants.TEXT_SIZE_BUTTON);
- /*
- lbl_drag.addListener(SWT.Resize, new Listener() {
+ reloadResources();
- @Override
- public void handleEvent(Event event) {
- DataSourceSelectComposite.this.fd_lbl_drag.top = new FormAttachment(
- 50, -1 * (lbl_drag.getSize().y / 2));
- DataSourceSelectComposite.this.fd_lbl_drag.left = new FormAttachment(
- 50, -1 * (lbl_drag.getSize().x / 2));
-
- Point size = btn_open.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- DataSourceSelectComposite.this.fd_btn_open.top = new FormAttachment(
- 50, (lbl_drag.getSize().y / 2) + 10);
- DataSourceSelectComposite.this.fd_btn_open.left = new FormAttachment(
- 50, -1 * (size.x / 2));
- DataSourceSelectComposite.this.fd_btn_open.right = new FormAttachment(
- 50, (size.x / 2));
- DataSourceSelectComposite.this.fd_btn_open.bottom = new FormAttachment(
- 50, (lbl_drag.getSize().y / 2) + 10 + size.y);
- }
- });
- */
- // lbl_drag.setBackground(back);
-
- this.fd_btn_open = new FormData();
- this.fd_btn_open.left = new FormAttachment(this.lbl_drag2, 0, SWT.CENTER);
- this.fd_btn_open.top = new FormAttachment(this.lbl_drag2, 10);
- this.btn_open.setLayoutData(this.fd_btn_open);
-
- // btn_open.setBackground(back);
this.btn_open.addSelectionListener(new FileBrowseDialogListener());
this.drop_area.pack();
this.redrawDrop();
@@ -324,11 +264,6 @@ public class DataSourceSelectComposite extends StateComposite {
Composite drop_area;
- FormData fd_lbl_drag;
- FormData fd_lbl_drag2;
-
- FormData fd_btn_open;
-
private Label lbl_drag2;
private Label lbl_drag;
@@ -357,7 +292,7 @@ public class DataSourceSelectComposite extends StateComposite {
@Override
public void reloadResources() {
SWTUtils.setLocalizedText(lbl_drag, "dataSourceSelection.DropLabel");
- SWTUtils.setLocalizedText(btn_open, "dataSourceSelection.browse");
SWTUtils.setLocalizedText(lbl_drag2, "dataSourceSelection.DropLabel2");
+ SWTUtils.setLocalizedText(btn_open, "dataSourceSelection.browse");
}
}
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 fd91d139..82de7a3e 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
@@ -31,8 +31,6 @@ import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Button;
@@ -325,66 +323,32 @@ public class MobileBKUEnterTANComposite extends StateComposite {
}
});
containerComposite.setLayout(new FormLayout());
- FormData fd_containerComposite = new FormData();
- fd_containerComposite.top = new FormAttachment(50, -120);
- fd_containerComposite.bottom = new FormAttachment(50, 120);
- fd_containerComposite.left = new FormAttachment(50, -200);
- fd_containerComposite.right = new FormAttachment(50, 200);
- containerComposite.setLayoutData(fd_containerComposite);
+ SWTUtils.anchor(containerComposite).top(50, -120).bottom(50, 120).left(50, -200).right(50, 200).set();
this.lblRefValLabel = new Label(containerComposite, SWT.NATIVE);
- this.lblRefValLabel.setAlignment(SWT.RIGHT);
- FormData fd_lblRefValLabel = new FormData();
- // fd_lblRefValLabel.left = new FormAttachment(0, 20);
- fd_lblRefValLabel.right = new FormAttachment(50, -10);
- // fd_lblRefValLabel.top = new FormAttachment(30, -15);
- fd_lblRefValLabel.bottom = new FormAttachment(50, -10);
- this.lblRefValLabel.setLayoutData(fd_lblRefValLabel);
+ SWTUtils.anchor(lblRefValLabel).right(50, -10).bottom(50,-10).set();
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);
-
- ImageData data = new ImageData(this.getClass().getResourceAsStream(
- Constants.RES_IMG_MOBILE));
- Image mobile = new Image(getDisplay(), data);
-
- FormData fd_lbl_image = new FormData();
- fd_lbl_image.top = new FormAttachment(50, -1 * (data.width / 2));
- fd_lbl_image.bottom = new FormAttachment(50, data.width / 2);
- fd_lbl_image.left = new FormAttachment(0, 10);
- fd_lbl_image.width = data.width;
- lbl_image.setLayoutData(fd_lbl_image);
- lbl_image.setImage(mobile);
+ SWTUtils.anchor(lbl_image).top(50, -1 * (mobileIcon.width / 2)).bottom(50, mobileIcon.width / 2).left(0, 10).width(mobileIcon.width).set();
+ lbl_image.setImage(new Image(getDisplay(), mobileIcon));
this.lblRefVal = new Label(containerComposite, SWT.NATIVE);
- FormData fd_lblRefVal = new FormData();
- fd_lblRefVal.left = new FormAttachment(50, 10);
- fd_lblRefVal.right = new FormAttachment(100, -20);
- // fd_lblRefVal.top = new FormAttachment(30, -15);
- fd_lblRefVal.bottom = new FormAttachment(50, -10);
- this.lblRefVal.setLayoutData(fd_lblRefVal);
+ SWTUtils.anchor(lblRefVal).left(50,10).right(100,-20).bottom(50,-10).set();
this.lblRefVal.setText("");
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);
- this.lblTan.setLayoutData(fd_lblTan);
+ SWTUtils.anchor(lblTan).right(50,-10).top(50,10).set();
SWTUtils.setLocalizedText(lblTan, "tanEnter.TAN");
+ this.lblTan.setAlignment(SWT.RIGHT);
this.txt_tan = new Text(containerComposite, SWT.BORDER | SWT.NATIVE);
- FormData fd_text = new FormData();
- fd_text.left = new FormAttachment(50, 10);
- fd_text.right = new FormAttachment(100, -20);
- fd_text.top = new FormAttachment(50, 10);
+ SWTUtils.anchor(txt_tan).left(50,10).right(100,-20).top(50,10).set();
this.txt_tan.setEditable(true);
- this.txt_tan.setLayoutData(fd_text);
this.txt_tan.addTraverseListener(new TraverseListener() {
-
@Override
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_RETURN) {
@@ -396,7 +360,6 @@ public class MobileBKUEnterTANComposite extends StateComposite {
});
this.txt_tan.addModifyListener(new ModifyListener() {
-
@Override
public void modifyText(ModifyEvent e) {
@@ -412,46 +375,24 @@ public class MobileBKUEnterTANComposite extends StateComposite {
});
Link lnk_sig_data = new Link(containerComposite, SWT.NATIVE | SWT.RESIZE);
-
- FormData fd_lnk_data = new FormData();
- fd_lnk_data.right = new FormAttachment(100, -20);
- fd_lnk_data.top = new FormAttachment(0, 20);
+ SWTUtils.anchor(lnk_sig_data).right(100,-20).top(0,20).set();
lnk_sig_data.setEnabled(true);
- lnk_sig_data.setLayoutData(fd_lnk_data);
lnk_sig_data.addSelectionListener(new ShowSignatureDataListener());
SWTUtils.setLocalizedText(lnk_sig_data, "mobileBKU.show");
lnk_sig_data.setToolTipText(Messages.getString("mobileBKU.show_tooltip"));
this.btn_ok = new Button(containerComposite, SWT.NATIVE);
- this.btn_cancel = new Button(containerComposite, SWT.NATIVE);
-
- this.lblTries = new Label(containerComposite, SWT.WRAP | SWT.NATIVE);
- FormData fd_lbl_tries = new FormData();
- // fd_lbl_tries.left = new FormAttachment(15, 5);
- fd_lbl_tries.right = new FormAttachment(this.btn_cancel, -10);
- // fd_lbl_tries.top = new FormAttachment(70, -15);
- fd_lbl_tries.bottom = new FormAttachment(100, -20);
- this.lblTries.setLayoutData(fd_lbl_tries);
-
- FormData fd_btn_ok = new FormData();
- // fd_btn_ok.left = new FormAttachment(95, 0);
- fd_btn_ok.right = new FormAttachment(100, -20);
- //fd_btn_ok.left = new FormAttachment(100, -70);
- fd_btn_ok.bottom = new FormAttachment(100, -20);
-
- this.btn_ok.setLayoutData(fd_btn_ok);
+ SWTUtils.anchor(btn_ok).right(100,-20).bottom(100,-20).set();
SWTUtils.setLocalizedText(btn_ok, "common.Ok");
this.btn_ok.addSelectionListener(new OkSelectionListener());
-
- FormData fd_btn_cancel = new FormData();
- // fd_btn_cancel.left = new FormAttachment(95, 0);
- fd_btn_cancel.right = new FormAttachment(this.btn_ok, -20);
- //fd_btn_cancel.left = new FormAttachment(100, -70);
- fd_btn_cancel.bottom = new FormAttachment(100, -20);
-
- this.btn_cancel.setLayoutData(fd_btn_cancel);
+
+ this.btn_cancel = new Button(containerComposite, SWT.NATIVE);
+ SWTUtils.anchor(btn_cancel).right(btn_ok, -20).bottom(100, -20).set();
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();
}
@Override