Class AttributeSelectionPanel

  • All Implemented Interfaces:
    ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ListSelectionListener

    public class AttributeSelectionPanel
    extends BasePanel
    implements ListSelectionListener
    Creates a panel that displays the attributes contained in a set of instances, letting the user toggle whether each attribute is selected or not (eg: so that unselected attributes can be removed before classification).
    Besides the All, None and Invert button one can also choose attributes which names match a regular expression (Pattern button). E.g. for removing all attributes that contain an ID and therefore unwanted information, one can match all names that contain "id" in the name:
    This does not match e.g. "humidity", which could be an attribute we would like to keep.
    Len Trigg (, FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_ButtonAll

        protected BaseButton m_ButtonAll
        to select all attributes
      • m_ButtonNone

        protected BaseButton m_ButtonNone
        to deselect all attributes
      • m_ButtonInvert

        protected BaseButton m_ButtonInvert
        to invert the current selection
      • m_ButtonPattern

        protected BaseButton m_ButtonPattern
        for entering a regular expression for selection
      • m_PanelFilter

        protected FilterPanel m_PanelFilter
        the filter panel.
      • m_PatternRegEx

        protected String m_PatternRegEx
        The current regular expression.
      • m_SelectionListeners

        protected Set<ListSelectionListener> m_SelectionListeners
        the listeners for changes in the selection.
    • Constructor Detail

      • AttributeSelectionPanel

        public AttributeSelectionPanel()
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        initialize in class BasePanel
      • initGUI

        protected void initGUI()
        Initializes the widgets.
        initGUI in class BasePanel
      • finishInit

        protected void finishInit()
        Finishes the initialization.
        finishInit in class BasePanel
      • updateWidgets

        protected void updateWidgets()
        Updates the enabled state of the buttons/combobox.
      • setInstances

        public void setInstances​(weka.core.Instances data)
        Sets the instances to display the attribute names for.
        data - the instances
      • getInstances

        public weka.core.Instances getInstances()
        Returns the currently displayed instances.
        the instances, null if none available
      • search

        protected void search()
        Searches the panel with the filter.
      • getSelectedRows

        public int[] getSelectedRows()
        Gets an array containing the indices of all selected rows.
        the array of selected indices.
      • getSelectedAttributes

        public int[] getSelectedAttributes()
        Gets an array containing the indices of all selected (ie checked) attributes.
        the array of selected indices, null if no model present.
      • getTable

        public BaseTable getTable()
        Returns the table.
        the table
      • getTableModel

        public TableModel getTableModel()
        Get the table model in use (or null if no instances have been set yet).
        the table model in use or null if no instances have been seen yet.
      • getSelectionModel

        public ListSelectionModel getSelectionModel()
        Gets the selection model used by the table.
        a value of type 'ListSelectionModel'
      • addSelectionListener

        public void addSelectionListener​(ListSelectionListener l)
        Add a listener to the list that's notified each time a change to the selection occurs.
        l - the ListSelectionListener
      • removeSelectionListener

        public void removeSelectionListener​(ListSelectionListener l)
        Remove a listener from the list that's notified each time a change to the selection occurs.
        l - the ListSelectionListener
      • notifySelectionListeners

        protected void notifySelectionListeners​(ListSelectionEvent e)
        Notifies all listeners that the selection has changed.