diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2012-11-14 09:56:45 +0100 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2012-11-14 10:25:19 +0100 |
commit | ec8fc4bc5fccdda812ec9fbab24b154f6e687dbf (patch) | |
tree | 9d623c61c24324461e386f50ba543ea9e76ab597 /trunk | |
parent | 47e1b81fcc7ae3d5604db7979cb1db057e75c298 (diff) | |
download | pdf-over-ec8fc4bc5fccdda812ec9fbab24b154f6e687dbf.tar.gz pdf-over-ec8fc4bc5fccdda812ec9fbab24b154f6e687dbf.tar.bz2 pdf-over-ec8fc4bc5fccdda812ec9fbab24b154f6e687dbf.zip |
+ fixed BKU Selection buttons
+ fixed pdf-as placeholder
Diffstat (limited to 'trunk')
4 files changed, 63 insertions, 5 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java index 1560ff61..c176dd54 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java @@ -182,25 +182,36 @@ public class BKUSelectionComposite extends StateComposite { fD_cc_karte[0].setHeight(Constants.TEXT_SIZE_BUTTON); cc_mobile.setFont(new Font(Display.getCurrent(), fD_cc_karte[0])); + int mobilesize = cc_mobile.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; + this.btnMobile = new Button(this, SWT.NONE); FormData fd_btnMobile = new FormData(); fd_btnMobile.top = new FormAttachment(cc_mobile, 10); //fd_btnMobile.left = new FormAttachment(btn_mobile, 0); fd_btnMobile.right = new FormAttachment(50, -5); - fd_btnMobile.width = cc_mobile.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; + //fd_btnMobile.width = cc_mobile.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; this.btnMobile.setLayoutData(fd_btnMobile); this.btnMobile.setText(Messages.getString("bku_selection.mobile")); //$NON-NLS-1$ this.btnMobile.addSelectionListener(new MobileSelectionListener()); + int btnmsize = this.btnMobile.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; + + fd_btnMobile.width = (btnmsize > mobilesize) ? btnmsize : mobilesize; + this.btnCard = new Button(this, SWT.NONE); FormData fd_btnCard = new FormData(); fd_btnCard.top = new FormAttachment(cc_karte, 10); //fd_btnMobile.left = new FormAttachment(btn_mobile, 0); fd_btnCard.left = new FormAttachment(50, 5); - fd_btnCard.width = cc_karte.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; + int cardsize = cc_karte.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; + this.btnCard.setLayoutData(fd_btnCard); this.btnCard.setText(Messages.getString("bku_selection.card")); //$NON-NLS-1$ this.btnCard.addSelectionListener(new LocalSelectionListener()); + + int btncsize = this.btnCard.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; + + fd_btnCard.width = (btncsize > cardsize) ? btncsize : cardsize; //this.pack(); } diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java index 7e1c486e..8ec31d63 100644 --- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java @@ -137,7 +137,8 @@ public class PdfAsSignatureParameter extends SignatureParameter { @Override public SignatureDimension getPlaceholderDimension() { // return new SignatureDimension(487, 206); - return new SignatureDimension(getWidth(), getHeight()); + return new SignatureDimension(276, 126); + //return new SignatureDimension(getWidth(), getHeight()); } private static int getWidth() { @@ -187,6 +188,52 @@ public class PdfAsSignatureParameter extends SignatureParameter { public Image getPlaceholder() { try { + Image logo = null; + try { + if (this.getEmblem() != null + && this.getEmblem().getFileName() != null + && new File(this.getEmblem().getFileName()) + .exists()) { + logo = ImageIO.read(new File(this.getEmblem() + .getFileName())); + + } + } + catch(Exception e) { + log.error("Failed to get emblem ...", e); + } + + Image img = null; + String lang = getSignatureLanguage(); + if (lang != null && lang.equals("en")) { + img = ImageIO.read(PdfAsSignatureParameter.class + .getResourceAsStream("/img/sign_prev_en.png")); + + if(logo != null) { + logo = logo.getScaledInstance(141, 140, + Image.SCALE_SMOOTH); + img.getGraphics().drawImage(logo, 6, 115, null); + } + + } else { + img = ImageIO.read(PdfAsSignatureParameter.class + .getResourceAsStream("/img/sign_prev_de.png")); + + if(logo != null) { + logo = logo.getScaledInstance(141, 140, + Image.SCALE_SMOOTH); + img.getGraphics().drawImage(logo, 6, 115, null); + } + } + return img; + } catch (IOException e) { + return new BufferedImage(getPlaceholderDimension().getWidth(), + getPlaceholderDimension().getHeight(), + BufferedImage.TYPE_INT_RGB); + } + + /* + try { PDFASHelper.getPdfAs(); @@ -238,7 +285,7 @@ public class PdfAsSignatureParameter extends SignatureParameter { getPlaceholderDimension().getHeight(), BufferedImage.TYPE_INT_RGB); } - } + }*/ } private Table getSignatureTable() throws SignatureException, SignatureTypesException { @@ -461,7 +508,7 @@ public class PdfAsSignatureParameter extends SignatureParameter { float[] sizes = new float[rows.size()]; Style style = parentstyle; if (table.getStyle() != null) { - style = table.getStyle(); + style = table.getStyle(); } Font font = PdfAsSignatureParameter.getFont(style); g.setFont(font); diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_de.png b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_de.png Binary files differnew file mode 100644 index 00000000..c8ca09f4 --- /dev/null +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_de.png diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_en.png b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_en.png Binary files differnew file mode 100644 index 00000000..aa450fcc --- /dev/null +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_en.png |