title: javafx - Custom Control - How to handle text events and apply predicates generically. (got stuck in middle)
body: <p>This is updated version of the question <a href="https://stackoverflow.com/questions/39372780/javafx-tableview-as-combobox-popup-tried-and-able-to-achieve-partially-need-he">javafx-TableView as combobox popup (Tried and able to achieve partially. need help further)</a></p>
  
  <p>Based on few inputs I got here and referred some existing custom controls (controlsFX), I started implementing my custom control and achieved most of it but got stuck in middle. So need your support.</p>
  
  <p><strong>I have attached my whole project <a href="https://app.box.com/s/dfmu9kajazhc00pnbtgm0d9gn1lr4wq3" rel="nofollow noreferrer">here</a> for reference.</strong> </p>
  
  <p>Let me explain my requirement first.</p>
  
  <p>My real application consists of around 40 to 50 text fields in the scene. Suggesstions should be poped up, based of the text typed by the user in the text fields and user should select something using keyboard and able to tab out to the next text field. The suggesstion popup should be a table view with 2 or more columns. The search can be applied on any 1 column or all columns which should be configured by the user while instantiating the control. Please see the screen shot for your reference.
  <a href="https://i.stack.imgur.com/DDo3P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DDo3P.png" alt="enter image description here"></a></p>
  
  <p><strong><em>Now what I have achieved.</em></strong></p>
  
  <p>I have created a CustomControl with 2 classess which will show a popup with a table view inside below the configured node.</p>
  
  <pre><code>**TableViewPopup.java extends PopupControl
  TableViewPopupSkin.java implements Skin&lt;TableViewPopup&lt;T&gt;&gt;**
  </code></pre>
  
  <p>refering <code>AutoCompletePopup.java and AutoCompletePopupSkin.java</code> from controlsFX project.
  This is working as expected (atleast most of the functionalities).</p>
  
  <p>Then I should be able to attach the TableViewPopup to a TextField.</p>
  
  <p>So I created another CustomControl with 2 classess</p>
  
  <pre><code>SearchableTextField.java extends TextField
  SearchableTextFieldSkin.java extends TextFieldSkin
  </code></pre>
  
  <p>So this is the control user will add it to their scene finally and tell this control what tableviewpopup should be displayed when the text changes.
  Till here everything works fine.</p>
  
  <p><strong><em>Where I got stuck or what I want to do?</em></strong></p>
  
  <pre><code>&lt;SearchableTextField fx:id="personSearchableTextField" referenceDataControlNameToLoad="/view/PersonReferenceDataTableView" /&gt;
  &lt;SearchableTextField fx:id="vehicleSearchableTextField" referenceDataControlNameToLoad="/view/VehicleReferenceDataTableView" /&gt;
  </code></pre>
  
  <p>In the above code snippet, I have 2 instances of my SearchableTextField each shows 2 different TableViewPopup(one with Person and other with Vehicle).</p>
  
  <p>Now I want to apply different predicates to the tableview's filtered list as the user started typing in the text field.
  I have attached a textChangedListener which is inside the SearchableTextFieldSkin class. First of all I dont know how to get the filtered list inside the textChangedListener (Please advice is there any better way.) but somehow I'm referring the filtered list but dont know how to apply the predicates bcoz it may be any different enitties (in my case it may be Person entity or Vehicle entity). 
  I dont want to check the instances hard coded bcoz in my real application i have around 150 entities.</p>
  
  <p>I also dont want the predicates related logic inside the SearchableTextFieldSkin class. means, i want all my different predicates in a separate file and just want to call them. </p>
  
  <p>Or atleast somehow route the filtering logic from the SearchableTextFieldSkin class.</p>
  
  <p>Please suggest a way and a better way. I really concerened about performance bcoz what i am doing is a c# with dev express components project that i am currently rewriting in java using javafx bcoz the performance is worse like anything in c#.</p>
  
  <p>Thanks in Advance.</p>