pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: Avoid "double click signal" when expanding and collapsing a branch in a TreeViewer
Date Wed, 15 Jun 2011 16:29:03 GMT
Greg or Todd could give you the official answer, but I think it is meant to
ensure that access to the skin always occurs via the StyleDictionary.  That
way the code would be able to run with a different theme, or merely a
different skin for the component.

You could always extend   TerraTreeViewSkin and add your code into that
class.  Then you *know* that  'indent' and 'spacing will be there, and it
would be fine to access them directly.

CustomTerraTreeViewSkin extends TerraTreeViewSkin {
    public void myMethod() {
        int indent = getIndent();
        int spacing = getSpacing();
        ...
      }
}'

You could then create a CustomTreeView and associate it with your
CustomTerraTreeViewSkin in the Theme, so that any instance of
CustomTreeView would use   CustomTerraTreeViewSkin.

Chris

On 15 June 2011 23:14, Edvin Syse <edvin@sysedata.no> wrote:

> Den 15.06.2011 18:02, skrev Chris Bartlett:
>
>> On 15 June 2011 22:50, Edvin Syse <edvin@sysedata.no
>> <mailto:edvin@sysedata.no>> 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.
>
>

Mime
View raw message