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_Keysthe sorted list of keys.protected booleanm_Modifiedwhether the values got modified.protected booleanm_ReadOnlywhether the model is readonly.protected Map<String,String>m_Valuesthe 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 voidadd(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.intgetColumnCount()Returns the number of columns in the model.StringgetColumnName(int column)Returns the name of the column.PropertiesgetProperties()Returns the data as props structure.intgetRowCount()Returns the number of rows in the model.ObjectgetValueAt(int rowIndex, int columnIndex)Returns the cell value.booleanisCellEditable(int rowIndex, int columnIndex)Checks whether the cell is editable.booleanisModified()Returns modified state.voidremove(int rowIndex)Removes the placeholder at the position.voidsetModified(boolean value)Sets the modified state.voidsetValueAt(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:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin 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:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein 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:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein 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:
setValueAtin interfaceTableModel- Overrides:
setValueAtin 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
-
-