alma::acsplugins::alarmsystem::gui::table::AlarmTableModel Class Reference

Inheritance diagram for alma::acsplugins::alarmsystem::gui::table::AlarmTableModel:
Inheritance graph
[legend]
Collaboration diagram for alma::acsplugins::alarmsystem::gui::table::AlarmTableModel:
Collaboration graph
[legend]

List of all members.

Classes

class  Priority

Public Types

enum  AlarmTableColumn {
  HIDES_CHILDREN = ("","Parent node flag",true), REDUCED = ("","Reduced flag",true), ICON = ("","Not acknowledged flag",true), TIME = ("Time",null,true),
  COMPONENT = ("Component",null,true), FAMILY = ("Family",null,true), CODE = ("Code",null,false), CAUSE = ("Cause",null,true),
  DESCRIPTION = ("Description",null,true), ACTION = ("Action",null,true), PRIORITY = ("Priority",null,true), CONSEQUENCE = ("Consequence",null,false),
  URL = ("URL",null,false), CONTACT = ("Contact",null,false), EMAIL = ("email",null,false), GSM = ("GSM",null,false),
  TRIPLET = ("Triplet",null,false)
}
enum  PriorityLabel { VERY_HIGH = ("VERY HIGH",Color.red), HIGH = ("HIGH", new Color(255,165,31)), MEDIUM = ("MEDIUM",Color.yellow), LOW = ("LOW",new Color(188,255,188)) }

Public Member Functions

 AlarmTableModel (JComponent owner, boolean reduce)
synchronized void onAlarm (Alarm alarm)
synchronized void acknowledge (AlarmTableEntry alarm)
void onException (LaserSelectionException e)
int getRowCount ()
int getColumnCount ()
AlarmTableEntry getAlarmAt (int rowIndex)
Object getCellContent (int rowIndex, int columnIndex)
void setAutoAckLevel (ComboBoxValues lvl)
Object getValueAt (int rowIndex, int columnIndex)
String getColumnName (int col)
Class<?> getColumnClass (int columnIndex)
AlarmTableEntry getRowAlarm (int row)
AlarmTableEntry getRowEntry (int row)
boolean isRowAlarmNew (int row)
AlarmCounter getAlarmCounter (AlarmGUIType type)
void alarmSelected (int row)
synchronized void removeInactiveAlarms (AlarmGUIType type)
void setConnectionListener (ConnectionListener listener)
void applyReductions (boolean reduce)
void setCategoryClient (CategoryClient client)
CategoryClient getCategoryClient ()
synchronized void clear ()
void pause (boolean pause)
void run ()
void close ()
int hasNotAckAlarms ()

Static Public Attributes

static final int MAX_ALARMS = 20000
static final int QUEUE_SIZE = 15000

Private Member Functions

void addAlarm (AlarmTableEntry alarm)
void autoAcknowledge (AlarmTableEntry alarm)
void replaceAlarm (AlarmTableEntry newAlarm)

Private Attributes

SimpleDateFormat dateFormat = new IsoDateFormat()
HashMap< AlarmGUIType,
AlarmCounter
counters = new HashMap<AlarmGUIType, AlarmCounter>()
ConnectionListener connectionListener = null
LinkedBlockingQueue
< AlarmTableEntry
queue = new LinkedBlockingQueue<AlarmTableEntry>(QUEUE_SIZE)
Semaphore paused = new Semaphore(1)
volatile boolean terminateThread = false
final Thread thread
boolean waitIfQueueFull = false
JComponent owner
AlarmsReductionContainer items = null
boolean applyReductionRules
ComboBoxValues autoAckLvl = ComboBoxValues.NONE

Detailed Description

The table model for the table alarms


Member Enumeration Documentation

The title of each column.

To change the initial order of the columns, change the order of the declaration of this enumerated.

Author:
acaproni
Enumerator:
HIDES_CHILDREN 
REDUCED 
ICON 
TIME 
COMPONENT 
FAMILY 
CODE 
CAUSE 
DESCRIPTION 
ACTION 
PRIORITY 
CONSEQUENCE 
URL 
CONTACT 
EMAIL 
GSM 
TRIPLET 

The label of the priority column of the table

Author:
acaproni
Enumerator:
VERY_HIGH 
HIGH 
MEDIUM 
LOW 

Constructor & Destructor Documentation

alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::AlarmTableModel ( JComponent  owner,
boolean  reduce 
) [inline]

Constructor

Parameters:
owner The component that owns the table
reduce true if the reduction rules must be applied
panel The AlarmPanel

References applyReductionRules, counters, items, MAX_ALARMS, and thread.


Member Function Documentation

synchronized void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::acknowledge ( AlarmTableEntry  alarm  )  [inline]
void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::addAlarm ( AlarmTableEntry  alarm  )  [inline, private]
void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::alarmSelected ( int  row  )  [inline]
void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::applyReductions ( boolean  reduce  )  [inline]

Enable/disable the applying of reduction rules in the table.

by applying reduction rules, the table will not show reduced alarms.

Parameters:
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 rules

References applyReductionRules.

Referenced by alma::acsplugins::alarmsystem::gui::toolbar::Toolbar::actionPerformed().

void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::autoAcknowledge ( AlarmTableEntry  alarm  )  [inline, private]

Automatically acknowledge an alarm depending on its priority and the selected priority level

Parameters:
alarm The alarm to acknowledge if its priority if greater the the selected priority level

References acknowledge(), autoAckLvl, alma::acsplugins::alarmsystem::gui::table::AlarmTableEntry::getPriority(), alma::acsplugins::alarmsystem::gui::table::AlarmTableEntry::getStatus(), and cern::laser::client::data::Status::isActive().

Referenced by replaceAlarm().

synchronized void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::clear (  )  [inline]
void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::close (  )  [inline]

Terminate the thread and free the resources.

References terminateThread, and thread.

Referenced by alma::acsplugins::alarmsystem::gui::CernSysPanel::close().

AlarmTableEntry alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::getAlarmAt ( int  rowIndex  )  [inline]

Return the alarm shown at the rowIndex row of the table.

Parameters:
rowIndex The index of the alarm in the model
Returns:
the alarm shown at the rowIndex row of the table

References applyReductionRules, alma::acsplugins::alarmsystem::gui::table::AlarmsReductionContainer::get(), and items.

Referenced by alma::acsplugins::alarmsystem::gui::table::AlarmTable::changeSelection(), and getCellContent().

AlarmCounter alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::getAlarmCounter ( AlarmGUIType  type  )  [inline]

Return the counter for the given alarm type

Parameters:
type The type of the alarm
Returns:
The counter for the alarm type

References counters.

Referenced by alma::acsplugins::alarmsystem::gui::statusline::StatusLine::initialize().

CategoryClient alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::getCategoryClient (  )  [inline]

Get the CategoryClient from the AlarmsContainer

Parameters:
client The CategoryCLient; it can be null.

References alma::acsplugins::alarmsystem::gui::table::AlarmsReductionContainer::getCategoryClient(), and items.

Referenced by alma::acsplugins::alarmsystem::gui::table::AlarmTable::showReductionChain().

Object alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::getCellContent ( int  rowIndex,
int  columnIndex 
) [inline]
Class<?> alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::getColumnClass ( int  columnIndex  )  [inline]

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).

See also:
javax.swing.table.AbstractTableModel::getColumnClass(int)
int alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::getColumnCount (  )  [inline]
String alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::getColumnName ( int  col  )  [inline]
AlarmTableEntry alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::getRowAlarm ( int  row  )  [inline]

Return the alarm whose content fills the given row

Parameters:
row The number of the row showing the alarm
Returns:
The alarm shown in the row

References getRowEntry().

int alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::getRowCount (  )  [inline]
AlarmTableEntry alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::getRowEntry ( int  row  )  [inline]
Object alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::getValueAt ( int  rowIndex,
int  columnIndex 
) [inline]
int alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::hasNotAckAlarms (  )  [inline]

Check if the container has alarm not yet acknowledged.

Returns:
-1 if there are not alarm to acknowledge; the highest priority of the alarm to acknowledge
See also:
alma.acsplugins.alarmsystem.gui.table.AlarmsContainer::hasNotAckAlarms()

References applyReductionRules, alma::acsplugins::alarmsystem::gui::table::AlarmsReductionContainer::hasNotAckAlarms(), and items.

Referenced by alma::acsplugins::alarmsystem::gui::sound::AlarmSound::run().

boolean alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::isRowAlarmNew ( int  row  )  [inline]
synchronized void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::onAlarm ( Alarm  alarm  )  [inline]

Add an alarm in the queue. The thread will get the alarm from the queue and update the model.

Parameters:
alarm The alarm to add to the table.
See also:
AlarmSelectionListener

Implements cern::laser::client::services::selection::AlarmSelectionListener.

References queue, terminateThread, and waitIfQueueFull.

Referenced by alma::acsplugins::alarmsystem::gui::CernSysPanel::addSpecialAlarm(), and alma::acsplugins::alarmsystem::gui::reduced::ReducedChainDlg::getAlarmChain().

void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::onException ( LaserSelectionException  e  )  [inline]
void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::pause ( boolean  pause  )  [inline]

Pause/un-pause the update of the table

If it is paused then the alarms received in onAlarm are not added in the model but queued until the application is unpaused.

Parameters:
pause if true no new alarms are added in the table

References paused, and terminateThread.

Referenced by alma::acsplugins::alarmsystem::gui::CernSysPanel::pause(), and alma::acsplugins::alarmsystem::gui::CernSysPanel::resume().

synchronized void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::removeInactiveAlarms ( AlarmGUIType  type  )  [inline]

Remove all the inactive alarms of a given type delegating to the AlarmsContainer. If the type is INACTIVE all inactive alarms are deleted regardless of their priority

Parameters:
type The type of the inactive alarms
See also:
AlarmsContainer.removeInactiveAlarms

References counters, items, and alma::acsplugins::alarmsystem::gui::table::AlarmsContainer::removeInactiveAlarms().

Referenced by alma::acsplugins::alarmsystem::gui::statusline::CounterWidget::actionPerformed().

void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::replaceAlarm ( AlarmTableEntry  newAlarm  )  [inline, private]
void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::run (  )  [inline]
void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::setAutoAckLevel ( ComboBoxValues  lvl  )  [inline]

Set the auto acknowledge level i.e. All the inactive alarms having a level equal or lower the the passed level automatically disappear from the table (i.e. with no user intervention)

Parameters:
lvl The new auto acknowledge level

References autoAckLvl.

Referenced by alma::acsplugins::alarmsystem::gui::toolbar::Toolbar::actionPerformed().

void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::setCategoryClient ( CategoryClient  client  )  [inline]
void alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::setConnectionListener ( ConnectionListener  listener  )  [inline]

Set the connection listener

Parameters:
listener The listener

References connectionListener.

Referenced by alma::acsplugins::alarmsystem::gui::CernSysPanel::initialize().


Member Data Documentation

If true applies the reduction rules hiding reduced alarms

Referenced by alarmSelected(), AlarmTableModel(), applyReductions(), getAlarmAt(), getRowCount(), getRowEntry(), hasNotAckAlarms(), isRowAlarmNew(), and run().

ComboBoxValues alma::acsplugins::alarmsystem::gui::table::AlarmTableModel::autoAckLvl = ComboBoxValues.NONE [private]

The auto acknowledge level

Referenced by autoAcknowledge(), and setAutoAckLevel().

The listener about the status of the connection

See also:
onException

Referenced by onException(), and setConnectionListener().

The date format

Referenced by getCellContent().

The max number of alarms in the table When the max has been reach, the oldest alarm is removed before adding a new one

Referenced by AlarmTableModel(), and run().

The owner component (used to show dialog messages)

Referenced by acknowledge(), addAlarm(), replaceAlarm(), and run().

The semaphore used to pause the thread

When the application is not paused, the thread acquire the semaphore before getting an alarm from the queue and release it when done.
The pause method acquires the semaphore blocking the thread. When the application is upaused then the semaphore is released and the thread restarts.

Referenced by pause(), and run().

The queue of alarms received from the CategoryClient that will be injected in the table

Referenced by onAlarm(), and run().

The max alarm in queue when the table is paused

Signal the thread to terminate

Referenced by close(), onAlarm(), pause(), and run().

The thread

Referenced by AlarmTableModel(), and close().

The behavior if the queue is full.

If it is true when a new alarm arrives and the queue is full then it waits until there is one free place in the queue.

If it is false and the queue is full then the incoming alarm will be discarded.

Referenced by onAlarm().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2