Search in sources :

Example 1 with PlanPhase

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

the class DmsActionModel method createColumns.

/**
 * Create the columns in the model
 */
@Override
protected ArrayList<ProxyColumn<DmsAction>> createColumns() {
    ArrayList<ProxyColumn<DmsAction>> cols = new ArrayList<ProxyColumn<DmsAction>>(5);
    cols.add(new ProxyColumn<DmsAction>("action.plan.dms.group", 120) {

        public Object getValueAt(DmsAction da) {
            return da.getSignGroup();
        }
    });
    cols.add(new ProxyColumn<DmsAction>("action.plan.phase", 100) {

        public Object getValueAt(DmsAction da) {
            return da.getPhase();
        }

        public boolean isEditable(DmsAction da) {
            return canWrite(da);
        }

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

        protected TableCellEditor createCellEditor() {
            JComboBox<PlanPhase> cbx = new JComboBox<PlanPhase>();
            cbx.setModel(new IComboBoxModel<PlanPhase>(phase_mdl));
            return new DefaultCellEditor(cbx);
        }
    });
    cols.add(new ProxyColumn<DmsAction>("quick.message", 160) {

        public Object getValueAt(DmsAction da) {
            return da.getQuickMessage();
        }

        public boolean isEditable(DmsAction da) {
            return canWrite(da);
        }

        public void setValueAt(DmsAction da, Object value) {
            String v = value.toString().trim();
            da.setQuickMessage(QuickMessageHelper.lookup(v));
        }
    });
    cols.add(new ProxyColumn<DmsAction>("dms.beacon.enabled", 100, Boolean.class) {

        public Object getValueAt(DmsAction da) {
            return da.getBeaconEnabled();
        }

        public boolean isEditable(DmsAction da) {
            return canWrite(da);
        }

        public void setValueAt(DmsAction da, Object value) {
            if (value instanceof Boolean)
                da.setBeaconEnabled((Boolean) value);
        }
    });
    cols.add(new ProxyColumn<DmsAction>("dms.msg.priority", 120) {

        public Object getValueAt(DmsAction da) {
            return DmsMsgPriority.fromOrdinal(da.getMsgPriority());
        }

        public boolean isEditable(DmsAction da) {
            return canWrite(da);
        }

        public void setValueAt(DmsAction da, Object value) {
            if (value instanceof DmsMsgPriority) {
                DmsMsgPriority p = (DmsMsgPriority) value;
                da.setMsgPriority(p.ordinal());
            }
        }

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

Example 2 with PlanPhase

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

the class PlanDispatcher method createPhaseSet.

/**
 * Create a set of phases for an action plan
 */
private TreeSet<PlanPhase> createPhaseSet(final ActionPlan ap) {
    final TreeSet<PlanPhase> phases = new TreeSet<PlanPhase>(comparator);
    Iterator<DmsAction> dit = DmsActionHelper.iterator();
    while (dit.hasNext()) {
        DmsAction da = dit.next();
        if (da.getActionPlan() == ap)
            phases.add(da.getPhase());
    }
    Iterator<BeaconAction> bit = BeaconActionHelper.iterator();
    while (bit.hasNext()) {
        BeaconAction ba = bit.next();
        if (ba.getActionPlan() == ap)
            phases.add(ba.getPhase());
    }
    Iterator<CameraAction> cit = CameraActionHelper.iterator();
    while (cit.hasNext()) {
        CameraAction ca = cit.next();
        if (ca.getActionPlan() == ap)
            phases.add(ca.getPhase());
    }
    Iterator<LaneAction> lit = LaneActionHelper.iterator();
    while (lit.hasNext()) {
        LaneAction la = lit.next();
        if (la.getActionPlan() == ap)
            phases.add(la.getPhase());
    }
    Iterator<MeterAction> mit = MeterActionHelper.iterator();
    while (mit.hasNext()) {
        MeterAction ma = mit.next();
        if (ma.getActionPlan() == ap)
            phases.add(ma.getPhase());
    }
    return phases;
}
Also used : LaneAction(us.mn.state.dot.tms.LaneAction) MeterAction(us.mn.state.dot.tms.MeterAction) BeaconAction(us.mn.state.dot.tms.BeaconAction) DmsAction(us.mn.state.dot.tms.DmsAction) TreeSet(java.util.TreeSet) PlanPhase(us.mn.state.dot.tms.PlanPhase) CameraAction(us.mn.state.dot.tms.CameraAction)

Example 3 with PlanPhase

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

the class PlanPhaseModel method createColumns.

/**
 * Create the columns in the model
 */
@Override
protected ArrayList<ProxyColumn<PlanPhase>> createColumns() {
    ArrayList<ProxyColumn<PlanPhase>> cols = new ArrayList<ProxyColumn<PlanPhase>>(3);
    cols.add(new ProxyColumn<PlanPhase>("action.plan.phase.name", 120) {

        public Object getValueAt(PlanPhase p) {
            return p.getName();
        }
    });
    cols.add(new ProxyColumn<PlanPhase>("action.plan.phase.hold", 120, Integer.class) {

        public Object getValueAt(PlanPhase p) {
            return p.getHoldTime();
        }

        public boolean isEditable(PlanPhase p) {
            return canWrite(p);
        }

        public void setValueAt(PlanPhase p, Object value) {
            if (value instanceof Integer)
                p.setHoldTime((Integer) value);
        }
    });
    cols.add(new ProxyColumn<PlanPhase>("action.plan.phase.next", 120) {

        public Object getValueAt(PlanPhase p) {
            return p.getNextPhase();
        }

        public boolean isEditable(PlanPhase p) {
            return canWrite(p);
        }

        public void setValueAt(PlanPhase p, Object value) {
            if (value instanceof PlanPhase)
                p.setNextPhase((PlanPhase) value);
            else
                p.setNextPhase(null);
        }

        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) 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 4 with PlanPhase

use of us.mn.state.dot.tms.PlanPhase 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 5 with PlanPhase

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

the class ActionPlanPanel method createObject.

/**
 * Create a new proxy object
 */
@Override
protected void createObject() {
    ActionPlanModel mdl = getActionPlanModel();
    if (mdl != null) {
        PlanPhase p = phase_mdl.getSelectedProxy();
        if (p != null) {
            String name = add_txt.getText().trim();
            mdl.create(name, p);
        }
    }
    add_txt.setText("");
    phase_mdl.setSelectedItem(null);
}
Also used : PlanPhase(us.mn.state.dot.tms.PlanPhase)

Aggregations

PlanPhase (us.mn.state.dot.tms.PlanPhase)15 ArrayList (java.util.ArrayList)8 DefaultCellEditor (javax.swing.DefaultCellEditor)8 JComboBox (javax.swing.JComboBox)8 TableCellEditor (javax.swing.table.TableCellEditor)8 ProxyColumn (us.mn.state.dot.tms.client.proxy.ProxyColumn)8 IComboBoxModel (us.mn.state.dot.tms.client.widget.IComboBoxModel)8 MultiString (us.mn.state.dot.tms.utils.MultiString)3 TreeSet (java.util.TreeSet)2 BeaconAction (us.mn.state.dot.tms.BeaconAction)2 CameraAction (us.mn.state.dot.tms.CameraAction)2 DmsAction (us.mn.state.dot.tms.DmsAction)2 LaneAction (us.mn.state.dot.tms.LaneAction)2 MeterAction (us.mn.state.dot.tms.MeterAction)2 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)1 ActionPlan (us.mn.state.dot.tms.ActionPlan)1 AlertMessage (us.mn.state.dot.tms.AlertMessage)1 DmsMsgPriority (us.mn.state.dot.tms.DmsMsgPriority)1 QuickMessage (us.mn.state.dot.tms.QuickMessage)1 SignConfig (us.mn.state.dot.tms.SignConfig)1