|Creating multiple objects simultaneously [message #230931]
||Thu, 22 February 2007 21:06
Originally posted by: mspivak.outerbay.com|
I'm writing an app that's a bit different from typical GEF app. In
typical apps (or at least all examples I've seen) user picks a palette
tool, drops a node on the canvas, then picks a connection tool, and
connects the node with another one.
My needs are somewhat different:
1. User right clicks on a node that represents a db table and picks Add
Child from a popup menu.
2. A dialog is posted from which a user picks a valid child table
(validity is determined via some business rules)
3. Dismissing the dlg adds the child table to the diagram and connects
it to the parent from which the dialog was launched.
I got it working so far by making necessary updates to the model inside
the dialog's OK handler. The diagram updates itself when once model
sends out event notification that it changed.
The problem with the above approach is that it bypassed GEF's
EditPolicy/Request/Command infrastructure and I don't have a way to undo
the action. How would I use GEF properly in this case?
I think I need to move model updates to a command to allow for
undo/redo. But how do I create both a node and a connection via a single
request when CreateRequest and CreateConnectionRequest are separate?
Am I on the right track or is there a better way?
Powered by FUDForum
. Page generated in 0.03198 seconds