🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #12537

Re: Thoughts/questions/suggestions on JTable/JdbTable and the JBCL datasets

#12537
From: Tommy Cox
Date: Sun, 20 Dec 1998 00:00
45 lines
3085 bytes
I now am finding that a very good way to have implement JBCL datasets with
JTable's is to NOT use JdbTable, but to rather use a combination of JTable,
dbTableColumnModel and dbTableModel. (I think Borland should rename the
latter two to DataSetTableColumnModel and DataSetTableModel!!!!! Btw, just
to maintain good naming convention and not start classes with  lowercase
letters.)

(After extensively working with these dbSwing classes, I think that they
were added in the middle of Sun's development and Borland probably couldn't
do all they wanted with them at the time. Their inclusion is useful and
appreciated, however extremely under-documented.)

Anway, back to the subject at hand, what I have been able to accomplish so
far that I really like better than the JBCL GridControl is to utilize the
combination of JTable, dbTableColumnModel and dbTableModel by doing the
following:

// Create a dbTableModel object and set it to a specific dataset.
// Create a dbTableColumn object and it ties to the same dataset and
automatically creates all your columns for you.
// I delete all the columns I don't want from the dbTableColumn object.
(doesn't delete from dataset, obviously)
// I add any new columns at any position to the column model and since I am
adding them based on the model index in the dbTableModel, that class of
Borlands automatically calls up the right data colum from the dataset.
// Next, bind the column model to the JTable (NOT JdbTable) class.
// Finally put the JTable in a scroll pane created using JTables create
scroll pane method.
// Add JTable to a visual container, and voila!  - A data grid browser using
JTable, not JdbTable.

Conclusions so far..
When you do this, modifications to the dataset are AUTOMATICALLY notified
and reflected in the table. I just added a row to the dataset and the table
was properly notified and automatically updated. Deleting rows works well
also. Only thing that doesn't work is that the dataset is not automatically
notified of changes in the visual table. Currently I only need a record
level editor in a separate dialog, so I just do a
ataSetobj.goToRow( jTableObj.getSelectedRow() ) to position the dataset
properly before invoking my record level dialog box. Any suggestions as to
which events or notifications could be used to make the dataset or data
model rather, track the position changes of the currently selected row in
the visual table would be welcome. In the meantime, I am proceeding, as is.

tommycox@mindspring.com
Technical Details
Message-ID: <75j3lp$5ge7@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <75i3vf$5ga1@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,51ccef507dd075d3
X-Google-Attributes: gid111d45,public
From: "Tommy Cox" <tommycox@ameasysoft.com>
Subject: Re: Thoughts/questions/suggestions on JTable/JdbTable and the JBCL datasets
Date: 1998/12/20
Message-ID: <75j3lp$5ge7@forums.borland.com>
X-Deja-AN: 424213433
References: <75i3vf$5ga1@forums.borland.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing