Search in sources :

Example 1 with EncodingQuality

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

the class EncoderStreamModel method createColumns.

/**
 * Create the columns in the model
 */
@Override
protected ArrayList<ProxyColumn<EncoderStream>> createColumns() {
    ArrayList<ProxyColumn<EncoderStream>> cols = new ArrayList<ProxyColumn<EncoderStream>>(8);
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.view.num", 80, Integer.class) {

        public Object getValueAt(EncoderStream es) {
            return es.getViewNum();
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "viewNum");
        }

        public void setValueAt(EncoderStream es, Object value) {
            Integer view = (value instanceof Integer) ? (Integer) value : null;
            es.setViewNum(view);
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.flow", 90, Boolean.class) {

        public Object getValueAt(EncoderStream es) {
            return es.getFlowStream();
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "flowStream");
        }

        public void setValueAt(EncoderStream es, Object value) {
            if (value instanceof Boolean)
                es.setFlowStream((Boolean) value);
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.encoding", 90) {

        public Object getValueAt(EncoderStream es) {
            return Encoding.fromOrdinal(es.getEncoding());
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "encoding");
        }

        public void setValueAt(EncoderStream es, Object value) {
            if (value instanceof Encoding) {
                Encoding e = (Encoding) value;
                es.setEncoding(e.ordinal());
            }
        }

        protected TableCellEditor createCellEditor() {
            return new DefaultCellEditor(new JComboBox<Encoding>(Encoding.values()));
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.quality", 80) {

        public Object getValueAt(EncoderStream es) {
            return EncodingQuality.fromOrdinal(es.getQuality());
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "quality");
        }

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

        protected TableCellEditor createCellEditor() {
            return new DefaultCellEditor(new JComboBox<EncodingQuality>(EncodingQuality.values()));
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.uri.scheme", 100) {

        public Object getValueAt(EncoderStream es) {
            return es.getUriScheme();
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "uriScheme");
        }

        public void setValueAt(EncoderStream es, Object value) {
            String s = value.toString().trim();
            es.setUriScheme((s.length() > 0) ? s : null);
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.uri.path", 240) {

        public Object getValueAt(EncoderStream es) {
            return es.getUriPath();
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "uriPath");
        }

        public void setValueAt(EncoderStream es, Object value) {
            String p = value.toString().trim();
            es.setUriPath((p.length() > 0) ? p : null);
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.mcast.port", 100, Integer.class) {

        public Object getValueAt(EncoderStream es) {
            return es.getMcastPort();
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "mcastPort");
        }

        public void setValueAt(EncoderStream es, Object value) {
            Integer port = (value instanceof Integer) ? (Integer) value : null;
            es.setMcastPort(port);
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.latency", 100, Integer.class) {

        public Object getValueAt(EncoderStream es) {
            return es.getLatency();
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "latency");
        }

        public void setValueAt(EncoderStream es, Object value) {
            if (value instanceof Integer)
                es.setLatency((Integer) value);
        }
    });
    return cols;
}
Also used : JComboBox(javax.swing.JComboBox) ArrayList(java.util.ArrayList) Encoding(us.mn.state.dot.tms.Encoding) EncodingQuality(us.mn.state.dot.tms.EncodingQuality) DefaultCellEditor(javax.swing.DefaultCellEditor) TableCellEditor(javax.swing.table.TableCellEditor) EncoderStream(us.mn.state.dot.tms.EncoderStream) ProxyColumn(us.mn.state.dot.tms.client.proxy.ProxyColumn)

Example 2 with EncodingQuality

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

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

the class FlowStreamImpl method getEncoding.

/**
 * Get camera stream encoding
 */
private String getEncoding(Camera cam, Boolean flow_stream) {
    EncodingQuality eq = getEncodingQuality();
    Encoding enc = CameraHelper.getEncoding(cam, eq, flow_stream);
    return (enc != Encoding.UNKNOWN) ? enc.toString() : "PNG";
}
Also used : Encoding(us.mn.state.dot.tms.Encoding) EncodingQuality(us.mn.state.dot.tms.EncodingQuality)

Example 4 with EncodingQuality

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

the class FlowStreamImpl method getSinkPort.

/**
 * Get the sink port
 */
public String getSinkPort() {
    Integer p = getPort();
    if (p != null)
        return p.toString();
    EncodingQuality eq = getEncodingQuality();
    EncoderStream es = CameraHelper.getStream(camera, eq, true);
    if (es != null) {
        p = es.getMcastPort();
        if (p != null)
            return p.toString();
    }
    return "";
}
Also used : EncodingQuality(us.mn.state.dot.tms.EncodingQuality) EncoderStream(us.mn.state.dot.tms.EncoderStream)

Aggregations

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