org.jreform.internal
Class AbstractInputCollection

java.lang.Object
  extended by org.jreform.internal.AbstractInputCollection
All Implemented Interfaces:
HttpServletRequestValidator, InputCollection
Direct Known Subclasses:
AbstractForm, GroupImpl

abstract class AbstractInputCollection
extends Object
implements InputCollection

Author:
armandino (at) gmail.com

Field Summary
private  Set<String> errors
           
private  Map<String,InputControl<?>> inputs
           
private  boolean isValid
           
 
Constructor Summary
AbstractInputCollection()
           
 
Method Summary
(package private)
<T> void
add(InputControl<T> input)
          Adds the specified input to the collection.
 void addError(String errorKey)
           
protected  void additionalValidate()
          Perform additional validation of form data where necessary.
<T> InputControlModifier<T>
checkbox(InputDataType<T> type, String name, Criterion<T>... criteria)
           
private
<T> InputControlModifier<T>
create(AbstractInputControl<T> input)
           
<T> Checkbox<T>
getCheckbox(String name)
           
 Set<String> getErrors()
          Returns a set of error keys describing validation errors or an empty set if the object has not been validated or validation was successful.
<T> Input<T>
getInput(String name)
           
(package private)  InputControl<?> getInputControl(String name)
           
(package private)  Map<String,InputControl<?>> getInputs()
           
<T> T
getInputValue(String name)
          Returns the value of the specified input.
<T> MultiCheckbox<T>
getMultiCheckbox(String name)
           
<T> List<T>
getMultiInputValue(String name)
          Returns the list of values of the specified multi input.
<T> MultiSelect<T>
getMultiSelect(String name)
           
<T> Radio<T>
getRadio(String name)
           
<T> Select<T>
getSelect(String name)
           
<T> InputControlModifier<T>
input(InputDataType<T> type, String name, Criterion<T>... criteria)
           
 boolean isValid()
           
<T> InputControlModifier<T>
multiCheckbox(InputDataType<T> type, String name, Criterion<T>... criteria)
           
<T> InputControlModifier<T>
multiSelect(InputDataType<T> type, String name, Criterion<T>... criteria)
           
<T> InputControlModifier<T>
radio(InputDataType<T> type, String name, Criterion<T>... criteria)
           
<T> InputControlModifier<T>
select(InputDataType<T> type, String name, Criterion<T>... criteria)
           
(package private)  void setValid(boolean isValid)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jreform.HttpServletRequestValidator
validate
 

Field Detail

inputs

private final Map<String,InputControl<?>> inputs

errors

private final Set<String> errors

isValid

private boolean isValid
Constructor Detail

AbstractInputCollection

AbstractInputCollection()
Method Detail

add

<T> void add(InputControl<T> input)
Adds the specified input to the collection.

Throws:
DuplicateNameException - if there is an existing input with the same name in this collection

getInputControl

final InputControl<?> getInputControl(String name)

getErrors

public final Set<String> getErrors()
Description copied from interface: HttpServletRequestValidator
Returns a set of error keys describing validation errors or an empty set if the object has not been validated or validation was successful.

Specified by:
getErrors in interface HttpServletRequestValidator

addError

public final void addError(String errorKey)

isValid

public final boolean isValid()

getInputs

final Map<String,InputControl<?>> getInputs()

setValid

final void setValid(boolean isValid)

additionalValidate

protected void additionalValidate()
Perform additional validation of form data where necessary.


getInputValue

public final <T> T getInputValue(String name)
Returns the value of the specified input.

Specified by:
getInputValue in interface InputCollection
Parameters:
name - of the input.

getMultiInputValue

public final <T> List<T> getMultiInputValue(String name)
Returns the list of values of the specified multi input.

Specified by:
getMultiInputValue in interface InputCollection
Parameters:
name - of the input.

getInput

public final <T> Input<T> getInput(String name)
Specified by:
getInput in interface InputCollection

getCheckbox

public final <T> Checkbox<T> getCheckbox(String name)
Specified by:
getCheckbox in interface InputCollection

getMultiCheckbox

public final <T> MultiCheckbox<T> getMultiCheckbox(String name)
Specified by:
getMultiCheckbox in interface InputCollection

getRadio

public final <T> Radio<T> getRadio(String name)
Specified by:
getRadio in interface InputCollection

getSelect

public final <T> Select<T> getSelect(String name)
Specified by:
getSelect in interface InputCollection

getMultiSelect

public final <T> MultiSelect<T> getMultiSelect(String name)
Specified by:
getMultiSelect in interface InputCollection

input

public final <T> InputControlModifier<T> input(InputDataType<T> type,
                                               String name,
                                               Criterion<T>... criteria)
Specified by:
input in interface InputCollection

checkbox

public final <T> InputControlModifier<T> checkbox(InputDataType<T> type,
                                                  String name,
                                                  Criterion<T>... criteria)
Specified by:
checkbox in interface InputCollection

multiCheckbox

public final <T> InputControlModifier<T> multiCheckbox(InputDataType<T> type,
                                                       String name,
                                                       Criterion<T>... criteria)
Specified by:
multiCheckbox in interface InputCollection

radio

public final <T> InputControlModifier<T> radio(InputDataType<T> type,
                                               String name,
                                               Criterion<T>... criteria)
Specified by:
radio in interface InputCollection

select

public final <T> InputControlModifier<T> select(InputDataType<T> type,
                                                String name,
                                                Criterion<T>... criteria)
Specified by:
select in interface InputCollection

multiSelect

public final <T> InputControlModifier<T> multiSelect(InputDataType<T> type,
                                                     String name,
                                                     Criterion<T>... criteria)
Specified by:
multiSelect in interface InputCollection

create

private <T> InputControlModifier<T> create(AbstractInputControl<T> input)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2008 jReform