From 98a4b4acfc9c228eb64d9ad36723abf45a3deaab Mon Sep 17 00:00:00 2001 From: john Date: Wed, 15 May 2019 14:24:35 -0400 Subject: [PATCH] PB-19360. Add support for the font size --- .../esl/api/model/CeremonySettings.java | 24 +++ .../java/com/silanis/esl/api/model/Field.java | 22 ++- .../esl/sdk/DocumentPackageSettings.java | 9 + .../main/java/com/silanis/esl/sdk/Field.java | 9 + .../DocumentPackageSettingsBuilder.java | 16 ++ .../silanis/esl/sdk/builder/FieldBuilder.java | 156 ++++++++++------- .../DocumentPackageSettingsExample.java | 2 + .../sdk/examples/GenericFieldsExample.java | 162 +++++++++--------- .../DocumentPackageSettingsConverter.java | 7 +- .../internal/converter/FieldConverter.java | 3 + .../DocumentPackageSettingsConverterTest.java | 90 +++++----- .../converter/FieldConverterTest.java | 4 + .../DocumentPackageSettingsExampleTest.java | 2 + .../examples/GenericFieldsExampleTest.java | 47 ++--- 14 files changed, 324 insertions(+), 229 deletions(-) diff --git a/sdk/src/main/java/com/silanis/esl/api/model/CeremonySettings.java b/sdk/src/main/java/com/silanis/esl/api/model/CeremonySettings.java index fe8fa8359..1966da8c2 100644 --- a/sdk/src/main/java/com/silanis/esl/api/model/CeremonySettings.java +++ b/sdk/src/main/java/com/silanis/esl/api/model/CeremonySettings.java @@ -58,6 +58,8 @@ public class CeremonySettings extends ViewSettings @JsonIgnore public static final String FIELD_ADA = "ada"; @JsonIgnore + public static final String FIELD_FONT_SIZE = "fontSize"; + @JsonIgnore public static final String FIELD_STYLE = "style"; // Empty Constructor @@ -86,6 +88,7 @@ public CeremonySettings() { protected Boolean _enforceCaptureSignature = false; protected List _optOutReasons = new ArrayList(); protected Boolean _ada = false; + protected Integer _fontSize = null; // Accessors @@ -676,6 +679,27 @@ public boolean evalAda() { } + + public CeremonySettings setFontSize(Integer value) { + this._fontSize = value; + setDirty(FIELD_FONT_SIZE); + return this; + } + + // Used internally by aws. Invokes a the corresponding setter if the value is not null + @JsonIgnore + public CeremonySettings safeSetFontSize(Integer value) { + if (value != null) + this.setFontSize(value); + return this; + } + + public Integer getFontSize() { + return _fontSize; + } + + + @Override public CeremonySettings setStyle(LayoutStyle value) { super.setStyle(value); diff --git a/sdk/src/main/java/com/silanis/esl/api/model/Field.java b/sdk/src/main/java/com/silanis/esl/api/model/Field.java index be8d32074..13c3798b4 100644 --- a/sdk/src/main/java/com/silanis/esl/api/model/Field.java +++ b/sdk/src/main/java/com/silanis/esl/api/model/Field.java @@ -41,6 +41,8 @@ public class Field extends Entity public static final String FIELD_VALUE = "value"; @JsonIgnore public static final String FIELD_WIDTH = "width"; + @JsonIgnore + public static final String FIELD_FONT_SIZE = "fontSize"; // Empty Constructor public Field ( ) {} @@ -58,6 +60,7 @@ public Field ( ) {} protected FieldValidation _validation = null; protected String _value = ""; protected Double _width = 0.0; + protected Integer _fontSize = null; // Accessors @@ -340,6 +343,21 @@ public Field safeSetWidth( Double value ){ public Double getWidth(){ return _width; } - - + + + + public Field setFontSize( Integer value ){ + this._fontSize = value; + setDirty(FIELD_FONT_SIZE); + return this; + } + // Used internally by aws. Invokes a the corresponding setter if the value is not null + @JsonIgnore + public Field safeSetFontSize( Integer value ){ + if ( value != null ) { this.setFontSize( value ); } + return this; + } + public Integer getFontSize(){ + return _fontSize; + } } \ No newline at end of file diff --git a/sdk/src/main/java/com/silanis/esl/sdk/DocumentPackageSettings.java b/sdk/src/main/java/com/silanis/esl/sdk/DocumentPackageSettings.java index be2dc7ed3..73278845e 100644 --- a/sdk/src/main/java/com/silanis/esl/sdk/DocumentPackageSettings.java +++ b/sdk/src/main/java/com/silanis/esl/sdk/DocumentPackageSettings.java @@ -23,6 +23,7 @@ public class DocumentPackageSettings { private Boolean disableOptOutOther = null; private Boolean enforceCaptureSignature = null; private Boolean ada = null; + private Integer fontSize = null; private String linkText; private String linkTooltip; @@ -205,4 +206,12 @@ public Boolean getAda() { public void setAda(Boolean ada) { this.ada = ada; } + + public Integer getFontSize() { + return fontSize; + } + + public void setFontSize(Integer fontSize) { + this.fontSize = fontSize; + } } diff --git a/sdk/src/main/java/com/silanis/esl/sdk/Field.java b/sdk/src/main/java/com/silanis/esl/sdk/Field.java index d566380fd..ee748e962 100644 --- a/sdk/src/main/java/com/silanis/esl/sdk/Field.java +++ b/sdk/src/main/java/com/silanis/esl/sdk/Field.java @@ -22,6 +22,7 @@ public class Field implements Serializable { private FieldValidator fieldValidator; private FieldId id; private TextAnchor textAnchor; + private Integer fontSize; public Field() {} @@ -148,4 +149,12 @@ public TextAnchor getTextAnchor() { public void setTextAnchor( TextAnchor textAnchor ) { this.textAnchor = textAnchor; } + + public Integer getFontSize() { + return fontSize; + } + + public void setFontSize(Integer fontSize) { + this.fontSize = fontSize; + } } diff --git a/sdk/src/main/java/com/silanis/esl/sdk/builder/DocumentPackageSettingsBuilder.java b/sdk/src/main/java/com/silanis/esl/sdk/builder/DocumentPackageSettingsBuilder.java index c1a551552..fb0f1eb0b 100644 --- a/sdk/src/main/java/com/silanis/esl/sdk/builder/DocumentPackageSettingsBuilder.java +++ b/sdk/src/main/java/com/silanis/esl/sdk/builder/DocumentPackageSettingsBuilder.java @@ -31,6 +31,7 @@ public class DocumentPackageSettingsBuilder { private Boolean disableOptOutOther = null; private Boolean enforceCaptureSignature = null; private Boolean ada = null; + private Integer fontSize = null; private String linkText = null; private String linkTooltip = null; @@ -261,6 +262,7 @@ public DocumentPackageSettingsBuilder withAda() { return this; } + /** * Disables the option for a signer to sign ADA documents. *

@@ -274,6 +276,19 @@ public DocumentPackageSettingsBuilder withoutAda() { return this; } + /** + * Sets the default font size for the package.. + *

+ * DEFAULT: null + *

+ * + * @return This + */ + public DocumentPackageSettingsBuilder withFontSize(Integer fontSize) { + this.fontSize = fontSize; + return this; + } + /** * Enables adding a link on the signing ceremony page where the user will be * sent after being shown the completion dialog box. Replaces the continue @@ -383,6 +398,7 @@ public DocumentPackageSettings build() { result.setDisableOptOutOther(disableOptOutOther); result.setEnforceCaptureSignature(enforceCaptureSignature); result.setAda(ada); + result.setFontSize(fontSize); result.setCeremonyLayoutSettings(ceremonyLayoutSettings); diff --git a/sdk/src/main/java/com/silanis/esl/sdk/builder/FieldBuilder.java b/sdk/src/main/java/com/silanis/esl/sdk/builder/FieldBuilder.java index 618d5a164..5e3838add 100644 --- a/sdk/src/main/java/com/silanis/esl/sdk/builder/FieldBuilder.java +++ b/sdk/src/main/java/com/silanis/esl/sdk/builder/FieldBuilder.java @@ -1,9 +1,12 @@ package com.silanis.esl.sdk.builder; -import com.silanis.esl.sdk.*; +import com.silanis.esl.sdk.Field; +import com.silanis.esl.sdk.FieldId; +import com.silanis.esl.sdk.FieldStyle; +import com.silanis.esl.sdk.FieldValidator; +import com.silanis.esl.sdk.TextAnchor; /** - * * FieldBuilder is a convenient class used to create fields. */ public class FieldBuilder { @@ -27,10 +30,12 @@ public class FieldBuilder { private String value; private FieldId fieldId; private TextAnchor textAnchor; + private Integer fontSize; /** * Creates a field builder - * @return a field builder + * + * @return a field builder */ public static FieldBuilder newField() { return new FieldBuilder(); @@ -41,8 +46,8 @@ public static FieldBuilder newField() { * will be displayed at the location defined for the field when the signer * signs the associated signature field. * - * @see FieldStyle * @return a BOUND_DATE styled field builder + * @see FieldStyle */ public static FieldBuilder signatureDate() { return new FieldBuilder().withStyle(FieldStyle.BOUND_DATE); @@ -53,8 +58,8 @@ public static FieldBuilder signatureDate() { * will be displayed at the location defined for the field when the signer * signs the associated signature field. * - * @see FieldStyle * @return a BOUND_NAME styled field builder + * @see FieldStyle */ public static FieldBuilder signerName() { return new FieldBuilder().withStyle(FieldStyle.BOUND_NAME); @@ -65,19 +70,20 @@ public static FieldBuilder signerName() { * will be displayed at the location defined for the field when the signer * signs the associated signature field. * + * @return a BOUND_TITLE styled field builder * @see FieldStyle - * @return a BOUND_TITLE styled field builder */ public static FieldBuilder signerTitle() { return new FieldBuilder().withStyle(FieldStyle.BOUND_TITLE); } + /** * Creates a field builder having set the style to BOUND_COMPANY. The signer's company string * will be displayed at the location defined for the field when the signer * signs the associated signature field. * + * @return a BOUND_COMPANY styled field builder * @see FieldStyle - * @return a BOUND_COMPANY styled field builder */ public static FieldBuilder signerCompany() { return new FieldBuilder().withStyle(FieldStyle.BOUND_COMPANY); @@ -88,23 +94,24 @@ public static FieldBuilder signerCompany() { * defines a text field at the location defined that the signer may be * required to fill prior to signing the its associated signature. * - * @see FieldStyle * @return a UNBOUND_TEXT_FIELD styled field builder + * @see FieldStyle */ public static FieldBuilder textField() { - return new FieldBuilder().withStyle(FieldStyle.UNBOUND_TEXT_FIELD ); + return new FieldBuilder().withStyle(FieldStyle.UNBOUND_TEXT_FIELD); } /** * Creates a field builder having set the style to UNBOUND_CUSTOM_FIELD * It defines a user defined form field that may be stamped on the document. - * + *

* E.g.: user's pharmacist license number. - * @see FieldStyle + * * @return a UNBOUND_CUSTOM_FIELD styled field builder + * @see FieldStyle */ public static FieldBuilder customField(String name) { - return new FieldBuilder().withStyle(FieldStyle.UNBOUND_CUSTOM_FIELD ).withName(name); + return new FieldBuilder().withStyle(FieldStyle.UNBOUND_CUSTOM_FIELD).withName(name); } /** @@ -112,8 +119,8 @@ public static FieldBuilder customField(String name) { * defines a checkbox field at the location defined that the signer may be * required to check prior to signing the its associated signature. * + * @return a UNBOUND_CHECK_BOX styled field builder * @see FieldStyle - * @return a UNBOUND_CHECK_BOX styled field builder */ public static FieldBuilder checkBox() { return new FieldBuilder().withStyle(FieldStyle.UNBOUND_CHECK_BOX); @@ -124,9 +131,9 @@ public static FieldBuilder checkBox() { * a radio button field in a group specified by the user. Only one radio button from * a group can be selected at a time. * - * @see FieldStyle * @param group the radio button group * @return a UNBOUND_RADIO_BUTTON styled field builder + * @see FieldStyle */ public static FieldBuilder radioButton(String group) { @@ -138,7 +145,7 @@ public static FieldBuilder radioButton(String group) { return new FieldBuilder() .withStyle(FieldStyle.UNBOUND_RADIO_BUTTON) .withValidation(FieldValidatorBuilder.basic() - .withOption(group)); + .withOption(group)); } /** @@ -146,8 +153,8 @@ public static FieldBuilder radioButton(String group) { * a drop list field at the location defined that the signer may be * required to select prior to signing the its associated signature * - * @see FieldStyle * @return a DROP_LIST styled field builder + * @see FieldStyle */ public static FieldBuilder dropList() { @@ -159,8 +166,8 @@ public static FieldBuilder dropList() { * a text area field at the location defined that the signer may be * required to fill prior to signing the its associated signature * - * @see FieldStyle * @return a TEXT_AREA styled field builder + * @see FieldStyle */ public static FieldBuilder textArea() { @@ -171,8 +178,8 @@ public static FieldBuilder textArea() { * Every bound field (Date, Title, Name) is a label. * The user should not have to set a field style to label. * - * @see FieldStyle * @return a LABEL styled field builder + * @see FieldStyle */ public static FieldBuilder label() { return new FieldBuilder().withStyle(FieldStyle.LABEL); @@ -183,8 +190,8 @@ public static FieldBuilder label() { * a datepicker field at the location defined that the signer may be * required to fill prior to signing the its associated signature * - * @see FieldStyle * @return a DATEPICKER styled field builder + * @see FieldStyle */ public static FieldBuilder datepicker() { return new FieldBuilder().withStyle(FieldStyle.DATEPICKER); @@ -195,8 +202,8 @@ public static FieldBuilder datepicker() { * A QR code field will be displayed at the location defined with a * default size of width=77 and height=77. * - * @see FieldStyle * @return a BOUND_QRCODE styled field builder + * @see FieldStyle */ public static FieldBuilder qrCode() { return new FieldBuilder().withStyle(FieldStyle.BOUND_QRCODE) @@ -205,8 +212,9 @@ public static FieldBuilder qrCode() { /** * Sets the page on which the field is located. - * @param pageNumber the page number - * @return the field builder itself + * + * @param pageNumber the page number + * @return the field builder itself */ public FieldBuilder onPage(int pageNumber) { this.pageNumber = pageNumber; @@ -215,9 +223,10 @@ public FieldBuilder onPage(int pageNumber) { /** * Sets the field at the position in pixel relative to the original document, specified by x and y coordinates - * @param x the x coordinate of the top-left corner @min="0" - * @param y the y coordinate of the top-left corner @min="0" - * @return the field builder itself + * + * @param x the x coordinate of the top-left corner @min="0" + * @param y the y coordinate of the top-left corner @min="0" + * @return the field builder itself */ public FieldBuilder atPosition(double x, double y) { this.x = x; @@ -227,11 +236,12 @@ public FieldBuilder atPosition(double x, double y) { /** * Sets the size, in pixel, of the field - * @param width the width of the field @min="0" + * + * @param width the width of the field @min="0" * @param height the height of the field @min="0" - * @return the field builder itself + * @return the field builder itself */ - public FieldBuilder withSize( double width, double height ) { + public FieldBuilder withSize(double width, double height) { this.width = width; this.height = height; return this; @@ -239,11 +249,12 @@ public FieldBuilder withSize( double width, double height ) { /** * Sets the style of the field + * + * @param style the style of the field + * @return the field builder itself * @see FieldStyle - * @param style the style of the field - * @return the field builder itself */ - public FieldBuilder withStyle( FieldStyle style ) { + public FieldBuilder withStyle(FieldStyle style) { this.style = style; return this; } @@ -256,7 +267,7 @@ public FieldBuilder withStyle( FieldStyle style ) { * @param name the name of the field @size(max="64") * @return the field builder itself */ - public FieldBuilder withName( String name ) { + public FieldBuilder withName(String name) { this.name = name; return this; } @@ -282,11 +293,12 @@ public FieldBuilder withPositionExtracted() { *

* When using {@link #withPositionAnchor(TextAnchorBuilder)} you must not use * {@link #withSize(double, double)}. + * * @param builder * @return the field builder itself */ public FieldBuilder withPositionAnchor(TextAnchorBuilder builder) { - return withPositionAnchor( builder.build() ); + return withPositionAnchor(builder.build()); } /** @@ -296,9 +308,9 @@ public FieldBuilder withPositionAnchor(TextAnchorBuilder builder) { * When using {@link #withPositionAnchor(TextAnchorBuilder)} you must not use * {@link #withSize(double, double)}. * - * @see #withPositionAnchor(TextAnchorBuilder) * @param textAnchor * @return the field builder itself + * @see #withPositionAnchor(TextAnchorBuilder) */ public FieldBuilder withPositionAnchor(TextAnchor textAnchor) { this.textAnchor = textAnchor; @@ -311,34 +323,35 @@ public FieldBuilder withPositionAnchor(TextAnchor textAnchor) { * It is up to the user to decide which validators they want to set to put constrains on the field. * Leave blank otherwise. * - * @param fieldValidator the field validator - * @return the field builder itself + * @param fieldValidator the field validator + * @return the field builder itself */ - public FieldBuilder withValidation( FieldValidator fieldValidator ) { + public FieldBuilder withValidation(FieldValidator fieldValidator) { mergeValidation(fieldValidator); return this; } /** * Sets a validator on the field that could be easily customized by the field validator builder provided as parameter. - * @param builder the field validator builder - * @return the field builder itself + * + * @param builder the field validator builder + * @return the field builder itself */ - public FieldBuilder withValidation( FieldValidatorBuilder builder ) { - return withValidation( builder.build() ); + public FieldBuilder withValidation(FieldValidatorBuilder builder) { + return withValidation(builder.build()); } private void mergeValidation(FieldValidator fieldValidator) { if (null != this.fieldValidator) { - if(null != fieldValidator.getErrorMessage()) + if (null != fieldValidator.getErrorMessage()) this.fieldValidator.setErrorMessage(fieldValidator.getErrorMessage()); - if(null != fieldValidator.getMaxLength()) + if (null != fieldValidator.getMaxLength()) this.fieldValidator.setMaxLength(fieldValidator.getMaxLength()); - if(null != fieldValidator.getMinLength()) + if (null != fieldValidator.getMinLength()) this.fieldValidator.setMinLength(fieldValidator.getMinLength()); - if(null != fieldValidator.getRegex()) + if (null != fieldValidator.getRegex()) this.fieldValidator.setRegex(fieldValidator.getRegex()); - if(null != fieldValidator.getOptions() && fieldValidator.getOptions().size() > 0) + if (null != fieldValidator.getOptions() && fieldValidator.getOptions().size() > 0) this.fieldValidator.setOptions(fieldValidator.getOptions()); this.fieldValidator.setRequired(fieldValidator.isRequired()); @@ -349,18 +362,20 @@ private void mergeValidation(FieldValidator fieldValidator) { /** * Set a field's value for a radio button or a checkbox + * * @param value true for checked and false for unchecked * @return the field builder itself */ public FieldBuilder withValue(boolean value) { - if ( style == FieldStyle.UNBOUND_CHECK_BOX || style == FieldStyle.UNBOUND_RADIO_BUTTON) { - this.value = value?SELECTED_VALUE:""; + if (style == FieldStyle.UNBOUND_CHECK_BOX || style == FieldStyle.UNBOUND_RADIO_BUTTON) { + this.value = value ? SELECTED_VALUE : ""; } return this; } /** * Set a field's value. + * * @param value String value of the field @size(max="255") * @return the field builder itself */ @@ -370,6 +385,18 @@ public FieldBuilder withValue(String value) { return this; } + /** + * Set a field's fontSize. + * + * @param fontSize Integer fontSize of the field) + * @return the field builder itself + */ + + public FieldBuilder withFontSize(Integer fontSize) { + this.fontSize = fontSize; + return this; + } + /** * Set a field's unique ID. This id allows the field value to be retrieved * when querying a package for information. @@ -377,7 +404,7 @@ public FieldBuilder withValue(String value) { * @param fieldId * @return the field builder itself */ - public FieldBuilder withId( FieldId fieldId ) { + public FieldBuilder withId(FieldId fieldId) { this.fieldId = fieldId; return this; } @@ -385,25 +412,26 @@ public FieldBuilder withId( FieldId fieldId ) { /** * Builds the actual Field with the values specified. * - * @return the built Field + * @return the built Field */ public Field build() { Field field = new Field(); - field.setPage( pageNumber ); - field.setX( x ); - field.setY( y ); - field.setStyle( style ); - field.setWidth( width ); - field.setHeight( height ); - field.setName( name ); - field.setExtraction( extract ); - field.setFieldValidator( fieldValidator ); - field.setValue( value ); - if ( fieldId != null ) { - field.setId( fieldId ); + field.setPage(pageNumber); + field.setX(x); + field.setY(y); + field.setStyle(style); + field.setWidth(width); + field.setHeight(height); + field.setName(name); + field.setExtraction(extract); + field.setFieldValidator(fieldValidator); + field.setValue(value); + field.setFontSize(fontSize); + if (fieldId != null) { + field.setId(fieldId); } - if ( textAnchor != null ) { - field.setTextAnchor( textAnchor ); + if (textAnchor != null) { + field.setTextAnchor(textAnchor); } return field; diff --git a/sdk/src/main/java/com/silanis/esl/sdk/examples/DocumentPackageSettingsExample.java b/sdk/src/main/java/com/silanis/esl/sdk/examples/DocumentPackageSettingsExample.java index 8449d5ca7..cf73fd1bb 100644 --- a/sdk/src/main/java/com/silanis/esl/sdk/examples/DocumentPackageSettingsExample.java +++ b/sdk/src/main/java/com/silanis/esl/sdk/examples/DocumentPackageSettingsExample.java @@ -21,6 +21,7 @@ public class DocumentPackageSettingsExample extends SDKSample { public static final String HAND_OVER_LINK_HREF = "http://www.google.ca"; public static final String HAND_OVER_LINK_TEXT = "click here"; public static final String HAND_OVER_LINK_TOOLTIP = "link tooltip"; + public static final Integer FONT_SIZE = 28; public static void main(String... args) { new DocumentPackageSettingsExample().run(); @@ -50,6 +51,7 @@ public void execute() { .withHandOverLinkHref(HAND_OVER_LINK_HREF) .withHandOverLinkText(HAND_OVER_LINK_TEXT) .withHandOverLinkTooltip(HAND_OVER_LINK_TOOLTIP) + .withFontSize(FONT_SIZE) .withDialogOnComplete() .withoutDeclineOther() .withoutOptOutOther() diff --git a/sdk/src/main/java/com/silanis/esl/sdk/examples/GenericFieldsExample.java b/sdk/src/main/java/com/silanis/esl/sdk/examples/GenericFieldsExample.java index f67870c89..7cdaca59e 100644 --- a/sdk/src/main/java/com/silanis/esl/sdk/examples/GenericFieldsExample.java +++ b/sdk/src/main/java/com/silanis/esl/sdk/examples/GenericFieldsExample.java @@ -7,13 +7,7 @@ import com.silanis.esl.sdk.builder.FieldValidatorBuilder; import static com.silanis.esl.sdk.builder.DocumentBuilder.newDocumentWithName; -import static com.silanis.esl.sdk.builder.FieldBuilder.checkBox; -import static com.silanis.esl.sdk.builder.FieldBuilder.datepicker; -import static com.silanis.esl.sdk.builder.FieldBuilder.dropList; -import static com.silanis.esl.sdk.builder.FieldBuilder.label; -import static com.silanis.esl.sdk.builder.FieldBuilder.radioButton; -import static com.silanis.esl.sdk.builder.FieldBuilder.textArea; -import static com.silanis.esl.sdk.builder.FieldBuilder.textField; +import static com.silanis.esl.sdk.builder.FieldBuilder.*; import static com.silanis.esl.sdk.builder.PackageBuilder.newPackageNamed; import static com.silanis.esl.sdk.builder.SignatureBuilder.signatureFor; import static com.silanis.esl.sdk.builder.SignerBuilder.newSignerWithEmail; @@ -26,6 +20,7 @@ public class GenericFieldsExample extends SDKSample { public static final String DOCUMENT_NAME = "First Document"; public static final String TEXTFIELD_ID = "textFieldId"; public static final int TEXTFIELD_PAGE = 0; + public static final Integer TEXTFIELD_FONT_SIZE = 0; public static final String CHECKBOX_1_ID = "checkbox1Id"; public static final int CHECKBOX_1_PAGE = 0; public static final String CHECKBOX_2_ID = "checkbox2Id"; @@ -43,18 +38,22 @@ public class GenericFieldsExample extends SDKSample { public static final String DROP_LIST_OPTION1 = "one"; public static final String DROP_LIST_OPTION2 = "two"; public static final String DROP_LIST_OPTION3 = "three"; + public static final Integer DROP_LIST_FONT_SIZE = 8; public static final String TEXT_AREA_ID = "textAreaId"; public static final int TEXT_AREA_PAGE = 0; public static final String TEXT_AREA_VALUE = "textAreaValue"; + public static final Integer TEXT_AREA_FONT_SIZE = 10; public static final String LABEL_ID = "labelId"; public static final String LABEL_NAME = "labelName"; public static final int LABEL_PAGE = 0; public static final String LABEL_VALUE = "labelValue"; + public static final Integer LABEL_FIELD_FONT_SIZE = 16; public static final String DATEPICKER_ID = "datepickerId"; public static final String DATEPICKER_NAME = "datepickerName"; public static final int DATEPICKER_PAGE = 0; public static final String DATEPICKER_VALUE = "datepickerValue"; public static final String DATEPICKER_FORMAT = "MM-dd-YYYY"; + public static final Integer DATEPICKER_FIELD_FONT_SIZE = null; private int textfieldPositionX = 400; private int textfieldPositionY = 200; @@ -91,84 +90,89 @@ public class GenericFieldsExample extends SDKSample { private int datepickerFieldPositionX = 150; private int datepickerFieldPositionY = 150; - public static void main( String... args ) { + public static void main(String... args) { new GenericFieldsExample().run(); } @Override public void execute() { DocumentPackage superDuperPackage = newPackageNamed(getPackageName()) - .describedAs("This is a package created using the eSignLive SDK") - .withSettings(DocumentPackageSettingsBuilder.newDocumentPackageSettings().withInPerson()) - .withSigner(newSignerWithEmail(email1) - .withFirstName("John") - .withLastName("Smith")) - .withDocument(newDocumentWithName(DOCUMENT_NAME) - .fromStream(documentInputStream1, DocumentType.PDF) - .withSignature(signatureFor(email1) - .onPage(0) - .atPosition(400, 100) - .withField(textField() - .withId(new FieldId(TEXTFIELD_ID)) - .onPage(TEXTFIELD_PAGE) - .atPosition(textfieldPositionX, textfieldPositionY)) - .withField(checkBox() - .withId(new FieldId(CHECKBOX_1_ID)) - .onPage(CHECKBOX_1_PAGE) - .withSize(checkbox1Width, checkbox1Height) - .atPosition(checkbox1PositionX, checkbox1PositionY)) - .withField(checkBox() - .withId(new FieldId(CHECKBOX_2_ID)) - .withValue(CHECKBOX_2_VALUE) - .onPage(CHECKBOX_2_PAGE) - .withSize(checkbox2Width, checkbox2Height) - .atPosition(checkbox2PositionX, checkbox2PositionY)) - .withField(radioButton(RADIO_1_GROUP) - .withId(new FieldId(RADIO_1_ID)) - .onPage(RADIO_1_PAGE) - .withSize(radio1Width, radio1Height) - .atPosition(radio1PositionX, radio1PositionY)) - .withField(radioButton(RADIO_2_GROUP) - .withId(new FieldId(RADIO_2_ID)) - .withValue(RADIO_2_VALUE) - .onPage(RADIO_2_PAGE) - .withSize(radio2Width, radio2Height) - .atPosition(radio2PositionX, radio2PositionY)) - .withField(dropList() - .withId(new FieldId(DROP_LIST_ID)) - .withValue(DROP_LIST_OPTION2) - .withValidation(FieldValidatorBuilder.basic() - .withOption(DROP_LIST_OPTION1) - .withOption(DROP_LIST_OPTION2) - .withOption(DROP_LIST_OPTION3)) - .onPage(DROP_LIST_PAGE) - .withSize(dropListWidth, dropListHeight) - .atPosition(dropListPositionX, dropListPositionY)) - .withField(textArea() - .withId(new FieldId(TEXT_AREA_ID)) - .withValue(TEXT_AREA_VALUE) - .onPage(TEXT_AREA_PAGE) - .withSize(textAreaWidth, textAreaHeight) - .atPosition(textAreaPositionX, textAreaPositionY)) - .withField(label() - .withId(new FieldId(LABEL_ID)) - .withName(LABEL_NAME) - .withValue(LABEL_VALUE) - .onPage(LABEL_PAGE) - .withSize(labelFieldWidth, labelFieldHeight) - .atPosition(labelFieldPositionX, labelFieldPositionY)) - .withField(datepicker() - .withId(new FieldId(DATEPICKER_ID)) - .withName(DATEPICKER_NAME) - .withValue(DATEPICKER_VALUE) - .onPage(DATEPICKER_PAGE) - .withSize(datepickerFieldWidth, datepickerFieldHeight) - .atPosition(datepickerFieldPositionX, datepickerFieldPositionY) - .withValidation(FieldValidatorBuilder.datepickerFormat(DATEPICKER_FORMAT) - .required())))) - .build(); + .describedAs("This is a package created using the eSignLive SDK") + .withSettings(DocumentPackageSettingsBuilder.newDocumentPackageSettings().withInPerson()) + .withSigner(newSignerWithEmail(email1) + .withFirstName("John") + .withLastName("Smith")) + .withDocument(newDocumentWithName(DOCUMENT_NAME) + .fromStream(documentInputStream1, DocumentType.PDF) + .withSignature(signatureFor(email1) + .onPage(0) + .atPosition(400, 100) + .withField(textField() + .withId(new FieldId(TEXTFIELD_ID)) + .withFontSize(TEXTFIELD_FONT_SIZE) + .onPage(TEXTFIELD_PAGE) + .atPosition(textfieldPositionX, textfieldPositionY)) + .withField(checkBox() + .withId(new FieldId(CHECKBOX_1_ID)) + .onPage(CHECKBOX_1_PAGE) + .withSize(checkbox1Width, checkbox1Height) + .atPosition(checkbox1PositionX, checkbox1PositionY)) + .withField(checkBox() + .withId(new FieldId(CHECKBOX_2_ID)) + .withValue(CHECKBOX_2_VALUE) + .onPage(CHECKBOX_2_PAGE) + .withSize(checkbox2Width, checkbox2Height) + .atPosition(checkbox2PositionX, checkbox2PositionY)) + .withField(radioButton(RADIO_1_GROUP) + .withId(new FieldId(RADIO_1_ID)) + .onPage(RADIO_1_PAGE) + .withSize(radio1Width, radio1Height) + .atPosition(radio1PositionX, radio1PositionY)) + .withField(radioButton(RADIO_2_GROUP) + .withId(new FieldId(RADIO_2_ID)) + .withValue(RADIO_2_VALUE) + .onPage(RADIO_2_PAGE) + .withSize(radio2Width, radio2Height) + .atPosition(radio2PositionX, radio2PositionY)) + .withField(dropList() + .withId(new FieldId(DROP_LIST_ID)) + .withFontSize(DROP_LIST_FONT_SIZE) + .withValue(DROP_LIST_OPTION2) + .withValidation(FieldValidatorBuilder.basic() + .withOption(DROP_LIST_OPTION1) + .withOption(DROP_LIST_OPTION2) + .withOption(DROP_LIST_OPTION3)) + .onPage(DROP_LIST_PAGE) + .withSize(dropListWidth, dropListHeight) + .atPosition(dropListPositionX, dropListPositionY)) + .withField(textArea() + .withId(new FieldId(TEXT_AREA_ID)) + .withFontSize(TEXT_AREA_FONT_SIZE) + .withValue(TEXT_AREA_VALUE) + .onPage(TEXT_AREA_PAGE) + .withSize(textAreaWidth, textAreaHeight) + .atPosition(textAreaPositionX, textAreaPositionY)) + .withField(label() + .withId(new FieldId(LABEL_ID)) + .withFontSize(LABEL_FIELD_FONT_SIZE) + .withName(LABEL_NAME) + .withValue(LABEL_VALUE) + .onPage(LABEL_PAGE) + .withSize(labelFieldWidth, labelFieldHeight) + .atPosition(labelFieldPositionX, labelFieldPositionY)) + .withField(datepicker() + .withId(new FieldId(DATEPICKER_ID)) + .withFontSize(DATEPICKER_FIELD_FONT_SIZE) + .withName(DATEPICKER_NAME) + .withValue(DATEPICKER_VALUE) + .onPage(DATEPICKER_PAGE) + .withSize(datepickerFieldWidth, datepickerFieldHeight) + .atPosition(datepickerFieldPositionX, datepickerFieldPositionY) + .withValidation(FieldValidatorBuilder.datepickerFormat(DATEPICKER_FORMAT) + .required())))) + .build(); - packageId = eslClient.createPackage( superDuperPackage ); - eslClient.sendPackage( packageId ); + packageId = eslClient.createPackage(superDuperPackage); + eslClient.sendPackage(packageId); } } \ No newline at end of file diff --git a/sdk/src/main/java/com/silanis/esl/sdk/internal/converter/DocumentPackageSettingsConverter.java b/sdk/src/main/java/com/silanis/esl/sdk/internal/converter/DocumentPackageSettingsConverter.java index 9dad886fd..835807b2d 100644 --- a/sdk/src/main/java/com/silanis/esl/sdk/internal/converter/DocumentPackageSettingsConverter.java +++ b/sdk/src/main/java/com/silanis/esl/sdk/internal/converter/DocumentPackageSettingsConverter.java @@ -62,6 +62,7 @@ public com.silanis.esl.api.model.PackageSettings toAPIPackageSettings() { ceremonySettings.safeSetDisableOptOutOther(sdkPackageSettings.getDisableOptOutOther()); ceremonySettings.safeSetEnforceCaptureSignature(sdkPackageSettings.getEnforceCaptureSignature()); ceremonySettings.safeSetAda(sdkPackageSettings.getAda()); + ceremonySettings.safeSetFontSize(sdkPackageSettings.getFontSize()); if (sdkPackageSettings.getEnableFirstAffidavit() != null) { ceremonySettings.safeSetDisableFirstInPersonAffidavit(!sdkPackageSettings.getEnableFirstAffidavit()); @@ -178,9 +179,11 @@ public com.silanis.esl.sdk.DocumentPackageSettings toSDKPackageSettings() { result.setEnforceCaptureSignature(apiPackageSettings.getCeremony().getEnforceCaptureSignature()); } - if (apiPackageSettings.getCeremony().getAda() != null) { + if (apiPackageSettings.getCeremony().getAda() != null) result.setAda(apiPackageSettings.getCeremony().getAda()); - } + + if (apiPackageSettings.getCeremony().getFontSize() != null) + result.setFontSize(apiPackageSettings.getCeremony().getFontSize()); result.setCeremonyLayoutSettings(new CeremonyLayoutSettingsConverter(apiPackageSettings.getCeremony().getLayout()).toSDKCeremonyLayoutSettings()); diff --git a/sdk/src/main/java/com/silanis/esl/sdk/internal/converter/FieldConverter.java b/sdk/src/main/java/com/silanis/esl/sdk/internal/converter/FieldConverter.java index 8e89a70ce..56d514411 100644 --- a/sdk/src/main/java/com/silanis/esl/sdk/internal/converter/FieldConverter.java +++ b/sdk/src/main/java/com/silanis/esl/sdk/internal/converter/FieldConverter.java @@ -80,6 +80,8 @@ public com.silanis.esl.api.model.Field toAPIField() { result.setExtractAnchor( new TextAnchorConverter( sdkField.getTextAnchor() ).toAPIExtractAnchor() ); } + result.setFontSize( sdkField.getFontSize() ); + return result; } @@ -120,6 +122,7 @@ public com.silanis.esl.sdk.Field toSDKField() { result.setWidth(apiField.getWidth()); if ( apiField.getHeight() != null ) result.setHeight(apiField.getHeight()); + result.setFontSize(apiField.getFontSize()); return result; } diff --git a/sdk/src/test/java/com/silanis/esl/sdk/internal/converter/DocumentPackageSettingsConverterTest.java b/sdk/src/test/java/com/silanis/esl/sdk/internal/converter/DocumentPackageSettingsConverterTest.java index 507ccf082..70654dbd4 100644 --- a/sdk/src/test/java/com/silanis/esl/sdk/internal/converter/DocumentPackageSettingsConverterTest.java +++ b/sdk/src/test/java/com/silanis/esl/sdk/internal/converter/DocumentPackageSettingsConverterTest.java @@ -22,9 +22,8 @@ * User: jessica * Date: 27/11/13 * Time: 4:46 PM - * + *

* Test DocumentPackageSettingsConverter. - * */ public class DocumentPackageSettingsConverterTest implements ConverterTest { @@ -39,7 +38,7 @@ public class DocumentPackageSettingsConverterTest implements ConverterTest { public void convertNullSDKToAPI() { sdkPackageSettings1 = null; converter = new DocumentPackageSettingsConverter(sdkPackageSettings1); - assertThat( "Converter didn't return a null api object for a null sdk object", converter.toAPIPackageSettings(), is( nullValue() ) ); + assertThat("Converter didn't return a null api object for a null sdk object", converter.toAPIPackageSettings(), is(nullValue())); } @Override @@ -47,7 +46,7 @@ public void convertNullSDKToAPI() { public void convertNullAPIToSDK() { apiPackageSettings1 = null; converter = new DocumentPackageSettingsConverter(apiPackageSettings1); - assertThat( "Converter didn't return a null sdk object for a null api object", converter.toSDKPackageSettings(), is( nullValue() ) ); + assertThat("Converter didn't return a null sdk object for a null api object", converter.toSDKPackageSettings(), is(nullValue())); } @Override @@ -55,7 +54,7 @@ public void convertNullAPIToSDK() { public void convertNullSDKToSDK() { sdkPackageSettings1 = null; converter = new DocumentPackageSettingsConverter(sdkPackageSettings1); - assertThat( "Converter didn't return a null sdk object for a null sdk object", converter.toSDKPackageSettings(), is( nullValue() ) ); + assertThat("Converter didn't return a null sdk object for a null sdk object", converter.toSDKPackageSettings(), is(nullValue())); } @Override @@ -63,7 +62,7 @@ public void convertNullSDKToSDK() { public void convertNullAPIToAPI() { apiPackageSettings1 = null; converter = new DocumentPackageSettingsConverter(apiPackageSettings1); - assertThat( "Converter didn't return a null api object for a null api object", converter.toAPIPackageSettings(), is( nullValue() ) ); + assertThat("Converter didn't return a null api object for a null api object", converter.toAPIPackageSettings(), is(nullValue())); } @Override @@ -72,8 +71,8 @@ public void convertSDKToSDK() { sdkPackageSettings1 = createTypicalSDKPackageSettings(); sdkPackageSettings2 = new DocumentPackageSettingsConverter(sdkPackageSettings1).toSDKPackageSettings(); - assertThat( "Converter returned a null sdk object for a non null sdk object", sdkPackageSettings2, notNullValue() ); - assertThat( "Converter didn't return the same non-null sdk object it was given", sdkPackageSettings2, is( sdkPackageSettings1 ) ); + assertThat("Converter returned a null sdk object for a non null sdk object", sdkPackageSettings2, notNullValue()); + assertThat("Converter didn't return the same non-null sdk object it was given", sdkPackageSettings2, is(sdkPackageSettings1)); } @Override @@ -83,8 +82,8 @@ public void convertAPIToAPI() { apiPackageSettings1 = createTypicalAPIPackageSettings(); apiPackageSettings2 = new DocumentPackageSettingsConverter(apiPackageSettings1).toAPIPackageSettings(); - assertThat( "Converter returned a null api object for a non null api object", apiPackageSettings2, notNullValue() ); - assertThat( "Converter didn't return the same non-null api object it was given", apiPackageSettings2, is( apiPackageSettings1 ) ); + assertThat("Converter returned a null api object for a non null api object", apiPackageSettings2, notNullValue()); + assertThat("Converter didn't return the same non-null api object it was given", apiPackageSettings2, is(apiPackageSettings1)); } @Override @@ -105,18 +104,17 @@ public void convertAPIToSDK() { assertThat("Second opt out reason was not correctly set", apiPackageSettings1.getCeremony().getOptOutReasons().get(1), is(sdkPackageSettings1.getOptOutReasons().get(1))); assertThat("Third opt out reason was not correctly set", apiPackageSettings1.getCeremony().getOptOutReasons().get(2), is(sdkPackageSettings1.getOptOutReasons().get(2))); assertThat("Disable OptOutOther was not correctly set", apiPackageSettings1.getCeremony().getDisableOptOutOther(), is(sdkPackageSettings1.getDisableOptOutOther())); - assertThat("Handover link was not correctly set",apiPackageSettings1.getCeremony().getHandOver().getHref(), is(sdkPackageSettings1.getLinkHref())); - assertThat("Handover text was not correctly set",apiPackageSettings1.getCeremony().getHandOver().getText(), is(sdkPackageSettings1.getLinkText())); - assertThat("Handover title was not correctly set",apiPackageSettings1.getCeremony().getHandOver().getTitle(), is(sdkPackageSettings1.getLinkTooltip())); - assertThat("Hide capture text flag was not correctly set",apiPackageSettings1.getCeremony().getHideCaptureText(), is(sdkPackageSettings1.getHideCaptureText())); - assertThat("Hide water mark flag was not correctly set",apiPackageSettings1.getCeremony().getHideWatermark(), is(sdkPackageSettings1.getHideWatermark())); - assertThat("Max auth fails allowed was not correctly set",apiPackageSettings1.getCeremony().getMaxAuthFailsAllowed(), is(sdkPackageSettings1.getMaxAuthAttempts())); - assertThat("Enforce capture signature flag was not correctly set",apiPackageSettings1.getCeremony().getEnforceCaptureSignature(), is(sdkPackageSettings1.getEnforceCaptureSignature())); - - assertThat("Download button flag was not correctly set",apiPackageSettings1.getCeremony().getLayout().getHeader().getGlobalActions().getDownload(), is(sdkPackageSettings1.getCeremonyLayoutSettings().getShowGlobalDownloadButton())); - assertThat("Confirm button flag was not correctly set",apiPackageSettings1.getCeremony().getLayout().getHeader().getGlobalActions().getConfirm(), is(sdkPackageSettings1.getCeremonyLayoutSettings().getShowGlobalConfirmButton())); - assertThat("Save as layout button flag was not correctly set",apiPackageSettings1.getCeremony().getLayout().getHeader().getGlobalActions().getSaveAsLayout(), is(sdkPackageSettings1.getCeremonyLayoutSettings().getShowGlobalSaveAsLayoutButton())); - + assertThat("Handover link was not correctly set", apiPackageSettings1.getCeremony().getHandOver().getHref(), is(sdkPackageSettings1.getLinkHref())); + assertThat("Handover text was not correctly set", apiPackageSettings1.getCeremony().getHandOver().getText(), is(sdkPackageSettings1.getLinkText())); + assertThat("Handover title was not correctly set", apiPackageSettings1.getCeremony().getHandOver().getTitle(), is(sdkPackageSettings1.getLinkTooltip())); + assertThat("Hide capture text flag was not correctly set", apiPackageSettings1.getCeremony().getHideCaptureText(), is(sdkPackageSettings1.getHideCaptureText())); + assertThat("Hide water mark flag was not correctly set", apiPackageSettings1.getCeremony().getHideWatermark(), is(sdkPackageSettings1.getHideWatermark())); + assertThat("Max auth fails allowed was not correctly set", apiPackageSettings1.getCeremony().getMaxAuthFailsAllowed(), is(sdkPackageSettings1.getMaxAuthAttempts())); + assertThat("Enforce capture signature flag was not correctly set", apiPackageSettings1.getCeremony().getEnforceCaptureSignature(), is(sdkPackageSettings1.getEnforceCaptureSignature())); + assertThat("Font size was not correctly set", apiPackageSettings1.getCeremony().getFontSize(), is(sdkPackageSettings1.getFontSize())); + assertThat("Download button flag was not correctly set", apiPackageSettings1.getCeremony().getLayout().getHeader().getGlobalActions().getDownload(), is(sdkPackageSettings1.getCeremonyLayoutSettings().getShowGlobalDownloadButton())); + assertThat("Confirm button flag was not correctly set", apiPackageSettings1.getCeremony().getLayout().getHeader().getGlobalActions().getConfirm(), is(sdkPackageSettings1.getCeremonyLayoutSettings().getShowGlobalConfirmButton())); + assertThat("Save as layout button flag was not correctly set", apiPackageSettings1.getCeremony().getLayout().getHeader().getGlobalActions().getSaveAsLayout(), is(sdkPackageSettings1.getCeremonyLayoutSettings().getShowGlobalSaveAsLayoutButton())); assertThat("Hide Language Drop Down was not correctly set", sdkPackageSettings1.getShowLanguageDropDown(), is(!apiPackageSettings1.getCeremony().getHideLanguageDropdown())); assertThat("Hide package owner from in person drop down was not correctly set", sdkPackageSettings1.getShowPackageOwnerInPerson(), is(!apiPackageSettings1.getCeremony().getHidePackageOwnerInPerson())); assertThat("Hide first affidavit was not correctly set", sdkPackageSettings1.getEnableFirstAffidavit(), is(!apiPackageSettings1.getCeremony().getDisableFirstInPersonAffidavit())); @@ -130,9 +128,9 @@ public void convertSDKToAPI() { sdkPackageSettings1 = createTypicalSDKPackageSettings(); apiPackageSettings1 = new DocumentPackageSettingsConverter(sdkPackageSettings1).toAPIPackageSettings(); - assertThat("Converter returned a null api object for a non null sdk object", apiPackageSettings1, is( notNullValue() ) ); - assertThat("Enable in-person flag was not correctly set", apiPackageSettings1.getCeremony().getInPerson(), is(sdkPackageSettings1.getEnableInPerson()) ); - assertThat("Decline button was not correctly set", apiPackageSettings1.getCeremony().getDeclineButton(), is(sdkPackageSettings1.getEnableDecline()) ); + assertThat("Converter returned a null api object for a non null sdk object", apiPackageSettings1, is(notNullValue())); + assertThat("Enable in-person flag was not correctly set", apiPackageSettings1.getCeremony().getInPerson(), is(sdkPackageSettings1.getEnableInPerson())); + assertThat("Decline button was not correctly set", apiPackageSettings1.getCeremony().getDeclineButton(), is(sdkPackageSettings1.getEnableDecline())); assertThat("Opt out button was not correctly set", apiPackageSettings1.getCeremony().getOptOutButton(), is(sdkPackageSettings1.getEnableOptOut())); assertThat("First decline reason was not correctly set", apiPackageSettings1.getCeremony().getDeclineReasons().get(0), is(sdkPackageSettings1.getDeclineReasons().get(0))); assertThat("Second decline reason was not correctly set", apiPackageSettings1.getCeremony().getDeclineReasons().get(1), is(sdkPackageSettings1.getDeclineReasons().get(1))); @@ -142,16 +140,16 @@ public void convertSDKToAPI() { assertThat("Second opt out reason was not correctly set", apiPackageSettings1.getCeremony().getOptOutReasons().get(1), is(sdkPackageSettings1.getOptOutReasons().get(1))); assertThat("Third opt out reason was not correctly set", apiPackageSettings1.getCeremony().getOptOutReasons().get(2), is(sdkPackageSettings1.getOptOutReasons().get(2))); assertThat("Disable OptOutOther was not correctly set", apiPackageSettings1.getCeremony().getDisableOptOutOther(), is(sdkPackageSettings1.getDisableOptOutOther())); - assertThat("Handover link was not correctly set",apiPackageSettings1.getCeremony().getHandOver().getHref(), is(sdkPackageSettings1.getLinkHref())); - assertThat("Handover text was not correctly set",apiPackageSettings1.getCeremony().getHandOver().getText(), is(sdkPackageSettings1.getLinkText())); - assertThat("Handover title was not correctly set",apiPackageSettings1.getCeremony().getHandOver().getTitle(), is(sdkPackageSettings1.getLinkTooltip())); - assertThat("Hide capture text flag was not correctly set",apiPackageSettings1.getCeremony().getHideCaptureText(), is(sdkPackageSettings1.getHideCaptureText())); - assertThat("Enforce capture signature flag was not correctly set",apiPackageSettings1.getCeremony().getEnforceCaptureSignature(), is(sdkPackageSettings1.getEnforceCaptureSignature())); - assertThat("Hide water mark flag was not correctly set",apiPackageSettings1.getCeremony().getHideWatermark(), is(sdkPackageSettings1.getHideWatermark())); - assertThat("Download button flag was not correctly set",apiPackageSettings1.getCeremony().getLayout().getHeader().getGlobalActions().getDownload(), is(sdkPackageSettings1.getCeremonyLayoutSettings().getShowGlobalDownloadButton())); - assertThat("Confirm button flag was not correctly set",apiPackageSettings1.getCeremony().getLayout().getHeader().getGlobalActions().getConfirm(), is(sdkPackageSettings1.getCeremonyLayoutSettings().getShowGlobalConfirmButton())); - assertThat("Save as layout button flag was not correctly set",apiPackageSettings1.getCeremony().getLayout().getHeader().getGlobalActions().getSaveAsLayout(), is(sdkPackageSettings1.getCeremonyLayoutSettings().getShowGlobalSaveAsLayoutButton())); - + assertThat("Handover link was not correctly set", apiPackageSettings1.getCeremony().getHandOver().getHref(), is(sdkPackageSettings1.getLinkHref())); + assertThat("Handover text was not correctly set", apiPackageSettings1.getCeremony().getHandOver().getText(), is(sdkPackageSettings1.getLinkText())); + assertThat("Handover title was not correctly set", apiPackageSettings1.getCeremony().getHandOver().getTitle(), is(sdkPackageSettings1.getLinkTooltip())); + assertThat("Hide capture text flag was not correctly set", apiPackageSettings1.getCeremony().getHideCaptureText(), is(sdkPackageSettings1.getHideCaptureText())); + assertThat("Enforce capture signature flag was not correctly set", apiPackageSettings1.getCeremony().getEnforceCaptureSignature(), is(sdkPackageSettings1.getEnforceCaptureSignature())); + assertThat("Font size was not correctly set", apiPackageSettings1.getCeremony().getFontSize(), is(sdkPackageSettings1.getFontSize())); + assertThat("Hide water mark flag was not correctly set", apiPackageSettings1.getCeremony().getHideWatermark(), is(sdkPackageSettings1.getHideWatermark())); + assertThat("Download button flag was not correctly set", apiPackageSettings1.getCeremony().getLayout().getHeader().getGlobalActions().getDownload(), is(sdkPackageSettings1.getCeremonyLayoutSettings().getShowGlobalDownloadButton())); + assertThat("Confirm button flag was not correctly set", apiPackageSettings1.getCeremony().getLayout().getHeader().getGlobalActions().getConfirm(), is(sdkPackageSettings1.getCeremonyLayoutSettings().getShowGlobalConfirmButton())); + assertThat("Save as layout button flag was not correctly set", apiPackageSettings1.getCeremony().getLayout().getHeader().getGlobalActions().getSaveAsLayout(), is(sdkPackageSettings1.getCeremonyLayoutSettings().getShowGlobalSaveAsLayoutButton())); assertThat("Hide Language Drop Down was not correctly set", apiPackageSettings1.getCeremony().getHideLanguageDropdown(), is(!sdkPackageSettings1.getShowLanguageDropDown())); assertThat("Hide package owner from in person drop down was not correctly set", apiPackageSettings1.getCeremony().getHidePackageOwnerInPerson(), is(!sdkPackageSettings1.getShowPackageOwnerInPerson())); assertThat("Hide first affidavit was not correctly set", apiPackageSettings1.getCeremony().getDisableFirstInPersonAffidavit(), is(!sdkPackageSettings1.getEnableFirstAffidavit())); @@ -175,19 +173,20 @@ private com.silanis.esl.sdk.DocumentPackageSettings createTypicalSDKPackageSetti .hideOwnerInPersonDropDown() .withoutLanguageDropDown() .withDeclineReason("Decline reason One") - .withDeclineReason( "Decline reason Two" ) - .withDeclineReason( "Decline reason Three" ) + .withDeclineReason("Decline reason Two") + .withDeclineReason("Decline reason Three") .withoutDeclineOther() .withOptOutReason("Reason One") - .withOptOutReason( "Reason Two" ) - .withOptOutReason( "Reason Three" ) + .withOptOutReason("Reason Two") + .withOptOutReason("Reason Three") .withoutOptOutOther() .withHandOverLinkHref("http://www.google.ca") - .withHandOverLinkText( "click here" ) - .withHandOverLinkTooltip( "link tooltip" ) + .withHandOverLinkText("click here") + .withHandOverLinkTooltip("link tooltip") .withDialogOnComplete() .withEnforceCaptureSignature() - .withCeremonyLayoutSettings( newCeremonyLayoutSettings() + .withFontSize(20) + .withCeremonyLayoutSettings(newCeremonyLayoutSettings() .withoutGlobalDownloadButton() .withoutGlobalConfirmButton() .withoutGlobalSaveAsLayoutButton() @@ -228,11 +227,12 @@ private com.silanis.esl.api.model.PackageSettings createTypicalAPIPackageSetting apiCeremonySettings.setHideWatermark(true); apiCeremonySettings.setMaxAuthFailsAllowed(3); - apiCeremonySettings.setDisableFirstInPersonAffidavit( true); - apiCeremonySettings.setDisableSecondInPersonAffidavit( true); + apiCeremonySettings.setDisableFirstInPersonAffidavit(true); + apiCeremonySettings.setDisableSecondInPersonAffidavit(true); apiCeremonySettings.setHideLanguageDropdown(true); apiCeremonySettings.setHidePackageOwnerInPerson(true); apiCeremonySettings.setEnforceCaptureSignature(true); + apiCeremonySettings.setFontSize(10); Style style = new Style(); style.setBackgroundColor("white"); @@ -265,5 +265,5 @@ private com.silanis.esl.api.model.PackageSettings createTypicalAPIPackageSetting apiPackageSettings.setCeremony(apiCeremonySettings); return apiPackageSettings; - } + } } diff --git a/sdk/src/test/java/com/silanis/esl/sdk/internal/converter/FieldConverterTest.java b/sdk/src/test/java/com/silanis/esl/sdk/internal/converter/FieldConverterTest.java index cf3d0e077..9821c95d6 100644 --- a/sdk/src/test/java/com/silanis/esl/sdk/internal/converter/FieldConverterTest.java +++ b/sdk/src/test/java/com/silanis/esl/sdk/internal/converter/FieldConverterTest.java @@ -92,6 +92,7 @@ public void convertAPIToSDK() { assertThat("Page was not correctly set",apiField1.getPage(), is(sdkField1.getPage())); assertThat("Extract was not correctly set",apiField1.getExtract(), is(sdkField1.isExtraction())); assertThat("Value was not correctly set",apiField1.getValue(), is(sdkField1.getValue())); + assertThat("FontSize was not correctly set", apiField1.getFontSize(), is(sdkField1.getFontSize())); assertThat("ID was not correctly set", apiField1.getId(), is(sdkField1.getId().toString())); assertThat("Name was not correctly set", apiField1.getName(), is(sdkField1.getName())); } @@ -111,6 +112,7 @@ public void convertSDKToAPI() { assertThat("Page was not correctly set",apiField1.getPage(), is(sdkField1.getPage())); assertThat("Extract was not correctly set",apiField1.getExtract(), is(sdkField1.isExtraction())); assertThat("Value was not correctly set",apiField1.getValue(), is(sdkField1.getValue())); + assertThat("FontSize was not correctly set",apiField1.getFontSize(), is(sdkField1.getFontSize())); assertThat("ID was not correctly set", apiField1.getId(), is(sdkField1.getId().toString())); assertThat("Name was not correctly set", apiField1.getName(), is(sdkField1.getName())); } @@ -148,6 +150,7 @@ private com.silanis.esl.sdk.Field createTypicalSDKField() { .withErrorMessage("Error message for validation.") .build()) .withValue("value") + .withFontSize(10) .build(); return sdkField; } @@ -171,6 +174,7 @@ private com.silanis.esl.api.model.Field createTypicalAPIField() { apiField.setType("INPUT"); apiField.setValue("field value"); apiField.setWidth(102.0); + apiField.setFontSize(12); return apiField; } diff --git a/tester/src/test/java/com/silanis/esl/sdk/examples/DocumentPackageSettingsExampleTest.java b/tester/src/test/java/com/silanis/esl/sdk/examples/DocumentPackageSettingsExampleTest.java index 0f2b3abe7..bdfdeecf0 100644 --- a/tester/src/test/java/com/silanis/esl/sdk/examples/DocumentPackageSettingsExampleTest.java +++ b/tester/src/test/java/com/silanis/esl/sdk/examples/DocumentPackageSettingsExampleTest.java @@ -8,6 +8,7 @@ import static com.silanis.esl.sdk.examples.DocumentPackageSettingsExample.*; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -53,5 +54,6 @@ public void verifyResult() { assertTrue("Disable OptOutOther was not set correctly.", documentPackageSettings.getDisableOptOutOther()); assertTrue("EnforceCaptureSignature was not set correctly.", documentPackageSettings.getEnforceCaptureSignature()); assertTrue("ADA was not set correctly.", documentPackageSettings.getAda()); + assertThat("Font size was not set correctly.", documentPackageSettings.getFontSize(), is(FONT_SIZE)); } } diff --git a/tester/src/test/java/com/silanis/esl/sdk/examples/GenericFieldsExampleTest.java b/tester/src/test/java/com/silanis/esl/sdk/examples/GenericFieldsExampleTest.java index 080c27563..a2893aa01 100644 --- a/tester/src/test/java/com/silanis/esl/sdk/examples/GenericFieldsExampleTest.java +++ b/tester/src/test/java/com/silanis/esl/sdk/examples/GenericFieldsExampleTest.java @@ -5,43 +5,11 @@ import com.silanis.esl.sdk.Signature; import org.junit.Test; -import static com.silanis.esl.sdk.FieldStyle.DATEPICKER; -import static com.silanis.esl.sdk.FieldStyle.DROP_LIST; -import static com.silanis.esl.sdk.FieldStyle.LABEL; -import static com.silanis.esl.sdk.FieldStyle.TEXT_AREA; -import static com.silanis.esl.sdk.FieldStyle.UNBOUND_CHECK_BOX; -import static com.silanis.esl.sdk.FieldStyle.UNBOUND_RADIO_BUTTON; -import static com.silanis.esl.sdk.FieldStyle.UNBOUND_TEXT_FIELD; +import static com.silanis.esl.sdk.FieldStyle.*; import static com.silanis.esl.sdk.builder.FieldBuilder.CHECKBOX_CHECKED; import static com.silanis.esl.sdk.builder.FieldBuilder.RADIO_SELECTED; import static com.silanis.esl.sdk.builder.FieldValidatorBuilder.DATEPICKER_ERROR_MESSAGE; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.CHECKBOX_1_ID; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.CHECKBOX_1_PAGE; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.CHECKBOX_2_ID; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.DATEPICKER_FORMAT; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.DATEPICKER_ID; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.DATEPICKER_PAGE; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.DATEPICKER_VALUE; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.DOCUMENT_NAME; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.DROP_LIST_ID; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.DROP_LIST_OPTION1; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.DROP_LIST_OPTION2; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.DROP_LIST_OPTION3; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.DROP_LIST_PAGE; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.LABEL_ID; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.LABEL_PAGE; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.LABEL_VALUE; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.RADIO_1_GROUP; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.RADIO_1_ID; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.RADIO_1_PAGE; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.RADIO_2_GROUP; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.RADIO_2_ID; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.RADIO_2_PAGE; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.TEXTFIELD_ID; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.TEXTFIELD_PAGE; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.TEXT_AREA_ID; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.TEXT_AREA_PAGE; -import static com.silanis.esl.sdk.examples.GenericFieldsExample.TEXT_AREA_VALUE; +import static com.silanis.esl.sdk.examples.GenericFieldsExample.*; import static junit.framework.TestCase.assertTrue; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; @@ -52,8 +20,8 @@ * Date: 21/01/14 * Time: 3:26 PM *

- * - * Test + *

+ * Test */ public class GenericFieldsExampleTest { @Test @@ -65,9 +33,10 @@ public void verifyResult() { for (Signature signature : documentPackage.getDocument(DOCUMENT_NAME).getSignatures()) { for (Field field : signature.getFields()) { - if(field.getId().toString().equals(TEXTFIELD_ID)){ + if (field.getId().toString().equals(TEXTFIELD_ID)) { assertThat(field.getPage(), is(TEXTFIELD_PAGE)); assertThat(field.getStyle(), is(UNBOUND_TEXT_FIELD)); + assertThat(field.getFontSize(), is(TEXTFIELD_FONT_SIZE)); } if (field.getId().toString().equals(CHECKBOX_1_ID)) { assertThat(field.getPage(), is(CHECKBOX_1_PAGE)); @@ -98,16 +67,19 @@ public void verifyResult() { assertThat(field.getFieldValidator().getOptions().get(1), is(DROP_LIST_OPTION2)); assertThat(field.getFieldValidator().getOptions().get(2), is(DROP_LIST_OPTION3)); assertThat(field.getValue(), is(DROP_LIST_OPTION2)); + assertThat(field.getFontSize(), is(DROP_LIST_FONT_SIZE)); } if (field.getId().toString().equals(TEXT_AREA_ID)) { assertThat(field.getPage(), is(TEXT_AREA_PAGE)); assertThat(field.getStyle(), is(TEXT_AREA)); assertThat(field.getValue(), is(TEXT_AREA_VALUE)); + assertThat(field.getFontSize(), is(TEXT_AREA_FONT_SIZE)); } if (field.getId().toString().equals(LABEL_ID)) { assertThat(field.getPage(), is(LABEL_PAGE)); assertThat(field.getStyle(), is(LABEL)); assertThat(field.getValue(), is(LABEL_VALUE)); + assertThat(field.getFontSize(), is(LABEL_FIELD_FONT_SIZE)); } if (field.getId().toString().equals(DATEPICKER_ID)) { assertThat(field.getPage(), is(DATEPICKER_PAGE)); @@ -116,6 +88,7 @@ public void verifyResult() { assertTrue(field.getFieldValidator().isRequired()); assertThat(field.getFieldValidator().getRegex(), is(DATEPICKER_FORMAT)); assertThat(field.getFieldValidator().getErrorMessage(), is(DATEPICKER_ERROR_MESSAGE)); + assertThat(field.getFontSize(), is(DATEPICKER_FIELD_FONT_SIZE)); } } }