Search in sources :

Example 1 with FlowStream

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

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

the class VideoMonitorImpl method doSetCamMirrored.

/**
 * Set camera on all video monitors / flow streams with a given number.
 * @param mn Monitor number.
 * @param c Camera to display.
 * @param src Source of command.
 * @param select Was source a new camera selection.
 */
private static void doSetCamMirrored(int mn, CameraImpl c, String src, boolean select) throws TMSException {
    Iterator<VideoMonitor> it = VideoMonitorHelper.iterator();
    while (it.hasNext()) {
        VideoMonitor m = it.next();
        if (m instanceof VideoMonitorImpl) {
            VideoMonitorImpl vm = (VideoMonitorImpl) m;
            if (vm.getMonNum() == mn)
                vm.setCamNotify(c, src, select);
        }
    }
    Iterator<FlowStream> fit = FlowStreamHelper.iterator();
    while (fit.hasNext()) {
        FlowStream f = fit.next();
        if (f instanceof FlowStreamImpl) {
            FlowStreamImpl fs = (FlowStreamImpl) f;
            Integer num = fs.getMonNum();
            if (num != null && num == mn)
                fs.setMonCamera(c);
        }
    }
}
Also used : VideoMonitor(us.mn.state.dot.tms.VideoMonitor) FlowStream(us.mn.state.dot.tms.FlowStream)

Example 3 with FlowStream

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

the class VideoMonitorImpl method blankRestrictedMonitors.

/**
 * Blank restricted video monitors viewing a camera
 */
public static void blankRestrictedMonitors() {
    Iterator<VideoMonitor> it = VideoMonitorHelper.iterator();
    while (it.hasNext()) {
        VideoMonitor m = it.next();
        if (m instanceof VideoMonitorImpl) {
            VideoMonitorImpl vm = (VideoMonitorImpl) m;
            vm.blankRestricted();
        }
    }
    Iterator<FlowStream> fit = FlowStreamHelper.iterator();
    while (fit.hasNext()) {
        FlowStream f = fit.next();
        if (f instanceof FlowStreamImpl) {
            FlowStreamImpl fs = (FlowStreamImpl) f;
            fs.updateStream();
        }
    }
}
Also used : VideoMonitor(us.mn.state.dot.tms.VideoMonitor) FlowStream(us.mn.state.dot.tms.FlowStream)

Aggregations

FlowStream (us.mn.state.dot.tms.FlowStream)3 VideoMonitor (us.mn.state.dot.tms.VideoMonitor)2 ArrayList (java.util.ArrayList)1 DefaultCellEditor (javax.swing.DefaultCellEditor)1 JComboBox (javax.swing.JComboBox)1 TableCellEditor (javax.swing.table.TableCellEditor)1 Camera (us.mn.state.dot.tms.Camera)1 EncodingQuality (us.mn.state.dot.tms.EncodingQuality)1 ProxyColumn (us.mn.state.dot.tms.client.proxy.ProxyColumn)1 IComboBoxModel (us.mn.state.dot.tms.client.widget.IComboBoxModel)1