cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lawrence Gerstley <lawg...@gmail.com>
Subject Proper use of nesting DataContexts in RCP
Date Fri, 12 Dec 2008 05:26:21 GMT
Hello,

I've been using Cayenne quite successfully for sometime in creating my  
Eclipse RCP applications, but there is something that has flummoxed me  
for sometime, and was wondering about best practices. I've been  
creating a childDataContext (let's call in EDITORCHILDCTXT) every time  
I open up an EditorPart, so that it can use the Eclipse dirty/save  
model. This works fine, but a problem arises when I have dialogs in  
the editor. If I was editing, say, an ontological concept--let's call  
in CONCEPT, and it has 0-many PROPERTY, I might have a dialog window  
pop-up to create that property. The first thing I want to do in such a  
dialog is to create a CANDIDATE_PROPERTY, and add it to CONCEPT1. To  
do this, I would create a childDataContext (called DIALOGCHILDCTXT) as  
a child of EDITORCHILDCTXT.

Now, ideally, I'd create and register a new PROPERTY and add it to the  
CONCEPT1 (something like "addToConceptProperties"). The problem, of  
course, is that the newly created PROPERTY1 is in DIALOGCHILDCONTEXT,  
and CONCEPT1 is in EDITORCHILDCTXT. The desired behavior is to be able  
to use a <Cancel> button in the dialog, rollback and close  
DIALOGCHILDCONTEXT, losing the PROPERTY information, but leaving any  
changes to CONCEPT1 in EDITORCHILDCTXT intact, and commit only if the  
user confirms a save in that editor.

Now, I don't think that I want to move CONCEPT1 to the  
DIALOGCHILDCONTEXT when I open the dialog--doesn't that mean that I'd  
have to move it back when I close said dialog? Or do I want to get  
another copy of CONCEPT1 in the DIALOGCHILDCTXT to use for the  
addition of the new PROPERTY, and if I do that, how can I inform  
CONCEPT1 in the EDITORCHILDCTXT that it has a new PROPERTY, but not  
lose any of its other changes? Or, does this type of paradigm just not  
work here? Or, finally, am I just missing something terribly obvious,  
and have made a fool of myself. :)

I've gone back and read some of your 2007 discussions about connecting  
relationships between different contexts, and combed through the  
documentation, but really can't determine how to do this without  
forcing premature commits, breaking the editor dirty/save paradigm. If  
you have any thoughts, I'd love to hear them!

Many thanks,

Lawrence
==================================
lawgers@gmail.com





Mime
View raw message