Class PopupListTableCellEditor<T>

  • Type Parameters:
    T - the type of the list items
    All Implemented Interfaces:
    java.io.Serializable, javax.swing.CellEditor, javax.swing.table.TableCellEditor

    public class PopupListTableCellEditor<T>
    extends PopupTableCellEditor
    A table cell editor that displays a popup with a ListField for editing a list of values. MultiSelectTableCellRenderer can be used to render the list.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected ListField textArea  
      • Fields inherited from class javax.swing.AbstractCellEditor

        changeEvent, listenerList
    • Constructor Summary

      Constructors 
      Constructor Description
      PopupListTableCellEditor​(java.util.function.Function<T,​java.lang.String> format, java.util.function.Function<java.lang.String,​T> parser, ListField.ItemValidator validator, javax.swing.text.Highlighter.HighlightPainter errorPainter, int rows)
      Create a PopupListTableCellEditor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> PopupListTableCellEditor.Builder<T> builder​(java.util.function.Function<T,​java.lang.String> format, java.util.function.Function<java.lang.String,​T> parser)
      Create a builder for creating a new PopupListTableCellEditor.
      protected java.awt.Window createWindow​(java.awt.Window owner)
      Create the popup window.
      java.lang.Object getCellEditorValue()  
      java.awt.Component getTableCellEditorComponent​(javax.swing.JTable table, java.lang.Object value, boolean isSelected, int row, int column)  
      protected void showPopup()
      Show the popup window.
      boolean stopCellEditing()
      Overridden to prevent closing the editor if it contains invalid items.
      • Methods inherited from class javax.swing.AbstractCellEditor

        addCellEditorListener, cancelCellEditing, getCellEditorListeners, isCellEditable, removeCellEditorListener, shouldSelectCell
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.swing.CellEditor

        addCellEditorListener, cancelCellEditing, isCellEditable, removeCellEditorListener, shouldSelectCell
    • Field Detail

      • textArea

        protected final ListField textArea
    • Constructor Detail

      • PopupListTableCellEditor

        public PopupListTableCellEditor​(java.util.function.Function<T,​java.lang.String> format,
                                        java.util.function.Function<java.lang.String,​T> parser,
                                        ListField.ItemValidator validator,
                                        javax.swing.text.Highlighter.HighlightPainter errorPainter,
                                        int rows)
        Create a PopupListTableCellEditor.
        Parameters:
        format - a function for formatting the list items
        parser - a function for parsing a list item from a string
        validator - a validator for items in the popup editor
        errorPainter - a highlighter for indicating errors in the popup editor
        rows - the number of rows to display in the popup editor
    • Method Detail

      • createWindow

        protected java.awt.Window createWindow​(java.awt.Window owner)
        Description copied from class: PopupTableCellEditor
        Create the popup window.
        Specified by:
        createWindow in class PopupTableCellEditor
        Parameters:
        owner - the window containing the table
      • stopCellEditing

        public boolean stopCellEditing()
        Overridden to prevent closing the editor if it contains invalid items.
        Specified by:
        stopCellEditing in interface javax.swing.CellEditor
        Overrides:
        stopCellEditing in class javax.swing.AbstractCellEditor
        Returns:
        false if the editor contains invalid items
      • getTableCellEditorComponent

        public java.awt.Component getTableCellEditorComponent​(javax.swing.JTable table,
                                                              java.lang.Object value,
                                                              boolean isSelected,
                                                              int row,
                                                              int column)
        Specified by:
        getTableCellEditorComponent in interface javax.swing.table.TableCellEditor
        Overrides:
        getTableCellEditorComponent in class PopupTableCellEditor
      • getCellEditorValue

        public java.lang.Object getCellEditorValue()
      • builder

        public static <T> PopupListTableCellEditor.Builder<T> builder​(java.util.function.Function<T,​java.lang.String> format,
                                                                      java.util.function.Function<java.lang.String,​T> parser)
        Create a builder for creating a new PopupListTableCellEditor.
        Type Parameters:
        T - the type of the list items
        Parameters:
        format - a function for formatting the list items
        parser - a function for parsing a list item from a string