Advertisement
Guest User

Untitled

a guest
Aug 18th, 2014
10,745
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.05 KB | None | 0 0
  1.         // Use a custom callback to determine the style of the tree item
  2.         layersTree.setCellFactory(new Callback<TreeView<String>, TreeCell<String>>() {
  3.             @Override
  4.             public TreeCell<String> call(TreeView<String> param) {
  5.                 return new CheckBoxTreeCell<String>(){
  6.                     @Override
  7.                     public void updateItem(String item, boolean empty){
  8.                         super.updateItem(item, empty);
  9.                         // If there is no information for the Cell, make it empty
  10.                         if(empty){
  11.                             setGraphic(null);
  12.                             setText(null);
  13.                         // Otherwise if it's not representation as an item of the tree
  14.                         // is not a CheckBoxTreeItem, remove the checkbox item
  15.                         }else if (!(getTreeItem() instanceof CheckBoxTreeItem)){
  16.                             setGraphic(null);
  17.                         }
  18.                     }
  19.                 };
  20.             }
  21.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement