I try to write a model which equals if beckendObject equals:

    private final class BackendEqualsThenModelEqualsModel extends Model {

        private BackendEqualsThenModelEqualsModel(Serializable object) {
            super(object);
        }

        @Override
        public boolean equals(Object obj) {
            return getObject(null).equals(((IModel) obj).getObject(null));
        }

        @Override
        public int hashCode() {
            return getObject(null).hashCode();
        }
    }

and that GridView use this model:

new GridView("checks", new ListDataProvider(dataList)) {
            @Override
            protected Item newItem(String id, int index, IModel model) {
                return super.newItem(id, index,
                        new BackendEqualsThenModelEqualsModel(
                                (Serializable) model.getObject(null)));
            }

            @Override
            protected void populateItem(Item item) {
                item.add(new Check("check", item.getModel()));
            }

            @Override
            protected void populateEmptyItem(Item item) {
                item.add(new Label("check"));
            }
};

It doesn't work... It must be something wrong somewhere.
Could you give me correct implemetation ? Thanks!

On 11/14/06, Igor Vaynberg <[EMAIL PROTECTED] > wrote:
the rowitems do not matter, they hold no state. it is the cell items (individual squares in the grid) whose component hierarchy must be preserved, and it looks to me like it is because those are managed by the dataview.

are you sure you overrode equals and hashcode on the IModel not on the model objects?


-igor


On 11/12/06, Ingram Chen < [EMAIL PROTECTED]> wrote:
Yes, I do try ReuseIfModelsEqualStrategy

but... it does not work for me.  I dig into source code and found GridView internally use
another RepeatingView for rows, and it doesn't utilize IItemReuseStrategy.

Maybe I just do wrong configuration...


On 11/13/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
thats not true, see GridView.setItemReuseStrategy, IItemReuseStrategy, and ReuseIfModelsEqualStrategy

-igor



On 11/12/06, Ingram Chen < [EMAIL PROTECTED]> wrote:
This reminds me bad experiences with check + gridview sometime ago.

GridView does not support Item reuse. i.e. If any form validation error occur,
user input are just disappeared. use with care!



On 11/9/06, Frank Bille <[EMAIL PROTECTED] > wrote:
On 11/9/06, Flemming Seerup <[EMAIL PROTECTED]> wrote
public ThumbnailImageFragment(String id, final ImageReference
reference, IModel
itemModel) {
        super(id);

        CheckBox checkBox = new CheckBox("select", itemModel);
        add(checkBox);


Try to use Check instead of CheckBox. I think that is your problem :)

http://wicket.sourceforge.net/apidocs/wicket/markup/html/form/CheckGroup.html

Frank

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





--
Ingram Chen
Java [EMAIL PROTECTED]
Institue of BioMedical Sciences Academia Sinica Taiwan
blog: http://www.javaworld.com.tw/roller/page/ingramchen

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





--
Ingram Chen
Java [EMAIL PROTECTED]
Institue of BioMedical Sciences Academia Sinica Taiwan
blog: http://www.javaworld.com.tw/roller/page/ingramchen

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





--
Ingram Chen
Java [EMAIL PROTECTED]
Institue of BioMedical Sciences Academia Sinica Taiwan
blog: http://www.javaworld.com.tw/roller/page/ingramchen
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to