Class AbstractApplicationFormUIModel<E,B extends AbstractApplicationFormUIModel<E,B>>
- java.lang.Object
-
- org.jdesktop.beans.AbstractBean
-
- org.jdesktop.beans.AbstractSerializableBean
-
- org.nuiton.jaxx.application.swing.AbstractApplicationFormUIModel<E,B>
-
- All Implemented Interfaces:
Serializable,JavaBeanObject
public abstract class AbstractApplicationFormUIModel<E,B extends AbstractApplicationFormUIModel<E,B>> extends org.jdesktop.beans.AbstractSerializableBean implements JavaBeanObject
A ui form model. Created on 8/15/14.- Since:
- 2.10
- Author:
- Tony Chemit - chemit@codelutin.com
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractApplicationFormUIModel.ModifyPropertyChangeListener
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.collect.ImmutableSet<String>MODIFY_IGNORE_PROPERTIESstatic StringPROPERTY_CREATEstatic StringPROPERTY_MODIFYstatic StringPROPERTY_VALID
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractApplicationFormUIModel()protectedAbstractApplicationFormUIModel(Class<E> entityType, Class<B> uiModelType)protectedAbstractApplicationFormUIModel(org.nuiton.util.beans.Binder<E,B> fromBeanBinder, org.nuiton.util.beans.Binder<B,E> toBeanBinder)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static <E,B extends AbstractApplicationFormUIModel<E,B>>
com.google.common.base.Function<E,B>entityToModel(Class<B> modelType)voidfirePropertyChanged(String propertyName, Object oldValue, Object newValue)voidfromBean(E bean)voidfromEntity(E entity)Method to override the copy of incoming entity into the form.protected Set<String>getModifyIgnorePropertyNames()booleanisCreate()booleanisModify()booleanisValid()protected <B extends JavaBeanObject>
voidlistenAndModifyModel(Iterable<B> javaBeanObjects)<B extends JavaBeanObject>
voidlistenModelIsModify(B... javaBeanObjects)protected static <E,B extends AbstractApplicationFormUIModel<E,B>>
com.google.common.base.Function<B,E>modelToEntity()protected abstract EnewEntity()Used to copy the form to outside world.voidsetCreate(boolean create)voidsetModify(boolean modify)voidsetValid(boolean valid)EtoBean()EtoBean(E bean)EtoEntity()Note: the method isfinal, if you need to customize something, do it in thetoEntity(Object)method.voidtoEntity(E entity)Method to override the copy of the form to outside world (entity).-
Methods inherited from class org.jdesktop.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuiton.jaxx.application.bean.JavaBeanObject
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
PROPERTY_MODIFY
public static final String PROPERTY_MODIFY
- See Also:
- Constant Field Values
-
PROPERTY_VALID
public static final String PROPERTY_VALID
- See Also:
- Constant Field Values
-
PROPERTY_CREATE
public static final String PROPERTY_CREATE
- See Also:
- Constant Field Values
-
MODIFY_IGNORE_PROPERTIES
public static final com.google.common.collect.ImmutableSet<String> MODIFY_IGNORE_PROPERTIES
-
-
Method Detail
-
newEntity
protected abstract E newEntity()
Used to copy the form to outside world.- Returns:
- a new instance of outisde world object.
-
fromEntity
public void fromEntity(E entity)
Method to override the copy of incoming entity into the form. By default, invoke the simple binder copy (methodfromBean(Object).- Parameters:
entity- incoming entity to copy inside the form
-
toEntity
public void toEntity(E entity)
Method to override the copy of the form to outside world (entity). By default, invoke the simple binder copy (methodtoBean(Object).- Parameters:
entity- the outside world object to fill
-
toEntity
public final E toEntity()
Note: the method isfinal, if you need to customize something, do it in thetoEntity(Object)method.- Returns:
- a new instance of object to persist from this form
-
fromBean
public final void fromBean(E bean)
- Parameters:
bean- object to copy into form using thefromBeanBinderbinder
-
toBean
public final E toBean()
- Returns:
- the new instance of bean binded from form to outside world
-
toBean
public final E toBean(E bean)
- Parameters:
bean- the bean to bind- Returns:
- the binded form to the given
result
-
isModify
public boolean isModify()
-
setModify
public void setModify(boolean modify)
-
isValid
public boolean isValid()
-
setValid
public void setValid(boolean valid)
-
isCreate
public boolean isCreate()
-
setCreate
public void setCreate(boolean create)
-
getModifyIgnorePropertyNames
protected Set<String> getModifyIgnorePropertyNames()
- Returns:
- set of property names that will not change the modify state.
-
firePropertyChanged
public void firePropertyChanged(String propertyName, Object oldValue, Object newValue)
- Specified by:
firePropertyChangedin interfaceJavaBeanObject
-
listenModelIsModify
public final <B extends JavaBeanObject> void listenModelIsModify(B... javaBeanObjects)
-
listenAndModifyModel
protected <B extends JavaBeanObject> void listenAndModifyModel(Iterable<B> javaBeanObjects)
-
modelToEntity
protected static <E,B extends AbstractApplicationFormUIModel<E,B>> com.google.common.base.Function<B,E> modelToEntity()
-
entityToModel
protected static <E,B extends AbstractApplicationFormUIModel<E,B>> com.google.common.base.Function<E,B> entityToModel(Class<B> modelType)
-
-