Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Data Binding - how to track if a form is dirty
Data Binding - how to track if a form is dirty [message #323754] Mon, 07 January 2008 12:50 Go to next message
Eclipse UserFriend
Originally posted by: jkosmoski.snotmail.com

New to Data Binding and I'm using it to bind a simple form to a simple
model.
I want to track when anything in the model has changed and thus the form is
dirty and needs to be saved.

There appear to be several ways one could do this, but I suspect there is a
proper/best way that I have been unable to figure out.
Any help/hints would be much appreciated. Thanks, - Jon
Re: Data Binding - how to track if a form is dirty [message #323772 is a reply to message #323754] Tue, 08 January 2008 09:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wjancz(at).gmail(dot).com

> New to Data Binding and I'm using it to bind a simple form to a simple
> model.
> I want to track when anything in the model has changed and thus the form
> is dirty and needs to be saved.
>
> There appear to be several ways one could do this, but I suspect there is
> a proper/best way that I have been unable to figure out.
> Any help/hints would be much appreciated. Thanks, - Jon

Data binding uses setters for setting values.
1) modify your setters to set your dirty flag and then firepropertychange
IEditorPart.PROP_DIRTY to notify editor for refresh
2) use AspectJ and create pointcut around setters which do the same thing
like 1)

...::WojT::..
Re: Data Binding - how to track if a form is dirty [message #323773 is a reply to message #323754] Tue, 08 January 2008 09:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Jon Kosmoski wrote:
> New to Data Binding and I'm using it to bind a simple form to a simple
> model.
> I want to track when anything in the model has changed and thus the form is
> dirty and needs to be saved.
>
> There appear to be several ways one could do this, but I suspect there is a
> proper/best way that I have been unable to figure out.
> Any help/hints would be much appreciated. Thanks, - Jon

If you use EMF to generate your model code, you can use EMF.edit
EditingDomain to funnel model changes and it manages dirty state
automatically (as well as undo/redo).
If you're not already using EMF then it can be a heavy-weight option
just to get dirty state tracking, though. If you don't need anything
else that EMF provides I'd suggest you roll your own dirty management.

Hope this helps,
Eric
Re: Data Binding - how to track if a form is dirty [message #323793 is a reply to message #323754] Tue, 08 January 2008 15:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lgojniczek.spetech.com.pl

Jon Kosmoski pisze:
> New to Data Binding and I'm using it to bind a simple form to a simple
> model.
> I want to track when anything in the model has changed and thus the form is
> dirty and needs to be saved.
>
> There appear to be several ways one could do this, but I suspect there is a
> proper/best way that I have been unable to figure out.
> Any help/hints would be much appreciated. Thanks, - Jon
I have got the same problem, can't figure out how to make it works
Im using Hibernate as a ORM layer, anybody help?
regards
Re: Data Binding - how to track if a form is dirty [message #323794 is a reply to message #323793] Tue, 08 January 2008 16:52 Go to previous messageGo to next message
Eclipse UserFriend
It's fairly simple. You simply need to record changes by attaching
yourself as change listener to your model objects.

Or if you don't want to write this your own use EMF which provides
EditingDomain or at a lower level ChangeRecorder. I'm planning to
provide this feature as part of my OSS-Lib UFace
(http://code.google.com/p/uface/). It's on my todo list for the next
weeks ;-) so if you subscribe to the google-groups you'll get informed
when something is available.

Tom

Leszek Gojniczek schrieb:
> Jon Kosmoski pisze:
>> New to Data Binding and I'm using it to bind a simple form to a simple
>> model.
>> I want to track when anything in the model has changed and thus the
>> form is dirty and needs to be saved.
>>
>> There appear to be several ways one could do this, but I suspect there
>> is a proper/best way that I have been unable to figure out.
>> Any help/hints would be much appreciated. Thanks, - Jon
> I have got the same problem, can't figure out how to make it works
> Im using Hibernate as a ORM layer, anybody help?
> regards


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Data Binding - how to track if a form is dirty [message #323897 is a reply to message #323754] Fri, 11 January 2008 09:36 Go to previous message
Eclipse UserFriend
Originally posted by: bokowski.ca.ibm.com

This functionality really belongs in your model layer (as does undo/redo),
as others have pointed out, and using EMF is definitely worth considering.

If your model layer cannot help you with this, a workaround might be to
track changes to all the model objects in a certain data binding context.
Have a look at WizardPageSupport.uiChangeListener, it does something similar
for the UI side of things to avoid having wizard pages that start in an
error state.

Boris

"Jon Kosmoski" <jkosmoski@snotmail.com> wrote in message
news:fltopq$t8d$1@build.eclipse.org...
> New to Data Binding and I'm using it to bind a simple form to a simple
> model.
> I want to track when anything in the model has changed and thus the form
> is dirty and needs to be saved.
>
> There appear to be several ways one could do this, but I suspect there is
> a proper/best way that I have been unable to figure out.
> Any help/hints would be much appreciated. Thanks, - Jon
>
Previous Topic:providing a progress dialog for nested jobs
Next Topic:Clear Bold Tab Highlight (warnOfContentChange)
Goto Forum:
  


Current Time: Fri Jul 18 15:50:09 EDT 2025

Powered by FUDForum. Page generated in 0.50163 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top