Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #38645

Re: Displaying a ragged array

From Martin Gregorie <martin@mydomain.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Displaying a ragged array
Date 2018-10-23 21:00 +0000
Organization albasani.net
Message-ID <pqo25e$bhr$1@news.albasani.net> (permalink)
References (5 earlier) <pntsi7$t5j$1@dont-email.me> <pnu278$1o1$1@news.albasani.net> <55787986-dfc9-408b-b592-d3e173b1ba10@googlegroups.com> <pob88f$vhs$1@news.albasani.net> <a5fdaa88-d1a4-4412-8d80-cd010eb6687d@googlegroups.com>

Show all headers | View raw


On Mon, 24 Sep 2018 12:01:06 -0700, Eric Douglas wrote:

Following up: this hasn't had a lot of time spent on it, but I've proved 
to myself that using a JTable doesn't do what I wanted, so I'm using a 
ControlPanel (comes for free with the RiverLayout layout manager from 
datadosen.se). This is used to set up a rectangular grid of EditorFields 
which extend JButton and are initially set to 'invisible'

CSV data is parsed into fields and loaded into an instance of my DataStore 
class. Then a refresh method is called which displays the ragged array by 
loading the fields into left-justified rows of EditorFields. The result 
looks like this:

Line|  1   |  2   |  3   |+|
   1|#|
   2|# Clean CVS input test data|
   3|#|
   4|field1|field2|field3|+|
   5|field4|+|
   6|field5|field6|+|
   7|field7|field8|field9|+|
++|                     

- the Line column and column headings are black on grey.

- comments are white on blue and, in this example, comment lines start 
with a '#'

- Fields with a '+' in them are controls, not data. Clicking on the one
  at the end of the column headings appends a new column Clicking on a
  column heading inserts a new column before the one that was clicked

- The '++' field at the bottom appends a new line if clicked. Clicking a
  line number inserts a new line in front of the one that was clicked

- Clicking the '+' at the end of a data line appends a new field to that
  line. Clicking a field containing data or a column will allow it to be
  edited, deleted or to insert a new field  in that line on front of it.
 
You'll notice that all data fields are aligned in a column which is the 
width of the widest data item in that column while comment lines take up 
as much space as they need without affecting the width of the first field 
in any way and that comment lines can't be extended (no '+] button,
but if a new field is inserted in front of the comment, the line becomes 
a non-comment and behaves like any other data-containing line. You can 
get the same effect by editing the comment to remove its leading marker 
character. Similarly, editing a one field data line and adding a comment 
marker at the front of its only field turns it into a comment line.

Multiple files can be inspected/edited/created in one session.

At present the program displays data as described and saves files but 
doesn't yet accept changes to displayed material or scroll, but I'm now 
happy that the display had the characteristics I wanted and adding 
scrolling and editing will be reasonably straight-forward. 

It loads my 0.5MB CSV files in 2-3 seconds. From launch to displaying the 
sort of small test file shown above is under a second, even with fairly 
extensive diagnostics turned on.


-- 
Martin    | martin at
Gregorie  | gregorie dot org

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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