title: setCellFactory override updateItem and wrap text
body: <p>I want the items in my listView to be all capitalized and to have line breaks.</p>
  
  <p>I'm using setCellFactory to provide an implementation of Cell.updateItem. This works fine. When I add the workaround for breaking lines in a ListView to my ListCell implementation, only one of the two "features" works. The first code block starts at line 25 and ends at line 33. The second code block starts at line 35 and ends at line 42. When I comment out the second block, the Strings in the ListView are all upper case and have no line breaks. When it is not commented out, the Strings have line breaks and are not all upper case. I want both "features" to work. How can I do that? </p>
  
  <pre><code>import javafx.application.Application;
  import javafx.scene.Scene;
  import javafx.scene.control.ListCell;
  import javafx.scene.control.ListView;
  import javafx.scene.text.Text;
  import javafx.stage.Stage;
  import javafx.util.Callback;
  
  public class Main extends Application {
      public static void main(String[] args) {
          launch(args);
      }
  
  @Override
  public void start(Stage primaryStage) {
      ListView&lt;String&gt; myList = new ListView&lt;&gt;();
  
      myList.setCellFactory(new Callback&lt;ListView&lt;String&gt;, ListCell&lt;String&gt;&gt;() {
          @Override
          public ListCell&lt;String&gt; call(final ListView&lt;String&gt; list) {
              return new ListCell&lt;String&gt;() {
  
                  @Override
                  protected void updateItem(String item, boolean empty) {
                      super.updateItem(item, empty);
                      if (empty || item == null || item == null) {
                          setText(null);
                      } else {
                          setText(item.toUpperCase());
                      }
                  }
  
                  {
                      Text text = new Text();
                      text.wrappingWidthProperty().bind(list.widthProperty().subtract(15));
                      text.textProperty().bind(itemProperty());
  
                      setPrefWidth(0);
                      setGraphic(text);
                  }
  
  
              };
          }
      });
  
  
      for (int i = 0; i &lt; 100; i++) {
          myList.getItems()
                  .add("Lorem ipsum dolor sit amet, consectetur adipisicing elit, "
                          + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "
                          + "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris "
                          + "nisi ut aliquip ex ea commodo consequat.");
      }
  
      primaryStage.setScene(new Scene(myList));
      primaryStage.setTitle("ListWrapBug");
      primaryStage.show();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Workaround to brake lines: <a href="https://stackoverflow.com/questions/9964579/javafx-setwraptexttrue-wordwrap-doesnt-work-in-listview">JavaFX: setWrapText(true) (WordWrap) doesn&#39;t work in ListView</a> .</p>
  
  <p>Unfortunately the SO code view does not have a line count.</p>