Search in sources :

Example 11 with MarvinTask

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

the class DynamicGridWidget method ActivateGrid.

private void ActivateGrid(String key) {
    String prevKey = _CurrentKey;
    key = key.toLowerCase();
    if (// specified grid ID is valid, so let's proceed
    _GridMap.containsKey(key)) {
        DynamicGrid objGridCurrent, objGridNext;
        objGridCurrent = null;
        if (prevKey != null && !prevKey.equalsIgnoreCase(key)) {
            objGridCurrent = _GridMap.get(prevKey);
            if (null != objGridCurrent) {
            // objGridCurrent.getStylableObject().setVisible(false);
            }
        }
        objGridNext = _GridMap.get(key);
        if (null != objGridNext) {
            setAlignment(objGridNext.getAlignment());
            getGridPane().setAlignment(getPosition());
            if (null == objGridCurrent) {
                objGridNext.getStylableObject().setVisible(true);
            } else {
                if (null != _latestTransition && _latestTransition.stillPlaying()) {
                    // current transition still playing, so stop it
                    _latestTransition.stopTransition();
                }
                _latestTransition = objGridNext.getTransition(objGridCurrent, _TransitionPane);
            }
            _CurrentKey = key;
        }
        if (// Grid now active - is there a task associated with it?
        _TaskOnGridActivatekMap.containsKey(key)) {
            // yup, go run it!
            TASKMAN.PerformTask(_TaskOnGridActivatekMap.get(key));
        }
    } else {
        LOGGER.warning("Received unknown ID: [" + key + "] for DynamicGrid #" + 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);
    }
}
Also used : DynamicGrid(kutch.biff.marvin.widget.dynamicgrid.DynamicGrid) MarvinTask(kutch.biff.marvin.task.MarvinTask)

Example 12 with MarvinTask

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

the class GenerateDatapointInfo method HandleIDList.

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

Example 13 with MarvinTask

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

the class GenerateDatapointInfo method HandleGetListSize.

private void HandleGetListSize(String strInpValue) {
    if (null == strInpValue) {
        return;
    }
    String strData;
    strData = Integer.toString(strInpValue.split(__splitToken).length);
    MarvinTask mt = new MarvinTask();
    mt.AddDataset(__ID, __Namespace, strData);
    TaskManager.getTaskManager().AddDeferredTaskObject(mt);
}
Also used : MarvinTask(kutch.biff.marvin.task.MarvinTask)

Example 14 with MarvinTask

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

the class GenerateDatapointInfo method CheckForUpdate.

/*
     * public void DumpPatterns() { for (Pair<String,String> entry :
     * __includeCriterea) { String ns = entry.getKey(); String ID = entry.getKey();
     * if (ns == ID) {
     * 
     * } ID = ns; } }
     */
private void CheckForUpdate(String NS, String ID) {
    if (_Method == GenerateMethod.PROXY) {
        LOGGER.severe("Entered CheckForUpdate() for proxied value - should NEVER occur.  Notify Patrick");
        return;
    }
    float Total = 0;
    boolean forceUpdate = false;
    int sourcePrecision = 0;
    synchronized (__dirtyMap) {
        if (__minFrequency > 0) {
            if (__lastUpdate + __minFrequency < System.currentTimeMillis()) {
                if (_Policy == RefreshPolicy.ZERO_OUT) {
                    ZeroOutStaleEntries();
                } else if (_Policy == RefreshPolicy.REUSE) {
                    forceUpdate = true;
                } else if (_Policy == RefreshPolicy.REMOVE) {
                    RemoveOutStaleEntries();
                }
            }
        }
        for (String key : __dirtyMap.keySet()) {
            // so don't worry about it, and return.
            if (__dirtyMap.get(key).getValue() || forceUpdate) {
                String strValue = __dirtyMap.get(key).getKey();
                Total += Float.parseFloat(strValue);
                int integerPlaces = strValue.indexOf('.');
                int precision;
                if (integerPlaces < 0) {
                    precision = 0;
                } else {
                    precision = strValue.length() - integerPlaces - 1;
                }
                if (precision > sourcePrecision) {
                    // use source precision, in case not specified
                    sourcePrecision = precision;
                }
            } else {
                // not all of them had been updated
                return;
            }
        }
        if (_Method == GenerateMethod.ADD || Total == 0.0) {
        } else if (_Method == GenerateMethod.AVERAGE) {
            Total /= __dirtyMap.size();
        } else {
            LOGGER.severe("Unknown GenerateDataPoint method: " + _Method);
            return;
        }
        Total *= __Scale;
        for (String key : __dirtyMap.keySet()) {
            // go flip the dirty bit - can't do this in main loop because not all could have
            // been dirty
            Pair<String, Boolean> entry = new Pair<>(__dirtyMap.get(key).getKey(), false);
            __dirtyMap.put(key, entry);
        }
    }
    MarvinTask mt = new MarvinTask();
    DecimalFormat df = new DecimalFormat();
    df.setGroupingUsed(false);
    int precision = __precision;
    if (-1 == precision) {
        // use precision of value received
        precision = sourcePrecision;
        if (0 == precision && Total < 1) {
            precision = 2;
        }
    }
    df.setMaximumFractionDigits(precision);
    df.setMinimumFractionDigits(precision);
    String newID = Utility.combineWildcards(__ID, ID);
    String newNS = Utility.combineWildcards(__Namespace, NS);
    mt.AddDataset(newID, newNS, df.format(Total));
    // mt.AddDataset(__ID, __Namespace, df.format(Total));
    TaskManager.getTaskManager().AddDeferredTaskObject(mt);
    __lastUpdate = System.currentTimeMillis();
}
Also used : DecimalFormat(java.text.DecimalFormat) MarvinTask(kutch.biff.marvin.task.MarvinTask) Pair(javafx.util.Pair)

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