|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.swing.models.MapToTableModelAdapter
public class MapToTableModelAdapter
The MapToTableModelAdapter allows Maps that implement java.util.Map
to be used as the
model for a javax.swing.JTable
. The Map 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
map can be modified and column names can be set so that the displayed columns can be customized.
Field Summary | |
---|---|
protected java.lang.String[] |
columnNames
Column names for table model |
protected java.util.List |
keys
Internal storage of keys from Map |
protected java.util.Map |
model
Model for the Map |
protected javax.swing.event.SwingPropertyChangeSupport |
spcs
Used to support property changes in the webAF customizer |
protected boolean |
tableEditable
Whether the table model is editable |
protected java.util.List |
values
Internal storage of values from Map |
Constructor Summary | |
---|---|
MapToTableModelAdapter()
Default constructor |
|
MapToTableModelAdapter(int size)
Overloaded constructor that initializes the delegate to be of given size |
|
MapToTableModelAdapter(java.util.Map m)
Overloaded constructor that intializes the adapter with the entire entrySet given by the Map |
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
|
protected void |
createDelegate()
Create the delegate object |
int |
getColumnCount()
Returns the number of columns in the model. |
java.lang.String |
getColumnName(int columnIndex)
Returns the name of the column at columnIndex. |
static com.sas.beans.ExtendedBeanInfo |
getExtendedBeanInfo()
|
java.util.Map |
getModel()
Returns the model of the adapter |
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. |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns true if the cell at rowIndex and columnIndex is editable and the table is editable. |
boolean |
isTableEditable()
Determine if the table is editable. |
void |
refresh()
Force a refresh on the adapter |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
|
void |
setColumnName(java.lang.String columnName,
int columnIndex)
Sets the name of the column at columnIndex to columnName. |
void |
setModel(java.util.Map model)
Sets the model of the adapter to the given Map |
void |
setTableEditable(boolean editable)
Set the table to state defined by editable. |
void |
setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex)
Sets the value in the cell at columnIndex and rowIndex to aValue. |
Field Detail |
---|
protected java.util.List keys
protected java.util.List values
protected java.util.Map model
protected java.lang.String[] columnNames
protected boolean tableEditable
protected javax.swing.event.SwingPropertyChangeSupport spcs
Constructor Detail |
---|
public MapToTableModelAdapter()
public MapToTableModelAdapter(int size)
size
- Initial size of the delegate representing the Mappublic MapToTableModelAdapter(java.util.Map m)
m
- Map whose data will be used within the adapterMethod Detail |
---|
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface javax.swing.table.TableModel
rowIndex
- the row whose value is to be queriedcolumnIndex
- the column whose value is to be queriedpublic void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
setValueAt
in interface javax.swing.table.TableModel
setValueAt
in class javax.swing.table.AbstractTableModel
aValue
- the new valuerowIndex
- the row whose value is to be changedcolumnIndex
- the column whose value is to be changedpublic boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
in class javax.swing.table.AbstractTableModel
rowIndex
- the row whose value to be queriedcolumnIndex
- the column whose value to be queried
public void setModel(java.util.Map model)
model
- Map whose data will be used within the adapterpublic java.util.Map getModel()
public void setColumnName(java.lang.String columnName, int columnIndex)
columnName
- the new name of the columncolumnIndex
- the index of the columnpublic java.lang.String getColumnName(int columnIndex)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
columnIndex
- the index of the column
public boolean isTableEditable()
public void setTableEditable(boolean editable)
protected void createDelegate()
public void refresh()
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener
in interface com.sas.beans.PropertyChangeSource
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener
in interface com.sas.beans.PropertyChangeSource
public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |