title: javafx 8: How to update TreeCell in TreeView on SlectedItemProperty Change
body: <p>I have a tree-view with costume TreeCell. tree cell is customized and it looks like below image. </p>
  
  <p><img src="https://i.stack.imgur.com/qAEJD.png" alt="enter image description here"></p>
  
  <p>On Right Side I selected the One Tree Cell or Tree item. as you can see there is image-view of hand on left side of each cell. By default it is in black color but i want to replace it with white color icon. as in above mock up.</p>
  
  <h1>How can i achieve this????</h1>
  
  <p>I want all text and image view icon on selection changed to white color. and last selected tree cell back to normal black color. </p>
  
  <p>My Tree Cell Code is below.</p>
  
  <pre><code>private final class AlertTreeCell extends TreeCell&lt;AlertListItem&gt; {
  
      private Node cell;
      private Rectangle rectSeverity;
      private Label mIncedentname;
      private Label mAlertTitle;
      private Label mSentTime;
      private Label mSender;
      private ImageView ivCategory;
      public AlertTreeCell() {
  
          FXMLLoader fxmlLoader = new FXMLLoader(
                  MainController.class
                          .getResource("/fxml/alert_list_item.fxml"));
          try {
              cell = (Node) fxmlLoader.load();
              rectSeverity = (Rectangle) cell.lookup("#rectSeverity");
              mIncedentname = (Label) cell.lookup("#lblIncidentName");
              mAlertTitle = (Label) cell.lookup("#lblAlertTitle");
              mSentTime = (Label) cell.lookup("#lblSentTime");
              mSender = (Label) cell.lookup("#lblSender");
              ivCategory = (ImageView) cell.lookup("#ivCategory");
          } catch (IOException ex) {
              mLogger.error(ex.getLocalizedMessage(),ex);
          }           
      }
  
      @Override
      public void updateItem(AlertListItem item, boolean empty) {
          super.updateItem(item, empty);
          if (empty) {
              setText(null);
              setGraphic(null);
          } else {
              setText(null);
               mAlertTitle.setText(item.getEvent());
               mIncedentname.setText(item.getHeadline());                                   
               mSentTime.setText(MyUtils.getListDateFormattedString(item.getReceivedTime()));
               mSender.setText(item.getSenderName());
               Image image = new Image("/images/ic_cat_" + item.getCategoryIcon().toLowerCase() + "_black.png");
               if(image != null){
                  ivCategory.setImage(image);
               }
               if(item.getSeverity() != null){
                   String severityColor = item.getSeverity().toString();
                   String severityColorCode = null;
                   if(severityColor != null) {
                       SeverityColorHelper severityColorHelper = new SeverityColorHelper();
                       severityColorCode = severityColorHelper.getColorBySeverity(AlertInfo.Severity.fromValue(severityColor));
                   }
                   rectSeverity.setFill(Color.web(severityColorCode,1.0) );
               }
               final AlertTreeCell this$=this;
               setOnMouseClicked(new EventHandler&lt;MouseEvent&gt;() {
                  @Override
                  public void handle(MouseEvent event) {
                       if(event.getClickCount()==1){                                
                              Node cell$ = this$.getGraphic();
                              ImageView ivCategory$ = (ImageView) cell.lookup("#ivCategory");
                              Image image = new Image("/images/ic_cat_" + item.getCategoryIcon().toLowerCase() + "_white.png");
                              if(image != null){
                                  ivCategory$.setImage(image);
                              }                                                           
                       }
  
                  }
               });
               this$.
               setGraphic(cell);
  
          }
      }
  }
  </code></pre>
  
  <p>problem is that new white icon properly selected and added but how to change back the last selected tree item's image view back to black color icon.  actually I have two color images of same type. one is in black color and same image in white color. on selection i want the image and text changed to white colored and all other tree-items in to black color text and black color icon.</p>