Class BeanSelectPanel<E extends NamedBean>

Type Parameters:
E - the type of NamedBean
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class BeanSelectPanel<E extends NamedBean> extends JPanel
Create a JPanel containing a NamedBeanComboBox. The default display option is DISPLAYNAME. JComboBoxUtil.setupComboBoxMaxRows() will be invoked.
See Also:
  • Field Details

  • Constructor Details

    • BeanSelectPanel

      public BeanSelectPanel(@Nonnull Manager<E> manager, E selection)
    • BeanSelectPanel

      public BeanSelectPanel(@Nonnull Manager<E> manager, E selection, NamedBean.DisplayOptions display)
    • BeanSelectPanel

      public BeanSelectPanel(@Nonnull Manager<E> manager, E selection, NamedBean.DisplayOptions display, boolean maxRows)
      Create a JPanel that contains a named bean combo box.
      Parameters:
      manager - The bean manager
      selection - The bean that is selected, null for no selection.
      display - The bean display option, null for default DISPLAYNAME.
      maxRows - Should max rows be enabled; if false the JComboBox default of 8 will be used.
    • BeanSelectPanel

      public BeanSelectPanel(@Nonnull Manager<E> manager, E selection, NamedBean.DisplayOptions display, boolean maxRows, Predicate<E> filter)
      Create a JPanel that contains a named bean combo box.
      Parameters:
      manager - The bean manager
      selection - The bean that is selected, null for no selection.
      display - The bean display option, null for default DISPLAYNAME.
      maxRows - Should max rows be enabled; if false the JComboBox default of 8 will be used.
      filter - The filter or null if no filter
  • Method Details

    • getBeanCombo

    • getNamedBean

      public E getNamedBean()
      Get the named bean that has been selected.
      Returns:
      the selected bean which may be null if the first row is selected.
    • setDefaultNamedBean

      public void setDefaultNamedBean(E nBean)
      Set the default selected item in the combo box.
      Parameters:
      nBean - the bean that is selected by default
    • setDefaultNamedBean

      public void setDefaultNamedBean(NamedBeanHandle<E> nBeanHandle)
      Set the default selected item in the combo box.
      Parameters:
      nBeanHandle - the bean that is selected by default
    • isEmpty

      public boolean isEmpty()
      Check that the user selected something in this BeanSelectPanel.
      Returns:
      true if nothing selected
    • dispose

      public void dispose()