Good, the data view thing seems to have started getting certain interest, so
there might be hope for its survival :))). Let me make a couple of remarks
called up by the quick peep into the HRDataView. It can be observed the
majority of "comboboxed" (checkbox, radiobutton, list are the flavors) cases
deals with picking one or several data objects (often although not
necessarily corresponding to the records in lookup tables) displayed as
strings to the application users. It almost always works so that however
grand and respectable data objects are there you end up with one line string
keys in a combo box for the user to look at and select from. Since for
really heavy objects many possible variants of such one-liners can be come
up with it may grow to a point of inconsistency (when in different places of
your application an object is displayed in slightly different string
"formats") and spreading the code responsible for the view generation. The
"LookupCache" is all about automation of this fundamental activity. It
maintains the single "library" of dictionaries of the type "string view" ->
data object for use with all those combo boxes, and the main beauty of it is
you have to update the string view only once per object, whenever the object
changes and immediately it becomes available for all the controls relying on
the lookup cache technology. Of course everything is raw to a certain
degree, but the proof of concept is definitely here. The other remark
concerns the formatted input. I put some serious effort to ensure quite
consistent configuration of the formatted table cell editors. Still there
always was and still remains lack of a really decent formatted input fields
(currency, date, numbers) in Swing. As everybody knows JFormattedTextField
does not work smoothly enough (for production apps) out of the box. In my
another project Rowan I tried not without success to solve the problems for
several important cases (Money fields, Date fields, Integer and Decimal
fields of unrestricted length relying completely on BigInteger and
BigDecimal). My envision was to make it (Rowan formatted input facilities) a
foundation for really easy to configure and use Cayenne Data Views, where
you won't have to bother about all those small Swing indecencies, when all
you need is to allow the user simple, reliable, intuitive, and easily
tracked way to fill in a bunch of money values in a currency of choice.
Unfortunately I never have time to integrate them both and lick everything
out for the out-of-the-box usage. More's the pity, taking into account the
"powerlifting" part has been laying accomplished for some time by now. Well,
like I said there is always hope someone would be interested in the approach
and the technique to take a part of it from here. Here I am also sending a
snippet showing one more example of the boilerplate DataView usage.
Andriy
----- Original Message -----
From: "Andrus Adamchik" <andru..bjectstyle.org>
To: <cayenne-use..bjectstyle.org>
Cc: "Andriy Shapochka" <ashapochk..otmail.com>
Sent: Friday, June 18, 2004 8:33 PM
Subject: Re: Data Views
As promised, here is a DataViews example showing how to build a simple
Swing app, configuring combo boxes and tables using DataViews. An app
is a standard Swing MVC application without using any third party MVC
frameworks. While it uses JGoodies forms and plastic look, this is
totally irrelevant for the purpose of DataViews demo. I just needed
decent layout tools. See the README.txt file in the download for
details.
http://objectstyle.org/downloads/cayenne/demos/HRDataView.tar.gz
README.txt mentions a bug that I fixed in DVModeler. In short, if you
want to use "display format" feature, you'll have to wait till
tomorrow's nightly build, or edit XML file by hand as current DVModeler
would corrupt display format settings.
Also, this was my first experience with data views, and I should say I
am impressed! That makes "classic" Swing development with DataObjects
so much easier and consistent.
Andrus
On Jun 16, 2004, at 8:56 AM, sabiha wrote:
> Hi,
>
> I have a swing application working with Cayenne, and by now I used
> swing components, like JTree, and it’s easy to use it with Cayenne
> model, but now I want to use table and I read about Cayenne Data Views
> but can’t figure out how to make it working with that. I saw example
> in User guide but it didn’t help me a lot. I would appreciate if
> someone could briefly just explain me what I need to do to simply
> present attributes of one object in table.
>
>
>
> Thanks a lot
>
>
> Sabiha
This archive was generated by hypermail 2.0.0 : Sun Jun 20 2004 - 05:49:37 EDT