On Thu, Mar 24, 2011 at 1:14 PM, Pete Muir <
pmuir@redhat.com> wrote:
>
> On 23 Mar 2011, at 21:55, Marek Śmigielski wrote:
>
>> On Wed, Mar 23, 2011 at 9:54 PM, Clint Popetz <
cpopetz@gmail.com> wrote:
>>>
>>>
>>> On Wed, Mar 23, 2011 at 3:02 PM, Marek Śmigielski
>>> <
marek.smigielski@gmail.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> In last few day I have deeply thought over wicket modul features
>>>> essential to fully integrate with wicket framework. In wicket
>>>> architecture there is idea of model as a state bean. Its quite
>>>> different in terms of live cycle from scopes provided by CDI.
>>>>
>>>> 1. It is page scope (in some cirumstances more than one http request)
>>>> 2. It is serialized after each request and store in session or disk.
>>>>
>>>> Wicket modules misses integration throught model object with wicket
>>>> architecture so I've developed some integration with it. The idea is
>>>> that you can achieve CDI beans exactly in the same way like in JSF,
>>>> through expressionLanguage. So you can inject any named or other el
>>>> bean via:
>>>>
>>>> @Inject @ModelExpression("#{nameBean}")
>>>> private SeamModel<String> label;
>>>>
>>>> and later use it on your page directly:
>>>>
>>>> Label label = new Label("headerLabel", headerLabelModel);
>>>>
>>>> or wrap it by other wicket model:
>>>>
>>>> @Inject @ModelExpression("#{registartion}")
>>>> private SeamModel<Registartion> registartion;
>>>>
>>>>
>>>> Form registrationForm = new Form("registartionForm", new
>>>> CompoundPropertyModel(registartion));
>>>>
>>>> and later use it on whole form.
>>>>
>>>
>>> I'm not sure what benefit this provides. The wicket page instance is
>>> already a scope, if you wanted something specific to the page, you could
>>> just add it as a field to the page or component. And EL as a referencing
>>> mechanism is a little too JSF-esque (weakly bound, not refactoring safe) to
>>> be well suited to a wicket integration layer.
>> I think that it's worth to have some way of injection components
>> straight to wicket model beans. Duplication of the fields between
>> wicket page and request component (or any scope component) in my
>> opinion is unnecessary. I agree that EL and wicket concept don't fit
>> well, but I haven't had any other idea how to inject a bean to wicket
>> page wrapped with Model interface without EL. Now I realize that if I
>> can get actualType of class form injection point, I can also resolve
>> targeted bean in typesafe way. SeamModel bean may be very similar to
>> InstanceImpl class from weld core. What do you think?
>
> You mean you need to know the generic type of the injection point?
>
> protected static Type getFacadeType(InjectionPoint injectionPoint)
> {
> Type genericType = injectionPoint.getType();
> if (genericType instanceof ParameterizedType )
> {
> return ((ParameterizedType) genericType).getActualTypeArguments()[0];
> }
> else
> {
> throw new IllegalStateException(TYPE_PARAMETER_MUST_BE_CONCRETE, injectionPoint);
> }
> }
>
> Does that.
>
> I would be very against introducing EL into Wicket, it completely removes a key benefit of Wicket.
>