com.izforge.izpack.panels
Class PasswordGroup

java.lang.Object
  extended bycom.izforge.izpack.panels.PasswordGroup
All Implemented Interfaces:
ProcessingClient

public class PasswordGroup
extends java.lang.Object
implements ProcessingClient

This class can be used to manage multiple related password fields. This is used in the UserInputPanel to manage communication with the validator and processor for password fields.

Version:
0.0.1 / 2/22/03
Author:
Elmar Grom
See Also:
UserInputPanel

Field Summary
private  java.util.Vector fields
           
private  Processor processor
           
private  Validator validator
           
 
Constructor Summary
PasswordGroup(java.lang.String validator, java.lang.String processor)
          Creates a passowrd group to manage one or more password fields.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fields

private java.util.Vector fields

validator

private Validator validator

processor

private Processor processor
Constructor Detail

PasswordGroup

public PasswordGroup(java.lang.String validator,
                     java.lang.String processor)
Creates a passowrd group to manage one or more password fields.

Parameters:
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.
Method Detail

getNumFields

public int getNumFields()
Returns the number of sub-fields.

Specified by:
getNumFields in interface ProcessingClient
Returns:
the number of sub-fields

getFieldContents

public java.lang.String getFieldContents(int index)
                                  throws java.lang.IndexOutOfBoundsException
Returns the contents of the field indicated by index.

Specified by:
getFieldContents in interface ProcessingClient
Parameters:
index - the index of the sub-field from which the contents is requested.
Returns:
the contents of the indicated sub-field.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of bounds.

addField

public void addField(javax.swing.JPasswordField field)
Adds a JPasswordField to the group of fields being managed by this object.

Parameters:
field - JPasswordField to add

validateContents

public boolean validateContents()
This method validates the group content. Validating is performed through a user supplied service class that provides the validation rules.

Returns:
true if the validation passes or no implementation of a validation rule exists. Otherwise false is returned.

getPassword

public java.lang.String getPassword()
Returns the password. If a processing service class was supplied it will be used to process the password before it is returned, otherwise the content of the first field will be returned.

Returns:
the password