Class CompoundRecordModel<R extends SRecordInstance>

  • 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 instance
      CompoundRecordModel​(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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 interface org.apache.wicket.model.IModel<R extends SRecordInstance>
        See Also:
        IModel.getObject()
      • setObject

        public void setObject​(java.util.List<R> object)
        Specified by:
        setObject in interface org.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 interface org.apache.wicket.model.IComponentInheritedModel<R extends SRecordInstance>
      • detach

        public void detach()
        Specified by:
        detach in interface org.apache.wicket.model.IDetachable
      • getChainedModel

        public org.apache.wicket.model.IModel<?> getChainedModel()
        Specified by:
        getChainedModel in interface org.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 interface org.apache.wicket.model.IChainingModel<R extends SRecordInstance>