Search in sources :

Example 1 with MarvinTask

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

the class DynamicGridWidget method OnResumed.

@Override
public void OnResumed() {
    if (_AutoAdvance) {
        if (null == getMinionID() || null == getNamespace()) {
            String ID = Integer.toBinaryString(DynamicGridWidget._AutoAdvanceGridNumber);
            DynamicGridWidget._AutoAdvanceGridNumber++;
            if (null == getMinionID()) {
                setMinionID(ID);
            }
            if (null == getNamespace()) {
                setNamespace(ID);
            }
        }
        MarvinTask mt = new MarvinTask();
        mt.AddDataset(getMinionID(), getNamespace(), "Next");
        TASKMAN.AddPostponedTask(mt, _AutoAdvanceInterval);
    }
}
Also used : MarvinTask(kutch.biff.marvin.task.MarvinTask)

Example 2 with MarvinTask

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

the class DynamicGridWidget method Create.

@Override
public boolean Create(GridPane parentPane, DataManager dataMgr) {
    setTaskID(null);
    // don't want a task setup for this actual dyanmic grid, but if one is
    setMouseHasBeenSetup(true);
    // specified, all the contined grids will have that task
    if (super.Create(parentPane, dataMgr)) {
        // _ParentPane is used in
        _TransitionPane = getGridPane();
        for (Widget objWidget : _Widgets) {
            if (GridWidget.class.isInstance(objWidget)) {
                // make all the grids invisible
                objWidget.getStylableObject().setVisible(false);
            }
        }
        if (_GridMap.isEmpty()) {
            LOGGER.warning("Dynamic Grid has no Grids.  Ignoring.");
            return true;
        }
        if (null != _CurrentKey) {
            if (!_GridMap.containsKey(_CurrentKey)) {
                LOGGER.severe("Initial ID for Dynamic Grid: " + _CurrentKey + " is invalid.");
                return false;
            }
            GridWidget objGrid = _GridMap.get(_ListID.get(_CurrentKey));
            setAlignment(objGrid.getAlignment());
            getGridPane().setAlignment(getPosition());
            objGrid.getStylableObject().setVisible(true);
        }
        if (_AutoAdvance) {
            if (null == getMinionID() || null == getNamespace()) {
                String ID = Integer.toBinaryString(DynamicGridWidget._AutoAdvanceGridNumber);
                DynamicGridWidget._AutoAdvanceGridNumber++;
                if (null == getMinionID()) {
                    setMinionID(ID);
                }
                if (null == getNamespace()) {
                    setNamespace(ID);
                }
            }
            MarvinTask mt = new MarvinTask();
            mt.AddDataset(getMinionID(), getNamespace(), "Next");
            TASKMAN.AddPostponedTask(mt, _AutoAdvanceInterval);
        }
        dataMgr.AddListener(getMinionID(), getNamespace(), new ChangeListener() {

            @Override
            public void changed(ObservableValue o, Object oldVal, Object newVal) {
                if (IsPaused()) {
                    return;
                }
                String strVal = newVal.toString().replaceAll("(\\r|\\n)", "");
                String key;
                if (// go to next image in the list
                strVal.equalsIgnoreCase("Next")) {
                    int count = _ListID.size();
                    key = _ListID.GetNext();
                    while (_DoNotIncludeInAutoMap.containsKey(key) && count >= 0) {
                        count--;
                        key = _ListID.GetNext();
                    }
                    if (count < 0) {
                        LOGGER.warning("Asked to perform Next, however all items in DyanmicGrid are marked as to exclude from automatic actions.");
                        return;
                    }
                } else if (// go to previous image in the list
                strVal.equalsIgnoreCase("Previous")) {
                    int count = _ListID.size();
                    key = _ListID.GetPrevious();
                    while (_DoNotIncludeInAutoMap.containsKey(key) && count >= 0) {
                        count--;
                        key = _ListID.GetPrevious();
                    }
                    if (count < 0) {
                        LOGGER.warning("Asked to perform previous, however all items in DyanmicGrid are marked as to exclude from automatic actions.");
                        return;
                    }
                } else {
                    // expecting an ID
                    key = strVal;
                    // just to keep next/prev alignment
                    _ListID.get(key);
                }
                ActivateGrid(key);
            }
        });
        return true;
    }
    return false;
}
Also used : ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener) MarvinTask(kutch.biff.marvin.task.MarvinTask)

Example 3 with MarvinTask

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

the class DynamicImageWidget method OnResumed.

@Override
public void OnResumed() {
    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);
    }
}
Also used : MarvinTask(kutch.biff.marvin.task.MarvinTask)

Example 4 with MarvinTask

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

the class PDF_ReaderWidget method Create.

@Override
public boolean Create(GridPane pane, DataManager dataMgr) {
    SetParent(pane);
    if (setupPDF()) {
        _objGroup = new Group();
        _objGroup.getChildren().add(_pdf);
        ConfigureAlignment();
        SetupPeekaboo(dataMgr);
        SetupTaskAction();
        ConfigureDimentions();
        pane.add(_objGroup, getColumn(), getRow(), getColumnSpan(), getRowSpan());
        gotoPage(_CurrPage);
        if (_AutoAdvance) {
            if (null == getMinionID() || null == getNamespace()) {
                String ID = this.toString() + "." + Integer.toBinaryString(PDF_ReaderWidget._AutoAdvancePageNumber);
                PDF_ReaderWidget._AutoAdvancePageNumber++;
                if (null == getMinionID()) {
                    setMinionID(ID);
                }
                if (null == getNamespace()) {
                    setNamespace(ID);
                }
            }
            MarvinTask mt = new MarvinTask();
            mt.AddDataset(getMinionID(), getNamespace(), "Next");
            TASKMAN.AddPostponedTask(mt, _AutoAdvanceInterval);
        }
        dataMgr.AddListener(getMinionID(), getNamespace(), new ChangeListener() {

            @Override
            public void changed(ObservableValue o, Object oldVal, Object newVal) {
                MyHandler(newVal);
            }
        });
        return ApplyCSS();
    }
    return false;
}
Also used : Group(javafx.scene.Group) ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener) MarvinTask(kutch.biff.marvin.task.MarvinTask)

Example 5 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)

Aggregations

MarvinTask (kutch.biff.marvin.task.MarvinTask)6 ChangeListener (javafx.beans.value.ChangeListener)3 ObservableValue (javafx.beans.value.ObservableValue)3 Group (javafx.scene.Group)1 ImageView (javafx.scene.image.ImageView)1 DynamicGrid (kutch.biff.marvin.widget.dynamicgrid.DynamicGrid)1 DynamicTransition (kutch.biff.marvin.widget.dynamicgrid.DynamicTransition)1