You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Nuno Pedro Jacinto <nu...@cern.ch> on 2012/10/21 12:19:55 UTC

Question concerning component class

Good afternoon,

Can someone explain me why you are using the data field to store the IModel?
I saw the comment on the model flag concerning the possibility of a model implementing also the Behaviour interface, what makes sense, but when we look at all the access to the get method we can see that it excludes always the first element if the model is set.
I image that you have more important things to do, but I was wondering if I am missing something.

Thank you.

Cheers,
Nuno Jacinto

RE: Question concerning component class

Posted by Nuno Pedro Jacinto <nu...@cern.ch>.
Hello,

Thank you for your answer. I saw that was being used for storing the model, just not being used for anything that could justify the extra operations on validations.
Considering the processor power of today and the page map it probably makes more sense to minimize memory than processing time.
Once again thank you.

Cheers,
Nuno


-----Original Message-----
From: Sven Meier [mailto:sven@meiers.net] 
Sent: 22 October 2012 10:13
To: dev@wicket.apache.org
Subject: Re: Question concerning component class

>Can someone explain me why you are using the data field to store the IModel?

Memory optimization.

>when we look at all the access to the get method we can see that it 
>excludes always the first element if the model is set.

If the model is set, Components knows it to be at index 0:

		if (getFlag(FLAG_MODEL_SET))
		{
			return (IModel<?>)data_get(0);
		}
		return null;

Doesn't look like the first element is excluded, does it?

Sven


On 10/21/2012 12:19 PM, Nuno Pedro Jacinto wrote:
> Good afternoon,
>
> Can someone explain me why you are using the data field to store the IModel?
> I saw the comment on the model flag concerning the possibility of a model implementing also the Behaviour interface, what makes sense, but when we look at all the access to the get method we can see that it excludes always the first element if the model is set.
> I image that you have more important things to do, but I was wondering if I am missing something.
>
> Thank you.
>
> Cheers,
> Nuno Jacinto
>


Re: Question concerning component class

Posted by Sven Meier <sv...@meiers.net>.
>Can someone explain me why you are using the data field to store the IModel?

Memory optimization.

>when we look at all the access to the get method we can see that it excludes always
>the first element if the model is set.

If the model is set, Components knows it to be at index 0:

		if (getFlag(FLAG_MODEL_SET))
		{
			return (IModel<?>)data_get(0);
		}
		return null;

Doesn't look like the first element is excluded, does it?

Sven


On 10/21/2012 12:19 PM, Nuno Pedro Jacinto wrote:
> Good afternoon,
>
> Can someone explain me why you are using the data field to store the IModel?
> I saw the comment on the model flag concerning the possibility of a model implementing also the Behaviour interface, what makes sense, but when we look at all the access to the get method we can see that it excludes always the first element if the model is set.
> I image that you have more important things to do, but I was wondering if I am missing something.
>
> Thank you.
>
> Cheers,
> Nuno Jacinto
>