Search in sources :

Example 1 with ProxyColumn

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

the class AlertMessageModel method createColumns.

/**
 * Create the columns in the model
 */
@Override
protected ArrayList<ProxyColumn<AlertMessage>> createColumns() {
    ArrayList<ProxyColumn<AlertMessage>> cols = new ArrayList<ProxyColumn<AlertMessage>>(2);
    cols.add(new ProxyColumn<AlertMessage>("alert.period", 100) {

        public Object getValueAt(AlertMessage am) {
            return AlertPeriod.fromOrdinal(am.getAlertPeriod());
        }

        public boolean isEditable(AlertMessage am) {
            return canWrite(am);
        }

        public void setValueAt(AlertMessage am, Object value) {
            if (value instanceof AlertPeriod) {
                AlertPeriod ap = (AlertPeriod) value;
                am.setAlertPeriod(ap.ordinal());
            }
        }

        protected TableCellEditor createCellEditor() {
            return new DefaultCellEditor(new JComboBox<AlertPeriod>(AlertPeriod.VALUES));
        }
    });
    cols.add(new ProxyColumn<AlertMessage>("alert.quick.message", 120) {

        public Object getValueAt(AlertMessage am) {
            return am.getQuickMessage();
        }

        public boolean isEditable(AlertMessage am) {
            return canWrite(am);
        }

        public void setValueAt(AlertMessage am, Object value) {
            am.setQuickMessage(lookupQuickMessage(value));
        }
    });
    return cols;
}
Also used : AlertPeriod(us.mn.state.dot.tms.AlertPeriod) JComboBox(javax.swing.JComboBox) ArrayList(java.util.ArrayList) TableCellEditor(javax.swing.table.TableCellEditor) AlertMessage(us.mn.state.dot.tms.AlertMessage) ProxyColumn(us.mn.state.dot.tms.client.proxy.ProxyColumn) DefaultCellEditor(javax.swing.DefaultCellEditor)

Example 2 with ProxyColumn

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

use of us.mn.state.dot.tms.client.proxy.ProxyColumn 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 4 with ProxyColumn

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

the class ControllerTableModel method createColumns.

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

        public Object getValueAt(Controller c) {
            return c.getCommLink().getName();
        }
    });
    cols.add(new ProxyColumn<Controller>("controller.drop", 48, Short.class) {

        public Object getValueAt(Controller c) {
            return isDropUsed(c) ? c.getDrop() : DROP_UNUSED;
        }

        public boolean isEditable(Controller c) {
            return canWrite(c, "drop") && isDropUsed(c);
        }

        public void setValueAt(Controller c, Object value) {
            if (value instanceof Number)
                c.setDrop(((Number) value).shortValue());
        }

        protected TableCellRenderer createCellRenderer() {
            return new DropCellRenderer();
        }

        protected TableCellEditor createCellEditor() {
            return new DropCellEditor();
        }
    });
    cols.add(new ProxyColumn<Controller>("location", 200) {

        public Object getValueAt(Controller c) {
            return GeoLocHelper.getLocation(c.getGeoLoc());
        }
    });
    cols.add(new ProxyColumn<Controller>("controller.condition", 100, CtrlCondition.class) {

        public Object getValueAt(Controller c) {
            return CtrlCondition.fromOrdinal(c.getCondition());
        }

        public boolean isEditable(Controller c) {
            return canWrite(c, "condition");
        }

        public void setValueAt(Controller c, Object value) {
            if (value instanceof CtrlCondition) {
                CtrlCondition cc = (CtrlCondition) value;
                c.setCondition(cc.ordinal());
            }
        }

        protected TableCellEditor createCellEditor() {
            JComboBox<CtrlCondition> cbx = new JComboBox<CtrlCondition>(CtrlCondition.values());
            return new DefaultCellEditor(cbx);
        }
    });
    cols.add(new ProxyColumn<Controller>("controller.comm", 32, CommState.class) {

        public Object getValueAt(Controller c) {
            return getCommState(c);
        }

        protected TableCellRenderer createCellRenderer() {
            return new CommCellRenderer();
        }
    });
    cols.add(new ProxyColumn<Controller>("controller.status", 200) {

        public Object getValueAt(Controller c) {
            return c.getStatus();
        }
    });
    cols.add(new ProxyColumn<Controller>("controller.fail", 180, Long.class) {

        public Object getValueAt(Controller c) {
            return c.getFailTime();
        }

        protected TableCellRenderer createCellRenderer() {
            return new TimeCellRenderer();
        }
    });
    cols.add(new ProxyColumn<Controller>("controller.version", 140) {

        public Object getValueAt(Controller c) {
            return c.getVersion();
        }
    });
    return cols;
}
Also used : TableCellRenderer(javax.swing.table.TableCellRenderer) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer) JComboBox(javax.swing.JComboBox) ArrayList(java.util.ArrayList) CtrlCondition(us.mn.state.dot.tms.CtrlCondition) Controller(us.mn.state.dot.tms.Controller) DefaultCellEditor(javax.swing.DefaultCellEditor) TableCellEditor(javax.swing.table.TableCellEditor) ProxyColumn(us.mn.state.dot.tms.client.proxy.ProxyColumn)

Example 5 with ProxyColumn

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

the class CommConfigModel method createColumns.

/**
 * Create the columns in the model
 */
@Override
protected ArrayList<ProxyColumn<CommConfig>> createColumns() {
    ArrayList<ProxyColumn<CommConfig>> cols = new ArrayList<ProxyColumn<CommConfig>>(9);
    cols.add(new ProxyColumn<CommConfig>("comm.config", 60) {

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

        public Object getValueAt(CommConfig cc) {
            return cc.getDescription();
        }

        public boolean isEditable(CommConfig cc) {
            return canWrite(cc, "description");
        }

        public void setValueAt(CommConfig cc, Object value) {
            cc.setDescription(value.toString().trim());
        }
    });
    cols.add(new ProxyColumn<CommConfig>("comm.config.protocol", 140) {

        public Object getValueAt(CommConfig cc) {
            return CommProtocol.fromOrdinal(cc.getProtocol());
        }

        public boolean isEditable(CommConfig cc) {
            return canWrite(cc, "protocol");
        }

        public void setValueAt(CommConfig cc, Object value) {
            if (value instanceof CommProtocol) {
                CommProtocol cp = (CommProtocol) value;
                cc.setProtocol((short) cp.ordinal());
            }
        }

        protected TableCellEditor createCellEditor() {
            JComboBox<CommProtocol> cbx = new JComboBox<CommProtocol>(CommProtocol.valuesSorted());
            return new DefaultCellEditor(cbx);
        }
    });
    cols.add(new ProxyColumn<CommConfig>("comm.config.modem", 56, Boolean.class) {

        public Object getValueAt(CommConfig cc) {
            return cc.getModem();
        }

        public boolean isEditable(CommConfig cc) {
            return canWrite(cc, "modem");
        }

        public void setValueAt(CommConfig cc, Object value) {
            if (value instanceof Boolean)
                cc.setModem((Boolean) value);
        }
    });
    cols.add(new ProxyColumn<CommConfig>("comm.config.timeout_ms", 60) {

        public Object getValueAt(CommConfig cc) {
            return cc.getTimeoutMs();
        }

        public boolean isEditable(CommConfig cc) {
            return canWrite(cc, "timeoutMs");
        }

        public void setValueAt(CommConfig cc, Object value) {
            if (value instanceof Integer)
                cc.setTimeoutMs((Integer) value);
        }

        protected TableCellEditor createCellEditor() {
            return new TimeoutCellEditor(MAX_TIMEOUT_MS);
        }
    });
    cols.add(new PeriodColumn("comm.config.poll_period_sec", CommConfig.VALID_PERIODS, 92) {

        protected int getPeriodSec(CommConfig cc) {
            return cc.getPollPeriodSec();
        }

        protected void setPeriodSec(CommConfig cc, int s) {
            cc.setPollPeriodSec(s);
        }

        public boolean isEditable(CommConfig cc) {
            return canWrite(cc, "pollPeriodSec");
        }
    });
    cols.add(new PeriodColumn("comm.config.long_poll_period_sec", CommConfig.VALID_PERIODS, 92) {

        protected int getPeriodSec(CommConfig cc) {
            return cc.getLongPollPeriodSec();
        }

        protected void setPeriodSec(CommConfig cc, int s) {
            cc.setLongPollPeriodSec(s);
        }

        public boolean isEditable(CommConfig cc) {
            return canWrite(cc, "longPollPeriodSec");
        }
    });
    cols.add(new PeriodColumn("comm.config.idle_disconnect_sec", CommConfig.VALID_DISCONNECT, 108) {

        protected int getPeriodSec(CommConfig cc) {
            return cc.getIdleDisconnectSec();
        }

        protected void setPeriodSec(CommConfig cc, int s) {
            cc.setIdleDisconnectSec(s);
        }

        public boolean isEditable(CommConfig cc) {
            return canWrite(cc, "idleDisconnectSec");
        }
    });
    cols.add(new PeriodColumn("comm.config.no_response_disconnect_sec", CommConfig.VALID_DISCONNECT, 108) {

        protected int getPeriodSec(CommConfig cc) {
            return cc.getNoResponseDisconnectSec();
        }

        protected void setPeriodSec(CommConfig cc, int s) {
            cc.setNoResponseDisconnectSec(s);
        }

        public boolean isEditable(CommConfig cc) {
            return canWrite(cc, "noResponseDisconnectSec");
        }
    });
    return cols;
}
Also used : JComboBox(javax.swing.JComboBox) ArrayList(java.util.ArrayList) DefaultCellEditor(javax.swing.DefaultCellEditor) CommProtocol(us.mn.state.dot.tms.CommProtocol) 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)23 DefaultCellEditor (javax.swing.DefaultCellEditor)23 JComboBox (javax.swing.JComboBox)23 TableCellEditor (javax.swing.table.TableCellEditor)23 ProxyColumn (us.mn.state.dot.tms.client.proxy.ProxyColumn)23 IComboBoxModel (us.mn.state.dot.tms.client.widget.IComboBoxModel)13 PlanPhase (us.mn.state.dot.tms.PlanPhase)8 DefaultTableCellRenderer (javax.swing.table.DefaultTableCellRenderer)3 TableCellRenderer (javax.swing.table.TableCellRenderer)3 MultiString (us.mn.state.dot.tms.utils.MultiString)3 CommConfig (us.mn.state.dot.tms.CommConfig)2 EncodingQuality (us.mn.state.dot.tms.EncodingQuality)2 IncRange (us.mn.state.dot.tms.IncRange)2 LaneType (us.mn.state.dot.tms.LaneType)2 Privilege (us.mn.state.dot.sonar.Privilege)1 ActionPlan (us.mn.state.dot.tms.ActionPlan)1 AlertMessage (us.mn.state.dot.tms.AlertMessage)1 AlertPeriod (us.mn.state.dot.tms.AlertPeriod)1 BeaconAction (us.mn.state.dot.tms.BeaconAction)1 Camera (us.mn.state.dot.tms.Camera)1