The Source for Java Technology Collaboration

Home » java.net Forums » Java Desktop Technologies » SwingLabs

Thread: JXTreeTable vs. Outline

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 9 - Last Post: Jul 9, 2008 5:40 AM by: Kleopatra
Kleopatra
JXTreeTable vs. Outline
Posted: Jun 16, 2008 6:44 AM
  Click to reply to this thread Reply


A couple of weeks ago, Tim Boudreau announced a new stab on a treeTable
component, named Outline (the Netbeans guys don't seem to care about
naming conventions <g>)

http://weblogs.java.net/blog/timboudreau/archive/2008/06/egads_an_actual.html

Naturally, I couldn't resist to give it a closer look :-)

And in fact, it's a huge step into the correct direction:

- identify and extract the bits and pieces from a JTree/BasicTreeUI
which a "TreeTableModel" and its corresponding view need

* AbstractLayoutCache as the (passiv) RowMapper (treepath <--> table row)
* TreePathSupport as the (active) expansion control
* EventBroadcaster as the mapper of tree <--> table events

- make the "TreeTableModel" (aka: OutlineModel) implement both TreeModel
and TableModel. Remember: that's something we tried but never could do
without the bits and pieces. This plus the support for the event mapping
tremendously simplifies any "JXOutline".


On the other hand, I think Tim's assessment of a "perfectly working"
treetable (aka: Outline) component is a bit ... ehem ...
over-optimistic. Apart from the cool separation, the most tricky (and
unstable) hacks are still needed:

- editCellAt tries to decide whether or not a mouseEvent should
expand/collapse. Apart from being the wrong place it re-introduces our
old bug of changing the selection on expand/collapse (remember: we have
TreeTableHacker versions 0...3 - with none being completely successful ;-)

- selection is table-based only: still (?) missing a dedicated
TreeTableSelectionModel, which can take care of the paths. Without, even
a well-behaved expand/collapse control is very difficult to make work
correctly.

- rendering involves custom paintComponent override (in a
DefaultTableCellRenderer, in itself not applicable in SwingX due to its
inherent misbehaviour ;-) to indent the nodes. Treelines are still
missing, but probably could be painted there as well.

IMO, these can be solved cleanly only if the JXOutline/TreeTable
(whatever the name) becomes a full citizen of Swing/X empire, that is
gets its own UIDelegate. That's where mouseEvents should be interpreted
and where the component-level (as opposed to cell-level which is
renderer's responsibility) painting is controlled.

Playing around (relaxing after dutifully bug fixing this morning <g>),
there's some - very raw - code in my incubator (foreign/netbeans).
Comparing Outline- vs. TreeTableModel: it it fairly easy to wrap an
(X)OutlineModel around a SwingX TreeTableModel - a conceptual difference
is that the former (or more precisely its default implementation) forces
the hierarchical column to contain the node, whereas the latter can have
anything in it. Not sure what that restriction should buy. The indent is
done in a Highlighter (wrong place, to be be moved into the ui-delegate
once it is ready) just to see what could be done.

As always, feedback highly welcome!

Jeanette




---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net


Kleopatra
Re: JXTreeTable vs. Outline
Posted: Jun 16, 2008 6:56 AM   in response to: Kleopatra
  Click to reply to this thread Reply


hmm ... just tried to comment Tim's blog with a link to here but got a
"not allowed to post" with my kleopatra id. Never happened before on
java.net - any ideas? Maybe somebody who is has comment-access could
post the link?

Thanks
Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net


hmichel

Posts: 28
Re: JXTreeTable vs. Outline
Posted: Jun 16, 2008 7:58 AM   in response to: Kleopatra
  Click to reply to this thread Reply

Done! :)

Kleopatra
Re: JXTreeTable vs. Outline
Posted: Jun 16, 2008 7:58 AM   in response to: hmichel
  Click to reply to this thread Reply

jdnc-interest@javadesktop.org schrieb:
> Done! :)
>

thanks :-) Any idea why my account isn't good enough for it? Yeah, I was
logged in when I tried.

Cheers
Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net


kschaefe

Posts: 1,662
Re: JXTreeTable vs. Outline
Posted: Jun 16, 2008 9:16 AM   in response to: Kleopatra
  Click to reply to this thread Reply

> thanks :-) Any idea why my account isn't good enough
> for it? Yeah, I was
> logged in when I tried.
You've been marked as a trouble-maker. ;)

Karl

kleopatra

Posts: 1,677
Re: JXTreeTable vs. Outline
Posted: Jun 16, 2008 10:17 AM   in response to: kschaefe
  Click to reply to this thread Reply

> > thanks :-) Any idea why my account isn't good
> enough
> > for it? Yeah, I was
> > logged in when I tried.
> You've been marked as a trouble-maker. ;)

LOL! Probably the blog software doesn't know that I'm paid for that role <g> And right now the forum seems to ignore me as well - don't get anything on the mailinglist.

Have a nice day
Jeanette

Kleopatra
Re: JXTreeTable vs. Outline
Posted: Jun 18, 2008 7:53 AM   in response to: Kleopatra
  Click to reply to this thread Reply

Kleopatra schrieb:
>
> Playing around (relaxing after dutifully bug fixing this morning <g>),
> there's some - very raw - code in my incubator (foreign/netbeans).
> Comparing Outline- vs. TreeTableModel: it it fairly easy to wrap an
> (X)OutlineModel around a SwingX TreeTableModel - a conceptual
> difference is that the former (or more precisely its default
> implementation) forces the hierarchical column to contain the node,
> whereas the latter can have anything in it. Not sure what that
> restriction should buy. The indent is done in a Highlighter (wrong
> place, to be be moved into the ui-delegate once it is ready) just to
> see what could be done.
>
okay, added rendering support - SwingX style which allows highlighter
and WYSIWYM (what you see is what you match) in the near future:

- dedicated OutlinePanel which contains a WrappingIconPanel for the
icon/content of the node, a Filler (= fixed width Box) for indentation
and paints the handle
- OutlinePanelProvider which provides a - surprise <g> - OutlinePanel as
rendering component
- OutlineCellContext which has additional methods to access the indent,
handle

Currently, there is much duplicated code and c&p - but it's just a proof
of concept. Which I'm rather pleased with: a bit shaking of
responsibilities and minor adjustments in our base classes should
greatly enhance its quality.

Enjoy!
Jeanette


---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net


maok

Posts: 1
Re: JXTreeTable vs. Outline
Posted: Jun 19, 2008 8:44 AM   in response to: Kleopatra
  Click to reply to this thread Reply

has anyone managed to use custom renderer/editor for the table part ?

I customized the RowModel in order to use JCheckBoxes and other Components, but I can't check them

I enabled editing for the cells (in the RowModel and the CellEditor), and added an ActionListener, but clicking has no effect besides selecting the row

Kleopatra
Re: JXTreeTable vs. Outline
Posted: Jun 19, 2008 9:38 AM   in response to: maok
  Click to reply to this thread Reply

jdnc-interest@javadesktop.org schrieb:
> has anyone managed to use custom renderer/editor for the table part ?
>
>

never tried - the drive here is not to work with Netbeans Outline but to
create a SwingX JXOutline (names pending) which basically will be filled
by an TreeTableModel, using (and hopefully improving, once I'll
understand them :) the new bits and pieces like eventBroadCaster,
TreePathSupport et al.

If you want to use the Netbeans comp as-is, you'r probably better off
asking in one of the Netbeans forums/lists.

Jeanette


---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net


Kleopatra
Re: JXTreeTable vs. Outline
Posted: Jul 9, 2008 5:40 AM   in response to: Kleopatra
  Click to reply to this thread Reply


Okay, implemented a SwingX variant and started a separate thread:

http://forums.java.net/jive/thread.jspa?threadID=43641&tstart=0

Cheers
Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net





 XML java.net RSS