Search in sources :

Example 1 with TimeAction

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

the class TimeActionModel method createColumns.

/**
 * Create the columns in the model
 */
@Override
protected ArrayList<ProxyColumn<TimeAction>> createColumns() {
    ArrayList<ProxyColumn<TimeAction>> cols = new ArrayList<ProxyColumn<TimeAction>>(4);
    cols.add(new ProxyColumn<TimeAction>("action.plan.day", 100) {

        public Object getValueAt(TimeAction ta) {
            return ta.getDayPlan();
        }
    });
    cols.add(new ProxyColumn<TimeAction>("action.plan.date", 100) {

        public Object getValueAt(TimeAction ta) {
            return ta.getSchedDate();
        }
    });
    cols.add(new ProxyColumn<TimeAction>("action.plan.time", 80) {

        public Object getValueAt(TimeAction ta) {
            return ta.getTimeOfDay();
        }
    });
    cols.add(new ProxyColumn<TimeAction>("action.plan.phase", 100) {

        public Object getValueAt(TimeAction ta) {
            return ta.getPhase();
        }

        public boolean isEditable(TimeAction ta) {
            return canWrite(ta);
        }

        public void setValueAt(TimeAction ta, Object value) {
            if (value instanceof PlanPhase)
                ta.setPhase((PlanPhase) value);
        }

        protected TableCellEditor createCellEditor() {
            JComboBox<PlanPhase> cbx = new JComboBox<PlanPhase>();
            cbx.setModel(new IComboBoxModel<PlanPhase>(phase_mdl));
            return new DefaultCellEditor(cbx);
        }
    });
    return cols;
}
Also used : IComboBoxModel(us.mn.state.dot.tms.client.widget.IComboBoxModel) JComboBox(javax.swing.JComboBox) TimeAction(us.mn.state.dot.tms.TimeAction) ArrayList(java.util.ArrayList) PlanPhase(us.mn.state.dot.tms.PlanPhase) TableCellEditor(javax.swing.table.TableCellEditor) ProxyColumn(us.mn.state.dot.tms.client.proxy.ProxyColumn) DefaultCellEditor(javax.swing.DefaultCellEditor)

Example 2 with TimeAction

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

the class ActionPlanImpl method getScheduledPhase.

/**
 * Get the currently scheduled phase
 */
private PlanPhase getScheduledPhase() {
    // Use time in thirty seconds to avoid missing time actions
    long now = TimeSteward.currentTimeMillis() + 30 * 1000;
    TimeAction ta = TimeActionHelper.getMostRecentAction(this, new Date(now));
    return (ta != null) ? ta.getPhase() : default_phase;
}
Also used : TimeAction(us.mn.state.dot.tms.TimeAction) Date(java.util.Date)

Example 3 with TimeAction

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

the class RampMeterImpl method getTimeActionMinute.

/**
 * Get the minute for a matching time action
 */
private int getTimeActionMinute(boolean start) {
    int period = currentPeriod();
    ArrayList<MeterAction> act = getMeterActions();
    Iterator<TimeAction> it = TimeActionHelper.iterator();
    while (it.hasNext()) {
        TimeAction ta = it.next();
        Integer min = TimeActionHelper.getMinuteOfDay(ta);
        if (min != null) {
            if (TimeActionHelper.getPeriod(min) == period) {
                if (checkTimeAction(ta, start, act))
                    return min;
            }
        }
    }
    return TimeActionHelper.NOON;
}
Also used : TimeAction(us.mn.state.dot.tms.TimeAction) MeterAction(us.mn.state.dot.tms.MeterAction)

Example 4 with TimeAction

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

the class TimeActionJob method perform.

/**
 * Perform time actions
 */
@Override
public void perform() throws TMSException {
    Calendar cal = TimeSteward.getCalendarInstance();
    int min = TimeSteward.currentMinuteOfDayInt();
    Iterator<TimeAction> it = TimeActionHelper.iterator();
    while (it.hasNext()) {
        TimeAction ta = it.next();
        if (ta instanceof TimeActionImpl) {
            TimeActionImpl tai = (TimeActionImpl) ta;
            tai.perform(cal, min);
        }
    }
}
Also used : Calendar(java.util.Calendar) TimeAction(us.mn.state.dot.tms.TimeAction)

Aggregations

TimeAction (us.mn.state.dot.tms.TimeAction)4 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1 DefaultCellEditor (javax.swing.DefaultCellEditor)1 JComboBox (javax.swing.JComboBox)1 TableCellEditor (javax.swing.table.TableCellEditor)1 MeterAction (us.mn.state.dot.tms.MeterAction)1 PlanPhase (us.mn.state.dot.tms.PlanPhase)1 ProxyColumn (us.mn.state.dot.tms.client.proxy.ProxyColumn)1 IComboBoxModel (us.mn.state.dot.tms.client.widget.IComboBoxModel)1