Skip to main content

Some experiments ...

9 replies [Last post]
kleopatra
Offline
Joined: 2003-06-11
Points: 0

... to tackle a couple of issues that popped up in the past and raised my interest.

http://swingempire.de/palace/jdnc/download/experiments.zip

Yeah, it's a pain to have a zip on my site instead of pulling from cvs at javadesktop - but somebody at Sun needs to be punched for that nuisance ... I'm always quick to point fingers :) And beware! Everything is very raw, unordered and unstripped - best to start with the examples (in de.kleopatra.jdnc) and then crawl from there - don't forget to read the comments, they sometimes warn about the deeper pits To compile, you'll need a fairly current version of JGoodies Binding and make BindingBorder public. To run correctly in all aspects, issues 78 and 86 need to be fixed.

DataModel

Personnally, I like the abstraction as is: It's main responsibility is "record level" - providing generic access to named parts of that record and notify about any changes in them. It has a notion of being contained somewhere which is weak - I see this weakness as a strength because the "container" can be anything. To illustrate my view of it:

http://swingempire.de/palace/jdnc/images/DataModel.png

As DataModel is nicely bounded, simple and complete - as far as the record-targeted functionality goes - the part labeled as "Controlling Model" in the diagram should not be moved into the DataModel, doing so will blur the boundaries of DataModel's responsibilities considerably.

So I tried to exercise the DataModel with the lessons learnt from Goodies Binding: If you have a XXModel to generically access arbitrary objects by name then think, eat and breathe that XXModel - in code that's equivalent to nest and chain XXModels.

One output is a changed implementation of TabularDataModelAdapter (see XTabularDataModelAdapter) which delegates to a DataModel to handle the value/notification specifics and concentrates on being the middle woman between the adaptee and that background working horse. Now adapting different data sources is simplified because it mostly only needs to provide the adaptee specifics - examples are XAdapter.

Another output is the ControllingDataModel (yeah, it shows again, I'm not too good with names...). The primary point is that it exposes the data source, the adapter and the selection as _values_ (and of course is responsible for keeping them reasonably in synch). Now clients can access them generically. Yes, some like TableBinding/ListBinding have to know what to expect - but that's general enough (we gave up type safety anyway). The examples of using them are ControllingXXOverview - they will create a nested form with the overview on the main and the details on a subform.

Just to be clear: I don't say that there is no need for a "unified notifying collection model with generic cell access" (though I'm not overly optimistic about the outcome - Einstein was kind of unhappy ever since he started hunting for the "unified field-theory" :-) - I only would like to explore the current possibilities in depth before moving on.

JGoodies Binding

The thing I tried was to use it interchangeably in the context of jdnc. DataModel and ValueModel are similar enough to do so - the similarity being the generic access. DataModel and BeanAdapter/PresentationModel are similar in that they handle a collection of "properties". The distinction comes at the precise moment when actually transfering data from a XXModel to/from a component, the former being a strict push/pull while the latter is direct synchronization by default.

It's straightforward to support the jdnc way with goodies binding (the ValueModelBinding internally uses a BufferedValueModel to mimic it). The advantage of using them in that way is that the framework comes with many (and thoroughly tested) adapters which support most of the swing widgets (examples and serving classes either start with a "G" or contain "Value" in the name)

And open question is how are the plans to support direct synchronization (f.i. field level) in jdnc? Technically I could call a binding.push() any time - but currently there's nothing that triggers it automatically. Can imagine something equivalent to AUTO_VALIDATE, f.i.

As a side-effect I refactored the component/binding creation a bit - just one way of making it easier to plug-in custom components/bindings.

Comments, opinions, critics? I'll take the blame :-)

Greetings
Jeanette

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Kleopatra

>
> Yeah, it's a pain to have a zip on my site instead of pulling from cvs at javadesktop -

Just to let you know: I moved everything to the incubator.

BTW, any conventions where to put documentation? For now I created a
www/documentation/kleopatra dir (not that there's much to see :-)

Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

rbair
Offline
Joined: 2003-07-08
Points: 0

Hey Jeanette,

I just checked out your code from CVS, looking forward to playing around with it. In particular, I have a master/detail demo in src/demo/org/jdesktop/jdnc/incubator/rbair/masterdetail that I'm going to try to adapt to use your binding ideas. I'll let you know how it goes.

Rich

rbair
Offline
Joined: 2003-07-08
Points: 0

Jeanette,

I'm getting a load of exceptions in your incubator code. It looks like it is dependent on jdnc-proper? Also, it looks like it needs some stuff from jgoodies bindings(?). Is there a jar or something for the jgoodies stuff?

Richard

Kleopatra

Richard,

I'm on the way into my bed :-)

>
> I'm getting a load of exceptions in your incubator code. It looks like it is dependent on jdnc-proper?

Yes, it does - seemed like a valid pre-requisitive, or isn't it?

> Also, it looks like it needs some stuff from jgoodies bindings(?). Is there a jar or something for the jgoodies stuff?
>

Yeah, some demos/DataModel implementations need JGoodies Binding - it's
where I come from :-) But ... all (hopefully it's complete) jars needed
besides jdnc are in the /kleopatra/lib. Please let me
know, if it doesn't work for you, I'll try to find out what I
overlooked.

Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

rbair
Offline
Joined: 2003-07-08
Points: 0

Hey Jeanette,

I had a hard time following your post, probably because I'm not very familiar with Karsten's binding framework. I know its bad form to not do my homework, but with the JDNC master/detail stuff swirling around (and my regular job!) I just don't have time. Could you quickly summarize the difference between the JDNC binding framework and the JGoodies framework? Where is JDNC lacking, exactly? What are we trying to fix?

I guess I'm afraid of complicating what seems like a simple idea. My only pet peeve with the JDNC binding is trying to remember the difference between "push" and "pull" :).

Richard

Kleopatra

jdnc-interest@javadesktop.org wrote:
>
> Hey Jeanette,
>
> I had a hard time following your post, probably because I'm not very familiar with Karsten's binding framework. I know its bad form to not do my homework, but with the JDNC master/detail stuff swirling around (and my regular job!) I just don't have time. Could you quickly summarize the difference between the JDNC binding framework and the JGoodies framework? Where is JDNC lacking, exactly? What are we trying to fix?

Well, the comparing stuff to goodies binding is only a minor part of it
- basically I'm trying out how far I can stretch the DataModel to do the
work at hand.

My approach in experimenting differs from yours in that I leave the
DataModel "as-is" (at least for now) and test the boundaries - bumping
my a head a lot :-) And I'm not soo quick - did not touch master/detail
yet - but exploring "overview/detail".

My gut has a strong aversion against enhancing the "collection-ness" of
DataModel, I'm groping more along the lines of keeping things more
decoupled:

"Master/??" --> "Overview/Collection-like" --> "Detail/Record-like"

Currently a DataModel is somewhere between the latter two with a strong
bias towards the last. In this triade I would put the responsibility for
adding/removing and synchronizing with Detail into the middle. Generally
that's a tricky business in itself, tagging records by "index" might not
be strong enough to guarantee proper notifications into both directions.
A "Master" probably is both, changing the contents of the Overview
according to internal state ... but I start burbling, will go back to
work for now

Greetings
Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

rbair
Offline
Joined: 2003-07-08
Points: 0

> My approach in experimenting differs from yours in
> that I leave the
> DataModel "as-is" (at least for now) and test the
> boundaries - bumping
> my a head a lot :-) And I'm not soo quick - did not
> touch master/detail
> yet - but exploring "overview/detail".

Ya, that is a different angle all right :). I'm fuzzy on what you mean by "overview/detail", I haven't heard that phrase before.

Richard

Kleopatra

>
> Ya, that is a different angle all right :). I'm fuzzy on what you mean by "overview/detail", I haven't heard that phrase before.
>

Could well be - took it from Karsten's binding tutorial :-) In that
nomenclature all so-called "masterDetail" examples in jdnc demos would
be "overview-detail" - some collection view (a list, combo, table)
having all records with some subset or summary representation and the
detail showing all the fields of the currently "selected".

Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Amy Fowler

Jeanette,

[as usual] I like the track you are on here -- unfortunately I can't
take a detailed look at your experiments until early next week, but it
will be my top priority and I owe you a detailed response.
I'm quite energized by all the excitement/discussion/mind-melding
around data-binding...

Aim

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net