public class PasswordGroup extends java.lang.Object implements ProcessingClient
UserInputPanel
to manage communication with the validator and processor for
password fields.UserInputPanel
Modifier and Type | Field and Description |
---|---|
private java.util.Vector |
fields |
private Processor |
processor |
private Validator |
validator |
Constructor and Description |
---|
PasswordGroup(java.lang.String validator,
java.lang.String processor)
Creates a passowrd group to manage one or more password fields.
|
Modifier and Type | Method and Description |
---|---|
void |
addField(javax.swing.JPasswordField field)
Adds a
JPasswordField to the group of fields being managed by this object. |
java.lang.String |
getFieldContents(int index)
Returns the contents of the field indicated by
index . |
int |
getNumFields()
Returns the number of sub-fields.
|
java.lang.String |
getPassword()
Returns the password.
|
boolean |
validateContents()
This method validates the group content.
|
private java.util.Vector fields
private Validator validator
private Processor processor
public PasswordGroup(java.lang.String validator, java.lang.String processor)
validator
- A string that specifies a class that provides a password validation service.
The class must implement the Validator
interface. If an attempt to instantiate
this class fails, no validation will be performed.processor
- A string that specifies a class that provides a password processing service,
such as password encryption. The class must implement the Processor
interface.
If an attempt to instantiate this class fails, no processing will be performed. Insted the
contents of the first field will be returned.public int getNumFields()
getNumFields
in interface ProcessingClient
public java.lang.String getFieldContents(int index) throws java.lang.IndexOutOfBoundsException
index
.getFieldContents
in interface ProcessingClient
index
- the index of the sub-field from which the contents is requested.java.lang.IndexOutOfBoundsException
- if the index is out of bounds.public void addField(javax.swing.JPasswordField field)
JPasswordField
to the group of fields being managed by this object.field
- JPasswordField
to addpublic boolean validateContents()
true
if the validation passes or no implementation of a validation
rule exists. Otherwise false
is returned.public java.lang.String getPassword()