Class CompoundRecordModel<R extends SRecordInstance>
- java.lang.Object
-
- com.inductiveautomation.ignition.gateway.web.models.CompoundRecordModel<R>
-
- All Implemented Interfaces:
java.io.Serializable
,org.apache.wicket.model.IChainingModel<java.util.List<R>>
,org.apache.wicket.model.IComponentInheritedModel<java.util.List<R>>
,org.apache.wicket.model.IDetachable
,org.apache.wicket.model.IModel<java.util.List<R>>
,org.apache.wicket.util.io.IClusterable
public class CompoundRecordModel<R extends SRecordInstance> extends java.lang.Object implements org.apache.wicket.model.IComponentInheritedModel<java.util.List<R>>, org.apache.wicket.model.IChainingModel<java.util.List<R>>
An implementation of model that is both chaining and inherited. The value represented by this model is always a list of SRecordInstance objects (one or more), with at most one record for any given RecordMeta type. They may be nested in deeper models (for instance, a LoadableDetchableModel). Components that wish to use this model by inheritance should implement IRecordFieldComponent. They may also use the field name as their Id, so long as the field name is unique among the types of records represented.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CompoundRecordModel(java.util.List<R> records)
Creates a CompoundRecordModel directly on the record instanceCompoundRecordModel(org.apache.wicket.model.IModel<java.util.List<R>> targetModel)
Creates a a CompoundRecordModel using a chained model.CompoundRecordModel(R... records)
Creates a CompoundRecordModel directly on the record instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.wicket.model.IModel
bind(SFieldMeta field)
Binds this model to a specific field by returning a model that has this compound model as its nested/wrapped model and the property which should be evaluated.void
detach()
org.apache.wicket.model.IModel<?>
getChainedModel()
java.util.List<R>
getObject()
java.util.List<SRecordInstance>
getObjectAsRecordList()
void
setChainedModel(org.apache.wicket.model.IModel<?> model)
void
setObject(java.util.List<R> object)
org.apache.wicket.model.IWrapModel<java.lang.Object>
wrapOnInheritance(org.apache.wicket.Component component)
-
-
-
Constructor Detail
-
CompoundRecordModel
public CompoundRecordModel(R... records)
Creates a CompoundRecordModel directly on the record instance
-
CompoundRecordModel
public CompoundRecordModel(java.util.List<R> records)
Creates a CompoundRecordModel directly on the record instance
-
CompoundRecordModel
public CompoundRecordModel(org.apache.wicket.model.IModel<java.util.List<R>> targetModel)
Creates a a CompoundRecordModel using a chained model. The target model must return a List of SRecordInstance from getObject()
-
-
Method Detail
-
getObject
public java.util.List<R> getObject()
- Specified by:
getObject
in interfaceorg.apache.wicket.model.IModel<R extends SRecordInstance>
- See Also:
IModel.getObject()
-
setObject
public void setObject(java.util.List<R> object)
- Specified by:
setObject
in interfaceorg.apache.wicket.model.IModel<R extends SRecordInstance>
- See Also:
IModel.setObject(java.lang.Object)
-
getObjectAsRecordList
public java.util.List<SRecordInstance> getObjectAsRecordList()
-
bind
public org.apache.wicket.model.IModel bind(SFieldMeta field)
Binds this model to a specific field by returning a model that has this compound model as its nested/wrapped model and the property which should be evaluated. This can be used if the id of the Component isn't a valid property for the record.- Returns:
- The IModel that is a wrapper around the current model and the field
-
wrapOnInheritance
public org.apache.wicket.model.IWrapModel<java.lang.Object> wrapOnInheritance(org.apache.wicket.Component component)
- Specified by:
wrapOnInheritance
in interfaceorg.apache.wicket.model.IComponentInheritedModel<R extends SRecordInstance>
-
detach
public void detach()
- Specified by:
detach
in interfaceorg.apache.wicket.model.IDetachable
-
getChainedModel
public org.apache.wicket.model.IModel<?> getChainedModel()
- Specified by:
getChainedModel
in interfaceorg.apache.wicket.model.IChainingModel<R extends SRecordInstance>
- See Also:
IChainingModel.getChainedModel()
-
setChainedModel
public void setChainedModel(org.apache.wicket.model.IModel<?> model)
- Specified by:
setChainedModel
in interfaceorg.apache.wicket.model.IChainingModel<R extends SRecordInstance>
-
-