Search in sources :

Example 6 with MarvinTask

use of kutch.biff.marvin.task.MarvinTask in project Board-Instrumentation-Framework by intel.

the class GenerateDatapointInfo method HandleMakeListIndexList.

private void HandleMakeListIndexList(String strInpValue) {
    if (null == strInpValue) {
        return;
    }
    String strData = null;
    int len = strInpValue.split(__splitToken).length;
    for (int iIndex = 0; iIndex < len; iIndex++) {
        if (null == strData) {
            strData = Integer.toString(iIndex);
        } else {
            strData += __splitToken + Integer.toString(iIndex);
        }
    }
    MarvinTask mt = new MarvinTask();
    mt.AddDataset(__ID, __Namespace, strData);
    TaskManager.getTaskManager().AddDeferredTaskObject(mt);
}
Also used : MarvinTask(kutch.biff.marvin.task.MarvinTask)

Example 7 with MarvinTask

use of kutch.biff.marvin.task.MarvinTask in project Board-Instrumentation-Framework by intel.

the class GenerateDatapointInfo method HandleProxiedValue.

private void HandleProxiedValue(String proxyNS, String proxyID, String strValue) {
    MarvinTask mt = new MarvinTask();
    String dataStr;
    try {
        float value;
        value = Float.parseFloat(strValue);
        value *= __Scale;
        int precision = __precision;
        if (-1 == precision) {
            // use precision of value received
            int integerPlaces = strValue.indexOf('.');
            if (integerPlaces > 0) {
                precision = strValue.length() - integerPlaces - 1;
            } else {
                precision = 0;
            }
        }
        DecimalFormat df = new DecimalFormat();
        df.setGroupingUsed(false);
        df.setMaximumFractionDigits(precision);
        df.setMinimumFractionDigits(precision);
        dataStr = df.format(value);
    } catch (NumberFormatException ex) {
        dataStr = strValue;
    }
    // Can use wildcard for target names, only for Proxy at moment
    mt.AddDataset(Utility.combineWildcards(__ID, proxyID), Utility.combineWildcards(__Namespace, proxyNS), dataStr);
    TaskManager.getTaskManager().AddDeferredTaskObject(mt);
}
Also used : DecimalFormat(java.text.DecimalFormat) MarvinTask(kutch.biff.marvin.task.MarvinTask)

Example 8 with MarvinTask

use of kutch.biff.marvin.task.MarvinTask in project Board-Instrumentation-Framework by intel.

the class GenerateDatapointInfo method HandleSplitList.

private void HandleSplitList(String NS, String ID, String strInpValue) {
    String[] parts = strInpValue.split(__splitToken);
    if (parts.length < 2) {
        LOGGER.warning("GenerateDatapoint: SplitList received data that was not a list: " + strInpValue);
        return;
    }
    int index = -1;
    for (String strValue : parts) {
        MarvinTask mt = new MarvinTask();
        String dataStr;
        try {
            float value;
            value = Float.parseFloat(strValue);
            value *= __Scale;
            int precision = __precision;
            if (-1 == precision) {
                // use precision of value received
                int integerPlaces = strValue.indexOf('.');
                if (integerPlaces > 0) {
                    precision = strValue.length() - integerPlaces - 1;
                } else {
                    precision = 0;
                }
            }
            DecimalFormat df = new DecimalFormat();
            df.setGroupingUsed(false);
            df.setMaximumFractionDigits(precision);
            df.setMinimumFractionDigits(precision);
            dataStr = df.format(value);
            index++;
        } catch (NumberFormatException ex) {
            dataStr = strValue;
        }
        // Can use wildcard for target names, only for Proxy at moment
        // mt.AddDataset(Utility.combineWildcards(__ID, proxyID),
        // Utility.combineWildcards(__Namespace, proxyNS), dataStr);
        String newID = Utility.combineWildcards(__ID, ID) + "." + Integer.toString(index);
        String newNS = Utility.combineWildcards(__Namespace, NS);
        mt.AddDataset(newID, newNS, dataStr);
        TaskManager.getTaskManager().AddDeferredTaskObject(mt);
    }
    MarvinTask mt = new MarvinTask();
    String newID = Utility.combineWildcards(__ID, ID) + ".count";
    String newNS = Utility.combineWildcards(__Namespace, NS);
    mt.AddDataset(newID, newNS, Integer.toString(parts.length));
    TaskManager.getTaskManager().AddDeferredTaskObject(mt);
}
Also used : DecimalFormat(java.text.DecimalFormat) MarvinTask(kutch.biff.marvin.task.MarvinTask)

Example 9 with MarvinTask

use of kutch.biff.marvin.task.MarvinTask in project Board-Instrumentation-Framework by intel.

the class GenerateDatapointInfo method HandleNamespaceList.

private void HandleNamespaceList(String strListItem) {
    if (!__mapOfListData.containsKey(strListItem.toUpperCase())) {
        String strNamespace;
        if (__ProcessRanges) {
            strNamespace = BaseWidget.ProcessIndexDataRequest(__dataIndexRange, __dataIndexToken, strListItem);
            if (null == strNamespace) {
                return;
            }
        } else {
            strNamespace = strListItem;
        }
        __mapOfListData.put(strListItem.toUpperCase(), strNamespace);
        String strData = null;
        String[] entries = __mapOfListData.keySet().toArray(new String[__mapOfListData.size()]);
        if (ListSortMethod.DESCENDING == _sortMethod) {
            java.util.Arrays.sort(entries);
        } else if (ListSortMethod.ASCENDING == _sortMethod) {
            java.util.Arrays.sort(entries, Collections.reverseOrder());
        }
        for (String item : entries) {
            if (null == strData) {
                strData = item;
            } else {
                strData += "," + item;
            }
        }
        MarvinTask mt = new MarvinTask();
        mt.AddDataset(__ID, __Namespace, strData);
        TaskManager.getTaskManager().AddDeferredTaskObject(mt);
    }
}
Also used : MarvinTask(kutch.biff.marvin.task.MarvinTask)

Example 10 with MarvinTask

use of kutch.biff.marvin.task.MarvinTask in project Board-Instrumentation-Framework by intel.

the class DynamicImageWidget method Create.

/**
 * @param pane
 * @param dataMgr
 * @return
 */
@Override
public boolean Create(GridPane pane, DataManager dataMgr) {
    SetParent(pane);
    if (setupImages()) {
        ConfigureAlignment();
        for (String key : this._ImageFilenames.keySet()) {
            ImageView obj = _ImageViewMap.get(key);
            basePane.add(obj, 0, 0);
        }
        pane.add(basePane, getColumn(), getRow(), getColumnSpan(), getRowSpan());
        SetupPeekaboo(dataMgr);
        if (_AutoAdvance) {
            if (null == getMinionID() || null == getNamespace()) {
                String ID = Integer.toBinaryString(DynamicImageWidget._AutoAdvanceImageNumber);
                DynamicImageWidget._AutoAdvanceImageNumber++;
                if (null == getMinionID()) {
                    setMinionID(ID);
                }
                if (null == getNamespace()) {
                    setNamespace(ID);
                }
            }
            MarvinTask mt = new MarvinTask();
            mt.AddDataset(getMinionID(), getNamespace(), "Next");
            TASKMAN.AddPostponedTask(mt, _AutoAdvanceInterval);
        }
        if (!_MontorMap.isEmpty()) {
            MarvinTask mt = new MarvinTask();
            mt.AddDataset(getMinionID(), getNamespace(), "Monitor");
            TASKMAN.AddPostponedTask(mt, _MonitorInterval);
        }
        DynamicImageWidget objDynaImg = this;
        dataMgr.AddListener(getMinionID(), getNamespace(), new ChangeListener<Object>() {

            @Override
            public void changed(ObservableValue<?> o, Object oldVal, Object newVal) {
                boolean ChangeOcurred = false;
                if (IsPaused()) {
                    return;
                }
                String strVal = newVal.toString().replaceAll("(\\r|\\n)", "");
                String key;
                if (// go to next image in the list
                strVal.equalsIgnoreCase("Next")) {
                    key = _ListID.GetNext();
                } else if (// go to previous image in the list
                strVal.equalsIgnoreCase("Previous")) {
                    key = _ListID.GetPrevious();
                } else if (strVal.equalsIgnoreCase("Monitor")) {
                    ChangeOcurred = MonitorForFilechange();
                    if (ChangeOcurred) {
                        key = _CurrentKey;
                    }
                    key = _CurrentKey;
                    MarvinTask mt = new MarvinTask();
                    mt.AddDataset(getMinionID(), getNamespace(), "Monitor");
                    TASKMAN.AddPostponedTask(mt, _MonitorInterval);
                } else {
                    // expecting an ID
                    key = strVal;
                    // just to keep next/prev alignment
                    _ListID.get(key);
                }
                key = key.toLowerCase();
                if (_ImageFilenames.containsKey(key)) {
                    if (// no reason to re-load if it is
                    !key.equalsIgnoreCase(_CurrentKey) || ChangeOcurred) // already loaded
                    {
                        DynamicTransition objTransition = null;
                        ImageView startView = null;
                        ImageView nextView = null;
                        if (_TransitionMap.containsKey(_CurrentKey)) {
                            DynamicTransition objCurrentTransition = _TransitionMap.get(_CurrentKey);
                            if (objCurrentTransition.stillPlaying()) {
                                objCurrentTransition.stopTransition();
                            }
                        }
                        if (_TransitionMap.containsKey(key)) {
                            objTransition = _TransitionMap.get(key);
                            startView = _ImageViewMap.get(_CurrentKey);
                        } else {
                            _ImageViewMap.get(_CurrentKey).setVisible(false);
                        }
                        _CurrentKey = key;
                        if (null != objTransition && null != startView) {
                            nextView = _ImageViewMap.get(_CurrentKey);
                            objTransition.Transition(objDynaImg, startView, nextView);
                        } else {
                            _ImageViewMap.get(_CurrentKey).setVisible(true);
                        }
                    }
                } else {
                    LOGGER.warning("Received unknown ID: [" + strVal + "] for dynamic Image#" + getName() + ": [" + getNamespace() + ":" + getMinionID() + "]");
                    return;
                }
                if (_AutoAdvance) {
                    if (!_AutoLoopWithAdvance && _ListID.IsLast(key)) {
                        _AutoAdvance = false;
                        return;
                    }
                    MarvinTask mt = new MarvinTask();
                    mt.AddDataset(getMinionID(), getNamespace(), "Next");
                    TASKMAN.AddPostponedTask(mt, _AutoAdvanceInterval);
                }
            }
        });
        SetupTaskAction();
        return ApplyCSS();
    }
    return false;
}
Also used : DynamicTransition(kutch.biff.marvin.widget.dynamicgrid.DynamicTransition) ImageView(javafx.scene.image.ImageView) MarvinTask(kutch.biff.marvin.task.MarvinTask)

Aggregations

MarvinTask (kutch.biff.marvin.task.MarvinTask)14 DecimalFormat (java.text.DecimalFormat)3 Group (javafx.scene.Group)1 ImageView (javafx.scene.image.ImageView)1 Pair (javafx.util.Pair)1 DynamicGrid (kutch.biff.marvin.widget.dynamicgrid.DynamicGrid)1 DynamicTransition (kutch.biff.marvin.widget.dynamicgrid.DynamicTransition)1