JXTreeTable: Is this possible? Screenshot attached

View: New views
6 Messages — Rating Filter:   Alert me  

JXTreeTable: Is this possible? Screenshot attached

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello!

is it actually possible to create a JXTreeTable, which looks like the right part of this screenshot?
http://www.midnightbeep.com/images/inbox-pagehead.png

I don't care that much if the enumeration stuff is possible, but i need at least edit capability and the checkboxes should only be shown at each node. The last time i tried with using a custom TreeTableModel and a Boolean column the Checkboxes were in a separate row... I couldn't find out how to attach them to the node only (and have them editable as well).

So is something as shown on the screenshot actually possible with the JXTreeTable component, and if yes, what is the best way to do it? Can you give any examples?

Thanks in advance.

Kind regards,
Andreas
[Message sent by forum member 'kixxass' (kixxass)]

http://forums.java.net/jive/thread.jspa?messageID=287888

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


Re: JXTreeTable: Is this possible? Screenshot attached

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It should be possible.  Can you give a small demo with what you're currently doing?

Karl
[Message sent by forum member 'kschaefe' (kschaefe)]

http://forums.java.net/jive/thread.jspa?messageID=287907

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


Re: JXTreeTable: Is this possible? Screenshot attached

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I uploaded an Image which shows the problem at
http://files.kuehntopf.org/problem.png

The bottom part is the goal i want to archieve.

It could also be possible that i need to hide the checkbox at each parent node, so only the leafs have checkboxes attached to them.


Any hint how to do that?

Thanks,
Kind regards

Andreas
[Message sent by forum member 'kixxass' (kixxass)]

http://forums.java.net/jive/thread.jspa?messageID=287913

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


Re: JXTreeTable: Is this possible? Screenshot attached

by Tim Boudreau :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Jul 20, 2008, at 3:51 AM, jdnc-interest@... wrote:

> Hello!
>
> is it actually possible to create a JXTreeTable, which looks like  
> the right part of this screenshot?
> http://www.midnightbeep.com/images/inbox-pagehead.png
>
> I don't care that much if the enumeration stuff is possible, but i  
> need at least edit capability and the checkboxes should only be  
> shown at each node. The last time i tried with using a custom  
> TreeTableModel and a Boolean column the Checkboxes were in a  
> separate row... I couldn't find out how to attach them to the node  
> only (and have them editable as well).
>
> So is something as shown on the screenshot actually possible with  
> the JXTreeTable component, and if yes, what is the best way to do  
> it? Can you give any examples?

I'd strongly advise against trying to do this with a tree table, or  
JTable or similar.  Most of the value of components that use the cell-
renderer pattern is to be able to use a single component as a "rubber  
stamp" for things that are painted in a uniform way.  In the case of  
your screen shot, each cell has different and dissimilar contents.  So  
you're going to need a different renderer for each row, which  
basically means you're going to design individual panels for each  
cell, and then keep two of them around - one for a renderer and one  
for a cell editor, and keep their state in sync.

You're far better off going with live components for this sort of  
thing - you can create a generic parent panel with an expand/collapse  
button that shows/hides a sub-panel with the additional contents  
depending on its state.

Otherwise, you'll find you have weird problems with components not  
behaving quite right - for example, have JComboBoxes in two cells;  
click one to open its popup (what's really happening under the hood is  
the cell editor is instantiated, plopped into the component, and then  
the event is [hopefully] forwarded to the right subcomponent);  now  
click a combo box in a different cell;  with live components, one  
popup would close and the other would open;  due to even ordering  
issues and a single shared popup component for combo boxes, you'll  
find that's not what happens inside a tree table or JTree;  also the  
bugs will be different on different look and feels.

While it's technically possible to do this, you will spend a *lot*  
more time trying to get it to work right than by just using live  
components for this sort of UI - the only thing a tree table is giving  
you is an expand button and state notification.  That's a not lot of  
value in exchange for the increased complexity of dealing with cell  
renderers and cell editors.  A JToggleButton will give you those same  
things and be much simpler code to maintain.

The links below might provide some inspiration - it involves an  
expandable panel such as you are using, for a similar UI.  In this  
case, the code is a little more complex because child panels may  
contain their own expansion buttons, so the layout manager looks for a  
parent panel that keeps a database of layout data (so the columns of  
expandable-panels that are children of other expandable panels all are  
vertically aligned:
https://imagine.dev.java.net/source/browse/imagine/misc/ui/src/org/netbeans/paint/api/components/SharedLayoutPanel.java?view=markup
https://imagine.dev.java.net/source/browse/imagine/misc/ui/src/org/netbeans/paint/api/components/LDPLayout.java?rev=1.2&view=log
https://imagine.dev.java.net/source/browse/imagine/misc/ui/src/org/netbeans/paint/api/components/LayoutDataProvider.java?view=markup
https://imagine.dev.java.net/source/browse/imagine/misc/ui/src/org/netbeans/paint/api/components/SharedLayoutData.java?view=markup
https://imagine.dev.java.net/source/browse/imagine/misc/ui/src/org/netbeans/paint/api/components/DefaultSharedLayoutData.java?view=markup

-Tim


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


Re: JXTreeTable: Is this possible? Screenshot attached

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The problem in the renderer/editor.  You need to have the hierarchical column contain more than just Boolean data.  You need the renderer and editor to understand the combined data and be able to present that data.

So, again, can you please post a small runnable code example with what you're doing?

Karl
[Message sent by forum member 'kschaefe' (kschaefe)]

http://forums.java.net/jive/thread.jspa?messageID=287927

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


Re: JXTreeTable: Is this possible? Screenshot attached

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, Tim.

That really helped a lot.
I will follow your suggestion and try to implement it using live components.


Andreas
[Message sent by forum member 'kixxass' (kixxass)]

http://forums.java.net/jive/thread.jspa?messageID=287930

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

LightInTheBox - Buy quality products at wholesale price