andrew
unread,Aug 15, 2011, 1:13:26 PM8/15/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-we...@googlegroups.com
Running into the same kinds of issues almost a year after this post (using GWT 2.0.4)...
Need to set alt text and need to discern both tree selection and hierarchy with CSS turned off.
This can be made more elegant but here is the strategy (some GWT Tree assumptions are made here)...
We are adding and OpenHandler and CloseHandler to the Tree.
Each handler checks if the TreeItem has children then it has an expand or collapse (+/-) child image (may want to consider whether or not you have leaf images).
For each TreeItem with children, item, whose <img> alt or title attributes you want to set, access its <img> tags:
NodeList<com.google.gwt.dom.client.Element> imgs = item.getElement().getElementsByTagName("img");
access the first Element in this set because this is the +/- img and set the attributes you want:
com.google.gwt.dom.client.Element elem = imgs.getItem(0);
elem.setAttribute("alt", "...");
elem.setAttribute("title", "...");
Our selected strategy is to append to the beginning of the selected TreeItem's text a selected character (ex. right-facing triangle).
Still working on a solution to showing tree depth with CSS off.