public class SignatureAppearance extends Object
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ Digitally signed by \ \ Your Name \ \ Your common name, org unit\ \ Name org name, locality \ \ state, country, email\ \ Date \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Each of these attributes can be visible or hidden. See
setVisibleName(boolean)
, setVisibleCommonName(boolean)
,
setVisibleOrgUnit(boolean)
, setVisibleOrgName(boolean)
,
setVisibleLocal(boolean)
, setVisibleState(boolean)
,
setVisibleCountry(boolean)
, setVisibleEmail(boolean)
, setVisibleDate(boolean)
. The orientation can also be reversed with setTextOrientation(int)
.
Custom text content can also be used instead of the distinguished name of the
signing certificate. See setTextLeft(java.lang.String)
, setTextRight(java.lang.String)
Additionally, an image can be used to create the signature appearance
setImage(java.awt.image.BufferedImage)
. The image can be placed in the center, left or right side
of the field with setImagePosition(int)
.
Constructor and Description |
---|
SignatureAppearance()
Default constructor
|
SignatureAppearance(String xmlString)
This constructor creates a
SignatureAppearance from a
properly formatted XML string. |
Modifier and Type | Method and Description |
---|---|
String |
getDisplayName()
This name is not used to generate the appearance stream.
|
long |
getID()
This unique identifier is not used to generate the appearance stream.
|
BufferedImage |
getImage()
Returns the buffered image to use when creating the signature appearance.
|
String |
getImageFile()
Returns the image file name.
|
float |
getImageOpacity()
Returns the image opacity value to use when drawing the image on the
SignatureField . |
int |
getImagePosition()
Returns the horizontal position of the image.
|
String |
getTextLeft()
Returns the text to display on the left side of the signature appearance.
|
int |
getTextOrientation()
Returns the orientation of the text.
|
String |
getTextRight()
Returns the text to display on the right side of the signature
appearance.
|
boolean |
isVisibleCommonName()
Returns whether or not the common name should be used when creating the
signature appearance.
|
boolean |
isVisibleCountry()
Returns whether or not the country should be used when creating the
signature appearance.
|
boolean |
isVisibleDate()
Returns whether or not the date should be used when creating the
signature appearance.
|
boolean |
isVisibleDigitallySigned()
Returns whether or not the "Digitally signed by..." label should be used
when creating the signature appearance.
|
boolean |
isVisibleEmail()
Returns whether or not the email address should be used when creating the
signature appearance.
|
boolean |
isVisibleLocal()
Returns whether or not the locality should be used when creating the
signature appearance.
|
boolean |
isVisibleName()
Returns whether or not the name should be used when creating the
signature appearance.
|
boolean |
isVisibleOrgName()
Returns whether or not the organization name should be used when creating
the signature appearance.
|
boolean |
isVisibleOrgUnit()
Returns whether or not the organizational unit should be used when
creating the signature appearance.
|
boolean |
isVisibleReason()
Returns whether or not the reason should be used when creating the signature appearance.
|
boolean |
isVisibleState()
Returns whether or not the state should be used when creating the
signature appearance.
|
void |
setDisplayName(String displayName)
This name is not used to generate the appearance stream.
|
void |
setImage(BufferedImage bufferedImage)
Sets a buffered image to use then creating the signature appearance.
|
void |
setImageFile(String fileName)
If the image file name is set, this
SignatureAppearance will attempt to load
a BufferedImage from the file. |
void |
setImageOpacity(float alpha)
Sets the image opacity value to use when drawing the image on the
SignatureField . |
void |
setImagePosition(int imagePosition)
Sets the horizontal position of the image.
|
void |
setTextLeft(String text)
Sets the left text property to use when creating the signature
appearance.
|
void |
setTextOrientation(int orientation)
Sets the orientation of the text.
|
void |
setTextRight(String text)
Sets the right text property to use when creating the signature
appearance.
|
void |
setVisibleCommonName(boolean visible)
If the distinguished name of the signing certificate contains a common
name, this sets whether or not the common name should be used when
creating the signature appearance.
|
void |
setVisibleCountry(boolean visible)
If the distinguished name of the signing certificate contains a country
code, this sets whether or not the country code should be used when
creating the signature appearance.
|
void |
setVisibleDate(boolean visible)
This sets whether or not the date should be used when creating the
signature appearance.
|
void |
setVisibleDigitallySigned(boolean visible)
Sets whether or not the "Digitally signed by..." label should be used
when creating the signature appearance.
|
void |
setVisibleEmail(boolean visible)
If the distinguished name of the signing certificate contains an email
address, this sets whether or not the email address should be used when
creating the signature appearance.
|
void |
setVisibleLocal(boolean visible)
If the distinguished name of the signing certificate contains a locality,
this sets whether or not the locality should be used when creating the
signature appearance.
|
void |
setVisibleName(boolean visible)
If the distinguished name of the signing certificate contains a common
name, this sets whether or not the name should be used when creating the
signature appearance.
|
void |
setVisibleOrgName(boolean visible)
If the distinguished name of the signing certificate contains an
organization name, this sets whether or not the organization name should
be used when creating the signature appearance.
|
void |
setVisibleOrgUnit(boolean visible)
If the distinguished name of the signing certificate contains an
organizational unit, this sets whether or not the organizational unit
should be used when creating the signature appearance.
|
void |
setVisibleReason(boolean visible)
This sets whether or not the reason should be used when creating the signature appearance.
|
void |
setVisibleState(boolean visible)
If the distinguished name of the signing certificate contains a state,
this sets whether or not the state should be used when creating the
signature appearance.
|
void |
showCertificateDN(boolean visible)
This is a convenience method set the visibility of all of the
distinguished name properties of the signing certificate.
|
String |
toString() |
String |
toXMLString()
This method creates a
String that contains an XML element of
the Tool default properties. |
public SignatureAppearance()
public SignatureAppearance(String xmlString)
SignatureAppearance
from a
properly formatted XML string.xmlString
- toXMLString()
public void showCertificateDN(boolean visible)
public boolean isVisibleName()
public void setVisibleName(boolean visible)
visible
- flag indicating if the name should be visiblepublic boolean isVisibleDigitallySigned()
public void setVisibleDigitallySigned(boolean visible)
visible
- flag indicating if the "Digitally signed by..." label should
be visiblepublic boolean isVisibleCommonName()
public void setVisibleCommonName(boolean visible)
visible
- flag indicating if the common name should be visiblepublic boolean isVisibleOrgUnit()
public void setVisibleOrgUnit(boolean visible)
visible
- flag indicating if the organizational unit should be visiblepublic boolean isVisibleOrgName()
public void setVisibleOrgName(boolean visible)
visible
- flag indicating if the organization name should be visiblepublic boolean isVisibleLocal()
public void setVisibleLocal(boolean visible)
visible
- flag indicating if the locality should be visiblepublic boolean isVisibleState()
public void setVisibleState(boolean visible)
visible
- flag indicating if the state should be visiblepublic boolean isVisibleCountry()
public void setVisibleCountry(boolean visible)
visible
- flag indicating if the country code should be visiblepublic boolean isVisibleEmail()
public void setVisibleEmail(boolean visible)
visible
- flag indicating if the email address should be visiblepublic boolean isVisibleDate()
public void setVisibleDate(boolean visible)
visible
- flag indicating if the date should be visiblepublic boolean isVisibleReason()
public void setVisibleReason(boolean visible)
visible
- flag indicating if the reason should be visiblepublic BufferedImage getImage() throws IOException
setImageFile(String)
and the
BufferedImage
is null
, this method will attempt
to read the a BufferedImage
from the image file name.IOException
public void setImage(BufferedImage bufferedImage)
bufferedImage
- the buffered image to use when creating the signature
appearancepublic float getImageOpacity()
SignatureField
. The default value is 1.public void setImageOpacity(float alpha)
SignatureField
. The value must be between 0.0 and 1.0
inclusive and the default value is 1.alpha
- The new image opacity.IllegalArgumentException
public int getImagePosition()
SwingConstants
: LEFT
,
CENTER
, RIGHT
, LEADING
or
TRAILING
.SwingConstants
public void setImagePosition(int imagePosition)
imagePosition
- One of the following constants defined in
SwingConstants
: LEFT
,
CENTER
(the default), RIGHT
,
LEADING
, or TRAILING
.public String getTextLeft()
public void setTextLeft(String text)
text
- the text on the left side of the signature fieldpublic String getTextRight()
public void setTextRight(String text)
text
- the text on the right side of the signature fieldpublic void setTextOrientation(int orientation)
orientation
- One of the following constants defined in
SwingConstants
: LEFT
,
RIGHT
, LEADING
(the default) or
TRAILING
.public int getTextOrientation()
SwingConstants
:
LEFT
, RIGHT
, LEADING
or
TRAILING
.setTextOrientation(int)
,
SwingConstants
public void setImageFile(String fileName)
SignatureAppearance
will attempt to load
a BufferedImage
from the file.fileName
- public String getImageFile()
setImageFile(String)
public long getID()
SignatureAppearance
as an XML string, or when
creating a SignatureAppearance
from an XML string.toXMLString()
,
SignatureAppearance(String)
public void setDisplayName(String displayName)
SignatureAppearance
. It is also used in
saving the SignatureAppearance
as an XML string, or when
creating a SignatureAppearance
from an XML string.displayName
- the displayName to settoXMLString()
,
SignatureAppearance(String)
public String getDisplayName()
SignatureAppearance
. It is also used in
saving the SignatureAppearance
as an XML string, or when
creating a SignatureAppearance
from an XML string.toXMLString()
,
SignatureAppearance(String)
public String toXMLString()
String
that contains an XML element of
the Tool default properties. This String
can be stored and
used to set the SignatureAppearance
.String
containing an XML element of the
SignatureAppearance
propertiesSignatureAppearance(String)