Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1953
| From | "Bjorn Abelli" <bjorn.abelli@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: One missing link in j |
| Message-ID | <f6ih27$1p6$1@aioe.org> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <Po-dncCH4rhllBHbnZ2dnUVZ_rO3nZ2d@comcast.com> |
| Date | 2011-04-27 15:36 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui,comp.l "Eric Sosman" <esosman@ieee-dot-org.invalid> wrote... > Bjorn Abelli wrote: >> I agree with Oliver that the TableModel should be a "backing unit", >> separate from the user interface, but now I'm not quite sure what you >> mean with "interaction between the user and this [displayed] data". >> >> As far as I'm concerned there is still a difference between the >> possibility to edit displayed data (in the interface) and the >> isCellEditable() in the TableModel; the possibility to affect the >> "backing data". > > If you could change the displayed data without changing > the model's data, in what sense would the model be "backing" > the display? As it's the data "backing" the displayed data, not "being" the displayed data... ;-) In any application using "tabular data", or other types of data for that matter, there are numerous ways of relating the display to that data; when and how changes in the "backing data" should be manipulated, viewed and committed. In that sense, the displayed data could (and maybe even should) be considered a "working copy" of the data provided by the TableModel, but... > If you edit the content of a displayed cell (and the edit > passes whatever validity checks are in force), the table eventually > calls the model's setValueAt() method with the newly-entered data. > It is conceivable that setValueAt() might be a no-op and leave the > model unchanged, but that's a pretty strange thing to do -- if the > table subsequently called getValueAt() on the cell, perhaps during > a repaint while scrolling or something, the edit would "softly and > silently vanish away!" ...in my opinion, a JTable and its TableModel are too tightly coupled. (But that's only my opinion, and it really doesn't bother me that much either). Consider, e.g., a table where possible values in some cells are constrained by values in some other cells in the same table. You have to change all involved values "at the same time", before committing them, which becomes slightly more complicated with this tight coupling. In practice, this makes the TableModel used in a JTable the "working copy" of the data, while the diplayed data becomes a "view of the data in the working copy", which means that you in many cases must have (at least) yet another layer of data, of which the TableModel is the "working copy"... Howevere you look at it, the displayed data and the data provided by the TableModel are still two different things, even considering the "autocommitting" mechanisms coupling the two. /// Bjorn A --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Find similar
One missing link in javax "RC" <rc@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: One missing link in j "Oliver Wong" <oliver.wong@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: One missing link in j "Eric Sosman" <eric.sosman@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: One missing link in j "Oliver Wong" <oliver.wong@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: One missing link in j "Bjorn Abelli" <bjorn.abelli@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: One missing link in j "Martin Gregorie" <martin.gregorie@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: One missing link in j "Judy Szikora" <judy.szikora@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: One missing link in j "Eric Sosman" <eric.sosman@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: One missing link in j "Esmond Pitt" <esmond.pitt@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: One missing link in j "Martin Gregorie" <martin.gregorie@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: One missing link in j "Eric Sosman" <eric.sosman@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: One missing link in j "Bjorn Abelli" <bjorn.abelli@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
csiph-web