001    package net.databinder.components.cay;
002    
003    import net.databinder.models.cay.DataObjectModel;
004    
005    import org.apache.cayenne.DataObject;
006    import org.apache.cayenne.ObjectId;
007    import org.apache.wicket.model.CompoundPropertyModel;
008    import org.apache.wicket.model.IChainingModel;
009    
010    /** Form to be used with a single object, wraps in a compound property model. */
011    public class DataForm extends CommittingDataForm {
012            public DataForm(String id, Class<? extends DataObject> cl) {
013                    super(id, new CompoundPropertyModel(new DataObjectModel(cl)));
014            }
015            public DataForm(String id, DataObject object) {
016                    super(id, new CompoundPropertyModel(new DataObjectModel(object)));
017            }
018            public DataForm(String id, ObjectId objectId) {
019                    super(id, new CompoundPropertyModel(new DataObjectModel(objectId)));
020            }
021            public DataObjectModel getPersistentObjectModel() {
022                    return (DataObjectModel) ((IChainingModel)getModel()).getChainedModel();
023            }
024    }