Search in sources :

Example 1 with AlertPeriod

use of us.mn.state.dot.tms.AlertPeriod in project iris by mnit-rtmc.

the class AlertMessageModel method createColumns.

/**
 * Create the columns in the model
 */
@Override
protected ArrayList<ProxyColumn<AlertMessage>> createColumns() {
    ArrayList<ProxyColumn<AlertMessage>> cols = new ArrayList<ProxyColumn<AlertMessage>>(2);
    cols.add(new ProxyColumn<AlertMessage>("alert.period", 100) {

        public Object getValueAt(AlertMessage am) {
            return AlertPeriod.fromOrdinal(am.getAlertPeriod());
        }

        public boolean isEditable(AlertMessage am) {
            return canWrite(am);
        }

        public void setValueAt(AlertMessage am, Object value) {
            if (value instanceof AlertPeriod) {
                AlertPeriod ap = (AlertPeriod) value;
                am.setAlertPeriod(ap.ordinal());
            }
        }

        protected TableCellEditor createCellEditor() {
            return new DefaultCellEditor(new JComboBox<AlertPeriod>(AlertPeriod.VALUES));
        }
    });
    cols.add(new ProxyColumn<AlertMessage>("alert.quick.message", 120) {

        public Object getValueAt(AlertMessage am) {
            return am.getQuickMessage();
        }

        public boolean isEditable(AlertMessage am) {
            return canWrite(am);
        }

        public void setValueAt(AlertMessage am, Object value) {
            am.setQuickMessage(lookupQuickMessage(value));
        }
    });
    return cols;
}
Also used : AlertPeriod(us.mn.state.dot.tms.AlertPeriod) JComboBox(javax.swing.JComboBox) ArrayList(java.util.ArrayList) TableCellEditor(javax.swing.table.TableCellEditor) AlertMessage(us.mn.state.dot.tms.AlertMessage) ProxyColumn(us.mn.state.dot.tms.client.proxy.ProxyColumn) DefaultCellEditor(javax.swing.DefaultCellEditor)

Example 2 with AlertPeriod

use of us.mn.state.dot.tms.AlertPeriod in project iris by mnit-rtmc.

the class AlertData method createDmsActions.

/**
 * Create DMS actions
 */
private void createDmsActions(AlertConfig cfg, ActionPlanImpl plan, AlertMessage msg, SignGroup grp) throws SonarException {
    AlertPeriod ap = AlertPeriod.fromOrdinal(msg.getAlertPeriod());
    QuickMessage qm = msg.getQuickMessage();
    if (ap == null || qm == null) {
        log("invalid alert message: " + msg);
        return;
    }
    switch(ap) {
        case BEFORE:
            if (cfg.getBeforePeriodHours() > 0)
                createDmsAction(plan, grp, "alert_before", qm);
            break;
        case DURING:
            createDmsAction(plan, grp, "alert_during", qm);
            break;
        case AFTER:
            if (cfg.getAfterPeriodHours() > 0)
                createDmsAction(plan, grp, "alert_after", qm);
            break;
    }
}
Also used : AlertPeriod(us.mn.state.dot.tms.AlertPeriod) QuickMessage(us.mn.state.dot.tms.QuickMessage)

Aggregations

AlertPeriod (us.mn.state.dot.tms.AlertPeriod)2 ArrayList (java.util.ArrayList)1 DefaultCellEditor (javax.swing.DefaultCellEditor)1 JComboBox (javax.swing.JComboBox)1 TableCellEditor (javax.swing.table.TableCellEditor)1 AlertMessage (us.mn.state.dot.tms.AlertMessage)1 QuickMessage (us.mn.state.dot.tms.QuickMessage)1 ProxyColumn (us.mn.state.dot.tms.client.proxy.ProxyColumn)1