@Override
public Object getValueAt(int rowIndex, int columnIndex) {
List<MacroButton> buttons = prefs.getTinaMacroButtons();
if (rowIndex >= 0 && rowIndex < buttons.size()) {
MacroButton button = buttons.get(rowIndex);
switch (columnIndex) {
case COL_CAPTION:
return button.getCaption();
case COL_HINT:
return button.getHint();
case COL_MACRO:
return button.getMacro();
}
}
return null;
}
@Override
public boolean isCellEditable(int row, int column) {
return column == COL_CAPTION || column == COL_HINT || column == COL_MACRO;
}
@Override
public void setValueAt(Object aValue, int row, int column) {
List<MacroButton> buttons = prefs.getTinaMacroButtons();
if (row >= 0 && row < buttons.size()) {
MacroButton button = buttons.get(row);
String valStr = (String) aValue;
if (valStr == null) {
valStr = "";
}
switch (column) {
case COL_CAPTION:
{
if (!valStr.equals(button.getCaption())) {
button.setCaption(valStr);
tinaController.refreshMacroButtonsPanel();
}
break;
}
case COL_HINT:
{
if (!valStr.equals(button.getHint())) {
button.setHint(valStr);
tinaController.refreshMacroButtonsPanel();
}
break;
}
case COL_MACRO:
{
if (!valStr.equals(button.getMacro())) {
button.setMacro(valStr);
tinaController.refreshMacroButtonsPanel();
}
break;
}
}