weka.gui
Class AttributeSelectionPanel.AttributeTableModel

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended byweka.gui.AttributeSelectionPanel.AttributeTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel
Enclosing class:
AttributeSelectionPanel

class AttributeSelectionPanel.AttributeTableModel
extends javax.swing.table.AbstractTableModel

A table model that looks at the names of attributes and maintains a list of attributes that have been "selected".


Field Summary
protected  Instances m_Instances
          The instances who's attribute structure we are reporting
protected  boolean[] m_Selected
          The flag for whether the instance will be included
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
AttributeSelectionPanel.AttributeTableModel(Instances instances)
          Creates the tablemodel with the given set of instances.
 
Method Summary
 java.lang.Class getColumnClass(int col)
          Gets the class of elements in a column.
 int getColumnCount()
          Gets the number of columns: 3
 java.lang.String getColumnName(int column)
          Gets the name for a column.
 int getRowCount()
          Gets the number of attributes.
 int[] getSelectedAttributes()
          Gets an array containing the indices of all selected attributes.
 java.lang.Object getValueAt(int row, int column)
          Gets a table cell
 void includeAll()
          Sets the state of all attributes to selected.
 void invert()
          Inverts the selected status of each attribute.
 boolean isCellEditable(int row, int col)
          Returns true if the column is the "selected" column.
 void removeAll()
          Deselects all attributes.
 void setInstances(Instances instances)
          Sets the tablemodel to look at a new set of instances.
 void setValueAt(java.lang.Object value, int row, int col)
          Sets the value at a cell.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_Instances

protected Instances m_Instances
The instances who's attribute structure we are reporting


m_Selected

protected boolean[] m_Selected
The flag for whether the instance will be included

Constructor Detail

AttributeSelectionPanel.AttributeTableModel

public AttributeSelectionPanel.AttributeTableModel(Instances instances)
Creates the tablemodel with the given set of instances.

Parameters:
instances - the initial set of Instances
Method Detail

setInstances

public void setInstances(Instances instances)
Sets the tablemodel to look at a new set of instances.

Parameters:
instances - the new set of Instances.

getRowCount

public int getRowCount()
Gets the number of attributes.

Returns:
the number of attributes.

getColumnCount

public int getColumnCount()
Gets the number of columns: 3

Returns:
3

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Gets a table cell

Parameters:
row - the row index
column - the column index
Returns:
the value at row, column

getColumnName

public java.lang.String getColumnName(int column)
Gets the name for a column.

Parameters:
column - the column index.
Returns:
the name of the column.

setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int col)
Sets the value at a cell.

Parameters:
value - the new value.
row - the row index.
col - the column index.

getColumnClass

public java.lang.Class getColumnClass(int col)
Gets the class of elements in a column.

Parameters:
col - the column index.
Returns:
the class of elements in the column.

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Returns true if the column is the "selected" column.

Parameters:
row - ignored
col - the column index.
Returns:
true if col == 1.

getSelectedAttributes

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

Returns:
the array of selected indices.

includeAll

public void includeAll()
Sets the state of all attributes to selected.


removeAll

public void removeAll()
Deselects all attributes.


invert

public void invert()
Inverts the selected status of each attribute.