public class AlarmTableModel extends javax.swing.table.AbstractTableModel implements AlarmSelectionListener, java.lang.Runnable
| Modifier and Type | Class and Description |
|---|---|
static class |
AlarmTableModel.AlarmTableColumn
The title of each column.
|
class |
AlarmTableModel.Priority
The content of the priority columns is composed of the label
and a reference to the
AlarmTableEntry needed to compare
two entries and sort. |
static class |
AlarmTableModel.PriorityLabel
The label of the priority column of the table
|
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_ALARMS
The max number of alarms in the table
When the max has been reach, the oldest alarm is removed
before adding a new one
|
static int |
REFRESH_TIMEINTERVAL
The time interval (seconds) between 2 updates of the
content of the table
|
| Constructor and Description |
|---|
AlarmTableModel(javax.swing.JComponent owner,
boolean reduce,
boolean addInactiveAlarms,
UndocAlarmTableModel undocModel)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
acknowledge(AlarmTableEntry alarm)
Acknowledge an alarm that in this version ends up to removing
from the table
|
void |
alarmSelected(int row)
The user pressed one mouse button over a row
|
void |
applyReductions(boolean reduce)
Enable/disable the applying of reduction rules in the table.
|
void |
autoAckAlarms(AlarmGUIType type)
Auto-acknowledge the terminated alarms is priority is equal or lower then the
passed priority.
|
void |
clear()
Clear the content of the model
|
void |
close()
Terminate the thread and free the resources.
|
AlarmTableEntry |
getAlarmAt(int rowIndex)
Return the alarm shown at the rowIndex row of the table.
|
java.util.concurrent.atomic.AtomicInteger |
getAlarmCounter(AlarmGUIType type)
Return the counter for the given alarm type
|
AlarmCategoryClient |
getCategoryClient()
Get the
CategoryClient from the AlarmsContainer |
java.lang.Object |
getCellContent(int rowIndex,
int columnIndex)
Return the text to display in a cell as it is read by the alarm
without any formatting (the table add some formatting for
example the color)
|
java.lang.Class<?> |
getColumnClass(int columnIndex)
The model needs to know that class of the PRIORITY
column in order to sort by priority (otherwise
the table sorts for the displayed string).
|
int |
getColumnCount() |
java.lang.String |
getColumnName(int col) |
AlarmTableEntry |
getRowAlarm(int row)
Return the alarm whose content fills the given row
|
int |
getRowCount() |
AlarmTableEntry |
getRowEntry(int row)
Return the entry the given row
|
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex) |
int |
hasNotAckAlarms()
Check if the container has alarm not yet acknowledged.
|
boolean |
isRowAlarmNew(int row) |
void |
onAlarm(Alarm alarm)
Each received alarm is temporarily stored in the
alarmsToAdd map so that if it appears more then
once the last occurrence replaces the old one. |
void |
onException(LaserSelectionException e)
Get exception from the client.
|
void |
pause(boolean pause)
Pause/un-pause the update of the table
|
void |
removeInactiveAlarms(AlarmGUIType type)
Remove all the inactive alarms of a given type
delegating to the AlarmsContainer.
|
void |
run()
The thread refreshes the content of the table at a fixed rate.
|
void |
setAutoAckLevel(Toolbar.ComboBoxValues lvl)
Set the auto acknowledge level
i.e.
|
void |
setCategoryClient(AlarmCategoryClient client)
Set the
CategoryClient in the AlarmsContainer |
void |
setConnectionListener(ConnectionListener listener)
Set the connection listener
|
void |
start()
Start the thread.
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAtpublic static final int MAX_ALARMS
public static final int REFRESH_TIMEINTERVAL
public AlarmTableModel(javax.swing.JComponent owner,
boolean reduce,
boolean addInactiveAlarms,
UndocAlarmTableModel undocModel)
owner - The component that owns the tablereduce - true if the reduction rules must be appliedpanel - The AlarmPanelundocModel) - The model of the undocumented tablepublic void onAlarm(Alarm alarm)
alarmsToAdd map so that if it appears more then
once the last occurrence replaces the old one.
The thread will get alarms from this map and flush them in the container to updated the table (@see run()).onAlarm in interface AlarmSelectionListeneralarm - The alarm to add to the table.AlarmSelectionListenerpublic void acknowledge(AlarmTableEntry alarm)
alarm - The inactive alarm to acknowledgepublic void onException(LaserSelectionException e)
null.onException in interface AlarmSelectionListenere - the LaserSelectionException carrying the exception codeAlarmSelectionListenerpublic int getRowCount()
getRowCount in interface javax.swing.table.TableModelpublic int getColumnCount()
getColumnCount in interface javax.swing.table.TableModelpublic AlarmTableEntry getAlarmAt(int rowIndex)
rowIndex - The index of the alarm in the modelpublic java.lang.Object getCellContent(int rowIndex,
int columnIndex)
rowIndex - The row of the cellcolumnIndex - The col of the cellpublic void setAutoAckLevel(Toolbar.ComboBoxValues lvl)
lvl - The new auto acknowledge levelpublic java.lang.Object getValueAt(int rowIndex,
int columnIndex)
getValueAt in interface javax.swing.table.TableModelAbstractTableModelpublic java.lang.String getColumnName(int col)
getColumnName in interface javax.swing.table.TableModelgetColumnName in class javax.swing.table.AbstractTableModelpublic java.lang.Class<?> getColumnClass(int columnIndex)
getColumnClass in interface javax.swing.table.TableModelgetColumnClass in class javax.swing.table.AbstractTableModelAbstractTableModel.getColumnClass(int)public AlarmTableEntry getRowAlarm(int row)
row - The number of the row showing the alarmpublic AlarmTableEntry getRowEntry(int row)
row - The number of the row showing the alarmpublic boolean isRowAlarmNew(int row)
row - Return true if the alarm is newpublic java.util.concurrent.atomic.AtomicInteger getAlarmCounter(AlarmGUIType type)
type - The type of the alarmpublic void alarmSelected(int row)
public void removeInactiveAlarms(AlarmGUIType type)
INACTIVE all inactive alarms are deleted
regardless of their prioritytype - The type of the inactive alarmsAlarmsContainer.removeInactiveAlarmspublic void autoAckAlarms(AlarmGUIType type)
This method delegates to removeInactiveAlarms(AlarmGUIType) but it is
called for each priority equal or lower then the passed priority.
priority - public void setConnectionListener(ConnectionListener listener)
listener - The listenerpublic void applyReductions(boolean reduce)
by applying reduction rules, the table will not show reduced alarms.
reduce - if true apply the reduction rules hiding reduced alarms;
if reduce is false all the alarms are shown
by the table independently of the reduction rulespublic void setCategoryClient(AlarmCategoryClient client)
CategoryClient in the AlarmsContainerclient - The CategoryCLient; it can be null.public AlarmCategoryClient getCategoryClient()
CategoryClient from the AlarmsContainerclient - The CategoryCLient; it can be null.public void clear()
public void pause(boolean pause)
If it is paused then the alarms received in onAlarm
are not added in the model but queued until the application is unpaused.
pause - if true no new alarms are added in the tablepublic void run()
executor that schedules the execution of this thread
at REFRESH_TIMEINTERVAL (2) msecs.
The thread flushes all the alarms from the alarmsToAdd vector
in the table before firing the event to refresh the content of the table.
run in interface java.lang.Runnablepublic void start()
public void close()
public int hasNotAckAlarms()
AlarmsContainer.hasNotAckAlarms()