Пример #1
0
        private OSMElements.OSMElement addElementInBrailleTree(object filteredNode, TextviewElement tve, int width, ref int startXPosition, int startYPosition)
        {
            OSMElements.OSMElement osmFiltered = strategyMgr.getSpecifiedTree().GetData(filteredNode);
            int            depth = strategyMgr.getSpecifiedTree().Depth(filteredNode) * shiftingPerDepth;
            TextviewObject tvo   = grantTrees.TextviewObject;

            OSMElements.OSMElement osmBraille  = new OSMElements.OSMElement();
            GeneralProperties      propBraille = new GeneralProperties();
            BrailleRepresentation  braille     = new BrailleRepresentation();

            braille.isVisible = true;
            propBraille.controlTypeFiltered = "Text";
            braille.isGroupChild            = true;
            braille.typeOfView = tvo.typeOfView;
            braille.screenName = tvo.screenName;
            braille.displayedGuiElementType = tve.property;
            braille.viewName = osmFiltered.properties.IdGenerated + "_" + tve.order;

            propBraille.boundingRectangleFiltered = new Rect(startXPosition, startYPosition, width, 5);//TODO: richtig machen

            osmBraille.properties            = propBraille;
            osmBraille.brailleRepresentation = braille;
            propBraille.IdGenerated          = treeOperation.generatedIds.generatedIdBrailleNode(osmBraille);
            osmBraille.properties            = propBraille;
            treeOperation.osmTreeConnector.addOsmConnection(osmFiltered.properties.IdGenerated, propBraille.IdGenerated);
            treeOperation.updateNodes.updateNodeOfBrailleUi(ref osmBraille);
            return(osmBraille);
        }
Пример #2
0
        /// <summary>
        /// Generates an id for one node of the braille (output) tree.
        /// </summary>
        /// <param name="node">one node of the braille tree</param>
        /// <returns>the generated id</returns>
        public String generatedIdBrailleNode(OSMElements.OSMElement osmElement)
        {
            /* https://blogs.msdn.microsoft.com/csharpfaq/2006/10/09/how-do-i-calculate-a-md5-hash-from-a-string/
             * http://stackoverflow.com/questions/12979212/md5-hash-from-string
             * http://stackoverflow.com/questions/10520048/calculate-md5-checksum-for-a-file
             */
            GeneralProperties     properties = osmElement.properties;
            BrailleRepresentation braille    = osmElement.brailleRepresentation;
            String result = properties.controlTypeFiltered +
                            braille.displayedGuiElementType +
                            braille.screenName +
                            braille.viewName +
                            properties.boundingRectangleFiltered.ToString() +
                            properties.controlTypeFiltered +
                            (braille.typeOfView == null? "":braille.typeOfView) +
                            (braille.uiElementSpecialContent == null? "": braille.uiElementSpecialContent.ToString());

            byte[] hash;
            using (var md5 = MD5.Create())
            {
                hash = md5.ComputeHash(Encoding.UTF8.GetBytes(result));
            }
            StringBuilder sb = new StringBuilder();

            foreach (byte b in hash)
            {
                sb.Append(b.ToString("X2"));
            }
            return(sb.ToString());
        }
Пример #3
0
        /// <summary>
        /// Adds a navigatiobar for the screen
        /// </summary>
        /// <param name="pathToXml">path of the used template (XML)</param>
        /// <param name="screenName">name of the screen on wich the navigation bar should be added</param>
        /// <param name="typeOfView">name of the type of view in which the navigation bar should be added</param>
        public void addNavigationbarForScreen(string pathToXml, String screenName, String typeOfView)
        {
            TemplateUiObject templateObject = getTemplateUiObjectOfNavigationbarScreen(pathToXml);

            if (templateObject.Equals(new TemplateUiObject()))
            {
                return;
            }
            List <String> screens    = treeOperation.searchNodes.getPosibleScreenNames(typeOfView);
            List <String> screenNavi = new List <string>();

            //screenNavi.Add(strategyMgr.getSpecifiedTree().GetData(subtree).brailleRepresentation.screenName);
            screenNavi.Add(screenName);
            templateObject.Screens = screenNavi;
            List <OSMElements.OSMElement> groupElementsStatic = calculatePositionOfScreenTab(screens, templateObject);

            if (groupElementsStatic == null || groupElementsStatic.Equals(new List <OSMElements.OSMElement>()))
            {
                return;
            }
            templateObject.groupElements = groupElementsStatic;
            Object tree = grantTrees.filteredTree;
            BrailleRepresentation br = templateObject.osm.brailleRepresentation;

            br.groupelementsOfSameType = new GroupelementsOfSameType();
            OSMElements.OSMElement osm = templateObject.osm;
            osm.brailleRepresentation = br;
            templateObject.osm        = osm;
            ATemplateUi generalUiInstance = new TemplateGroupStatic(strategyMgr, grantTrees, treeOperation);

            generalUiInstance.createUiElementFromTemplate(tree, templateObject);
        }
Пример #4
0
        private OSMElements.OSMElement createChildBrailleNode(Object filteredSubtree, TemplateUiObject templateObject, String viewName)
        {
            //TODO: falls eine Beziehung im Baum erstellt werden soll muss diese hier? noch gesetzt werden => geht nicht ID ist noch nicht vorhanden
            OSMElements.OSMElement brailleNode = templateObject.osm;
            GeneralProperties      prop        = templateObject.osm.properties;
            BrailleRepresentation  braille     = templateObject.osm.brailleRepresentation;

            prop.isEnabledFiltered = false;
            braille.isVisible      = true;
            if (templateObject.osm.properties.controlTypeFiltered.Equals("DropDownMenuItem"))
            {
                OSMElements.UiElements.DropDownMenuItem dropDownMenu = new OSMElements.UiElements.DropDownMenuItem();
                if (strategyMgr.getSpecifiedTree().HasChild(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(filteredSubtree)).properties.controlTypeFiltered.Contains("Item"))
                {
                    dropDownMenu.hasChild = true;
                }
                if (strategyMgr.getSpecifiedTree().HasNext(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Next(filteredSubtree)).properties.controlTypeFiltered.Contains("Item"))
                {
                    dropDownMenu.hasNext = true;
                }
                if (strategyMgr.getSpecifiedTree().HasPrevious(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Previous(filteredSubtree)).properties.controlTypeFiltered.Contains("Item"))
                {
                    dropDownMenu.hasPrevious = true;
                }
                if (strategyMgr.getSpecifiedTree().HasParent(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Parent(filteredSubtree)).properties.controlTypeFiltered.Contains("Item"))
                {
                    dropDownMenu.isChild = true;
                }
                dropDownMenu.isOpen             = false;
                dropDownMenu.isVertical         = false;
                braille.uiElementSpecialContent = dropDownMenu;
            }
            if (templateObject.osm.properties.controlTypeFiltered.Equals("TabItem"))
            {
                OSMElements.UiElements.TabItem tabView = new OSMElements.UiElements.TabItem();
                //tabView.orientation = templateObject.orientation;
                //braille.uiElementSpecialContent = tabView;
                braille.uiElementSpecialContent = templateObject.osm.brailleRepresentation.uiElementSpecialContent;
            }
            if (templateObject.Screens == null)
            {
                Debug.WriteLine("Achtung, hier wurde kein Screen angegeben!"); return(new OSMElements.OSMElement());
            }
            braille.screenName                = templateObject.Screens[0]; // hier wird immer nur ein Screen-Name übergeben
            braille.viewName                  = viewName;
            brailleNode.properties            = prop;
            brailleNode.brailleRepresentation = braille;
            prop.IdGenerated                  = treeOperation.generatedIds.generatedIdBrailleNode(brailleNode);
            brailleNode.properties            = prop;

            return(brailleNode);
        }
Пример #5
0
        protected override Object createSpecialUiElement(Object filteredSubtree, TemplateUiObject templateObject, String brailleNodeId = null)
        {
            OSMElements.OSMElement brailleNode = templateObject.osm;
            GeneralProperties      prop        = templateObject.osm.properties;
            BrailleRepresentation  braille     = templateObject.osm.brailleRepresentation;

            prop.isEnabledFiltered = false;
            braille.isVisible      = true;
            #region DropDownMenuItem
            if (templateObject.osm.properties.controlTypeFiltered.Equals("DropDownMenuItem"))
            {
                OSMElements.UiElements.DropDownMenuItem dropDownMenu = new OSMElements.UiElements.DropDownMenuItem();
                if (strategyMgr.getSpecifiedTree().HasChild(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(filteredSubtree)).properties.controlTypeFiltered.Contains("Item"))
                {
                    dropDownMenu.hasChild = true;
                }
                if (strategyMgr.getSpecifiedTree().HasNext(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Next(filteredSubtree)).properties.controlTypeFiltered.Contains("Item"))
                {
                    dropDownMenu.hasNext = true;
                }
                if (strategyMgr.getSpecifiedTree().HasPrevious(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Previous(filteredSubtree)).properties.controlTypeFiltered.Contains("Item"))
                {
                    dropDownMenu.hasPrevious = true;
                }
                if (strategyMgr.getSpecifiedTree().HasParent(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Parent(filteredSubtree)).properties.controlTypeFiltered.Contains("Item"))
                {
                    dropDownMenu.isChild = true;
                }
                dropDownMenu.isOpen             = false;
                dropDownMenu.isVertical         = false;
                braille.uiElementSpecialContent = dropDownMenu;
            }
            #endregion
            #region TabItem
            if (templateObject.osm.properties.controlTypeFiltered.Equals("TabItem"))
            {
                OSMElements.UiElements.TabItem tabView = new OSMElements.UiElements.TabItem();
                tabView.orientation             = templateObject.orientation;
                braille.uiElementSpecialContent = tabView;
                //braille.uiElementSpecialContent = templateObject.osm.brailleRepresentation.uiElementSpecialContent;
            }
            #endregion
            if (templateObject.Screens == null)
            {
                Debug.WriteLine("Achtung, hier wurde kein Screen angegeben!"); return(strategyMgr.getSpecifiedTree().NewTree());
            }
            braille.screenName = templateObject.Screens[0]; // hier wird immer nur ein Screen-Name übergeben
            if (!templateObject.allElementsOfType || !treeOperation.searchNodes.existViewInScreen(braille.screenName, templateObject.viewName, templateObject.osm.brailleRepresentation.typeOfView))
            {
                braille.viewName = templateObject.viewName;
            }
            else
            {
                int    i        = 0;
                String viewName = templateObject.viewName + "_" + i;

                while (treeOperation.searchNodes.existViewInScreen(braille.screenName, viewName, templateObject.osm.brailleRepresentation.typeOfView))
                {
                    i++;
                    viewName += i;
                }
                braille.viewName = viewName;
            }

            brailleNode.properties            = prop;
            brailleNode.brailleRepresentation = braille;
            Object tree = strategyMgr.getSpecifiedTree().NewTree();
            strategyMgr.getSpecifiedTree().AddChild(tree, brailleNode);
            return(tree);
        }