Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 0.52 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Prevent GWT Tree from closing branch with selected node
  2. public class CustomTreeItem extends TreeItem {
  3.     @Override
  4.     public void setState(boolean open, boolean fireEvents) {
  5.         //check if we want to allow the item to close
  6.         if (!open && !mayClose()) {
  7.             return;
  8.         }
  9.         super.setState(boolean open, boolean fireEvents);
  10.     }
  11.     /**
  12.      * Returns true if the item may be closed, due to some specific rules
  13.      */
  14.     public boolean mayClose() {
  15.         // your check goes here
  16.     }
  17. }