Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #38594
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Displaying a ragged array |
| Date | Mon, 17 Sep 2018 16:00:03 +0200 |
| Organization | A noiseless patient Spider |
| Lines | 45 |
| Message-ID | <pnoc21$ga9$1@dont-email.me> (permalink) |
| References | <pnmkqh$7dp$1@news.albasani.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Mon, 17 Sep 2018 14:00:33 -0000 (UTC) |
| Injection-Info | reader02.eternal-september.org; posting-host="25e9d1d5cbcaa543f5ee701f9cde0c69"; logging-data="16713"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/cSF+ZTxY1s0apFadHD3DV" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
| Cancel-Lock | sha1:vuVOC7gdxPfJSah2+nE+s4KiNuA= |
| In-Reply-To | <pnmkqh$7dp$1@news.albasani.net> |
| X-Antivirus-Status | Clean |
| Content-Language | en-GB |
| X-Antivirus | AVG (VPS 180917-4, 09/17/2018), Outbound message |
| Xref | csiph.com comp.lang.java.programmer:38594 |
Show key headers only | View raw
On 2018-09-17 00:17, Martin Gregorie wrote: > I'm in the process of creating a desktop application to display and edit > data that's best treated as a ragged array of Strings: it is quite > unlikely that all rows in the array will be the same length. > > I've built and debugged a Datastore class to hold it as an ArrayList of > ArrayList<String> - the ArrayList<String> being in a wrapper class > representing a row of fields. The DataStore allows rows, columns and > individual fields to be inserted, deleted, and the fields to be modified. > > Datastore extends AbstractTableModel because I was initially intending to > use a JTable to display and manipulate its contents, but now its > successfully manipulating the ragged array I'm having twinges of doubt > about how whether a JTable can is the best way of displaying it and > allowing it to be viewed and modified, i.e. can a JTable deal successfully > with the missing elements at the end of rows in a ragged array? > > Would I be better off with a custom built structure containing, say, an > array of JButtons to display fields in the ragged array and that can be > clicked to add a field, edit or delete it? > > I'll be very interested to hear how you've handled, or would handle, this > display problem. > > Datastore extends AbstractTableModel I think you should compose, rather than inherit that (i.e. a DatastoreTableModel layer). > can a JTable deal successfully > with the missing elements at the end of rows in a ragged array I don't see why it wouldn't (all you need to do is render missing values properly, see below). Also, will missing elements always be at the end, rather than interspersed? > I'll be very interested to hear how you've handled, or would handle, this > display problem. A _display_ problem I would address at the _rendering_ level, rather than the model level. That is, using the TableCellRenderer and TableCellEditor. -- DF.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Displaying a ragged array Martin Gregorie <martin@mydomain.invalid> - 2018-09-16 22:17 +0000
Re: Displaying a ragged array Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2018-09-17 16:00 +0200
Re: Displaying a ragged array Martin Gregorie <martin@mydomain.invalid> - 2018-09-17 19:32 +0000
Re: Displaying a ragged array Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2018-09-17 23:29 +0200
Re: Displaying a ragged array Martin Gregorie <martin@mydomain.invalid> - 2018-09-17 23:43 +0000
Re: Displaying a ragged array Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2018-09-19 18:12 +0200
Re: Displaying a ragged array Martin Gregorie <martin@mydomain.invalid> - 2018-09-19 17:49 +0000
Re: Displaying a ragged array Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-09-19 14:25 -0400
Re: Displaying a ragged array Martin Gregorie <martin@mydomain.invalid> - 2018-09-19 19:29 +0000
Re: Displaying a ragged array Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2018-09-20 15:30 +0200
Re: Displaying a ragged array Martin Gregorie <martin@mydomain.invalid> - 2018-09-20 15:06 +0000
Re: Displaying a ragged array Eric Douglas <e.d.programmer@gmail.com> - 2018-09-24 08:11 -0700
Re: Displaying a ragged array Martin Gregorie <martin@mydomain.invalid> - 2018-09-24 17:52 +0000
Re: Displaying a ragged array Eric Douglas <e.d.programmer@gmail.com> - 2018-09-24 12:01 -0700
Re: Displaying a ragged array Martin Gregorie <martin@mydomain.invalid> - 2018-10-23 21:00 +0000
Re: Displaying a ragged array Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-09-17 10:17 -0400
Re: Displaying a ragged array Martin Gregorie <martin@mydomain.invalid> - 2018-09-17 19:46 +0000
Re: Displaying a ragged array Martin Gregorie <martin@mydomain.invalid> - 2018-09-17 23:53 +0000
csiph-web