Skip to main content

RE: Setting editor/renderer for JTreeTable

1 reply [Last post]
Anonymous

Im building a more graphical treetable. So I want to change the entire UI of the tree table. I would rather not deal with the minutae of replacing the entire renderer editor situation, but I don't see
a way around it. And the UI changes go beyond icons. For example, I do row gradiation from top to bottom in my tables, and I need to do the same in the treetable. Currently, the gradiatin is working
through custom renderers in the rest of the treetable, but needs to work in the tree part as well.

Does that give you some ideas? If not I can put up some screenshots or something.

-jonathan

-----Original Message-----
From: jdnc-interest@javadesktop.org [mailto:jdnc-interest@javadesktop.org]
Sent: Wednesday, July 28, 2004 4:34 PM
To: jdnc@jdnc.dev.java.net
Subject: Re: Setting editor/renderer for JTreeTable

> I'm trying to switch my old JTreeTable code out for
> the new JDNC stuff. Im having trouble setting a new
> editor/renderer for the tree.

Do you have a custom tree cell renderer and editor with specialized needs? If so, we'd like to know.

The new treetable design treats the tree strictly as an implementation detail and does not leak a reference to that through the public api. This is to ensure that the internal state of the tree stays
in sync with the state of the treetable.

All of the work necessary to set up the renderer and editor for the hierarchical column is done internally by JTreeTable. Please see JTreeTable.setTreeTableModel for details on how this is done. The
idea is that users should not have to deal with these.

>
> Basically, I dont want the tree to look like a file
> explorerer -- I actually want it to look more like
> the demo for the JDNC XML stuff. (speaking of which,
> I dug through the src and didnt immediately see that
> code either).
>
> Any tips?

JTreeTable has dedicated methods for these. Please see setOpenIcon, setClosedIcon, setLeafIcon, setExpandedIcon, and setCollapsedIcon.

Hope this helps.

Ramesh
---
[Message sent by forum member 'rameshgupta' (Ramesh Gupta)]

http://www.javadesktop.org/forums/thread.jspa?messageID=19755&#19755

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

==============================================================================

If you are not an intended recipient of this e-mail, please notify
the sender, delete it and do not read, act upon, print, disclose,
copy, retain or redistribute it.

Click here for important additional terms relating to this e-mail.

==============================================================================

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

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rameshgupta
Offline
Joined: 2004-06-04
Points: 0

> Im building a more graphical treetable. So I want to
> change the entire UI of the tree table. I would
> rather not deal with the minutae of replacing the
> entire renderer editor situation, but I don't see
> a way around it. And the UI changes go beyond icons.
> For example, I do row gradiation from top to bottom
> in my tables, and I need to do the same in the
> treetable. Currently, the gradiatin is working
> through custom renderers in the rest of the
> treetable, but needs to work in the tree part as
> well.
>
> Does that give you some ideas? If not I can put up
> some screenshots or something.
>
> -jonathan
>
>

Screenshots are always helpful ;-)
Also, have you looked at the new highlighter support in Swing extensions? Seems like a perfect fit for your use case. Basically, it lets you get what you want without having to write component-specific renderers (TableCellRenderer, TreeCellRenderer, ...).

We have built-in highlighters that you can use right out of the box, but they don't support gradients yet. It shouldn't be too hard to extend Highlighter (perhaps by using AlternateRowHighlighter as an example) to define your own gradient highlighter which should work for all components. Let me know if you need more details on this.

The bottom line is that we want to discourage developers from ever accessing JTreeTable's private JTree. If there is something that you can't implement without accessing the tree directly, we'd like to know, so that we can provide suitable methods on JTreeTable instead.

Ramesh

>
> -----Original Message-----
> From: jdnc-interest@javadesktop.org
> [mailto:jdnc-interest@javadesktop.org]
> Sent: Wednesday, July 28, 2004 4:34 PM
> To: jdnc@jdnc.dev.java.net
> Subject: Re: Setting editor/renderer for JTreeTable
>
>
> > I'm trying to switch my old JTreeTable code out for
> > the new JDNC stuff. Im having trouble setting a new
> > editor/renderer for the tree.
>
> Do you have a custom tree cell renderer and editor
> with specialized needs? If so, we'd like to know.
>
> The new treetable design treats the tree strictly as
> an implementation detail and does not leak a
> reference to that through the public api. This is to
> ensure that the internal state of the tree stays
> in sync with the state of the treetable.
>
> All of the work necessary to set up the renderer and
> editor for the hierarchical column is done internally
> by JTreeTable. Please see
> JTreeTable.setTreeTableModel for details on how this
> is done. The
> idea is that users should not have to deal with
> these.
>
> >
> > Basically, I dont want the tree to look like a file
> > explorerer -- I actually want it to look more like
> > the demo for the JDNC XML stuff. (speaking of
> which,
> > I dug through the src and didnt immediately see
> that
> > code either).
> >
> > Any tips?
>
> JTreeTable has dedicated methods for these. Please
> see setOpenIcon, setClosedIcon, setLeafIcon,
> setExpandedIcon, and setCollapsedIcon.
>
> Hope this helps.
>
> Ramesh
> ---
> [Message sent by forum member 'rameshgupta' (Ramesh
> Gupta)]
>
> http://www.javadesktop.org/forums/thread.jspa?messageI
> D=19755?
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> jdnc-unsubscribe@jdnc.dev.java.net
> For additional commands, e-mail:
> jdnc-help@jdnc.dev.java.net
>
>
> ======================================================
> ========================
>
> If you are not an intended recipient of this e-mail,
> please notify
> the sender, delete it and do not read, act upon,
> print, disclose,
> copy, retain or redistribute it.
>
> Click here for important additional terms relating to
> this e-mail.
>
>
> ======================================================
> ========================
>
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> jdnc-unsubscribe@jdnc.dev.java.net
> For additional commands, e-mail:
> jdnc-help@jdnc.dev.java.net