Igor, I have one more question about IWrapModel :

why the Component#defaultModelComparator doesn't check and unwrap IWrapModel
before calling the IModel#getObject() ?


        private static final IModelComparator defaultModelComparator = new
IModelComparator()
        {
                private static final long serialVersionUID = 1L;

                public boolean compare(Component component, Object b)
                {
                        //final Object a =
component.getDefaultModelObject();
                        // the default model can act as IWrapModel
                        final Object a = 
component.getInnermostModel().getObject();
                        if (a == null && b == null)
                        {
                                return true;
                        }
                        if (a == null || b == null)
                        {
                                return false;
                        }
                        return a.equals(b);
                }
        };


In the sample above  with DDC, if we use the DefaultingWrapModel,
defaultModelComparator will always return true (in case of default value
selection) and the default model object will never updated because of :
Component#setDefaultModelObject(final Object object)

                // Check whether this will result in an actual change
                if (!getModelComparator().compare(this, object))
                {
                        modelChanging();
                        model.setObject(object);
                        modelChanged();
                }

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/1-4-15-FLAG-INHERITABLE-MODEL-and-default-model-change-tp3252093p3254620.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to