Example #1
0
        private void createScreenshotViews(string pathToTemplate)
        {
            XElement xmlDoc = XElement.Load(@pathToTemplate);

            if (xmlDoc.Element(VIEWCATEGORY_LAYOUTVIEW) == null)
            {
                return;
            }
            IEnumerable <XElement> uiElement =
                from el in xmlDoc.Element(VIEWCATEGORY_LAYOUTVIEW).Elements("Screenshot")
                select el;

            if (uiElement == null || !uiElement.Any())
            {
                return;
            }
            ATemplateUi generalUiInstance = new TemplateNode(strategyMgr, grantTrees, treeOperation);

            foreach (XElement element in uiElement)
            {
                TemplateScreenshotObject templateObject = xmlUiScreenshotToTemplateUiScreenshot(element);
                GeneralProperties        prop           = new GeneralProperties();
                prop.controlTypeFiltered = templateObject.connectedFilteredNodeControltype;
                List <Object> nodes = treeOperation.searchNodes.getNodesByProperties(grantTrees.filteredTree, prop);

                generalUiInstance.createUiScreenshotFromTemplate(templateObject, nodes);
            }
        }
Example #2
0
        /// <summary>
        /// Adds all elements (of the subtree) as Sysmbols to the braille tree
        /// </summary>
        /// <param name="subtree">subtree to add as Symbols</param>
        /// <param name="lastRect">position of the last UI element which was added</param>
        /// <param name="idToIgnore">a list of all (ids of) elements which should NOT be added as symbol</param>
        public void addsAllElementsAsSymbols(object subtree, ref Rect lastRect, string[] idToIgnore = null)
        {
            ATemplateUi generalUiInstance = new TemplateNode(strategyMgr, grantTrees, treeOperation);
            RendererUiElementConnector defaultRendererUiConnector = new RendererUiElementConnector("Text", "Text", new RendererUiElementConnector.SizeUiElement(5, 21));

            foreach (Object node in strategyMgr.getSpecifiedTree().DirectChildrenNodes(subtree))
            {
                /* Prüfen, ob der Knoten Ignoriert werden soll
                 *    nicht ignorieren -> Kinder
                 * nur Kinder Zeichnen -> ControllType der Eltern beachten --> evtl. werden mehrere Kinder mit einmal dargestellt
                 */
                OSMElements.OSMElement osmNode = strategyMgr.getSpecifiedTree().GetData(node);
                if (idToIgnore == null || !idToIgnore.Contains(osmNode.properties.IdGenerated))
                {
                    RendererUiElementConnector connector = rendererUiElementConnectorContainsControltype(osmNode.properties.controlTypeFiltered);
                    if (connector == null && strategyMgr.getSpecifiedTree().HasChild(node))
                    {
                        //consider the children
                        addsAllElementsAsSymbols(node, ref lastRect, idToIgnore);
                    }
                    else
                    {
                        if (connector == null)
                        {
                            connector = defaultRendererUiConnector;
                        }
                        //TODO: use a diffenent template for every element type?
                        generalUiInstance.createUiElementFromTemplate(node, createTemplateObjectFromNode(node, connector, ref lastRect));//new type of view
                    }
                }
            }
        }
Example #3
0
        /// <summary>
        /// Creates UI elements (braille nodes) for the symbol view which have no connection to the filtered tree
        /// </summary>
        /// <param name="pathToTemplate">path of the used template (XML)</param>
        private void createUiElementsWitheNoDependencySymbolView(String pathToTemplate)
        {
            XElement xmlDoc = XElement.Load(pathToTemplate);

            if (xmlDoc.Element(VIEWCATEGORY_SYMBOLVIEW) == null)
            {
                return;
            }
            IEnumerable <XElement> uiElement =
                from el in xmlDoc.Element(VIEWCATEGORY_SYMBOLVIEW).Elements("UiElement")
                where (string)el.Element("TextFromUIElement") != null && (string)el.Element("TextFromUIElement") == "" &&
                (string)el.Element("Screens") != null && (string)el.Element("Screens") != ""
                select el;

            if (uiElement == null || !uiElement.Any())
            {
                return;
            }
            foreach (XElement element in uiElement)
            {
                ATemplateUi      generalUiInstance;
                TemplateUiObject templateObject = xmlUiElementToTemplateUiObject(element, VIEWCATEGORY_SYMBOLVIEW);
                if (templateObject.osm.brailleRepresentation.groupelementsOfSameType.Equals(new GroupelementsOfSameType()))
                {
                    generalUiInstance = new  TemplateNode(strategyMgr, grantTrees, treeOperation);
                }
                else
                {
                    generalUiInstance = new TemplateGroupAutomatic(strategyMgr, grantTrees, treeOperation);
                }
                Object tree = strategyMgr.getSpecifiedTree().NewTree();
                generalUiInstance.createUiElementFromTemplate(tree, templateObject);
            }
        }
Example #4
0
        /// <summary>
        /// Creates for all screens of the list a braille node depending on the template object
        /// </summary>
        /// <param name="screenList">the list of screen names</param>
        /// <param name="tree">a filtered tree object</param>
        /// <param name="templateObject">the template object</param>
        private void createsBrailleNodeForScreenList(List <String> screenList, ref Object tree, TemplateUiObject templateObject)
        {
            if (screenList == null)
            {
                return;
            }
            ATemplateUi generalUiInstance;

            if (templateObject.osm.brailleRepresentation.groupelementsOfSameType.Equals(new GroupelementsOfSameType()))
            {
                generalUiInstance = new TemplateNode(strategyMgr, grantTrees, treeOperation);
            }
            else
            {
                generalUiInstance = new TemplateGroupAutomatic(strategyMgr, grantTrees, treeOperation);
            }

            foreach (String screen in screenList)
            {
                TemplateUiObject copyTemp = templateObject.DeepCopy();
                copyTemp.Screens = new List <string>();
                copyTemp.Screens.Add(screen);
                generalUiInstance.createUiElementFromTemplate(tree, copyTemp);
            }
        }
Example #5
0
        /// <summary>
        /// Converts a filtered (sub-)tree to symbole (for the braille tree) and adds this node
        /// </summary>
        /// <param name="subtree">filtered (sub-)tree to convert as symbols</param>
        /// <param name="pathToXml">path of the used template (XML)</param>
        private void createElementTypeOfSymbolView(Object subtree, String pathToXml)
        {
            String   controlType = strategyMgr.getSpecifiedTree().GetData(subtree).properties.controlTypeFiltered;
            XElement xmlDoc      = XElement.Load(@pathToXml);

            if (xmlDoc.Element(VIEWCATEGORY_SYMBOLVIEW) == null)
            {
                return;
            }
            IEnumerable <XElement> uiElement =
                from el in xmlDoc.Element(VIEWCATEGORY_SYMBOLVIEW).Elements("UiElement")
                where (string)el.Attribute("name") == controlType &&
                (string)el.Element("TextFromUIElement") != null && (string)el.Element("TextFromUIElement") != "" &&
                (string)el.Element("Screens") != null && (string)el.Element("Screens") != ""
                select el;

            if (uiElement == null || !uiElement.Any())
            {
                return;
            }
            ATemplateUi generalUiInstance;

            foreach (XElement element in uiElement)
            {
                TemplateUiObject templateObject = xmlUiElementToTemplateUiObject(element, VIEWCATEGORY_SYMBOLVIEW);

                if (templateObject.osm.brailleRepresentation.groupelementsOfSameType.Equals(new GroupelementsOfSameType()))
                {
                    generalUiInstance = new TemplateNode(strategyMgr, grantTrees, treeOperation);
                }
                else
                {
                    generalUiInstance = new TemplateGroupAutomatic(strategyMgr, grantTrees, treeOperation);
                }
                generalUiInstance.createUiElementFromTemplate(subtree, templateObject);
            }
        }