Search in sources :

Example 1 with IComboBoxModel

use of us.mn.state.dot.tms.client.widget.IComboBoxModel in project iris by mnit-rtmc.

the class FlowStreamModel method createColumns.

/**
 * Create the columns in the model
 */
@Override
protected ArrayList<ProxyColumn<FlowStream>> createColumns() {
    ArrayList<ProxyColumn<FlowStream>> cols = new ArrayList<ProxyColumn<FlowStream>>(9);
    cols.add(new ProxyColumn<FlowStream>("flow.stream", 140) {

        public Object getValueAt(FlowStream fs) {
            return fs.getName();
        }
    });
    cols.add(new ProxyColumn<FlowStream>("video.restricted", 100, Boolean.class) {

        public Object getValueAt(FlowStream fs) {
            return fs.getRestricted();
        }

        public boolean isEditable(FlowStream fs) {
            return canWrite(fs, "restricted");
        }

        public void setValueAt(FlowStream fs, Object value) {
            if (value instanceof Boolean)
                fs.setRestricted((Boolean) value);
        }
    });
    cols.add(new ProxyColumn<FlowStream>("flow.stream.loc.overlay", 120, Boolean.class) {

        public Object getValueAt(FlowStream fs) {
            return fs.getLocOverlay();
        }

        public boolean isEditable(FlowStream fs) {
            return canWrite(fs, "locOverlay");
        }

        public void setValueAt(FlowStream fs, Object value) {
            if (value instanceof Boolean)
                fs.setLocOverlay((Boolean) value);
        }
    });
    cols.add(new ProxyColumn<FlowStream>("flow.stream.quality", 80) {

        public Object getValueAt(FlowStream fs) {
            return EncodingQuality.fromOrdinal(fs.getQuality());
        }

        public boolean isEditable(FlowStream fs) {
            return canWrite(fs, "quality");
        }

        public void setValueAt(FlowStream fs, Object value) {
            if (value instanceof EncodingQuality) {
                EncodingQuality q = (EncodingQuality) value;
                fs.setQuality(q.ordinal());
            }
        }

        protected TableCellEditor createCellEditor() {
            return new DefaultCellEditor(new JComboBox<EncodingQuality>(EncodingQuality.values()));
        }
    });
    cols.add(new ProxyColumn<FlowStream>("camera", 160) {

        public Object getValueAt(FlowStream fs) {
            return fs.getCamera();
        }

        public boolean isEditable(FlowStream fs) {
            return canWrite(fs, "camera");
        }

        public void setValueAt(FlowStream fs, Object value) {
            fs.setCamera((value instanceof Camera) ? (Camera) value : null);
        }

        protected TableCellEditor createCellEditor() {
            JComboBox<Camera> cbx = new JComboBox<Camera>();
            cbx.setModel(new IComboBoxModel<Camera>(camera_mdl));
            return new DefaultCellEditor(cbx);
        }
    });
    cols.add(new ProxyColumn<FlowStream>("video.monitor.num", 90, Integer.class) {

        public Object getValueAt(FlowStream fs) {
            return fs.getMonNum();
        }

        public boolean isEditable(FlowStream fs) {
            return canWrite(fs, "monNum");
        }

        public void setValueAt(FlowStream fs, Object value) {
            fs.setMonNum((value instanceof Integer) ? (Integer) value : null);
        }
    });
    cols.add(new ProxyColumn<FlowStream>("flow.stream.address", 110) {

        public Object getValueAt(FlowStream fs) {
            return fs.getAddress();
        }

        public boolean isEditable(FlowStream fs) {
            return canWrite(fs, "address");
        }

        public void setValueAt(FlowStream fs, Object value) {
            String v = value.toString().trim();
            fs.setAddress(v.length() > 0 ? v : null);
        }
    });
    cols.add(new ProxyColumn<FlowStream>("flow.stream.port", 90, Integer.class) {

        public Object getValueAt(FlowStream fs) {
            return fs.getPort();
        }

        public boolean isEditable(FlowStream fs) {
            return canWrite(fs, "port");
        }

        public void setValueAt(FlowStream fs, Object value) {
            fs.setPort((value instanceof Integer) ? (Integer) value : null);
        }
    });
    cols.add(new ProxyColumn<FlowStream>("flow.stream.status", 120) {

        public Object getValueAt(FlowStream fs) {
            return FlowStreamStatus.fromOrdinal(fs.getStatus());
        }
    });
    return cols;
}
Also used : JComboBox(javax.swing.JComboBox) ArrayList(java.util.ArrayList) EncodingQuality(us.mn.state.dot.tms.EncodingQuality) DefaultCellEditor(javax.swing.DefaultCellEditor) IComboBoxModel(us.mn.state.dot.tms.client.widget.IComboBoxModel) FlowStream(us.mn.state.dot.tms.FlowStream) TableCellEditor(javax.swing.table.TableCellEditor) Camera(us.mn.state.dot.tms.Camera) ProxyColumn(us.mn.state.dot.tms.client.proxy.ProxyColumn)

Example 2 with IComboBoxModel

use of us.mn.state.dot.tms.client.widget.IComboBoxModel 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 3 with IComboBoxModel

use of us.mn.state.dot.tms.client.widget.IComboBoxModel 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 IComboBoxModel

use of us.mn.state.dot.tms.client.widget.IComboBoxModel 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 IComboBoxModel

use of us.mn.state.dot.tms.client.widget.IComboBoxModel in project iris by mnit-rtmc.

the class CommLinkModel method createColumns.

/**
 * Create the columns in the model
 */
@Override
protected ArrayList<ProxyColumn<CommLink>> createColumns() {
    ArrayList<ProxyColumn<CommLink>> cols = new ArrayList<ProxyColumn<CommLink>>(6);
    cols.add(new ProxyColumn<CommLink>("comm.link", 80) {

        public Object getValueAt(CommLink cl) {
            return cl.getName();
        }
    });
    cols.add(new ProxyColumn<CommLink>("device.description", 220) {

        public Object getValueAt(CommLink cl) {
            return cl.getDescription();
        }

        public boolean isEditable(CommLink cl) {
            return canWrite(cl, "description");
        }

        public void setValueAt(CommLink cl, Object value) {
            cl.setDescription(value.toString().trim());
        }
    });
    cols.add(new ProxyColumn<CommLink>("comm.link.uri", 280) {

        public Object getValueAt(CommLink cl) {
            return cl.getUri();
        }

        public boolean isEditable(CommLink cl) {
            return canWrite(cl, "uri");
        }

        public void setValueAt(CommLink cl, Object value) {
            cl.setUri(value.toString().trim());
        }
    });
    cols.add(new ProxyColumn<CommLink>("comm.link.poll_enabled", 56, Boolean.class) {

        public Object getValueAt(CommLink cl) {
            return cl.getPollEnabled();
        }

        public boolean isEditable(CommLink cl) {
            return canWrite(cl, "pollEnabled");
        }

        public void setValueAt(CommLink cl, Object value) {
            if (value instanceof Boolean)
                cl.setPollEnabled((Boolean) value);
        }
    });
    cols.add(new ProxyColumn<CommLink>("comm.link.connected", 50) {

        public Object getValueAt(CommLink cl) {
            return cl.getConnected();
        }

        protected TableCellRenderer createCellRenderer() {
            return new ConnectedCellRenderer();
        }
    });
    cols.add(new ProxyColumn<CommLink>("comm.config", 180) {

        public Object getValueAt(CommLink cl) {
            return cl.getCommConfig();
        }

        public boolean isEditable(CommLink cl) {
            return canWrite(cl, "commConfig");
        }

        public void setValueAt(CommLink cl, Object value) {
            if (value instanceof CommConfig) {
                CommConfig cc = (CommConfig) value;
                cl.setCommConfig(cc);
            }
        }

        @Override
        protected TableCellEditor createCellEditor() {
            JComboBox<CommConfig> cbx = new JComboBox<CommConfig>();
            cbx.setModel(new IComboBoxModel<CommConfig>(comm_config_mdl));
            cbx.setRenderer(new CommConfigListRenderer());
            return new DefaultCellEditor(cbx);
        }

        @Override
        protected TableCellRenderer createCellRenderer() {
            return new CommConfigTableRenderer();
        }
    });
    return cols;
}
Also used : CommLink(us.mn.state.dot.tms.CommLink) TableCellRenderer(javax.swing.table.TableCellRenderer) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer) JComboBox(javax.swing.JComboBox) ArrayList(java.util.ArrayList) DefaultCellEditor(javax.swing.DefaultCellEditor) IComboBoxModel(us.mn.state.dot.tms.client.widget.IComboBoxModel) TableCellEditor(javax.swing.table.TableCellEditor) CommConfig(us.mn.state.dot.tms.CommConfig) ProxyColumn(us.mn.state.dot.tms.client.proxy.ProxyColumn)

Aggregations

ArrayList (java.util.ArrayList)13 DefaultCellEditor (javax.swing.DefaultCellEditor)13 JComboBox (javax.swing.JComboBox)13 TableCellEditor (javax.swing.table.TableCellEditor)13 ProxyColumn (us.mn.state.dot.tms.client.proxy.ProxyColumn)13 IComboBoxModel (us.mn.state.dot.tms.client.widget.IComboBoxModel)13 PlanPhase (us.mn.state.dot.tms.PlanPhase)8 DefaultTableCellRenderer (javax.swing.table.DefaultTableCellRenderer)2 TableCellRenderer (javax.swing.table.TableCellRenderer)2 ActionPlan (us.mn.state.dot.tms.ActionPlan)1 BeaconAction (us.mn.state.dot.tms.BeaconAction)1 Camera (us.mn.state.dot.tms.Camera)1 CameraAction (us.mn.state.dot.tms.CameraAction)1 CommConfig (us.mn.state.dot.tms.CommConfig)1 CommLink (us.mn.state.dot.tms.CommLink)1 DmsAction (us.mn.state.dot.tms.DmsAction)1 DmsMsgPriority (us.mn.state.dot.tms.DmsMsgPriority)1 EncodingQuality (us.mn.state.dot.tms.EncodingQuality)1 EventType (us.mn.state.dot.tms.EventType)1 FlowStream (us.mn.state.dot.tms.FlowStream)1