Home » Archived » Visual Editor (VE) » Action objects
Action objects [message #4195] |
Mon, 24 November 2003 06:39  |
Eclipse User |
|
|
|
Maybe I'm missing something completely obvious here....
Really impressed with the work so far, but I've one item that I can't get
straight.
Is it possible (easily) to manage Action objects for tying in with the
controls. If I have some existing Action objects in my code, can I
associate them with the visual controls?
Using the existing builder, I can easily create an 'actionPerformed' stub.
Is it possible to create an actionPerformed on an Action object (so the
builder will create the action object and write the actionPerformed stub
within that (and make the control use the Action object).
If I'm missing the point here, then let me know (I'm a bit of a newbie
with the GUI side of things, but coming 'late to the party' I've just
always been used to writing Action objects to deal with the control
processing).
|
|
|
Re: Action objects [message #4475 is a reply to message #4195] |
Mon, 24 November 2003 11:40   |
Eclipse User |
|
|
|
Gary,
I assume you mean javax.swing.Action.
> Is it possible (easily) to manage Action objects for tying in with the
> controls. If I have some existing Action objects in my code, can I
> associate them with the visual controls?
Currently... this is not easily done in the Visual Editor because we depend
on objects that derive from java.awt.Component in order to render them in
the remote VM. Also the VE architecture limits the use of one graphical
object per model which doesn't allow you to have multiple actions for the
same component (I think it will reflect the first one found and the others
will not be modeled). An example of this would be the reuse of a specific
button on a toolbar, popup menu, and from a menu on the menubar.
We have put in a bit of code to allow you drop actions onto a JToolBar in
the graph viewer and beans viewer, and/or dropping actions onto a JMenu or
JPopupMenu in the Beans viewer only. For the actions dropped onto the
JToolBar, we reflect the actual image of what's in the VM back into the
graph viewer but you can't select it here... you must select it in the beans
viewer (the VE doesn't have GEF objects in the graph viewer to handle
these). In the beans viewer you can reorder the actions and the graph viewer
will reflect the changes.
> Using the existing builder, I can easily create an 'actionPerformed' stub.
> Is it possible to create an actionPerformed on an Action object (so the
> builder will create the action object and write the actionPerformed stub
> within that (and make the control use the Action object).
Since an Action is really just an interface, we don't have a way of
instrospecting it and reflecting properties in the property sheet or showing
the events in the events dialog.
I would recommend opening a bug in bugzilla to reflect your requirements for
the full use of Actions in the VE.
Regards....
Peter Walker
"Gary" <gmcwilliams@yahoo.co.uk> wrote in message
news:bpsqkm$4ni$1@eclipse.org...
> Maybe I'm missing something completely obvious here....
>
> Really impressed with the work so far, but I've one item that I can't get
> straight.
>
> Is it possible (easily) to manage Action objects for tying in with the
> controls. If I have some existing Action objects in my code, can I
> associate them with the visual controls?
> Using the existing builder, I can easily create an 'actionPerformed' stub.
> Is it possible to create an actionPerformed on an Action object (so the
> builder will create the action object and write the actionPerformed stub
> within that (and make the control use the Action object).
>
> If I'm missing the point here, then let me know (I'm a bit of a newbie
> with the GUI side of things, but coming 'late to the party' I've just
> always been used to writing Action objects to deal with the control
> processing).
>
>
>
>
|
|
|
Re: Action objects [message #5160 is a reply to message #4195] |
Tue, 25 November 2003 07:18   |
Eclipse User |
|
|
|
Hi Gary,
> Is it possible (easily) to manage Action objects for tying in with the
> controls. If I have some existing Action objects in my code, can I
> associate them with the visual controls?
Thoughts,
you can do this right now just by entering a set method, e.g.
jButton1.setAction(new MyAction());
There's no reason why you can't do this in code right now as the visual editor
is source centric and we won't overwrite the change, but it'd be nice if there
was a good UI way of doing this.
One idea we have toyed with is the idea of doing this kind of association
through the property sheet. It's kind of already there for things like color,
font, etc... We hide action as a property but if we surfaced it what would
the experience be ?
1 - We could have a property editor that gave a drop down list of other
action objects that existed on the canvas. This way you'd subclass Action to
create your own class, drop it as a non-visual, and then make the association
using the property editor.
2 - We could have the property editor select a list of known classes
implementing the interface, let you pick one, let you select constructor
arguments and then write the code. The problem with this is that it doesn't
lead to using shared action objects as easily as 1)
Do either/both of these sound like good ideas or the sort of thing you're
looking for ?
Best regards,
Joe
|
|
|
Re: Action objects [message #5228 is a reply to message #5160] |
Tue, 25 November 2003 09:11   |
Eclipse User |
|
|
|
Guys, thanks for the replies.
I don't feel that I have the necessary experience to determine if anything
suggested would be 'good'. As I said, I'm a bit of a GUI newbie (I've been
mostly writing services code sitting behind RMI interfaces, so have been
quite sheltered). However, following examples I've gotten (from the web
and from other internal developments here) it does seem that the Action
interface approach is an elegant implementation of dealing with interface
commands, and this is what I've been doing so far.
Peter's reply has given me a better understanding of where the current
implementation lies, which was helpful for my own understanding.
I'd not looked at using the setAction method (silly of me really). If I
change the jButton constructor to take an Action object it just breaks
everything (can no longer display the visual builder), so I'd just done
that and given up. Now that this has been pointed out, I can get on and
use my Actions as appropriate, so thanks for that.
Looking at the options 1 & 2 below, from my own perspective, option 1
appears to be a good fit. I can write the Action implementations and then
associate these actions with the necessary GUI components. Sharing the
actions is really what I'm after.
Joe Winchester wrote:
> Hi Gary,
> > Is it possible (easily) to manage Action objects for tying in with the
> > controls. If I have some existing Action objects in my code, can I
> > associate them with the visual controls?
> Thoughts,
> you can do this right now just by entering a set method, e.g.
> jButton1.setAction(new MyAction());
> There's no reason why you can't do this in code right now as the visual
editor
> is source centric and we won't overwrite the change, but it'd be nice if
there
> was a good UI way of doing this.
> One idea we have toyed with is the idea of doing this kind of association
> through the property sheet. It's kind of already there for things like
color,
> font, etc... We hide action as a property but if we surfaced it what would
> the experience be ?
> 1 - We could have a property editor that gave a drop down list of other
> action objects that existed on the canvas. This way you'd subclass Action to
> create your own class, drop it as a non-visual, and then make the association
> using the property editor.
> 2 - We could have the property editor select a list of known classes
> implementing the interface, let you pick one, let you select constructor
> arguments and then write the code. The problem with this is that it doesn't
> lead to using shared action objects as easily as 1)
> Do either/both of these sound like good ideas or the sort of thing you're
> looking for ?
> Best regards,
> Joe
|
|
|
Re: Action objects [message #5518 is a reply to message #5228] |
Tue, 25 November 2003 10:13  |
Eclipse User |
|
|
|
Gary,
I should say that for a "GUI newbie " you learn fast.
Sharing Action instance is exactly the reason why this class exists, and
it's IMHO the proper way to develop profesional looking GUI.
I too would share your support of the first option (i.e. use an dedicated
property editor to use non-visual beans dropped on the canvas).
--
Cordialement / Best regards
=======================================================
S
|
|
|
Re: Action objects [message #568814 is a reply to message #4195] |
Mon, 24 November 2003 11:40  |
Eclipse User |
|
|
|
Gary,
I assume you mean javax.swing.Action.
> Is it possible (easily) to manage Action objects for tying in with the
> controls. If I have some existing Action objects in my code, can I
> associate them with the visual controls?
Currently... this is not easily done in the Visual Editor because we depend
on objects that derive from java.awt.Component in order to render them in
the remote VM. Also the VE architecture limits the use of one graphical
object per model which doesn't allow you to have multiple actions for the
same component (I think it will reflect the first one found and the others
will not be modeled). An example of this would be the reuse of a specific
button on a toolbar, popup menu, and from a menu on the menubar.
We have put in a bit of code to allow you drop actions onto a JToolBar in
the graph viewer and beans viewer, and/or dropping actions onto a JMenu or
JPopupMenu in the Beans viewer only. For the actions dropped onto the
JToolBar, we reflect the actual image of what's in the VM back into the
graph viewer but you can't select it here... you must select it in the beans
viewer (the VE doesn't have GEF objects in the graph viewer to handle
these). In the beans viewer you can reorder the actions and the graph viewer
will reflect the changes.
> Using the existing builder, I can easily create an 'actionPerformed' stub.
> Is it possible to create an actionPerformed on an Action object (so the
> builder will create the action object and write the actionPerformed stub
> within that (and make the control use the Action object).
Since an Action is really just an interface, we don't have a way of
instrospecting it and reflecting properties in the property sheet or showing
the events in the events dialog.
I would recommend opening a bug in bugzilla to reflect your requirements for
the full use of Actions in the VE.
Regards....
Peter Walker
"Gary" <gmcwilliams@yahoo.co.uk> wrote in message
news:bpsqkm$4ni$1@eclipse.org...
> Maybe I'm missing something completely obvious here....
>
> Really impressed with the work so far, but I've one item that I can't get
> straight.
>
> Is it possible (easily) to manage Action objects for tying in with the
> controls. If I have some existing Action objects in my code, can I
> associate them with the visual controls?
> Using the existing builder, I can easily create an 'actionPerformed' stub.
> Is it possible to create an actionPerformed on an Action object (so the
> builder will create the action object and write the actionPerformed stub
> within that (and make the control use the Action object).
>
> If I'm missing the point here, then let me know (I'm a bit of a newbie
> with the GUI side of things, but coming 'late to the party' I've just
> always been used to writing Action objects to deal with the control
> processing).
>
>
>
>
|
|
|
Re: Action objects [message #569045 is a reply to message #4195] |
Tue, 25 November 2003 07:18  |
Eclipse User |
|
|
|
Hi Gary,
> Is it possible (easily) to manage Action objects for tying in with the
> controls. If I have some existing Action objects in my code, can I
> associate them with the visual controls?
Thoughts,
you can do this right now just by entering a set method, e.g.
jButton1.setAction(new MyAction());
There's no reason why you can't do this in code right now as the visual editor
is source centric and we won't overwrite the change, but it'd be nice if there
was a good UI way of doing this.
One idea we have toyed with is the idea of doing this kind of association
through the property sheet. It's kind of already there for things like color,
font, etc... We hide action as a property but if we surfaced it what would
the experience be ?
1 - We could have a property editor that gave a drop down list of other
action objects that existed on the canvas. This way you'd subclass Action to
create your own class, drop it as a non-visual, and then make the association
using the property editor.
2 - We could have the property editor select a list of known classes
implementing the interface, let you pick one, let you select constructor
arguments and then write the code. The problem with this is that it doesn't
lead to using shared action objects as easily as 1)
Do either/both of these sound like good ideas or the sort of thing you're
looking for ?
Best regards,
Joe
|
|
|
Re: Action objects [message #569067 is a reply to message #5160] |
Tue, 25 November 2003 09:11  |
Eclipse User |
|
|
|
Guys, thanks for the replies.
I don't feel that I have the necessary experience to determine if anything
suggested would be 'good'. As I said, I'm a bit of a GUI newbie (I've been
mostly writing services code sitting behind RMI interfaces, so have been
quite sheltered). However, following examples I've gotten (from the web
and from other internal developments here) it does seem that the Action
interface approach is an elegant implementation of dealing with interface
commands, and this is what I've been doing so far.
Peter's reply has given me a better understanding of where the current
implementation lies, which was helpful for my own understanding.
I'd not looked at using the setAction method (silly of me really). If I
change the jButton constructor to take an Action object it just breaks
everything (can no longer display the visual builder), so I'd just done
that and given up. Now that this has been pointed out, I can get on and
use my Actions as appropriate, so thanks for that.
Looking at the options 1 & 2 below, from my own perspective, option 1
appears to be a good fit. I can write the Action implementations and then
associate these actions with the necessary GUI components. Sharing the
actions is really what I'm after.
Joe Winchester wrote:
> Hi Gary,
> > Is it possible (easily) to manage Action objects for tying in with the
> > controls. If I have some existing Action objects in my code, can I
> > associate them with the visual controls?
> Thoughts,
> you can do this right now just by entering a set method, e.g.
> jButton1.setAction(new MyAction());
> There's no reason why you can't do this in code right now as the visual
editor
> is source centric and we won't overwrite the change, but it'd be nice if
there
> was a good UI way of doing this.
> One idea we have toyed with is the idea of doing this kind of association
> through the property sheet. It's kind of already there for things like
color,
> font, etc... We hide action as a property but if we surfaced it what would
> the experience be ?
> 1 - We could have a property editor that gave a drop down list of other
> action objects that existed on the canvas. This way you'd subclass Action to
> create your own class, drop it as a non-visual, and then make the association
> using the property editor.
> 2 - We could have the property editor select a list of known classes
> implementing the interface, let you pick one, let you select constructor
> arguments and then write the code. The problem with this is that it doesn't
> lead to using shared action objects as easily as 1)
> Do either/both of these sound like good ideas or the sort of thing you're
> looking for ?
> Best regards,
> Joe
|
|
|
Re: Action objects [message #569130 is a reply to message #5228] |
Tue, 25 November 2003 10:13  |
Eclipse User |
|
|
|
Gary,
I should say that for a "GUI newbie " you learn fast.
Sharing Action instance is exactly the reason why this class exists, and
it's IMHO the proper way to develop profesional looking GUI.
I too would share your support of the first option (i.e. use an dedicated
property editor to use non-visual beans dropped on the canvas).
--
Cordialement / Best regards
=======================================================
S
|
|
|
Goto Forum:
Current Time: Sat Jun 07 18:02:09 EDT 2025
Powered by FUDForum. Page generated in 0.25165 seconds
|