Paint Background of Hierarchical Table Node

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Paint Background of Hierarchical Table Node

Postby poregan » Thu Feb 27, 2014 10:15 am

In the Hierarchical Table I want to paint to the background color of the margin that is directly under the expand/collaspe node. Is this possible?

I have tired to setMarginBackground but this doesnt paint the area under the icon rather just the space under the name of the parent node.

Any suggestions?
poregan
 
Posts: 11
Joined: Tue Dec 03, 2013 8:42 am

Re: Paint Background of Hierarchical Table Node

Postby JIDE Support » Thu Feb 27, 2014 11:03 am

You can call HierarchicalTable#setMarginBackground to change the color.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Paint Background of Hierarchical Table Node

Postby poregan » Thu Feb 27, 2014 11:27 am

As mentioned I have already tried this and it will paint the area around the expand/collapse icon and will also paint the area to the left of the child component but only to the point where the expand " L " icon begins.

I want to paint the panel containing the L (expand) icon.
poregan
 
Posts: 11
Joined: Tue Dec 03, 2013 8:42 am

Re: Paint Background of Hierarchical Table Node

Postby JIDE Support » Thu Feb 27, 2014 11:32 am

Currently there is no way to paint different colors for the background of the expand/collapse icon and the "L" line. You will have to write your code. The L line's background is painted in TreeLikeHierarchicalPanel. It extends HierarchicalTable and have this paintComponent. You can modify it to paint yourself.

Code: Select all
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.setColor(UIDefaultsLookup.getColor("Tree.hash"));
        if (getComponentOrientation().isLeftToRight()) {
            g.drawLine(ExpandablePanel.LEFT_MARGIN / 2, 0, ExpandablePanel.LEFT_MARGIN / 2, ExpandablePanel.LEFT_MARGIN);
            g.drawLine(ExpandablePanel.LEFT_MARGIN / 2, ExpandablePanel.LEFT_MARGIN, ExpandablePanel.LEFT_MARGIN, ExpandablePanel.LEFT_MARGIN);
        }
        else {
            g.drawLine(getWidth() - ExpandablePanel.LEFT_MARGIN / 2 - 2, 0, getWidth() - ExpandablePanel.LEFT_MARGIN / 2 - 2, ExpandablePanel.LEFT_MARGIN);
            g.drawLine(getWidth() - ExpandablePanel.LEFT_MARGIN / 2 - 2, ExpandablePanel.LEFT_MARGIN, getWidth() - ExpandablePanel.LEFT_MARGIN, ExpandablePanel.LEFT_MARGIN);
        }
    }
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Paint Background of Hierarchical Table Node

Postby poregan » Thu Feb 27, 2014 11:35 am

Excellent Thank you.
poregan
 
Posts: 11
Joined: Tue Dec 03, 2013 8:42 am

Re: Paint Background of Hierarchical Table Node

Postby poregan » Thu Feb 27, 2014 11:38 am

By calling setBackground on the TreeLikeHierarchicalPanel that I return in the TableComponentFactory.createChildComponent I was able to achieve what I was looking for.

Thanks for your help.
poregan
 
Posts: 11
Joined: Tue Dec 03, 2013 8:42 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 16 guests