Search in sources :

Example 1 with PvList

use of com.fr3ts0n.pvs.PvList in project AndrOBD by fr3ts0n.

the class ObdDataPanel method setPidPvs.

/**
 * Setter for property pidPvs.
 *
 * @param pidPvs New value of property pidPvs.
 */
@SuppressWarnings("unchecked")
public void setPidPvs(PvList pidPvs) {
    TimeSeries ts;
    // if there is an o previous instance registered, unregister ...
    if (this.pidPvs instanceof PvList)
        this.pidPvs.removePvChangeListener(this);
    this.pidPvs = pidPvs;
    tblPids.setProcessVar(pidPvs);
    tblPids.setDefaultRenderer(Object.class, new ObdItemTableRenderer());
    pidPvs.addPvChangeListener(this);
    // update all TimeSeries with PIDs from PV-List
    plotter.dataset.removeAllSeries();
    selPids.clear();
    Iterator<EcuDataPv> it = pidPvs.values().iterator();
    while (it.hasNext()) {
        EcuDataPv pv = it.next();
        // create new data series
        ts = new TimeSeries(String.valueOf(pv.get(EcuDataPv.FID_DESCRIPT)));
        ts.setDescription(String.valueOf(pv.get(EcuDataPv.FID_DESCRIPT)));
        ts.setRangeDescription(String.valueOf(pv.get(EcuDataPv.FID_UNITS)));
        // set graph time of new element
        ts.setMaximumItemAge(slGraphTime.getValue() * 60);
        // and add to selectable PID list
        selPids.put(getPvId(pv), ts);
    }
    updateColumnWidths();
}
Also used : PvList(com.fr3ts0n.pvs.PvList) EcuDataPv(com.fr3ts0n.ecu.EcuDataPv) TimeSeries(org.jfree.data.time.TimeSeries)

Example 2 with PvList

use of com.fr3ts0n.pvs.PvList in project AndrOBD by fr3ts0n.

the class PvExplorer method valueChanged.

@Override
public void valueChanged(TreeSelectionEvent e) {
    TreePath selPath = e.getNewLeadSelectionPath();
    if (selPath == null)
        return;
    ProcessVar pv = PvTreeNode.getPvFromTreePath(selPath);
    if (pv instanceof PvList) {
        // if process var is a PV list itself then show it in table
        pvTable.setProcessVar(pv);
    } else {
        // ... otherwise create a list with PV as contained element
        tblList.clear();
        tblList.put(pv.getKeyValue(), pv);
        pvTable.setProcessVar(tblList);
    }
}
Also used : PvList(com.fr3ts0n.pvs.PvList) ProcessVar(com.fr3ts0n.pvs.ProcessVar) TreePath(javax.swing.tree.TreePath)

Example 3 with PvList

use of com.fr3ts0n.pvs.PvList in project AndrOBD by fr3ts0n.

the class MainActivity method setFiltered.

/**
 * Filter display items to just the selected ones
 */
private void setFiltered(boolean filtered) {
    if (filtered) {
        PvList filteredList = new PvList();
        TreeSet<Integer> selPids = new TreeSet<Integer>();
        for (int pos : getSelectedPositions()) {
            EcuDataPv pv = (EcuDataPv) mPidAdapter.getItem(pos);
            selPids.add(pv.getAsInt(EcuDataPv.FID_PID));
            filteredList.put(pv.toString(), pv);
        }
        mPidAdapter.setPvList(filteredList);
        setFixedPids(selPids);
    } else {
        ObdProt.resetFixedPid();
        mPidAdapter.setPvList(ObdProt.PidPvs);
    }
}
Also used : PvList(com.fr3ts0n.pvs.PvList) EcuDataPv(com.fr3ts0n.ecu.EcuDataPv) TreeSet(java.util.TreeSet)

Aggregations

PvList (com.fr3ts0n.pvs.PvList)3 EcuDataPv (com.fr3ts0n.ecu.EcuDataPv)2 ProcessVar (com.fr3ts0n.pvs.ProcessVar)1 TreeSet (java.util.TreeSet)1 TreePath (javax.swing.tree.TreePath)1 TimeSeries (org.jfree.data.time.TimeSeries)1