On 10/21/2013 11:56 AM, Martin Grigorov wrote:
> Hi,
>
> Experiment with it and if nothing breaks then apply the changes.
> If it is not something that you need in your application then I'd prefer to
> make the change only in master branch.
I also prefer to postpone this shange to Wicket 7. Even if I need this
kind of component, I can easely a custom component like this:
public class ExternalImage extends WebComponent {
public ExternalImage(String id) {
super(id);
}
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
//check tag...
tag.put("src", getDefaultModelObjectAsString());
}
}
> Hi Andrea,
>
> Image works with ResourceReferences and doesn't do anything with its
> model.
> If you just want to control a src attribute with a model object, why
> not use ContextImage?
>
> Sven
>
I'd like to use model inheritance and ContextImage is not able to use
this kind of model (right?). In addition in my bean I have a full
external URL to the image that I want to put into src attribute (my bean
is obtained from a REST JSON fragment).
> On 10/21/2013 11:16 AM, Andrea Del Bene wrote:
>> Hi,
>>
>> at the moment is impossible to use Image component with inheritable
>> models. Method initModel is overridden to return null and the
>> constructor that takes in input just the component id is declared as
>> protected. It would be fine if we could inherit a model object and use
>> one of its string property to set the src attribute of the <img> tag.
>> Coudn't we make the protected constructor public and use the default
>> version of initModel? The comment inside initModel says that the method
>> is overridden to use "... a simple model, explicitly set, or use their
>> tag's src or value attribute". However, if we look at the code of method
>> LocalizedImageResource.setSrcAttribute, it doesn't seem necessary to
>> override initModel to achieve this result.
>