diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2012-10-23 17:00:12 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2012-10-23 17:00:12 +0200 |
commit | 74ff027ae135c9280912009d23cbd9945121b088 (patch) | |
tree | 4c08585da4dacb680178d9eb4307a956a0cb2b0c | |
parent | e96e9dd6bcab614a60fa491ef68017bea4862af3 (diff) | |
download | pdf-over-74ff027ae135c9280912009d23cbd9945121b088.tar.gz pdf-over-74ff027ae135c9280912009d23cbd9945121b088.tar.bz2 pdf-over-74ff027ae135c9280912009d23cbd9945121b088.zip |
+ fixed Warnings
8 files changed, 135 insertions, 130 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 a7a1b6aa..522b3bad 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 @@ -41,6 +41,9 @@ import at.asit.pdfover.signator.BKUs; */ public class BKUSelectionComposite extends StateComposite { + /** + * Margin for button + */ public static final int btnMargin = 2; /** @@ -115,12 +118,12 @@ public class BKUSelectionComposite extends StateComposite { Button btn_mobile = new Button(this, SWT.NATIVE | SWT.RESIZE); - btn_mobile.setText(Messages.getString("bku_selection.mobile")); //$NON-NLS-1$ + //btn_mobile.setText(Messages.getString("bku_selection.mobile")); //$NON-NLS-1$ //Point mobile_size = btn_mobile.computeSize(SWT.DEFAULT, SWT.DEFAULT); FormData fd_btn_mobile = new FormData(); //fd_btn_mobile.left = new FormAttachment(40, 0); fd_btn_mobile.right = new FormAttachment(50, -5); - fd_btn_mobile.top = new FormAttachment(40, 0); + fd_btn_mobile.top = new FormAttachment(40, -20); //fd_btn_mobile.bottom = new FormAttachment(55, 0); btn_mobile.setLayoutData(fd_btn_mobile); btn_mobile.addSelectionListener(new MobileSelectionListener()); @@ -134,12 +137,12 @@ public class BKUSelectionComposite extends StateComposite { btn_mobile.setFont(new Font(Display.getCurrent(), fD_btn_mobile[0])); Button btn_card = new Button(this, SWT.NATIVE | SWT.RESIZE); - btn_card.setText(Messages.getString("bku_selection.card")); //$NON-NLS-1$ + //btn_card.setText(Messages.getString("bku_selection.card")); //$NON-NLS-1$ //Point card_size = btn_card.computeSize(SWT.DEFAULT, SWT.DEFAULT); FormData fd_btn_card = new FormData(); fd_btn_card.left = new FormAttachment(50, 5); //fd_btn_card.right = new FormAttachment(60, 0); - fd_btn_card.top = new FormAttachment(40, 0); + fd_btn_card.top = new FormAttachment(40, -20); //fd_btn_card.bottom = new FormAttachment(55, 0); btn_card.setLayoutData(fd_btn_card); btn_card.addSelectionListener(new LocalSelectionListener()); @@ -152,6 +155,25 @@ public class BKUSelectionComposite extends StateComposite { btn_card.setImage(karte); + Button btnMobile = new Button(this, SWT.NONE); + FormData fd_btnMobile = new FormData(); + fd_btnMobile.top = new FormAttachment(btn_mobile, 10); + //fd_btnMobile.left = new FormAttachment(btn_mobile, 0); + fd_btnMobile.right = new FormAttachment(50, -5); + fd_btnMobile.width = btn_mobile.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; + btnMobile.setLayoutData(fd_btnMobile); + btnMobile.setText(Messages.getString("bku_selection.mobile")); //$NON-NLS-1$ + btnMobile.addSelectionListener(new MobileSelectionListener()); + + Button btnCard = new Button(this, SWT.NONE); + FormData fd_btnCard = new FormData(); + fd_btnCard.top = new FormAttachment(btn_card, 10); + //fd_btnMobile.left = new FormAttachment(btn_mobile, 0); + fd_btnCard.left = new FormAttachment(50, 5); + fd_btnCard.width = btn_card.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; + btnCard.setLayoutData(fd_btnCard); + btnCard.setText(Messages.getString("bku_selection.card")); //$NON-NLS-1$ + btnCard.addSelectionListener(new LocalSelectionListener()); //this.pack(); } @@ -167,5 +189,4 @@ public class BKUSelectionComposite extends StateComposite { public void doLayout() { this.layout(true, true); } - } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java index a158d7ca..cafcc64e 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java @@ -26,9 +26,6 @@ import at.asit.pdfover.gui.composites.DataSourceSelectComposite; import at.asit.pdfover.gui.workflow.ConfigProvider; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; -import at.asit.pdfover.signator.FileNameEmlbem; -import at.asit.pdfover.signator.SignatureException; -import at.asit.pdfover.signator.SignatureParameter; /** * Selects the data source for the signature process. diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java index 92cdb774..b4398581 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java @@ -170,7 +170,7 @@ public class PrepareConfigurationState extends State { log.error( "Failed to write PDF Over config file to config directory", e); //$NON-NLS-1$ throw new InitializationException( - "Failed to write PDF Over config file to config directory", + "Failed to write PDF Over config file to config directory", //$NON-NLS-1$ e); } finally { if (pdfOverConfig != null) { @@ -201,7 +201,7 @@ public class PrepareConfigurationState extends State { log.error( "Failed to create local configuration directory!", e); //$NON-NLS-1$ throw new InitializationException( - "Failed to create local configuration directory!", + "Failed to create local configuration directory!", //$NON-NLS-1$ e); } allOK = true; diff --git a/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties index 7f7e8590..643d3cff 100644 --- a/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties +++ b/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties @@ -1,117 +1,97 @@ +#Eclipse messages class +#Tue Oct 23 16:04:42 CEST 2012 +BKU.LOCAL=Local BKU +BKU.MOBILE=Mobile BKU +BKU.NONE=no default +BKUSelectionComposite.btnMobile.text=MOBILE TrustedSocketFactory.FailedToCreateSecureConnection=Failed to create secure network connection - -main.title=PDF-Over -main.configuration=Configuration -main.position=Positioning -main.signature=Signing -main.done=Finish - -common.browse=browse +advanced_config.AutoPosition=Automatic positioning +advanced_config.AutoPosition_Title=Positioning +advanced_config.BKUSelection_Title=BKU Selection +advanced_config.OutputFolder=Default output folder\: +advanced_config.OutputFolder.Dialog=Select a folder +advanced_config.OutputFolder.Dialog_Title=Select Output folder +advanced_config.OutputFolder_Title=Output location +argument.error.output=is not a directory +argument.help.bku=Select the BKU to use values are\: LOCAL, MOBILE (example\: -b <option> +argument.help.config=Defines which configuration file to use. Example\: -c <config file> +argument.help.emblem=Sets the emblem file to use for the signature. Example\: -e <emblem file> +argument.help.help=shows this help message +argument.help.input=Sets the document to sign. Example\: -i <input document> +argument.help.number=Sets the telephone number to use for mobile bku. Example\: -n <number> +argument.help.output=Sets the output folder to use. Example\: -o <folder> +argument.help.password=Sets the password to use for mobile bku. Example\: -p <password> +argument.help.proxyhost=Sets the proxy host to use. Example\: -proxy <hostname/IP> +argument.help.proxyport=Sets the proxy port to use. Example\: -proxyport <port> +argument.info.help=The following options are available\: +argument.invalid.bku=BKU Argument invalid\! Use\: +argument.invalid.config=Configuration File Argument invalid\! Use\: +argument.invalid.emblem=Emblem argument invalid\! Use\: +argument.invalid.input=Document to sign argument invalid\! Use\: +argument.invalid.number=Phone Number Argument invalid\! Use\: +argument.invalid.output=Output folder argument invalid\! Use\: +argument.invalid.password=Mobile BKU password invalid\! Use\: +argument.invalid.proxyhost=Proxy host argument invalid\! Use\: +argument.invalid.proxyport=Proxy port argument invalid\! Use\: +bku_selection.card=CARD +bku_selection.mobile=MOBILE +common.ALLExtension_Description=All files common.Cancel=Cancel +common.GIFExtension_Description=Gif Dateien +common.JPGExtension_Description=JPG Dateien common.Ok=OK -common.Save=Save common.PDFExtension_Description=PDF documents -common.JPGExtension_Description=JPG Dateien -common.GIFExtension_Description=Gif Dateien -common.ALLExtension_Description=All files -common.file=File: -common.file_not_exists= does not exist! +common.Save=Save +common.browse=browse +common.file=File\: +common.file_not_exists=does not exist\! common.open=Open - -config.Simple=Simple config.Advanced=Advanced - -advanced_config.AutoPosition_Title=Positioning -advanced_config.AutoPosition=Automatic positioning -advanced_config.BKUSelection_Title=BKU Selection -advanced_config.OutputFolder_Title=Output location -advanced_config.OutputFolder=Default output folder: -advanced_config.OutputFolder.Dialog_Title=Select Output folder -advanced_config.OutputFolder.Dialog=Select a folder - -simple_config.Emblem_Title=Emblem -simple_config.EmblemEmpty=No image.\nDrag and Drop an image.\nOr use the browse button to select an emblem. -simple_config.UseEmblem=Use emblem -simple_config.MobileBKU_Title=Mobile signature -simple_config.PhoneNumber=Mobile number: -simple_config.ExampleNumber=+43676123456789 -simple_config.Proxy_Title=Proxy -simple_config.ProxyHost=Host: -simple_config.ProxyHostTemplate=Hostname or IP of proxy server -simple_config.ProxyPort=Port: -simple_config.ProxyPortTemplate=port proxy server [1-65535] - -output.success_message=Signature was successful -output.link_open_message=You can open the signed file <a>here</a> -output.link_save_message=You can save the signed file - +config.Simple=Simple dataSourceSelection.DropLabel=Drag document here dataSourceSelection.DropLabel2=Or, if you prefer dataSourceSelection.browse=Select document - -bku_selection.card=CARD -bku_selection.mobile=MOBILE - -mobileBKU.number=Number: -mobileBKU.password=Password: - -tanEnter.tries= tries left!" -tanEnter.ReferenceValue=reference value -tanEnter.TAN=TAN: - -BKU.LOCAL=Local BKU -BKU.MOBILE=Mobile BKU -BKU.NONE=no default - -error.SaveOutputFolder=Failed to save signed document to configured output folder. -error.Signatur=Signature error -error.PrepareDocument=Failed to prepare document for signature. -error.Initialization=Initialization failed. Please check your configuration. -error.Unexpected=Unexpected Error -error.LocalBKU=Please check if a local BKU is running error.Details=Details -error.Retry=Retry +error.EnteredReferenceValue=You entered the reference value\! +error.FailedToGetSignedDocument=Failed to get signed document. +error.FailedToLoadEmblem=Failed to load the emblem +error.FailedToSaveSettings=Failed to save configuration file\! +error.Initialization=Initialization failed. Please check your configuration. error.InvalidBKU=Invalid BKU selection. Please check. +error.InvalidPhoneNumber=Given phone number is invalid\! Example\: +43664123456789 error.InvalidSettings=Invalid settings are still present. Please check your input. -error.FailedToSaveSettings=Failed to save configuration file! -error.InvalidPhoneNumber=Given phone number is invalid! Example: +43664123456789 -error.EnteredReferenceValue=You entered the reference value! +error.LocalBKU=Please check if a local BKU is running +error.PrepareDocument=Failed to prepare document for signature. +error.Retry=Retry +error.SaveOutputFolder=Failed to save signed document to configured output folder. +error.Signatur=Signature error error.TanTooLong=Entered TAN too long -error.FailedToGetSignedDocument=Failed to get signed document. -error.FailedToLoadEmblem=Failed to load the emblem - -exception.InvalidEmblemFile= is an invalid emblem file! -exception.InvalidPort= is invalid has to be between 1 and -exception.PasswordTooLong=Given password is too long! -exception.PasswordTooShort=Given password is too short! - -argument.help.bku=Select the BKU to use values are: LOCAL, MOBILE (example: -b <option> -argument.invalid.bku=BKU Argument invalid! Use: - -argument.help.config=Defines which configuration file to use. Example: -c <config file> -argument.invalid.config=Configuration File Argument invalid! Use: - -argument.help.emblem=Sets the emblem file to use for the signature. Example: -e <emblem file> -argument.invalid.emblem=Emblem argument invalid! Use: - -argument.help.help=shows this help message -argument.info.help=The following options are available: - -argument.help.input=Sets the document to sign. Example: -i <input document> -argument.invalid.input=Document to sign argument invalid! Use: - -argument.help.output=Sets the output folder to use. Example: -o <folder> -argument.invalid.output=Output folder argument invalid! Use: -argument.error.output= is not a directory - -argument.help.password=Sets the password to use for mobile bku. Example: -p <password> -argument.invalid.password=Mobile BKU password invalid! Use: - -argument.help.number=Sets the telephone number to use for mobile bku. Example: -n <number> -argument.invalid.number=Phone Number Argument invalid! Use: - -argument.help.proxyhost=Sets the proxy host to use. Example: -proxy <hostname/IP> -argument.invalid.proxyhost=Proxy host argument invalid! Use: - -argument.help.proxyport=Sets the proxy port to use. Example: -proxyport <port> -argument.invalid.proxyport=Proxy port argument invalid! Use:
\ No newline at end of file +error.Unexpected=Unexpected Error +exception.InvalidEmblemFile=is an invalid emblem file\! +exception.InvalidPort=is invalid has to be between 1 and +exception.PasswordTooLong=Given password is too long\! +exception.PasswordTooShort=Given password is too short\! +main.configuration=Configuration +main.done=Finish +main.position=Positioning +main.signature=Signing +main.title=PDF-Over +mobileBKU.number=Number\: +mobileBKU.password=Password\: +output.link_open_message=You can open the signed file <a>here</a> +output.link_save_message=You can save the signed file +output.success_message=Signature was successful +simple_config.EmblemEmpty=No image.\nDrag and Drop an image.\nOr use the browse button to select an emblem. +simple_config.Emblem_Title=Emblem +simple_config.ExampleNumber=+43676123456789 +simple_config.MobileBKU_Title=Mobile signature +simple_config.PhoneNumber=Mobile number\: +simple_config.ProxyHost=Host\: +simple_config.ProxyHostTemplate=Hostname or IP of proxy server +simple_config.ProxyPort=Port\: +simple_config.ProxyPortTemplate=port proxy server [1-65535] +simple_config.Proxy_Title=Proxy +simple_config.UseEmblem=Use emblem +tanEnter.ReferenceValue=reference value +tanEnter.TAN=TAN\: +tanEnter.tries=tries left\!" diff --git a/trunk/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureParameter.java b/trunk/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureParameter.java index 8cc97f7e..fc9fb346 100644 --- a/trunk/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureParameter.java +++ b/trunk/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureParameter.java @@ -126,6 +126,7 @@ public abstract class SignatureParameter { /** * Gets the Dimension to display the Placeholder * @return the placeholder dimensions + * @throws SignatureException thrown if the creation of the placeholdes fails */ public abstract Image getPlaceholder() throws SignatureException; diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASHelper.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASHelper.java index 2553eaad..d16b7532 100644 --- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASHelper.java +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASHelper.java @@ -50,6 +50,10 @@ public class PDFASHelper { return new at.gv.egiz.pdfas.impl.api.PdfAsObject(); } + /** + * Provides the working directory + * @return the working directory + */ public static String getWorkDir() { return System.getProperty("user.home")+"/.pdfover"; } diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java index 91581a17..516a54ad 100644 --- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java @@ -1,31 +1,27 @@ package at.asit.pdfover.signer.pdfas; -import java.util.Iterator; -import java.util.List; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.signator.BKUs; import at.asit.pdfover.signator.ByteArrayDocumentSource; import at.asit.pdfover.signator.SLResponse; -import at.asit.pdfover.signator.SignatureException; -import at.asit.pdfover.signator.Signer; import at.asit.pdfover.signator.SignResult; import at.asit.pdfover.signator.SignResultImpl; +import at.asit.pdfover.signator.SignatureException; import at.asit.pdfover.signator.SignatureParameter; import at.asit.pdfover.signator.SignaturePosition; +import at.asit.pdfover.signator.Signer; import at.asit.pdfover.signator.SigningState; import at.asit.pdfover.signer.pdfas.exceptions.PDFASSLRequestException; import at.gv.egiz.pdfas.api.PdfAs; -import at.gv.egiz.pdfas.api.sign.SignParameters; -import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; -import at.gv.egiz.pdfas.io.ByteArrayDataSink; import at.gv.egiz.pdfas.api.commons.Constants; import at.gv.egiz.pdfas.api.exceptions.PdfAsException; import at.gv.egiz.pdfas.api.internal.LocalBKUParams; import at.gv.egiz.pdfas.api.internal.PdfAsInternal; -import at.knowcenter.wag.egov.egiz.cfg.SettingsReader; +import at.gv.egiz.pdfas.api.sign.SignParameters; +import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; +import at.gv.egiz.pdfas.io.ByteArrayDataSink; /** * PDF AS Signer Implementation 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 eb598f07..ab44d1b4 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 @@ -20,7 +20,6 @@ import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; -import java.awt.ImageCapabilities; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; @@ -36,7 +35,6 @@ import at.asit.pdfover.signator.SignatureDimension; import at.asit.pdfover.signator.SignatureException; import at.asit.pdfover.signator.SignatureParameter; import at.asit.pdfover.signator.SignaturePosition; -import at.asit.pdfover.signer.pdfas.exceptions.PDFASSLRequestException; import at.gv.egiz.pdfas.api.io.DataSource; import at.gv.egiz.pdfas.api.sign.pos.SignaturePositioning; import at.gv.egiz.pdfas.impl.signator.binary.BinarySignator_1_1_0; @@ -174,7 +172,7 @@ public class PdfAsSignatureParameter extends SignatureParameter { } } - private Font getFont(Style style) { + private static Font getFont(Style style) { String def = "COURIER-NORMAL-8"; String fontString = style.getFont(); String[] font_arr = fontString.split(","); @@ -186,7 +184,13 @@ public class PdfAsSignatureParameter extends SignatureParameter { } - private Font getValueFont(Style style) { + /** + * extracts the value font + * @param style the table style + * @return the value font + */ + @SuppressWarnings("unused") + private static Font getValueFont(Style style) { String def = "COURIER-NORMAL-8"; String fontString = style.getValueFont(); String[] font_arr = fontString.split(","); @@ -197,6 +201,7 @@ public class PdfAsSignatureParameter extends SignatureParameter { font_arr[1])); } + @SuppressWarnings("rawtypes") private int drawTable(int xoff, int yoff, int width, int height, Table table, Style parentstyle, Graphics graphic, float[] heights) { Style style = parentstyle; @@ -207,8 +212,7 @@ public class PdfAsSignatureParameter extends SignatureParameter { log.debug(String.format("Table@ %dx%d", xoff, yoff)); Font oldFont = graphic.getFont(); - Font font = this.getFont(style); - Font valuefont = this.getValueFont(style); + Font font = PdfAsSignatureParameter.getFont(style); // draw background // graphic.setColor(style.getBgColor()); @@ -285,7 +289,7 @@ public class PdfAsSignatureParameter extends SignatureParameter { float[] cheights = this.getTableHeights( (Table) entry.getValue(), style, rsize); - int tsize = this.drawTable( + this.drawTable( (int) (xoff + offset), (int) (yoff + roffset), (int) (colWidths[j] * perUnit), @@ -308,6 +312,7 @@ public class PdfAsSignatureParameter extends SignatureParameter { private float perUnitHeight = 0; + @SuppressWarnings("rawtypes") private float[] getTableHeights(Table table, Style parentstyle, float height) { ArrayList rows = table.getRows(); float[] sizes = new float[rows.size()]; @@ -356,6 +361,7 @@ public class PdfAsSignatureParameter extends SignatureParameter { return sizes; } + @SuppressWarnings("rawtypes") private float getTableHeight(Table table, Style parentstyle) { ArrayList rows = table.getRows(); Style style = parentstyle; |