Open BenBE opened 6 years ago
I will have a look at that.
Hello,
Sorry, I've been quite busy IRL... Still, would https://github.com/nikiroo/jexer/tree/ttable (far from done, it's still a WIP) looks more or less like what you were expecting that change to become?
Note, it's currently not usable: it is still not possible to select a row nor to add actions, and I still haven't added the jDoc (SHAME!).
But if you have any note to swap about the implementation (since it seems you gave some thought to it), I'm interested.
Thanks, Niki
I know this feeling; not too different around here. :) I had a short look at the for patches and only noticed one minor wording issue bit skimming over the code. Will have to actually implement some bigger test case against the interface to tell for sure, but the direction looks good on first glance; probably some kinks here and there that will need some tweaking.
Ok, I finally had some time to work on this (I actually saw the message from the other thread before this one... shame on me).
I did indeed rename lines
to rows
, it seems better.
I also adopted a JModel approach, and allowed for a separate renderer.
It works well for text (with colours and such), and seems mostly OK for widgets (still have some problems when moving with the hscroller, the content is visible outside of the window).
I still need to implement 2 things though:
Both branches are up to date (ttable
and ttable_pull
) but the second one has 4 simple commits and is upstream-updated.
If you have notes regarding the current status, feel free to share!
(Sorry for the long delay, I was very busy IRL, though I have slightly moer time now -- my old eeePC is now back to work, so I can code when commuting to work.)
Would be nice if the view of the table and the data model for it could be separated. For an example of what I mean you might want to have a look at javax.swing.JTable and its use of TableModel and TableCellRenderer classes.
What this separation allows is for the TTable to be backed by a simple list of Model objects (e.g. each representing a file copy operation in progress) with one of the columns represented by some TProgressBar object instead of normal labels. The current design somewhat blocks this usecase for multiple reasons:
To make this change possible each access to the lines [sic] field should at least be wrapped by some "getObjectForCell" (JTableModel.getValueAt) call.