use of com.cosylab.logging.viewcoordination.ViewCoordinator.SingleLogSelectionListener in project ACS by ACS-Community.
the class LogEntryTable method changeSelection.
/**
* Override the method in <code>JTable</code> to catch the change of selection operated
* by the user and update the detailed log info accordingly.
*
* @see <code>JTable.changeSelection(int rowIndex, int columnIndex, boolean toggle,boolean extend)</code>
*/
@Override
public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) {
super.changeSelection(rowIndex, columnIndex, toggle, extend);
// to avoid concurrency issues
SingleLogSelectionListener listenerCopy = listener;
if (rowIndex != -1 && !toggle && !extend) {
LogTableDataModel model = (LogTableDataModel) getModel();
ILogEntry log = model.getVisibleLogEntry(convertRowIndexToModel(rowIndex));
loggingClient.setLogDetailContent(log);
selecteViewdRow = rowIndex;
selecteModelRow = convertRowIndexToModel(rowIndex);
selecteLogKey = ((LogTableDataModel) getModel()).getLogKey(selecteModelRow);
if (listenerCopy != null && log != null) {
listenerCopy.notifyLogSelected(log);
}
} else {
// Multiple line selection etc all mean 'deselection' for our SingleLogSelectionListener
if (listenerCopy != null) {
listenerCopy.notifyLogSelected(null);
}
}
}
Aggregations