Class InstancesTable

    • Field Detail

      • m_FileChooser

        protected WekaFileChooser m_FileChooser
        the filechooser for exporting data.
      • m_LastSetup

        protected HashMap<String,​Object> m_LastSetup
        for keeping track of the setups being used (classname-{plot|process}-{column|row} - setup).
      • m_HeaderPopupMenuCustomizer

        protected adams.gui.visualization.core.PopupMenuCustomizer m_HeaderPopupMenuCustomizer
        the customizer for the table header popup menu.
      • m_CellPopupMenuCustomizer

        protected adams.gui.visualization.core.PopupMenuCustomizer m_CellPopupMenuCustomizer
        the customizer for the table cells popup menu.
    • Constructor Detail

      • InstancesTable

        public InstancesTable​(weka.core.Instances data)
        Initializes the table with the data.
        Parameters:
        data - the data to display
      • InstancesTable

        public InstancesTable​(InstancesTableModel model)
        Initializes the table with the model.
        Parameters:
        model - the model to use
    • Method Detail

      • initGUI

        protected void initGUI()
        Initializes the widget.
        Overrides:
        initGUI in class adams.gui.core.SortableAndSearchableTable
      • setModel

        public void setModel​(TableModel model)
        Sets the model to use.
        Overrides:
        setModel in class adams.gui.core.SortableAndSearchableTable
        Parameters:
        model - the model to display
      • afterTableLayoutChanged

        protected void afterTableLayoutChanged()
        Can be called after the layout changed.
      • setUndoHandler

        public void setUndoHandler​(adams.gui.core.UndoHandlerWithQuickAccess value)
        Sets the undo handler to use.
        Parameters:
        value - the handler, null if to turn off
      • getUndoHandler

        public adams.gui.core.UndoHandlerWithQuickAccess getUndoHandler()
        Returns the undo handler in use.
        Returns:
        the handler, null if none set
      • isUndoEnabled

        public boolean isUndoEnabled()
        returns whether undo support is enabled
        Specified by:
        isUndoEnabled in interface weka.core.Undoable
        Returns:
        true if undo support is enabled
      • setUndoEnabled

        public void setUndoEnabled​(boolean enabled)
        sets whether undo support is enabled
        Specified by:
        setUndoEnabled in interface weka.core.Undoable
        Parameters:
        enabled - whether to enable/disable undo support
      • clearUndo

        public void clearUndo()
        removes the undo history
        Specified by:
        clearUndo in interface weka.core.Undoable
      • canUndo

        public boolean canUndo()
        returns whether an undo is possible, i.e. whether there are any undo points saved so far
        Specified by:
        canUndo in interface weka.core.Undoable
        Returns:
        returns TRUE if there is an undo possible
      • undo

        public void undo()
        undoes the last action
        Specified by:
        undo in interface weka.core.Undoable
      • addUndoPoint

        public void addUndoPoint()
        adds an undo point to the undo history, if the undo support is enabled
        Specified by:
        addUndoPoint in interface weka.core.Undoable
        See Also:
        isUndoEnabled(), setUndoEnabled(boolean)
      • isReadOnly

        public boolean isReadOnly()
        returns whether the model is read-only
        Returns:
        true if model is read-only
      • setReadOnly

        public void setReadOnly​(boolean value)
        sets whether the model is read-only
        Parameters:
        value - if true the model is set to read-only
      • setInstances

        public void setInstances​(weka.core.Instances data)
        sets the data
        Parameters:
        data - the data to use
      • getInstances

        public weka.core.Instances getInstances()
        returns the data
        Returns:
        the current data
      • selectionRowToModelRow

        protected int selectionRowToModelRow​(int index)
        Determines the actual row index.
        Overrides:
        selectionRowToModelRow in class adams.gui.core.BaseTable
        Parameters:
        index - the selected row
        Returns:
        the actual model row
      • toInstances

        public weka.core.Instances toInstances​(adams.gui.core.TableRowRange range)
        Returns the data.
        Parameters:
        range - the range of rows to return
        Returns:
        the data
      • toInstances

        public weka.core.Instances toInstances​(adams.gui.core.TableRowRange range,
                                               boolean view)
        Returns the data.
        Parameters:
        range - the range of rows to return
        view - whether to return a view
        Returns:
        the data
      • getCellRenderer

        public TableCellRenderer getCellRenderer​(int row,
                                                 int column)
        Returns the renderer for this cell.
        Overrides:
        getCellRenderer in class JTable
        Parameters:
        row - the row
        column - the column
        Returns:
        the renderer
      • showHeaderPopup

        protected void showHeaderPopup​(MouseEvent e)
        Shows a popup menu for the header.
        Parameters:
        e - the event
      • createHeaderPopup

        protected adams.gui.core.BasePopupMenu createHeaderPopup​(MouseEvent e)
        Shows a popup menu for the header.
        Parameters:
        e - the event
        Returns:
        the menu
      • showCellPopup

        protected void showCellPopup​(MouseEvent e)
        Shows a popup menu for the cells.
        Parameters:
        e - the event
      • createCellPopup

        protected adams.gui.core.BasePopupMenu createCellPopup​(MouseEvent e)
        Creates a popup menu for the cells.
        Parameters:
        e - the event
        Returns:
        the menu
      • setHeaderPopupMenuCustomizer

        public void setHeaderPopupMenuCustomizer​(adams.gui.visualization.core.PopupMenuCustomizer value)
        Sets the popup menu customizer to use (for the header).
        Parameters:
        value - the customizer, null to remove it
      • getHeaderPopupMenuCustomizer

        public adams.gui.visualization.core.PopupMenuCustomizer getHeaderPopupMenuCustomizer()
        Returns the current popup menu customizer (for the header).
        Returns:
        the customizer, null if none set
      • setCellPopupMenuCustomizer

        public void setCellPopupMenuCustomizer​(adams.gui.visualization.core.PopupMenuCustomizer value)
        Sets the popup menu customizer to use (for the cells).
        Parameters:
        value - the customizer, null to remove it
      • getCellPopupMenuCustomizer

        public adams.gui.visualization.core.PopupMenuCustomizer getCellPopupMenuCustomizer()
        Returns the current popup menu customizer (for the cells).
        Returns:
        the customizer, null if none set
      • saveAs

        protected void saveAs​(adams.gui.core.TableRowRange range)
        Exports the data.
        Overrides:
        saveAs in class adams.gui.core.BaseTable
        Parameters:
        range - what data to export
      • createLastSetupKey

        protected String createLastSetupKey​(Class cls,
                                            boolean plot,
                                            boolean row)
        Generates a key for the HashMap used for the last setups.
        Parameters:
        cls - the scheme
        plot - plot or process
        row - row or column
        Returns:
        the generated key
      • addLastSetup

        public void addLastSetup​(Class cls,
                                 boolean plot,
                                 boolean row,
                                 Object setup)
        Stores this last setup.
        Parameters:
        cls - the scheme
        plot - plot or process
        row - row or column
        setup - the setup to add
      • getLastSetup

        public Object getLastSetup​(Class cls,
                                   boolean plot,
                                   boolean row)
        Returns any last setup if available.
        Parameters:
        cls - the scheme
        plot - plot or process
        row - row or column
        Returns:
        the last setup or null if none stored
      • addChangeListener

        public void addChangeListener​(ChangeListener l)
        Adds the listener to the pool of listeners that get notified when the data changes.
        Parameters:
        l - the listener to add
      • removeChangeListener

        public void removeChangeListener​(ChangeListener l)
        Removes the listener from the pool of listeners that get notified when the data changes.
        Parameters:
        l - the listener to remove
      • notifyChangeListeners

        protected void notifyChangeListeners()
        Notifies all the change listeners.
      • modelToSpreadSheet

        protected adams.data.spreadsheet.SpreadSheet modelToSpreadSheet()
        Returns the underlying sheet.
        Overrides:
        modelToSpreadSheet in class adams.gui.core.BaseTable
        Returns:
        the spread sheet
      • setShowWeightsColumn

        public void setShowWeightsColumn​(boolean value)
        Sets whether to display a weights column.
        Parameters:
        value - if true then the weights get shown in a separate column
      • getShowWeightsColumn

        public boolean getShowWeightsColumn()
        Returns whether to display a weights column.
        Returns:
        true if the weights get shown in a separate column
      • setShowAttributeWeights

        public void setShowAttributeWeights​(boolean value)
        Sets whether to display attribute weights.
        Parameters:
        value - if true then the attributes weights get shown in the header
      • getShowAttributeWeights

        public boolean getShowAttributeWeights()
        Returns whether to display attribute weights.
        Returns:
        true if the attributes weights get shown in the header
      • sort

        public void sort​(InstanceComparator comparator)
        Sorts the data with the given comparator.
        Parameters:
        comparator - the comparator to use
      • getSendToClasses

        public Class[] getSendToClasses()
        Returns the classes that the supporter generates.
        Specified by:
        getSendToClasses in interface adams.gui.sendto.SendToActionSupporter
        Returns:
        the classes
      • hasSendToItem

        public boolean hasSendToItem​(Class[] cls)
        Checks whether something to send is available.
        Specified by:
        hasSendToItem in interface adams.gui.sendto.SendToActionSupporter
        Parameters:
        cls - the classes to retrieve the item for
        Returns:
        true if an object is available for sending
      • getSendToItem

        public Object getSendToItem​(Class[] cls)
        Returns the object to send.
        Specified by:
        getSendToItem in interface adams.gui.sendto.SendToActionSupporter
        Parameters:
        cls - the classes to retrieve the item for
        Returns:
        the item to send