|Multiple creation factories for tool palette entries [message #139306]
||Tue, 22 June 2004 14:16
Originally posted by: invalid.soft-gems.net|
In my GEF editor I have a palette with a couple of tool entries created as
CombinedTemplateCreationEntry, which take a creation factory to create a
new instance of the tool each time the user selects the tool entry.
Unfortunately, due to restrictions for my application I have to use one
tool for two different actual target classes. The character of the target
class depends on the container it is placed in. My problem is now that the
new tool element is created already when the tool palette is clicked on
and does not change anymore when the mouse pointer is dragged arround.
I can fake one type to be the other one to have the drag operation
accepted and would need to create the other type whenever my create
command is created and I have this special case. However this seems like a
ugly hack to me and I would rather tell during the drag (or at least after
the drop) operation, which element I really need.
Can somebody help to solve that problem?
|Re: Multiple creation factories for tool palette entries [message #139647 is a reply to message #139580]
||Wed, 23 June 2004 14:20
Originally posted by: none.us.ibm.com|
You'll have to promote it in a subclass. There is concern with accessing
the factory directly because each EditPolicy could get the factory, and ask
it to create a new object. This pattern fails when 2 or more editpolicies
need to contribute to a command during creation. If they both obtain a new
object, they will not be acting on the same object. But, if they use the
CreateRequest, the object is created once and cached by the request.
Can you use setFactory? Or will the tool overwrite your change?
"Mike Lischke" <email@example.com> wrote in message
> Randy Hudson wrote:
> > Get the factory from the CreateRequest, and flip a switch on it based on
> > what you need to create.
> I should mention, though, that getFactory() protected is, while setFactory
> is public. I wonder how I am supposed to access the factory. Why is the
> getter protected?
Powered by FUDForum
. Page generated in 0.02156 seconds