I am trying to change the background color of a tree item by adding a
dependent style name.  However, when I called
treeItem.addStyleDependentName(newStyleName), nothing happened.  I
look at the docs, and found out that addStyleDependentName calls
addStyleName(getStylePrimaryName() + "-" + newStyleName).  So I
manually coded this, and still the new style was not applied.  I did a
little tinkering, and discovered that getStylePrimaryName() was
returning an empty string, instead of "gwt-TreeItem" as the primary
style name. A simplified version of my code is below:

//JAVA CODE
Tree tree = new Tree();
TreeItem treeItem = new TreeItem("I'm a TreeItem!");
String style = treeItem.getStylePrimaryName() + "blue";
Window.alert(style);
treeItem.addStyleName(style);
tree.addItem(treeItem);

//CSS CODE
.gwt-TreeItem{
        color: "red";
}
.gwt-TreeItem-blue{
        background-color: "blue";
}

Somebody know how to fix this?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to