Den 15.06.2011 18:02, skrev Chris Bartlett:
On 15 June 2011 22:50, Edvin Syse <[email protected]
<mailto:[email protected]>> wrote:

                        TerraTreeViewSkin skin = (TerraTreeViewSkin)
    getSkin();
                        int baseNodeX = path.getLength() *
    (skin.getIndent() + skin.getSpacing());


If all you need are the 'indent' and 'spacing', they are properties of
the skin, and therefore available as styles via the TreeView.  You can
avoid casting the skin to TerraTreeViewSkin and accessing its properies
directly.

treeView.getStyles().get("indent");
treeView.getStyles().get("spacing");

In reality that doesn't really help much though, as you are still
relying on those styles being there, and also relying on the fact that
they behave exactly as they do in TerraTreeViewSkin.

Absolutely :) I'll rewrite my utility class to use the indent and spacing styles anyway, since a new skin is more than likely to be based on Terra. Later on I could add special cases based on the skin maybe. I see Component.getSkin() is protected - why is that? Would be nice to be able to check what kind of skin was installed on a component.

Reply via email to