Package adams.gui.tools
Class PlaceholderManagementPanel.PlaceholderTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- adams.gui.core.AbstractBaseTableModel
-
- adams.gui.tools.PlaceholderManagementPanel.PlaceholderTableModel
-
- All Implemented Interfaces:
LoggingLevelHandler
,LoggingSupporter
,SpreadSheetSupporter
,Serializable
,TableModel
- Enclosing class:
- PlaceholderManagementPanel
public static class PlaceholderManagementPanel.PlaceholderTableModel extends AbstractBaseTableModel
Specialized table model for the placeholders.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>
m_Keys
the sorted list of keys.protected boolean
m_Modified
whether the values got modified.protected boolean
m_ReadOnly
whether the model is readonly.protected Map<String,String>
m_Values
the key - actual value relation.-
Fields inherited from class adams.gui.core.AbstractBaseTableModel
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description PlaceholderTableModel(boolean system)
Initializes the model with the global placeholders.PlaceholderTableModel(Properties props, boolean system)
Initializes the model with the specified properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(String key, String value)
Adds the placeholder (key-value pair) to the model.BaseString[]
getArray()
Returns the data as BaseString array.Class<?>
getColumnClass(int columnIndex)
Returns the class of the column.int
getColumnCount()
Returns the number of columns in the model.String
getColumnName(int column)
Returns the name of the column.Properties
getProperties()
Returns the data as props structure.int
getRowCount()
Returns the number of rows in the model.Object
getValueAt(int rowIndex, int columnIndex)
Returns the cell value.boolean
isCellEditable(int rowIndex, int columnIndex)
Checks whether the cell is editable.boolean
isModified()
Returns modified state.void
remove(int rowIndex)
Removes the placeholder at the position.void
setModified(boolean value)
Sets the modified state.void
setValueAt(Object value, int rowIndex, int columnIndex)
Sets the value at the specified position.-
Methods inherited from class adams.gui.core.AbstractBaseTableModel
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, setLoggingLevel, toSpreadSheet, toString
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Constructor Detail
-
PlaceholderTableModel
public PlaceholderTableModel(boolean system)
Initializes the model with the global placeholders.- Parameters:
system
- whether to display system ones or user-defined ones
-
PlaceholderTableModel
public PlaceholderTableModel(Properties props, boolean system)
Initializes the model with the specified properties.- Parameters:
props
- the properties to displaysystem
- whether to display system ones or user-defined ones
-
-
Method Detail
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the model.- Returns:
- always 2
-
getRowCount
public int getRowCount()
Returns the number of rows in the model.- Returns:
- the number of placeholders
-
getColumnClass
public Class<?> getColumnClass(int columnIndex)
Returns the class of the column.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- Parameters:
columnIndex
- the index of the column- Returns:
- the class of the column
-
getColumnName
public String getColumnName(int column)
Returns the name of the column.- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- Parameters:
column
- the index of the column- Returns:
- the name
-
getValueAt
public Object getValueAt(int rowIndex, int columnIndex)
Returns the cell value.- Parameters:
rowIndex
- the row of the cellcolumnIndex
- the column of the cell- Returns:
- the value
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)
Checks whether the cell is editable.- Specified by:
isCellEditable
in interfaceTableModel
- Overrides:
isCellEditable
in classAbstractTableModel
- Parameters:
rowIndex
- the row of the cellcolumnIndex
- the column of the cell- Returns:
- always true
-
setValueAt
public void setValueAt(Object value, int rowIndex, int columnIndex)
Sets the value at the specified position.- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classAbstractTableModel
- Parameters:
value
- the value to setrowIndex
- the row of the cellcolumnIndex
- the column of the cell
-
setModified
public void setModified(boolean value)
Sets the modified state.- Parameters:
value
- the modified state
-
isModified
public boolean isModified()
Returns modified state.- Returns:
- the modified state
-
remove
public void remove(int rowIndex)
Removes the placeholder at the position.- Parameters:
rowIndex
- the row to remove
-
add
public void add(String key, String value)
Adds the placeholder (key-value pair) to the model.- Parameters:
key
- the key of the placeholdervalue
- the corresponding value
-
getProperties
public Properties getProperties()
Returns the data as props structure.- Returns:
- the generated properties
-
getArray
public BaseString[] getArray()
Returns the data as BaseString array.- Returns:
- the generated array
-
-