Class BeanComboBoxHandler<O>

java.lang.Object
jaxx.runtime.swing.editor.bean.BeanComboBoxHandler<O>
Type Parameters:
O - le type des objet contenus dans le modèle du composant.
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener

public class BeanComboBoxHandler<O>
extends java.lang.Object
implements java.beans.PropertyChangeListener
Le handler d'un BeanComboBox.

Note: ce handler n'est pas stateless et n'est donc pas partageable entre plusieurs ui.

Author:
Tony Chemit - dev@tchemit.fr
See Also:
BeanComboBox
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected org.jdesktop.swingx.autocomplete.ObjectToStringConverter convertor
    the convertor used to auto-complete
    protected org.nuiton.decorator.MultiJXPathDecorator<O> decorator
    the decorator of data
    protected java.awt.event.FocusListener EDITOR_TEXT_COMP0NENT_FOCUSLISTENER  
    protected boolean init  
    static org.apache.commons.logging.Log log  
    protected java.lang.reflect.Method mutator
    the mutator method on the property of boxed bean in the ui
    protected javax.swing.text.Document originalDocument
    the original document of the combbo box editor (keep it to make possible undecorate)
    protected BeanComboBox<O> ui
    ui if the handler
  • Constructor Summary

    Constructors
    Constructor Description
    BeanComboBoxHandler​(BeanComboBox<O> ui)  
  • Method Summary

    Modifier and Type Method Description
    void addItem​(O item)
    Add the given item into the comboBox.
    void addItems​(java.lang.Iterable<O> items)
    Add the given items into the comboBox.
    protected void fireEmpty​(boolean wasEmpty)  
    void focusCombo()
    Focus combo only if autoFocus ui property is on.
    java.lang.Class<O> getBeanType()  
    org.nuiton.decorator.MultiJXPathDecorator<O> getDecorator()  
    protected java.lang.reflect.Method getMutator()  
    javax.swing.text.Document getOriginalDocument()  
    java.lang.Class<?> getTargetClass()
    Deprecated.
    since 2.5.9 (use now method getBeanType())
    void init​(org.nuiton.decorator.JXPathDecorator<O> decorator, java.util.List<O> data)
    Initialise le handler de l'ui
    boolean isEmpty()  
    void propertyChange​(java.beans.PropertyChangeEvent evt)  
    void removeItem​(O item)
    Remove the given item from the comboBox model.
    void removeItems​(java.lang.Iterable<O> items)
    Remove the given items from the comboBox model.
    protected void setAutoComplete​(java.lang.Boolean oldValue, java.lang.Boolean newValue)
    Modifie l'état autoComplete de l'ui.
    protected void setIndex​(java.lang.Integer oldValue, java.lang.Integer newValue)
    Modifie l'index du décorateur
    protected void setSelectedItem​(O oldValue, O newValue)
    Modifie la valeur sélectionnée dans la liste déroulante.
    protected void setSortOrder​(java.lang.Boolean oldValue, java.lang.Boolean newValue)
    Modifie l'index du décorateur
    void sortData()
    Sort data of the model.
    void togglePopup()
    Toggle the popup visible state.
    protected void updateUI​(int index, boolean reversesort)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • log

      public static final org.apache.commons.logging.Log log
    • ui

      protected BeanComboBox<O> ui
      ui if the handler
    • mutator

      protected java.lang.reflect.Method mutator
      the mutator method on the property of boxed bean in the ui
    • originalDocument

      protected javax.swing.text.Document originalDocument
      the original document of the combbo box editor (keep it to make possible undecorate)
    • convertor

      protected org.jdesktop.swingx.autocomplete.ObjectToStringConverter convertor
      the convertor used to auto-complete
    • decorator

      protected org.nuiton.decorator.MultiJXPathDecorator<O> decorator
      the decorator of data
    • init

      protected boolean init
    • EDITOR_TEXT_COMP0NENT_FOCUSLISTENER

      protected final java.awt.event.FocusListener EDITOR_TEXT_COMP0NENT_FOCUSLISTENER
  • Constructor Details

    • BeanComboBoxHandler

      public BeanComboBoxHandler​(BeanComboBox<O> ui)
  • Method Details

    • init

      public void init​(org.nuiton.decorator.JXPathDecorator<O> decorator, java.util.List<O> data)
      Initialise le handler de l'ui
      Parameters:
      decorator - le decorateur a utiliser
      data - la liste des données a gérer
    • togglePopup

      public void togglePopup()
      Toggle the popup visible state.
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if there is no data in comboBox, false otherwise.
      Since:
      2.5.9
    • addItems

      public void addItems​(java.lang.Iterable<O> items)
      Add the given items into the comboBox.

      Note: The item will be inserted at his correct following the selected ordering.

      Parameters:
      items - items to add in comboBox.
      Since:
      2.5.28
    • removeItems

      public void removeItems​(java.lang.Iterable<O> items)
      Remove the given items from the comboBox model.

      Note: If this item was selected, then selection will be cleared.

      Parameters:
      items - items to remove from the comboBox model
      Since:
      2.5.28
    • addItem

      public void addItem​(O item)
      Add the given item into the comboBox.

      Note: The item will be inserted at his correct following the selected ordering.

      Parameters:
      item - item to add in comboBox.
      Since:
      2.5.9
    • removeItem

      public void removeItem​(O item)
      Remove the given item from the comboBox model.

      Note: If this item was selected, then selection will be cleared.

      Parameters:
      item - the item to remove from the comboBox model
      Since:
      2.5.9
    • sortData

      public void sortData()
      Sort data of the model.
      Since:
      2.5.10
    • focusCombo

      public void focusCombo()
      Focus combo only if autoFocus ui property is on.
      Since:
      2.8.5
    • setAutoComplete

      protected void setAutoComplete​(java.lang.Boolean oldValue, java.lang.Boolean newValue)
      Modifie l'état autoComplete de l'ui.
      Parameters:
      oldValue - l'ancienne valeur
      newValue - la nouvelle valeur
    • setIndex

      protected void setIndex​(java.lang.Integer oldValue, java.lang.Integer newValue)
      Modifie l'index du décorateur
      Parameters:
      oldValue - l'ancienne valeur
      newValue - la nouvelle valeur
    • setSortOrder

      protected void setSortOrder​(java.lang.Boolean oldValue, java.lang.Boolean newValue)
      Modifie l'index du décorateur
      Parameters:
      oldValue - l'ancienne valeur
      newValue - la nouvelle valeur
    • updateUI

      protected void updateUI​(int index, boolean reversesort)
    • setSelectedItem

      protected void setSelectedItem​(O oldValue, O newValue)
      Modifie la valeur sélectionnée dans la liste déroulante.
      Parameters:
      oldValue - l'ancienne valeur
      newValue - la nouvelle valeur
    • getOriginalDocument

      public javax.swing.text.Document getOriginalDocument()
      Returns:
      le document de l'éditeur avant complétion.
    • getDecorator

      public org.nuiton.decorator.MultiJXPathDecorator<O> getDecorator()
    • getBeanType

      public java.lang.Class<O> getBeanType()
      Returns:
      get the type of objects contained in the comboBox model.
      Since:
      2.5.9
    • getTargetClass

      @Deprecated public java.lang.Class<?> getTargetClass()
      Deprecated.
      since 2.5.9 (use now method getBeanType())
      Obtain the type of objects contained in the comboBox using the model mutator.
      Returns:
      get the type of objects contained in the comboBox model.
    • getMutator

      protected java.lang.reflect.Method getMutator()
      Returns:
      le mutateur a utiliser pour modifier le bean associé.
    • propertyChange

      public void propertyChange​(java.beans.PropertyChangeEvent evt)
      Specified by:
      propertyChange in interface java.beans.PropertyChangeListener
    • fireEmpty

      protected void fireEmpty​(boolean wasEmpty)