Maybe... you can try....
.....
Tree staticTree = new Tree() {
@Override
public void onBrowserEvent(Event event) {
Element el = event.getEventTarget().cast();
if (el == null)
return;
switch (event.getTypeInt()) {
case Event.ONCLICK:
for (int i = 0; i < getItemCount(); i++) {
TreeItem treeItem = getItem(i);
TableElement table = getTableElement(treeItem);
if (table != null) {
NodeList<Element> nodeList = table
.getElementsByTagName("div");
if (nodeList.getLength() > 0)
if (el.equals(nodeList.getItem(0))) {
treeItem.setState(!treeItem.getState());
break;
}// end if
}// end if
}// end for
break;
}// end switch
super.onBrowserEvent(event);
}// end onBrowserEvent
private final TableElement getTableElement(TreeItem treeItem) {
return (TableElement) treeItem.getElement()
.getFirstChildElement();
}// end getTableElement
};
TreeItem item1 = staticTree.addTextItem("Item 1");
item1.addTextItem("Item 1 - 1");
item1.addTextItem("Item 1 - 2");
item1.setStyleName("parent");
DOM.getFirstChild(item1.getElement()).addClassName("nocross");
TreeItem item2 = staticTree.addTextItem("Item 2");
item2.addTextItem("Item 2 - 1");
item2.addTextItem("Item 2 - 2");
item2.setStyleName("parent");
DOM.getFirstChild(item2.getElement()).addClassName("nocross");
..............
.....
Tree staticTree = new Tree() {
@Override
public void onBrowserEvent(Event event) {
Element el = event.getEventTarget().cast();
if (el == null)
return;
switch (event.getTypeInt()) {
case Event.ONCLICK:
for (int i = 0; i < getItemCount(); i++) {
TreeItem treeItem = getItem(i);
TableElement table = getTableElement(treeItem);
if (table != null) {
NodeList<Element> nodeList = table
.getElementsByTagName("div");
if (nodeList.getLength() > 0)
if (el.equals(nodeList.getItem(0))) {
treeItem.setState(!treeItem.getState());
break;
}// end if
}// end if
}// end for
break;
}// end switch
super.onBrowserEvent(event);
}// end onBrowserEvent
private final TableElement getTableElement(TreeItem treeItem) {
return (TableElement) treeItem.getElement()
.getFirstChildElement();
}// end getTableElement
};
TreeItem item1 = staticTree.addTextItem("Item 1");
item1.addTextItem("Item 1 - 1");
item1.addTextItem("Item 1 - 2");
item1.setStyleName("parent");
DOM.getFirstChild(item1.getElement()).addClassName("nocross");
TreeItem item2 = staticTree.addTextItem("Item 2");
item2.addTextItem("Item 2 - 1");
item2.addTextItem("Item 2 - 2");
item2.setStyleName("parent");
DOM.getFirstChild(item2.getElement()).addClassName("nocross");
..............
CSS File ...
.nocross > tbody > tr > td > img {
display: none;
}
.parent > div > div {
padding: 3px !important;
}
......
display: none;
}
.parent > div > div {
padding: 3px !important;
}
......
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment