[jsr-314-open-mirror] [jsr-314-open] Composite components only support one action attribute (review of issue 859)

Leonardo Uribe lu4242 at gmail.com
Thu Oct 28 13:17:12 EDT 2010


Hi

Yesterday I attached a patch for this issue:

https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=859

and then Ed Burns propose another similar one, but filling the gaps in
documentation and integration with automated tests (That's cool!).

Instead call it "methodType", it was proposed targetAttributeName and added
this
documentation:

"...This attribute allows the name of the attribute exposed to the using
page to differ from the one actually used in the implementation.  For
example, consider a composite component that contains two buttons, one
that means "submit" and one that means "cancel".  It is natural to want
to declare two composite component attributes to allow these buttons to
be customized, for example, "submitAction" and "cancelAction".  For both
of these buttons, the method expression should be retargeted to the
inner button's "action" attribute.  This scenario would be expressed as
follows..."

I see that from other point of view. I think that the attribute proposed
indicates
the attribute will be "consumed" as an method expression of type "action".

The proposal using "methodType" looks like this in the test app:

  <cc:attribute name="submitAction" targets="submitButton"
methodType="action"/>
  <cc:attribute name="cancelAction" targets="cancelButton"
methodType="action"/>

But the intention including the patch on 755 (allow #{cc.attrs.action}) is
this
should looks like this (I'm trying to keep them separate to prevent
confusions):

  <cc:attribute name="submitAction" methodType="action"/>
  <cc:attribute name="cancelAction" methodType="action"/>

And the proposal using "targetAttributeName" looks like this:

  <cc:attribute name="submitAction" targetAttributeName="action"
                method-signature="java.lang.Object action()"/>
  <cc:attribute name="cancelAction" targetAttributeName="action"
                method-signature="java.lang.Object action()"/>

In my opinion, the syntax using "methodType" is preferred. In that one, we
are just
defining the attribute is used for the behavioral interface ActionSource, as
an "action",
and the method-signature declaration is not necessary anymore.

Note that this syntax already works (partially) without the patch:

  <cc:attribute name="submitAction" method-signature="java.lang.Object
action()"/>

I said "partially" because these two method signatures are valid for action:

java.lang.Object action()
void action()

The problem is more clear when "actionListener" is considered because it has
these two
valid signatures (since JSF 2):

void method(javax.faces.event.ActionEvent )
void method()

It is not possible to map it using method-signature, because it only allows
one of them, but
if we use a notation like this:

  <cc:attribute name="submitActionListener" methodType="actionListener"/>

The previous two signatures are assumed and problem solved. I still think
method-signature should allow multiple ones using ';', but before that (I
want to propose a
patch but not yet), I prefer the proposed patch using methodType.

Suggestions are welcome.

best regards,

Leonardo Uribe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsr-314-open-mirror/attachments/20101028/044858f2/attachment-0002.html 


More information about the jsr-314-open-mirror mailing list