All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sas.swing.visuals.dataselectors.propertyeditor
Class EntityAttributeValueTableModelAdapter

    com.sas.swing.visuals.dataselectors.propertyeditor.EntityAttributeValueTableModelAdapter

All Implemented Interfaces:
  com.sas.beans.PropertyChangeSource, UpdateRowInterface, java.io.Serializable, javax.swing.table.TableModel

    public class EntityAttributeValueTableModelAdapter

implements com.sas.beans.PropertyChangeSource, UpdateRowInterface

The EntityAttributeValueTableModelAdapter allows objects that implement `com.sas.entities.RemoteEntityInterface` to be used as the model for viewers whose models are subclasses of `javax.swing.table.AbstractTableModel`(`javax.swing.JTable`, `com.sas.servlet.tbeans.table.html.TableView`,`com.sas.swing.visuals.tableview`). The Entity must be set as the model for the adapter, which can then used as the model for the viewer. The adapter can be editable so that the underlying entity can be modified and column names can be set so that the displayed columns can be customized.

See Also:
  Serialized Form

Field Summary
`protected java.lang.String[]` | `columnNames` Column names for table model
`protected java.util.Locale` | `locale` Locale to be used for retrieving attribute labels
`protected RemoteEntityInterface` | `model` Model for the Map
`protected EntityAttributeValueModelInterface` | `modelInterface`
`protected java.util.Map` | `properties` Internal storage of properties from entity
`static java.lang.String` | `RB_KEY`
`protected javax.swing.event.SwingPropertyChangeSupport` | `spcs` Used to support property changes in the webAF customizer
`protected boolean` | `tableEditable` Whether the table model is editable

Constructor Summary
`EntityAttributeValueTableModelAdapter(EntityAttributeValueModelInterface modelInterface)` Constructor that intializes the adapter

Method Summary
`void` | `addPropertyChangeListener(java.beans.PropertyChangeListener listener)` Add a propertyChangeListener
`int` | `getColumnCount()` Returns the number of columns in the model.
`java.lang.String` | `getColumnName(int columnIndex)` Returns the name of the column at columnIndex.
`java.util.Locale` | `getLocale()` Returns the locale.
`java.lang.Object` | `getPropertyAt(int position)` Returns the number of columns in the model.
`int` | `getRowCount()` Returns the number of rows in the model
`java.lang.Object` | `getValueAt(int rowIndex, int columnIndex)` Returns the value for the cell at columnIndex and rowIndex.
`protected void` | `initialize()` Intializes the adapter
`boolean` | `isCellEditable(int rowIndex, int columnIndex)` Returns true if the cell at rowIndex and columnIndex is editable and the table is editable.
`boolean` | `isRowUpdateAllowed()` Indicates whether rows can be updated.
`boolean` | `isTableEditable()` Determine if the table is editable.
`void` | `removePropertyChangeListener(java.beans.PropertyChangeListener listener)` Remove a propertyChangeListener
`void` | `setColumnName(java.lang.String columnName, int columnIndex)` Sets the name of the column at columnIndex to columnName.
`void` | `setLocale(java.util.Locale locale)` Sets the locale.
`void` | `setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)` Sets the value in the cell at columnIndex and rowIndex to aValue.

Field Detail

### RB_KEY

    public static final java.lang.String RB_KEY

See Also:
  Constant Field Values

### properties

    protected java.util.Map properties

  Internal storage of properties from entity

### model

    protected RemoteEntityInterface model

  Model for the Map

### columnNames

    protected java.lang.String[] columnNames

  Column names for table model

### tableEditable

    protected boolean tableEditable

  Whether the table model is editable

### spcs

    protected javax.swing.event.SwingPropertyChangeSupport spcs

  Used to support property changes in the webAF customizer

### locale

    protected java.util.Locale locale

  Locale to be used for retrieving attribute labels

### modelInterface

    protected EntityAttributeValueModelInterface modelInterface

Constructor Detail

### EntityAttributeValueTableModelAdapter

    public EntityAttributeValueTableModelAdapter(EntityAttributeValueModelInterface modelInterface)

  Constructor that intializes the adapter

Method Detail

### initialize

    protected void initialize()

  Intializes the adapter

### getRowCount

    public int getRowCount()

  Returns the number of rows in the model

  Specified by:
    `getRowCount` in interface `javax.swing.table.TableModel`
  Returns:
    row count

### getColumnCount

    public int getColumnCount()

  Returns the number of columns in the model. This will always return two columns, one being the keys and the other being the values.

  Specified by:
    `getColumnCount` in interface `javax.swing.table.TableModel`
  Returns:
    2

### getPropertyAt

    public java.lang.Object getPropertyAt(int position)

  Returns the number of columns in the model. This will always return two columns, one being the keys and the other being the values.

  Returns:
    2

### getValueAt

    public java.lang.Object getValueAt(int rowIndex,
                                       int columnIndex)

  Returns the value for the cell at columnIndex and rowIndex.

  Specified by:
    `getValueAt` in interface `javax.swing.table.TableModel`
  Parameters:
    `rowIndex` - the row whose value is to be queried
    `columnIndex` - the column whose value is to be queried

### setValueAt

    public void setValueAt(java.lang.Object aValue,
                           int rowIndex,
                           int columnIndex)

  Sets the value in the cell at columnIndex and rowIndex to aValue. Only the values in the map can be changed, the keys must remain the same.

  Specified by:
    `setValueAt` in interface `javax.swing.table.TableModel`
  Overrides:
    `setValueAt` in class `javax.swing.table.AbstractTableModel`
  Parameters:
    `aValue` - the new value
    `rowIndex` - the row whose value is to be changed
    `columnIndex` - the column whose value is to be changed

### isCellEditable

    public boolean isCellEditable(int rowIndex,
                                  int columnIndex)

  Returns true if the cell at rowIndex and columnIndex is editable and the table is editable. Otherwise, setValueAt on the cell will not change the value of that cell. Only the values in the map are editable, the keys must remain the same.

  Specified by:
    `isCellEditable` in interface `javax.swing.table.TableModel`
  Overrides:
    `isCellEditable` in class `javax.swing.table.AbstractTableModel`
  Parameters:
    `rowIndex` - the row whose value to be queried
    `columnIndex` - the column whose value to be queried
  Returns:
    true if the cell is editable

### setColumnName

    public void setColumnName(java.lang.String columnName,
                              int columnIndex)

  Sets the name of the column at columnIndex to columnName. Note: this name does not need to be unique; two columns in a table can have the same name. If null is set as the column name, then the default column name will be used.

  Parameters:
    `columnName` - the new name of the column
    `columnIndex` - the index of the column

### getColumnName

    public java.lang.String getColumnName(int columnIndex)

  Returns the name of the column at columnIndex. This is used to initialize the table's column header name. Note: this name does not need to be unique; two columns in a table can have the same name. If null is set as the column name, then the default column name will be used.

  Specified by:
    `getColumnName` in interface `javax.swing.table.TableModel`
  Overrides:
    `getColumnName` in class `javax.swing.table.AbstractTableModel`
  Parameters:
    `columnIndex` - the index of the column
  Returns:
    the name of the column

### getLocale

    public java.util.Locale getLocale()

  Returns the locale.

  See Also:
    `setLocale(java.util.Locale)`

### setLocale

    public void setLocale(java.util.Locale locale)

  Sets the locale. The locale will be used to determine the proper column labels.

  Parameters:
    `locale` - the locale in which to display labels.
  See Also:
    `getLocale()`

### isTableEditable

    public boolean isTableEditable()

  Determine if the table is editable. If the table is not editable, then none of the cells will be editable. This value is FALSE by default.

  Returns:
    boolean indicating whether the table is editable

### addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

  Add a propertyChangeListener

  Specified by:
    `addPropertyChangeListener` in interface `com.sas.beans.PropertyChangeSource`
  Parameters:
    `listener` - listener to be added

### removePropertyChangeListener

    public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

  Remove a propertyChangeListener

  Specified by:
    `removePropertyChangeListener` in interface `com.sas.beans.PropertyChangeSource`
  Parameters:
    `listener` - listener to be removed

### isRowUpdateAllowed

    public boolean isRowUpdateAllowed()

  Indicates whether rows can be updated.

  Specified by:
    `isRowUpdateAllowed` in interface `UpdateRowInterface`
  Returns:
    true if rows can be updated, false otherwise.

All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 SAS Institute Inc. All Rights Reserved.