pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: Best practice for implementing Actions
Date Thu, 09 Sep 2010 16:54:36 GMT
Ha. I think you have identified a valid issue with the Action interface: the perform() method
does not provide the implementor with any information about the object that triggered the
action. 

Now, this was originally by design - the thinking was that it should be possible to execute
an action regardless of the UI element that invoked it. Since actions can potentially be triggered
by multiple elements, they should not generally have a dependency on a particular element.
However, that premise doesn't account for shared actions, or the possibility that the developer
may actually want to execute different action behaviors based on the source value.

In order to resolve this, I think we'll need to add an argument to the perform() method that
identifies the action's source. If we add it to 1.5.2, it will be a breaking API change, which
we generally try to avoid in maintenance releases. However, I have already made one API change
for 1.5.2 (to the ResultList class, to resolve a serious performance issue), so it is not
out of the question. Since this is a major functional limitation, it is probably worth doing.

The only question in my mind is - what should the type of the source argument be? It could
be an Object, but I could also see an argument for making it a Component (Action is defined
in the org.apache.pivot.wtk package, after all).

Thoughts/comments?

Greg

On Sep 9, 2010, at 10:33 AM, Roger L. Whitcomb wrote:

> My application has a large tree in the left-hand side with context menus (different)
on every node of the tree.  So, the context menu actions are highly context-sensitive (the
“Properties” item, obviously, would need to know the exact selected object that the context
menu was brought up on in order to get the right Properties dialog).
>  
> So, my question is:  what is “best practice” as far as Pivot goes in order to transmit
this context into the Action.perform() method?  The “Expenses” tutorial seems to rely
on global variables and using “getSelectedRow” on that TableView object.  So, is this
the best way?  Is there some way I don’t see to get the context directly in the Action object?
>  
> Thanks.
>  
> Roger Whitcomb
> Architect, Engineering
> Ingres Corporation
> roger.whitcomb@ingres.com
>  
> PHONE +1 650.587.5596
> FAX +1 650.587.5550
>  
> www.ingres.com
>  
> This transmission is confidential and intended solely for the use of the recipient named
above. It may contain confidential, proprietary, or legally privileged information. If you
are not the intended recipient, you are hereby notified that any unauthorized review, use,
disclosure or distribution is strictly prohibited. If you have received this transmission
in error, please contact the sender by reply e-mail and delete the original transmission and
all copies from your system.
>  


Mime
View raw message