Search in sources :

Example 1 with DynamicItemInfoContainer

use of kutch.biff.marvin.utility.DynamicItemInfoContainer in project Board-Instrumentation-Framework by intel.

the class ConfigurationReader method ReadAppSettings.

private boolean ReadAppSettings(Document doc, boolean basicInfoOnly) {
    NodeList appStuff = doc.getElementsByTagName("Application");
    if (appStuff.getLength() < 1) {
        LOGGER.severe("No <Application> section of config file");
        return false;
    }
    if (appStuff.getLength() > 1) {
        LOGGER.warning("More than one <Application> section found, only using first.");
    }
    boolean NetworkSettingsRead = false;
    FrameworkNode baseNode = new FrameworkNode(appStuff.item(0));
    FetchDimenstions(baseNode);
    boolean currErrorBool = Configuration.getConfig().DoNotReportAliasErrors();
    Configuration.getConfig().SetDoNotReportAliasErrors(basicInfoOnly);
    AliasMgr.getAliasMgr().addMarvinInfo();
    AliasMgr.ReadAliasFromRootDocument(doc);
    ReadAppAttributes(baseNode);
    Configuration.getConfig().SetDoNotReportAliasErrors(currErrorBool);
    ArrayList<String> DeclaredTabList = new ArrayList<>();
    for (FrameworkNode node : baseNode.getChildNodes()) {
        if (node.getNodeName().equalsIgnoreCase("#Text") || node.getNodeName().equalsIgnoreCase("#Comment")) {
            continue;
        } else if (node.getNodeName().equalsIgnoreCase("Title")) {
            _Configuration.setAppTitle(node.getTextContent());
            LOGGER.config("Application Title = " + _Configuration.getAppTitle());
        } else if (node.getNodeName().equalsIgnoreCase("Heartbeat")) {
            if (node.hasAttribute("rate")) {
                _Configuration.setHeartbeatInterval(node.getIntegerAttribute("rate", _Configuration.getHeartbeatInterval()));
            }
        } else if (node.getNodeName().equalsIgnoreCase("StyleSheet")) {
            _Configuration.setCSSFile(node.getTextContent());
            LOGGER.config("Setting application CSS to " + _Configuration.getCSSFile());
        } else if (node.getNodeName().equalsIgnoreCase("IgnoreWebCerts")) {
            _Configuration.setIgnoreWebCerts(node.getBooleanValue());
            LOGGER.config("Ignoring Web Certifications");
        } else if (node.getNodeName().equalsIgnoreCase("MonitorNumber")) {
            if (false == basicInfoOnly) {
                continue;
            }
            int count = Screen.getScreens().size();
            if (count == 1) {
                continue;
            }
            try {
                int monitorNum = Integer.parseInt(node.getTextContent());
                if (monitorNum < 1) {
                    LOGGER.warning("<MonitorNumber> set to " + node.getTextContent() + " smallest valid value is 1.Ignoring");
                    continue;
                }
                if (monitorNum <= count) {
                    Screen primary = Screen.getScreens().get(monitorNum - 1);
                    _Configuration.setPrimaryScreen(primary);
                    if (false == basicInfoOnly) {
                        LOGGER.config("Setting Primary Screen to monitor #" + node.getTextContent());
                    }
                } else if (false == basicInfoOnly) {
                    LOGGER.warning("<MonitorNumber> set to " + node.getTextContent() + " however there are only " + Integer.toHexString(count) + " monitors. Ignoring");
                }
            } catch (Exception Ex) {
                LOGGER.severe("Invalid MonitorNumber specified.  Ignoring.");
            // return false;
            }
        } else if (node.getNodeName().equalsIgnoreCase("CreationSize")) {
            Utility.ValidateAttributes(new String[] { "Height", "Width" }, node);
            if (node.hasAttribute("Height") && node.hasAttribute("Width")) {
                _Configuration.setCreationWidth(node.getIntegerAttribute("Width", 0));
                _Configuration.setCreationHeight(node.getIntegerAttribute("Height", 0));
            } else if (false == basicInfoOnly) {
                LOGGER.severe("Invalid CreationSize specified");
            }
        } else if (node.getNodeName().equalsIgnoreCase("Tasks")) {
            if (basicInfoOnly) {
                continue;
            }
            Utility.ValidateAttributes(new String[] { "Enabled" }, node);
            if (node.hasAttribute("Enabled")) {
                String str = node.getAttribute("Enabled");
                if (str.equalsIgnoreCase("True")) {
                    _Configuration.setAllowTasks(true);
                    LOGGER.config("Tasks Enabled");
                } else {
                    _Configuration.setAllowTasks(false);
                    LOGGER.config("Tasks Disabled");
                }
            }
        } else if (node.getNodeName().equalsIgnoreCase("Network")) {
            if (basicInfoOnly) {
                continue;
            }
            Utility.ValidateAttributes(new String[] { "IP", "Port" }, node);
            boolean fPort = false;
            if (node.hasAttribute("IP")) {
                String str = node.getAttribute("IP");
                _Configuration.setAddress(str);
            } else {
                LOGGER.config("No IP specified in <Network> settings. Will listen on all interfaces");
                _Configuration.setAddress("0.0.0.0");
            }
            if (node.hasAttribute("Port")) {
                String str = node.getAttribute("Port");
                try {
                    _Configuration.setPort(Integer.parseInt(str));
                    fPort = true;
                } catch (Exception ex) {
                    LOGGER.severe("Invalid Network port: " + str);
                }
            } else {
                LOGGER.info("Port not attribute for <Network> settings.");
            }
            if (fPort) {
                NetworkSettingsRead = true;
            } else {
                return false;
            }
            for (FrameworkNode oscarNode : node.getChildNodes()) {
                if (oscarNode.getNodeName().equalsIgnoreCase("#Text") || oscarNode.getNodeName().equalsIgnoreCase("#Comment")) {
                    continue;
                } else if (oscarNode.getNodeName().equalsIgnoreCase("Oscar")) {
                    if (false == ReadOscarConnection(oscarNode)) {
                        return false;
                    }
                }
            }
        } else if (node.getNodeName().equalsIgnoreCase("Padding")) {
            if (basicInfoOnly) {
                continue;
            }
            Utility.ValidateAttributes(new String[] { "top", "bottom", "left", "right", "legacymode" }, node);
            String strTop = "-1";
            String strBottom = "-1";
            String strLeft = "-1";
            String strRight = "-1";
            if (node.hasAttribute("top")) {
                strTop = node.getAttribute("top");
            }
            if (node.hasAttribute("bottom")) {
                strBottom = node.getAttribute("bottom");
            }
            if (node.hasAttribute("left")) {
                strLeft = node.getAttribute("left");
            }
            if (node.hasAttribute("right")) {
                strRight = node.getAttribute("right");
            }
            try {
                _Configuration.setInsetTop(Integer.parseInt(strTop));
                _Configuration.setInsetBottom(Integer.parseInt(strBottom));
                _Configuration.setInsetLeft(Integer.parseInt(strLeft));
                _Configuration.setInsetRight(Integer.parseInt(strRight));
            } catch (NumberFormatException ex) {
                LOGGER.severe("Invalid Application <Inset> configuration.");
                return false;
            }
            if (node.hasAttribute("legacymode")) {
                _Configuration.setLegacyInsetMode(node.getBooleanAttribute("legacymode"));
                if (_Configuration.getLegacyInsetMode()) {
                    LOGGER.config("Using LEGACY mode of padding.");
                }
            }
        } else if (node.getNodeName().equalsIgnoreCase("MainMenu")) {
            if (false == ReadAppMenu(node, basicInfoOnly)) {
                return false;
            }
        } else if (node.getNodeName().equalsIgnoreCase("UnregisteredData")) {
            if (basicInfoOnly) {
                continue;
            }
            if (false == ReadUnregisteredDataInfo(node)) {
                return false;
            }
        } else if (node.getNodeName().equalsIgnoreCase("Tabs")) {
            Utility.ValidateAttributes(new String[] { "side" }, node);
            if (// where the tabs should be located.
            node.hasAttribute("Side")) {
                String sideStr = node.getAttribute("Side");
                if (sideStr.equalsIgnoreCase("Top")) {
                    _Configuration.setSide(Side.TOP);
                } else if (sideStr.equalsIgnoreCase("Bottom")) {
                    _Configuration.setSide(Side.BOTTOM);
                } else if (sideStr.equalsIgnoreCase("Left")) {
                    _Configuration.setSide(Side.LEFT);
                } else if (sideStr.equalsIgnoreCase("Right")) {
                    _Configuration.setSide(Side.RIGHT);
                } else {
                    LOGGER.warning("Invalid <Tabs Side=> attribute: " + sideStr + ". Ignoring");
                }
            }
            if (basicInfoOnly) {
                continue;
            }
            int tabCount = 0;
            for (FrameworkNode tabNode : node.getChildNodes(true)) {
                if (tabNode.getNodeName().equalsIgnoreCase("#Text")) {
                    continue;
                }
                if (tabNode.getNodeName().equalsIgnoreCase("Tab")) {
                    if (tabNode.hasAttributes()) {
                        String ID = tabNode.getAttribute("ID");
                        if (ID != null && ID.length() > 0) {
                            if (tabNode.hasChild("OnDemand")) {
                                DynamicItemInfoContainer dynaInfo = ReadOnDemandInfo(tabNode.getChild("OnDemand"));
                                if (null != dynaInfo) {
                                    OnDemandTabBuilder objBuilder = new OnDemandTabBuilder(ID, tabCount, dynaInfo);
                                    DataManager.getDataManager().AddOnDemandWidgetCriterea(dynaInfo, objBuilder);
                                    _OnDemandID_List.add(ID.toUpperCase());
                                }
                            } else {
                                DeclaredTabList.add(ID);
                            }
                            tabCount++;
                        } else {
                            LOGGER.warning("Tab defined in <Tabs> without an ID");
                        }
                    }
                }
            }
        } else if (node.getNodeName().equalsIgnoreCase("RefreshInterval")) {
            if (basicInfoOnly) {
                continue;
            }
            String strInterval = node.getTextContent();
            try {
                _Configuration.setTimerInterval(Long.parseLong(strInterval));
            } catch (NumberFormatException ex) {
                LOGGER.severe("Invalid Application <RefreshInterval> configuration.");
                return false;
            }
        } else {
            LOGGER.warning("Unexpected section in <Application>: " + node.getNodeName());
        }
    }
    if (basicInfoOnly) {
        return true;
    }
    if (DeclaredTabList.isEmpty() && !DataManager.getDataManager().DynamicTabRegistered()) {
        LOGGER.severe("No Tabs defined in <Application> section of configuration file.");
        return false;
    }
    _Configuration.setPrimaryScreenDetermined(true);
    if (VerifyTabList(DeclaredTabList)) {
        _tabs = ReadTabs(doc, DeclaredTabList);
        if (null == _tabs) {
            return false;
        }
    }
    if (DataManager.getDataManager().DynamicTabRegistered()) {
        ReadOnDemandTabs(doc);
    }
    if (false == NetworkSettingsRead) {
        LOGGER.severe("No <Network> section found in Application.xml");
    }
    return NetworkSettingsRead;
}
Also used : DynamicItemInfoContainer(kutch.biff.marvin.utility.DynamicItemInfoContainer) Screen(javafx.stage.Screen) NodeList(org.w3c.dom.NodeList) ArrayList(java.util.ArrayList) OnDemandTabBuilder(kutch.biff.marvin.widget.widgetbuilder.OnDemandTabBuilder) FrameworkNode(kutch.biff.marvin.utility.FrameworkNode) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException)

Example 2 with DynamicItemInfoContainer

use of kutch.biff.marvin.utility.DynamicItemInfoContainer in project Board-Instrumentation-Framework by intel.

the class DataManager method ChangeValue.

public void ChangeValue(String ID, String Namespace, String Value) {
    boolean OnDemandItemFound = false;
    boolean OnDemandTabFound = false;
    synchronized (this) {
        for (Pair<DynamicItemInfoContainer, OnDemandWidgetBuilder> entry : _OnDemandQueue) {
            if (entry.getKey().Matches(Namespace, ID, Value)) {
                LateCreateTask objTask = new LateCreateTask(entry.getValue(), Namespace, ID, Value, entry.getKey().getLastMatchedSortStr());
                TaskManager.getTaskManager().AddDeferredTaskObject(objTask);
                OnDemandItemFound = true;
                if (entry.getValue() instanceof OnDemandTabBuilder) {
                    OnDemandTabFound = true;
                }
            }
        }
        if (OnDemandItemFound) {
            Configuration.getConfig().setCursorToWait();
        }
        // go and handle any GenerateDatapoint stuff
        for (GenerateDatapointInfo info : __GenerateDatapointList) {
            if (info.Matches(Namespace, ID)) {
                info.BuildDatapoint(Namespace, ID);
            }
        }
    }
    synchronized (this) {
        String Key = Utility.generateKey(Namespace, ID);
        _UpdateCount++;
        boolean inWildcard = HandleWildcardChangeValue(ID, Namespace, Value);
        if (false == _DataMap.containsKey(Key)) {
            _DataMap.put(Key, new DataSet());
            if (false == inWildcard) {
                _UnassignedDataPoints++;
                // nifty stuff to dynamically add a tab to show 'unregistered' data points.
                if (kutch.biff.marvin.widget.DynamicTabWidget.isEnabled()) {
                    DynamicDebugWidgetTask objTask = new DynamicDebugWidgetTask(Namespace, ID, Value);
                    TaskManager.getTaskManager().AddPostponedTask(objTask, 0);
                }
            }
        }
        if (// if didn't exist, is created above
        _DataMap.containsKey(Key)) {
            _DataMap.get(Key).setLatestValue(Value);
        }
    }
    if (true == OnDemandTabFound) {
    // ApplyOnDemandTabStyle objTask = new ApplyOnDemandTabStyle();
    // TaskManager.getTaskManager().AddPostponedTask(objTask, 1000);
    }
}
Also used : DynamicItemInfoContainer(kutch.biff.marvin.utility.DynamicItemInfoContainer) OnDemandWidgetBuilder(kutch.biff.marvin.widget.widgetbuilder.OnDemandWidgetBuilder) GenerateDatapointInfo(kutch.biff.marvin.utility.GenerateDatapointInfo) LateCreateTask(kutch.biff.marvin.task.LateCreateTask) OnDemandTabBuilder(kutch.biff.marvin.widget.widgetbuilder.OnDemandTabBuilder) DynamicDebugWidgetTask(kutch.biff.marvin.task.DynamicDebugWidgetTask)

Example 3 with DynamicItemInfoContainer

use of kutch.biff.marvin.utility.DynamicItemInfoContainer in project Board-Instrumentation-Framework by intel.

the class ApplyOnDemandTabStyle method PerformTask.

@Override
public void PerformTask() {
    for (Pair<DynamicItemInfoContainer, OnDemandWidgetBuilder> entry : DataManager.getDataManager().getOnDemandList()) {
        if (entry.getValue() instanceof OnDemandTabBuilder) {
            OnDemandTabBuilder tabBuilder = (OnDemandTabBuilder) entry.getValue();
            tabBuilder.ApplyOddEvenStyle();
        }
    }
}
Also used : DynamicItemInfoContainer(kutch.biff.marvin.utility.DynamicItemInfoContainer) OnDemandWidgetBuilder(kutch.biff.marvin.widget.widgetbuilder.OnDemandWidgetBuilder) OnDemandTabBuilder(kutch.biff.marvin.widget.widgetbuilder.OnDemandTabBuilder)

Example 4 with DynamicItemInfoContainer

use of kutch.biff.marvin.utility.DynamicItemInfoContainer in project Board-Instrumentation-Framework by intel.

the class ConfigurationReader method ReadOnDemandInfo.

/**
 * *
 *
 * @param sourceNode
 * @return
 */
public static DynamicItemInfoContainer ReadOnDemandInfo(FrameworkNode sourceNode) {
    ArrayList<String> namespaceMaskList = new ArrayList<>();
    ArrayList<String> namespaceExcludeList = new ArrayList<>();
    ArrayList<String> idMaskList = new ArrayList<>();
    ArrayList<String> idExcludeList = new ArrayList<>();
    for (FrameworkNode dynaNode : sourceNode.getChildNodes(true)) {
        if (dynaNode.getNodeName().equalsIgnoreCase("NamespaceTriggerPattern")) {
            String Mask = dynaNode.getTextContent();
            if (InList(namespaceMaskList, Mask)) {
                LOGGER.warning("On Demand item specified duplicate NamespaceTriggerPattern.  Ignoring.");
            } else {
                namespaceMaskList.add(dynaNode.getTextContent());
            }
        } else if (dynaNode.getNodeName().equalsIgnoreCase("NamespaceTriggerExcludePattern")) {
            String Exclude = dynaNode.getTextContent();
            if (InList(namespaceExcludeList, Exclude)) {
                LOGGER.warning("On Demand item specified duplicate NamespaceTriggerExcludePattern.  Ignoring.");
            } else {
                namespaceExcludeList.add(dynaNode.getTextContent());
            }
            if (InList(namespaceMaskList, Exclude)) {
                LOGGER.warning("On Demand item specified duplicate NamespaceTriggerExcludePattern that matches NamespaceTriggerExcludePattern.");
            }
        } else if (dynaNode.getNodeName().equalsIgnoreCase("IDTriggerPattern")) {
            String Mask = dynaNode.getTextContent();
            if (InList(idMaskList, Mask)) {
                LOGGER.warning("On Demand item specified duplicate IDTriggerPattern.  Ignoring.");
            } else {
                idMaskList.add(dynaNode.getTextContent());
            }
        } else if (dynaNode.getNodeName().equalsIgnoreCase("IDTriggerExcludePattern")) {
            String Exclude = dynaNode.getTextContent();
            if (InList(idExcludeList, Exclude)) {
                LOGGER.warning("On Demand item specified duplicate IDTriggerExcludePattern.  Ignoring.");
            } else {
                idExcludeList.add(dynaNode.getTextContent());
            }
            if (InList(idMaskList, Exclude)) {
                LOGGER.warning("On Demand item specified duplicate IDTriggerExcludePattern that matches IDTriggerExcludePattern.");
            }
        } else if (dynaNode.getNodeName().equalsIgnoreCase("StyleOverride-Odd") || dynaNode.getNodeName().equalsIgnoreCase("StyleOverride-Even")) {
        } else if (dynaNode.getNodeName().equalsIgnoreCase("Growth")) {
        } else {
            LOGGER.warning("Invalid Tag found in <OnDemand>: " + dynaNode.getNodeName());
        }
    }
    if (namespaceMaskList.isEmpty() && idMaskList.isEmpty()) {
        LOGGER.severe("On Demand item did not specify a namespace or ID Trigger pattern");
        return null;
    }
    Pair<ArrayList<String>, ArrayList<String>> namespaceCriterea;
    namespaceCriterea = new Pair<>(namespaceMaskList, namespaceExcludeList);
    Pair<ArrayList<String>, ArrayList<String>> idCriterea = new Pair<>(idMaskList, idExcludeList);
    DynamicItemInfoContainer dynaInfo = new DynamicItemInfoContainer(namespaceCriterea, idCriterea);
    dynaInfo.ReadStyles(sourceNode);
    if (sourceNode.hasAttribute("SortBy")) {
        String strSortBy = sourceNode.getAttribute("SortBy");
        if (strSortBy.equalsIgnoreCase("Namespace")) {
            dynaInfo.setSortByMethod(DynamicItemInfoContainer.SortMethod.NAMESPACE);
        } else if (strSortBy.equalsIgnoreCase("ID")) {
            dynaInfo.setSortByMethod(DynamicItemInfoContainer.SortMethod.ID);
        } else if (strSortBy.equalsIgnoreCase("Value")) {
            dynaInfo.setSortByMethod(DynamicItemInfoContainer.SortMethod.VALUE);
        } else if (strSortBy.equalsIgnoreCase("None")) {
            dynaInfo.setSortByMethod(DynamicItemInfoContainer.SortMethod.NONE);
        } else {
            LOGGER.severe("OnDemand item specified invalid SortBy: " + strSortBy + ". Ignoring.");
            dynaInfo.setSortByMethod(DynamicItemInfoContainer.SortMethod.NONE);
        }
    }
    if (sourceNode.hasAttribute("TriggeredIdToken")) {
        String strToken = sourceNode.getAttribute("TriggeredIdToken");
        dynaInfo.setToken(strToken);
    }
    return dynaInfo;
}
Also used : DynamicItemInfoContainer(kutch.biff.marvin.utility.DynamicItemInfoContainer) ArrayList(java.util.ArrayList) FrameworkNode(kutch.biff.marvin.utility.FrameworkNode) Pair(javafx.util.Pair)

Example 5 with DynamicItemInfoContainer

use of kutch.biff.marvin.utility.DynamicItemInfoContainer in project Board-Instrumentation-Framework by intel.

the class WidgetBuilder method BuildGrid.

public static GridWidget BuildGrid(FrameworkNode gridNode, boolean isFlipPanelGrid) {
    GridWidget retWidget = new GridWidget();
    String rowSpan = "1";
    String colSpan = "1";
    String strRow = "0";
    String strColumn = "0";
    String WhatIsIt = "Grid";
    boolean isOnDemand = false;
    DynamicItemInfoContainer info = null;
    if (true == isFlipPanelGrid) {
        WhatIsIt = "FlipPanel";
    }
    if (false == gridNode.hasAttribute("row") && false == isFlipPanelGrid) {
        LOGGER.severe("Grid with no row");
        return null;
    }
    if (false == gridNode.hasAttribute("column") && false == isFlipPanelGrid) {
        LOGGER.severe("Grid with no column");
        return null;
    }
    if (gridNode.hasAttribute("rowSpan")) {
        rowSpan = gridNode.getAttribute("rowSpan");
    }
    if (gridNode.hasAttribute("colSpan")) {
        colSpan = gridNode.getAttribute("colSpan");
    }
    if (gridNode.hasAttribute("columnspan")) {
        colSpan = gridNode.getAttribute("columnspan");
    }
    if (gridNode.hasChild("OnDemand")) {
        FrameworkNode demandNode = gridNode.getChild("OnDemand");
        info = ConfigurationReader.ReadOnDemandInfo(demandNode);
        OnDemandGridWidget objWidget = new OnDemandGridWidget(info);
        if (demandNode.hasChild("Growth")) {
            objWidget.ReadGrowthInfo(demandNode.getChild("Growth"));
        }
        // get hgap and all those good things
        ReadGridAttributes(objWidget, gridNode, false);
        retWidget = objWidget;
        WhatIsIt = "OnDemand Grid";
        isOnDemand = true;
        // delete the ondemand section, not needed anymore
        gridNode.DeleteChildNodes("OnDemand");
        // int row = gridNode.getIntegerAttribute("row", 0);
        // int col = gridNode.getIntegerAttribute("column", 0);
        // gridNode.AddAttibute("GRID_COLUMN_ODD", col % 2 == 0 ? "FALSE" : "TRUE");
        // gridNode.AddAttibute("GRID_ROW_ODD", row % 2 == 0 ? "FALSE" : "TRUE");
        info.setNode(gridNode);
    }
    if (true == gridNode.hasAttribute("Height")) {
        if (!retWidget.parseHeight(gridNode)) {
            return null;
        }
    }
    if (true == gridNode.hasAttribute("Width")) {
        if (!retWidget.parseWidth(gridNode)) {
            return null;
        }
    }
    if (false == isFlipPanelGrid) {
        strRow = gridNode.getAttribute("row");
        strColumn = gridNode.getAttribute("column");
        if (strRow == null) {
            LOGGER.severe("Invalid " + WhatIsIt + " definition in Configuration file. no row defined");
            return null;
        }
        if (strColumn == null) {
            LOGGER.severe("Invalid " + WhatIsIt + " definition in Configuration file. No column defined");
            return null;
        }
    }
    try {
        retWidget.setRow(Integer.parseInt(strRow));
        retWidget.setColumn(Integer.parseInt(strColumn));
        retWidget.setRowSpan(Integer.parseInt(rowSpan));
        retWidget.setColumnSpan(Integer.parseInt(colSpan));
    } catch (NumberFormatException ex) {
        LOGGER.severe("Invalid " + WhatIsIt + " definition in Configuration file. " + ex.toString());
        return null;
    }
    AliasMgr.getAliasMgr().UpdateCurrentColumn(Integer.parseInt(strColumn));
    AliasMgr.getAliasMgr().UpdateCurrentRow(Integer.parseInt(strRow));
    if (isOnDemand) {
        // need to nuke these, otherwise the on-demand grid will suck them up, and that
        // will be a problem.
        gridNode.DeleteAttribute("rowspan");
        gridNode.DeleteAttribute("colspan");
        gridNode.DeleteAttribute("columnpan");
        gridNode.DeleteAttribute("hgap");
        gridNode.DeleteAttribute("vgap");
        gridNode.DeleteAttribute("align");
        gridNode.DeleteAttribute("height");
        gridNode.DeleteAttribute("width");
        AliasMgr.getAliasMgr().PushAliasList(false);
        AliasMgr.getAliasMgr().AddAliasFromAttibuteList(gridNode, new String[] { "row", "column", "rowSpan", "colSpan", "columnSpan", "hgap", "vgap", "Align", "File", "Height", "Width" });
        // have to do this way down here, after the other stuff
        info.TakeAliasSnapshot();
        AliasMgr.getAliasMgr().PopAliasList();
        return retWidget;
    }
    AliasMgr.getAliasMgr().AddUpdateAlias("GRID_ROW_ODD", AliasMgr.getAliasMgr().GetAlias("CurrentRowIsOddAlias"));
    AliasMgr.getAliasMgr().AddUpdateAlias("GRID_COLUMN_ODD", AliasMgr.getAliasMgr().GetAlias("CurrentColumnIsOddAlias"));
    AliasMgr.getAliasMgr().PushAliasList(true);
    if (true == gridNode.hasAttribute("File")) {
        String strFileName = gridNode.getAttribute("File");
        StartReadingExternalFile(gridNode);
        AliasMgr.getAliasMgr().PushAliasList(true);
        AliasMgr.getAliasMgr().AddAliasFromAttibuteList(gridNode, new String[] { "row", "column", "rowSpan", "colSpan", "columnSpan", "hgap", "vgap", "Align", "File", "Height", "Width" });
        if (false == AliasMgr.ReadAliasFromExternalFile(strFileName)) {
            AliasMgr.getAliasMgr().PopAliasList();
            return null;
        }
        FrameworkNode GridNode = WidgetBuilder.OpenDefinitionFile(gridNode.getAttribute("File"), "Grid");
        if (null == GridNode) {
            LOGGER.severe("Invalid file: " + strFileName + " no <Grid> found.");
            return null;
        }
        // read grid from external file
        retWidget = ReadGridInfo(GridNode, retWidget, strFileName);
        if (null == retWidget) {
            return null;
        }
        if (// could also be tasks defined in external
        !ConfigurationReader.ReadTasksFromExternalFile(strFileName)) // file
        {
            return null;
        }
        AliasMgr.getAliasMgr().PopAliasList();
        DoneReadingExternalFile();
    }
    if (gridNode.hasAttribute("Macro")) {
        if (gridNode.hasAttribute("File")) {
            LOGGER.severe("Grid cannot have both file and Macro.");
            return null;
        }
        String strMacro = gridNode.getAttribute("Macro");
        FrameworkNode nodeMacro = GridMacroMgr.getGridMacroMgr().getGridMacro(strMacro);
        if (null == nodeMacro) {
            LOGGER.severe("Grid Macro specified [" + strMacro + "] does not defined.");
            return null;
        }
        // need to get alias from the grid macro is in
        AliasMgr.getAliasMgr().AddAliasFromAttibuteList(gridNode, new String[] { "rowSpan", "colSpan", "columnSpan", "hgap", "vgap", "Align", "Height", "Width" });
        AliasMgr.getAliasMgr().AddAliasFromAttibuteList(nodeMacro, new String[] { "rowSpan", "colSpan", "columnSpan", "hgap", "vgap", "Align", "Height", "Width" });
        retWidget = ReadGridInfo(nodeMacro, retWidget, null);
        if (null == retWidget) {
            return null;
        }
    }
    // go read the grid contents - note that this could be a continuation from stuff
    // already read in via file
    // so you can define most of grid in external file, but keep adding
    retWidget = ReadGridInfo(gridNode, retWidget, "");
    AliasMgr.getAliasMgr().PopAliasList();
    return retWidget;
}
Also used : DynamicItemInfoContainer(kutch.biff.marvin.utility.DynamicItemInfoContainer) OnDemandGridWidget(kutch.biff.marvin.widget.OnDemandGridWidget) GridWidget(kutch.biff.marvin.widget.GridWidget) DynamicGridWidget(kutch.biff.marvin.widget.DynamicGridWidget) OnDemandGridWidget(kutch.biff.marvin.widget.OnDemandGridWidget) FrameworkNode(kutch.biff.marvin.utility.FrameworkNode)

Aggregations

DynamicItemInfoContainer (kutch.biff.marvin.utility.DynamicItemInfoContainer)5 FrameworkNode (kutch.biff.marvin.utility.FrameworkNode)3 OnDemandTabBuilder (kutch.biff.marvin.widget.widgetbuilder.OnDemandTabBuilder)3 ArrayList (java.util.ArrayList)2 OnDemandWidgetBuilder (kutch.biff.marvin.widget.widgetbuilder.OnDemandWidgetBuilder)2 IOException (java.io.IOException)1 Screen (javafx.stage.Screen)1 Pair (javafx.util.Pair)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 DynamicDebugWidgetTask (kutch.biff.marvin.task.DynamicDebugWidgetTask)1 LateCreateTask (kutch.biff.marvin.task.LateCreateTask)1 GenerateDatapointInfo (kutch.biff.marvin.utility.GenerateDatapointInfo)1 DynamicGridWidget (kutch.biff.marvin.widget.DynamicGridWidget)1 GridWidget (kutch.biff.marvin.widget.GridWidget)1 OnDemandGridWidget (kutch.biff.marvin.widget.OnDemandGridWidget)1 NodeList (org.w3c.dom.NodeList)1 SAXException (org.xml.sax.SAXException)1