com.izforge.izpack.panels
Class PasswordGroup

java.lang.Object
  extended by com.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  int currentValidator
           
private  java.util.Vector<javax.swing.JPasswordField> fields
           
private  InstallData idata
           
private  java.lang.String modifiedPassword
           
private  Processor processor
           
private  java.util.List<ValidatorContainer> validatorContainers
           
 
Constructor Summary
PasswordGroup(InstallData idata, java.util.List<ValidatorContainer> validatorContainers, java.lang.String processor)
          Creates a password 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.
 InstallData getIdata()
           
 int getNumFields()
          Returns the number of sub-fields.
 java.lang.String getPassword()
          Returns the password in the following order: If a validator sets a modified password such as an encrypted string that is returned, OR 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.
 java.lang.String getText()
          Returns the field contents.
 ValidatorContainer getValidatorContainer()
           
 ValidatorContainer getValidatorContainer(int i)
           
 java.lang.String getValidatorMessage(int i)
           
 java.util.Map<java.lang.String,java.lang.String> getValidatorParams()
          Returns the validator parameters, if any.
 java.util.Map<java.lang.String,java.lang.String> getValidatorParams(int i)
           
 boolean hasParams()
           
 boolean hasParams(int i)
           
 void setModifiedPassword(java.lang.String value)
           
 boolean validateContents(int i)
          This method validates the group content.
 int validatorSize()
           
 
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<javax.swing.JPasswordField> fields

validatorContainers

private java.util.List<ValidatorContainer> validatorContainers

processor

private Processor processor

modifiedPassword

private java.lang.String modifiedPassword

currentValidator

private int currentValidator

idata

private InstallData idata
Constructor Detail

PasswordGroup

public PasswordGroup(InstallData idata,
                     java.util.List<ValidatorContainer> validatorContainers,
                     java.lang.String processor)
Creates a password group to manage one or more password fields.

Parameters:
idata - the installation data
validatorContainers - the validator containers
processor - the processor
Method Detail

getIdata

public InstallData getIdata()

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(int i)
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.

getValidatorMessage

public java.lang.String getValidatorMessage(int i)

validatorSize

public int validatorSize()

getValidatorContainer

public ValidatorContainer getValidatorContainer()

getValidatorContainer

public ValidatorContainer getValidatorContainer(int i)

hasParams

public boolean hasParams()
Specified by:
hasParams in interface ProcessingClient
Returns:
true if this instance has any parameters to pass to the Validator instance.

hasParams

public boolean hasParams(int i)

getValidatorParams

public java.util.Map<java.lang.String,java.lang.String> getValidatorParams()
Description copied from interface: ProcessingClient
Returns the validator parameters, if any. The caller should check for the existence of validator parameters via the hasParams() method prior to invoking this method.

Specified by:
getValidatorParams in interface ProcessingClient
Returns:
a java.util.Map containing the validator parameters.

getValidatorParams

public java.util.Map<java.lang.String,java.lang.String> getValidatorParams(int i)

getText

public java.lang.String getText()
Description copied from interface: ProcessingClient
Returns the field contents.

Specified by:
getText in interface ProcessingClient
Returns:
the field contents

setModifiedPassword

public void setModifiedPassword(java.lang.String value)

getPassword

public java.lang.String getPassword()
Returns the password in the following order: If a validator sets a modified password such as an encrypted string that is returned, OR 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