pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roger L. Whitcomb" <Roger.Whitc...@actian.com>
Subject RE: Coloring similar UI components
Date Tue, 27 Aug 2013 17:41:51 GMT
No problem.  But, you would have to write a little loop (possibly a
recursive method) to navigate through all the children of the TabPane
and set the style.  Here is some sample code I wrote for doing a similar
thing (only with a new font):

                /**

                * Recursively set the font on all necessary
subcomponents

                * of the given component (which initially should be the

                * {@link #resultsPane}.  Traverse the hierarchy
appropriately.

                */

                private void setOutputFont(Component component) {

                    if (component instanceof TabPane) {

                                TabPane tabPane = (TabPane)component;

                                for (Component tab : tabPane.getTabs())
{

                                    setOutputFont(tab);

                                }

                    }

                    else if (component instanceof ScrollPane) {

                                ScrollPane scrollPane =
(ScrollPane)component;

                                setOutputFont(scrollPane.getView());

                                if (scrollPane.getColumnHeader() !=
null)

 
setOutputFont(scrollPane.getColumnHeader());

                    }

                    else if (component instanceof Border) {

 
setOutputFont(((Border)component).getContent());

                    }

                    else if (component instanceof Container) {

                                for (Component child :
(Container)component) {

                                    setOutputFont(child);

                                }

                    }

                    else if (component instanceof TableView ||

                                     component instanceof
TableViewHeader ||

                                     component instanceof ListView) {

                                component.getStyles().put("font",
outputFont);

                    }

                }

 

~Roger

 

From: Ajay Bhat [mailto:a.ajay.bhat@gmail.com] 
Sent: Tuesday, August 27, 2013 10:21 AM
To: user@pivot.apache.org
Subject: Coloring similar UI components

 

Hi,

 

Suppose I have a set of different panes (like Table Pane, Label etc) in
different tabs. Would it be possible to color all the panes of same type
across the different tabs using the method as shown in Pivot tutorial
[1]

 

function onColorChange() {

    var color = colorChooser.selectedColor;

    sampleBorder.styles.put("backgroundColor", color);

}

 

[1] http://pivot.apache.org/tutorials/color-choosers.html


 

-- 

Thanks and regards,

Ajay Bhat


Mime
View raw message