Search in sources :

Example 1 with DynamicGrid

use of kutch.biff.marvin.widget.dynamicgrid.DynamicGrid in project Board-Instrumentation-Framework by intel.

the class DynamicGridWidget method PerformPostCreateActions.

@Override
public boolean PerformPostCreateActions(GridWidget objParentGrid, boolean updateToolTipOnly) {
    if (true == updateToolTipOnly) {
        if (CONFIG.isDebugMode()) {
            _ToolTip = this.toString();
        }
        if (_ToolTip != null && null != getStylableObject()) {
            HandleToolTipInit();
            Tooltip.install(this.getStylableObject(), _objToolTip);
        }
        return super.PerformPostCreateActions(objParentGrid, updateToolTipOnly);
    }
    _WidgetParentGridWidget = objParentGrid;
    if (CONFIG.isDebugMode()) {
        _ToolTip = this.toString();
    }
    if (_ToolTip != null) {
        HandleToolTipInit();
        for (String key : _GridMap.keySet()) {
            DynamicGrid objGrid = _GridMap.get(key);
            Tooltip.install(objGrid.getStylableObject(), _objToolTip);
        }
    }
    super.PerformPostCreateActions(objParentGrid, updateToolTipOnly);
    return handlePercentageDimentions();
}
Also used : DynamicGrid(kutch.biff.marvin.widget.dynamicgrid.DynamicGrid)

Example 2 with DynamicGrid

use of kutch.biff.marvin.widget.dynamicgrid.DynamicGrid in project Board-Instrumentation-Framework by intel.

the class DynamicGridWidget method HandleWidgetSpecificSettings.

@Override
public boolean HandleWidgetSpecificSettings(FrameworkNode node) {
    String Id = "";
    if (// padding override etc.
    super.HandleWidgetSpecificSettings(node)) {
        return true;
    }
    if (node.getNodeName().equalsIgnoreCase("AutoAdvance")) {
        /*
	     * <AutoAdvance Frequency='1000' Loop='False'/>
	     */
        if (node.hasAttribute("Frequency")) {
            _AutoAdvanceInterval = node.getIntegerAttribute("Frequency", -1);
            if (_AutoAdvanceInterval < 100) {
                LOGGER.severe("Frequency specified for DynamicGrid is invalid: " + node.getAttribute("Frequency"));
                return false;
            }
            if (node.hasAttribute("Loop")) {
                _AutoLoopWithAdvance = node.getBooleanAttribute("Loop");
            }
            _AutoAdvance = true;
            return true;
        }
        return false;
    }
    if (node.getNodeName().equalsIgnoreCase("Initial")) {
        Utility.ValidateAttributes(new String[] { "ID" }, node);
        if (node.hasAttribute("ID")) {
            _CurrentKey = node.getAttribute("ID").toLowerCase();
            return true;
        }
        LOGGER.severe("Dynamic Grid Widget incorrectly defined Initial Grid, no ID.");
        return false;
    }
    if (node.getNodeName().equalsIgnoreCase("GridFile")) {
        if (node.hasAttribute("Source")) {
        // FileName = node.getAttribute("Source");
        } else if (node.hasAttribute("Macro")) {
        } else {
            LOGGER.severe("Dynamic Grid Widget has no Source for Grid");
            return false;
        }
        if (node.hasAttribute("ID")) {
            Id = node.getAttribute("ID");
            if (true == _GridMap.containsKey(Id.toLowerCase())) {
                LOGGER.severe("Dynamic Grid Widget has repeated Grid ID: " + Id);
                return false;
            }
            Id = Id.toLowerCase();
        } else {
            LOGGER.severe("Dynamic Grid Widget has no ID for Grid");
            return false;
        }
        if (node.hasAttribute("TaskOnActivate")) {
            String Task = node.getAttribute("TaskOnActivate");
            // task to run on activate
            _TaskOnGridActivatekMap.put(Id, Task);
        }
        if (node.hasAttribute("ExcludeForAutoActions")) {
            boolean fExclude = node.getBooleanAttribute("ExcludeForAutoActions");
            if (true == fExclude) {
                _DoNotIncludeInAutoMap.put(Id, Id);
            }
        }
        DynamicGrid objGrid = (DynamicGrid) BuildGrid(node);
        if (null == objGrid) {
            return false;
        }
        if (null == objGrid.ReadTransitionInformation(node)) {
            return false;
        }
        objGrid.ConfigureAlignment();
        _Widgets.add(objGrid);
        _GridMap.put(Id, objGrid);
        _ListID.add(Id);
    }
    return true;
}
Also used : DynamicGrid(kutch.biff.marvin.widget.dynamicgrid.DynamicGrid)

Example 3 with DynamicGrid

use of kutch.biff.marvin.widget.dynamicgrid.DynamicGrid in project Board-Instrumentation-Framework by intel.

the class DynamicGridWidget method BuildGrid.

private GridWidget BuildGrid(FrameworkNode node) {
    // DynamicGrid is a superset, so can do this
    GridWidget retWidget = new DynamicGrid();
    if (true == node.hasAttribute("Source") || node.hasAttribute("Macro")) {
        FrameworkNode GridNode = null;
        AliasMgr.getAliasMgr().PushAliasList(true);
        AliasMgr.getAliasMgr().AddAliasFromAttibuteList(node, new String[] { "hgap", "vgap", "Align", "Source", "ID" });
        if (node.hasAttribute("Source")) {
            if (false == AliasMgr.ReadAliasFromExternalFile(node.getAttribute("Source"))) {
                AliasMgr.getAliasMgr().PopAliasList();
                return null;
            }
            WidgetBuilder.StartReadingExternalFile(node);
            GridNode = WidgetBuilder.OpenDefinitionFile(node.getAttribute("Source"), "Grid");
            if (// could also be tasks
            !ConfigurationReader.ReadTasksFromExternalFile(node.getAttribute("Source"))) // defined in external
            // file
            {
                return null;
            }
            WidgetBuilder.DoneReadingExternalFile();
        } else {
            GridNode = GridMacroMgr.getGridMacroMgr().getGridMacro(node.getAttribute("Macro"));
            if (null == GridNode) {
                LOGGER.severe("Unknown Grid Macro [" + node.getAttribute("Macro") + "] specified for Dynamic Grid Source");
            }
        }
        if (null == GridNode) {
            return null;
        }
        // read grid from external file
        retWidget = ReadGridInfo(GridNode, retWidget, null);
        if (null == retWidget) {
            return null;
        }
        if (node.hasAttribute("hgap")) {
            if (retWidget.parsehGapValue(node)) {
                LOGGER.config("Setting hGap for DynamicGrid :" + node.getAttribute("hgap"));
            } else {
                LOGGER.warning("hgap for DynamicGrid  invalid: " + node.getAttribute("hgap") + ".  Ignoring");
                return null;
            }
        }
        if (node.hasAttribute("vgap")) {
            if (retWidget.parsevGapValue(node)) {
                LOGGER.config("Setting vGap for DynamicGrid :" + node.getAttribute("vgap"));
            } else {
                LOGGER.warning("vgap for DynamicGrid invalid: " + node.getAttribute("vgap") + ".  Ignoring");
                return null;
            }
        }
        if (true == node.hasAttribute("Align")) {
            String str = node.getAttribute("Align");
            retWidget.setAlignment(str);
        } else {
            // if one wasn't specifice for the grid file, use whatever the
            retWidget.setAlignment(getAlignment());
        // master for the widget is.
        }
        if (node.hasAttribute("Task")) {
            retWidget.setTaskID(node.getAttribute("Task"));
        } else if (null != getTaskID()) {
            // if no task setup for individual grid, use the one for this grid
            retWidget.setTaskID(getTaskID());
        }
        AliasMgr.getAliasMgr().PopAliasList();
    }
    return retWidget;
}
Also used : DynamicGrid(kutch.biff.marvin.widget.dynamicgrid.DynamicGrid) FrameworkNode(kutch.biff.marvin.utility.FrameworkNode)

Example 4 with DynamicGrid

use of kutch.biff.marvin.widget.dynamicgrid.DynamicGrid 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

DynamicGrid (kutch.biff.marvin.widget.dynamicgrid.DynamicGrid)4 MarvinTask (kutch.biff.marvin.task.MarvinTask)1 FrameworkNode (kutch.biff.marvin.utility.FrameworkNode)1