i've tried out the simple model class below and it seems to work quite nicely in the FormInput example. the idea is that Model is a wrapper class, but AbstractModel is designed to be extended directly. this will save some space for most models which don't already have a base class and works quite well with the forminput example because the reset button now looks like this:


           add(new OnClickLink("resetButtonLink")
           {
               public void onClick()
               {
                   InputForm.this.setModel(new FormInputModel());
               }
           }.add(new Image("resetButtonImage")));

where

   public final class FormInputModel extends AbstractModel

this all looks pretty good to me, but was wondering what feedback anyone has...

      jon

--------------------------------------

package wicket.model;

/**
* A simple model class which is not detachable.
*
* @author Jonathan Locke
*/
public abstract class AbstractModel implements IModel
{
   /** Serial Version ID. */
   private static final long serialVersionUID = 3031804965001519439L;

   /**
    * @see wicket.model.IModel#getObject()
    */
   public Object getObject()
   {
       return this;
   }

/**
* @see wicket.model.IModel#setObject(java.lang.Object)
*/
public void setObject(Object object)
{
throw new UnsupportedOperationException("Cannot set object on a simple model");
}
}



------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to