public class FieldProvider<U extends org.ujorm.Ujo> extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
static String |
PASSWORD_KEY_NAME
Password key name to create a component PasswordField
|
| Constructor and Description |
|---|
FieldProvider(org.apache.wicket.markup.repeater.RepeatingView repeatingView)
Default constructor with a repeatingView
|
FieldProvider(org.apache.wicket.markup.repeater.RepeatingView repeatingView,
Map<String,Field> fields)
Final constructor
|
FieldProvider(String repeatingViewId)
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Class<? super U> domainClass)
Add all fields of a domain class to the form
|
<T> Field<T> |
add(Field<T> field)
Add any field to a repeating view
and set the OutputMarkupPlaceholderTag to value
true. |
<T> Field<T> |
add(org.ujorm.Key<? super U,T> key)
Add new field to a repeating view
|
<T extends org.ujorm.Ujo> |
add(org.ujorm.Key<? super U,T> key,
Class<? extends Field> fieldClass)
Create a field of the required instance and set the result into container.
|
<T extends org.ujorm.Ujo & Serializable> |
add(org.ujorm.Key<? super U,T> key,
org.ujorm.criterion.Criterion<T> filter)
Add new field to a repeating view
|
<T extends OrmUjo> |
add(org.ujorm.Key<? super U,T> key,
org.ujorm.Key<T,?> display,
org.ujorm.criterion.Criterion<T> crn)
Add a Combo-box for a
|
<T extends org.ujorm.Ujo & Serializable> |
add(org.ujorm.Key<? super U,T> key,
OfferModel<T> model)
Add new field to a repeating view
|
void |
add(org.ujorm.KeyList<? super U> fields)
Add all fields
|
<T> void |
addCssStyle(org.ujorm.Key<? super U,? super T> key,
String cssStyle)
Add a CSS style to the field of required key.
|
protected void |
addValidator(org.ujorm.Key<? super U,?> key,
Field field)
Set a validator of the Key to the Field from argument
|
<T> void |
addValidator(org.ujorm.Key<? super U,T> key,
org.apache.wicket.validation.IValidator<? super T> validator)
Set a visible attribute for a required filed.
|
<T> void |
addValidator(org.ujorm.Key<? super U,T> key,
org.ujorm.Validator<? super T> validator)
Add a validator for a required filed.
|
<T> void |
addValidatorUnchecked(org.ujorm.Key<? super U,? super T> key,
org.ujorm.Validator validator)
Add a validator for a required filed, where the validator have no generic type.
|
protected U |
cloneDomain(U domain,
OrmSessionProvider session)
Clone the domain object or reload the ORM object from database.
|
void |
copyToDomain(U domain)
Copy component values of the enabled fields to the domain
|
protected U |
copyToFields(U domain)
Assign values to required component fields in a transaction for a lazy loading case
|
void |
copyValues(U domain,
boolean toFields)
Copy values according to argument from or to the domain.
|
FieldProvider<U> |
disableFields()
Disable new fields (by default)
|
protected Field<?> |
findFirstField()
Find first enabled field with a non-null Key or return the
null. |
protected int |
getClonedDepth()
Get a default cloned depth for the method
cloneDomain(org.ujorm.Ujo, org.ujorm.wicket.OrmSessionProvider) |
U |
getDomain()
Copy component values to the domain result and return the result
|
<V,F extends Field<V>> |
getField(org.ujorm.Key<? super U,V> key)
Returns the related Field component
|
Collection<Field> |
getFields()
Return all fields
|
U |
getInputDomain()
Get original domain
|
protected Set<String> |
getKeyNames()
Return all keys in a String format
|
<T> Field<T> |
getLast()
Returns the last field or throw an exception
|
protected OrmHandler |
getOrmHandler()
Returns OrmHandler
|
org.apache.wicket.markup.repeater.RepeatingView |
getRepeatingView()
Returns the repeating view
|
int |
getTextAreaLimit()
Returns a minimal text length to create a TextArea component.
|
<T> T |
getValue(org.ujorm.Key<? super U,T> key)
Get Value, or returns a default value
|
boolean |
isDisableRequest()
Disable new fields if the argument is
true |
protected boolean |
isMandatory(org.ujorm.Key<? super U,?> key)
Is the key mandatory ?
|
protected boolean |
isPasswordKey(org.ujorm.Key<? super U,?> key)
Is the key type of PasswordField ?
|
protected String |
newChildId()
Generates a child component id
|
void |
onChange(org.ujorm.Key<? super U,?> source)
Refresh component
|
void |
onChange(org.ujorm.Key<? super U,?> source,
String action)
Refresh component
|
void |
requestFocus(org.apache.wicket.ajax.AjaxRequestTarget target)
Set a focus to the first component by default
|
void |
setDisablRequest(boolean disableRequest)
Disable new fields if the argument is
true |
void |
setDomain(U domain)
Copy domain attributes to fields and clone the arguments to internal parameters.
|
<T> void |
setEnabled(org.ujorm.Key<? super U,T> key,
boolean enabled)
Set an enabled attribute for a required filed.
|
<T> void |
setValue(org.ujorm.Key<? super U,T> key,
T value)
Set Value
|
<T> void |
setValue(org.ujorm.Key<? super U,T> key,
T value,
org.apache.wicket.ajax.AjaxRequestTarget target)
Set Value and repaint the component
|
void |
setVisible(org.ujorm.Key<? super U,?> key,
boolean visible)
Set a visible attribute for a required filed.
|
public static final String PASSWORD_KEY_NAME
public FieldProvider(String repeatingViewId)
public FieldProvider(org.apache.wicket.markup.repeater.RepeatingView repeatingView)
public <T> Field<T> add(Field<T> field)
true.protected String newChildId()
public <T extends org.ujorm.Ujo & Serializable> Field<T> add(org.ujorm.Key<? super U,T> key, org.ujorm.criterion.Criterion<T> filter)
public <T extends org.ujorm.Ujo & Serializable> Field<T> add(org.ujorm.Key<? super U,T> key, OfferModel<T> model)
public void add(org.ujorm.KeyList<? super U> fields)
public <T extends org.ujorm.Ujo> Field<T> add(org.ujorm.Key<? super U,T> key, Class<? extends Field> fieldClass)
T - Ujo typekey - Related KeyfieldClass - Class must have got a one argument constructor type of Key.public <T extends OrmUjo> Field<T> add(org.ujorm.Key<? super U,T> key, org.ujorm.Key<T,?> display, org.ujorm.criterion.Criterion<T> crn)
public <T> T getValue(org.ujorm.Key<? super U,T> key)
public <T> void setValue(org.ujorm.Key<? super U,T> key, T value)
public <T> void setValue(org.ujorm.Key<? super U,T> key, T value, org.apache.wicket.ajax.AjaxRequestTarget target)
public Collection<Field> getFields()
@Nonnull public <V,F extends Field<V>> F getField(org.ujorm.Key<? super U,V> key)
@Nonnull public <T> Field<T> getLast() throws ArrayIndexOutOfBoundsException, IllegalArgumentException
null alwaysArrayIndexOutOfBoundsException - No last filed was found.IllegalArgumentExceptionpublic org.apache.wicket.markup.repeater.RepeatingView getRepeatingView()
protected OrmHandler getOrmHandler()
protected boolean isMandatory(org.ujorm.Key<? super U,?> key)
protected void addValidator(org.ujorm.Key<? super U,?> key, Field field)
public void setDomain(U domain)
protected U cloneDomain(U domain, OrmSessionProvider session) throws NoSuchElementException, IllegalStateException
protected int getClonedDepth()
cloneDomain(org.ujorm.Ujo, org.ujorm.wicket.OrmSessionProvider)protected U copyToFields(U domain)
public U getDomain()
public void copyToDomain(U domain)
public void copyValues(U domain, boolean toFields)
domain - Domain objecttoFields - The TRUE value means 'copy to fields' and FALSE means 'copy to domain'.public U getInputDomain()
public int getTextAreaLimit()
protected boolean isPasswordKey(org.ujorm.Key<? super U,?> key)
public void onChange(org.ujorm.Key<? super U,?> source)
public <T> void setEnabled(org.ujorm.Key<? super U,T> key, boolean enabled)
public void setVisible(org.ujorm.Key<? super U,?> key, boolean visible)
public boolean isDisableRequest()
truepublic void setDisablRequest(boolean disableRequest)
truepublic final FieldProvider<U> disableFields()
public <T> void addValidator(org.ujorm.Key<? super U,T> key, org.ujorm.Validator<? super T> validator)
public <T> void addValidatorUnchecked(org.ujorm.Key<? super U,? super T> key, org.ujorm.Validator validator)
#setValidator(org.ujorm.Key, org.ujorm.Validator)public <T> void addValidator(org.ujorm.Key<? super U,T> key, org.apache.wicket.validation.IValidator<? super T> validator)
public <T> void addCssStyle(org.ujorm.Key<? super U,? super T> key, String cssStyle)
public void requestFocus(@Nonnull org.apache.wicket.ajax.AjaxRequestTarget target)
Copyright © 2018. All rights reserved.