public Object getValueAt(int row, int colum) { Object o = super.getValueAt(row, colum); if (o instanceof LGString) { lgs = (LGString) o; if (colum % 2 == 0) { lgs.setReturnKey(true); } else { lgs.setReturnKey(false); } return lgs; } else { return o; } }
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (value instanceof LGString) { lgs = (LGString) value; switch (lgs.isTranslated()) { case LGString.TRANSLATED: cell.setBackground(Color.white); break; case LGString.NEWLY_TRANSLATED: cell.setBackground(Color.orange); break; case LGString.NOT_IN_BASE_FILE: cell.setBackground(Color.red); break; case LGString.NOT_TRANSLATED: cell.setBackground(Color.yellow); break; default: cell.setBackground(Color.white); } } else { cell.setFocusable(false); cell.setBackground(Color.lightGray); } return cell; }
public void setValueAt(Object value, int row, int colum) { Object o = getValueAt(row, colum); if (value instanceof String && !(((String) value).startsWith("MOD_") || ((String) value).startsWith("TAR_") || ((String) value).startsWith("GENERAL")) && o instanceof LGString) { lgs = (LGString) o; if (!((String) value).equals(lgs.getValue())) { lgs.setTranslated(LGString.NEWLY_TRANSLATED); lgs.setValue((String) value); super.setValueAt(lgs.getClone(), row, colum); } } else { super.setValueAt(value, row, colum); } }