Exemple #1
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);
            }
        }
Exemple #2
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);
            }
        }
Exemple #3
0
        /// <summary>
        /// Creates navigation bars for every screen in this tpye of view
        /// </summary>
        /// <param name="pathToXml">path of the used template (XML)</param>
        /// <param name="typeOfView">name of the type of view in which the navigation bars should be added</param>
        public void createNavigationbar(string pathToXml, String typeOfView)
        {
            TemplateUiObject templateObject = getTemplateUiObjectOfNavigationbarScreen(pathToXml);

            if (templateObject.Equals(new TemplateUiObject()))
            {
                return;
            }
            //TODO: mit Events verknüpfen
            List <String> screens = treeOperation.searchNodes.getPosibleScreenNames(typeOfView);
            ATemplateUi   generalUiInstance;

            if (templateObject.Screens == null)
            {
                //we use all available screens of this tpye of view
                templateObject.Screens = screens;
            }
            List <OSMElements.OSMElement> groupElementsStatic = calculatePositionOfScreenTab(screens, templateObject);

            if (groupElementsStatic == null || groupElementsStatic.Equals(new List <OSMElements.OSMElement>()))
            {
                return;
            }
            templateObject.groupElements = groupElementsStatic;
            //  templateObject.osm = templateObject.osm;
            templateObject.osm.brailleRepresentation.groupelementsOfSameType = new GroupelementsOfSameType();
            generalUiInstance = new TemplateGroupStatic(strategyMgr, grantTrees, treeOperation);
            Object tree = grantTrees.filteredTree;

            generalUiInstance.createUiElementFromTemplate(tree, templateObject);//
        }
Exemple #4
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);
        }
Exemple #5
0
        /// <summary>
        /// Creates all UI elements for the Braille tree which are specified in the template
        /// </summary>
        /// <param name="filteredSubtree">the filtered (sub-)tree</param>
        /// <param name="templateObject">the template object for the group to created</param>
        /// <param name="brailleNodeId">Id of the parent element of the group</param>
        public void createUiElementFromTemplate(Object filteredSubtree, TemplateUiObject templateObject, String brailleNodeId = null)
        {
            Type typeOfTemplate = Type.GetType(templateObject.osm.brailleRepresentation.templateFullName + ", " + templateObject.osm.brailleRepresentation.templateNamspace);

            if (typeOfTemplate != null)
            {
                ATemplateUi template = (ATemplateUi)Activator.CreateInstance(typeOfTemplate, strategyMgr, grantTrees, treeOperation);
                template.createUiElementFromTemplate(filteredSubtree, templateObject, brailleNodeId);
            }
        }
Exemple #6
0
        private TemplateUiObject CastScreenshotObject(TemplateScreenshotObject screenshotObject)
        {
            TemplateUiObject castedSO = new TemplateUiObject();

            castedSO.viewName = screenshotObject.viewName;
            castedSO.Screens  = screenshotObject.Screens;
            castedSO.osm      = screenshotObject.osm;

            return(castedSO);
        }
Exemple #7
0
 public override void createUiElementFromTemplate(Object filteredSubtree, TemplateUiObject templateObject, String brailleNodeId = null) //noch sollte eigenltich das OSM-Element reichen, aber bei Komplexeren Elementen wird wahrscheinlich ein Teilbaum benötigt
 {
     if (templateObject.Screens != null)
     {
         List <String> screenList = templateObject.Screens;
         foreach (String screen in screenList)
         {
             TemplateUiObject copyTemplate = templateObject.DeepCopy();
             copyTemplate.Screens = new List <string>();
             copyTemplate.Screens.Add(screen);
             Object brailleNode = createSpecialUiElement(filteredSubtree, copyTemplate);
             addSubtreeInBrailleTree(brailleNode);
         }
     }
 }
Exemple #8
0
 public override void createUiElementFromTemplate(Object filteredSubtree, TemplateUiObject templateObject, String brailleNodeId)
 {
     if (!strategyMgr.getSpecifiedTree().HasChild(filteredSubtree))
     {
         return;
     }
     if (strategyMgr.getSpecifiedTree().HasChild(filteredSubtree))
     {
         Object filteredSubtreeCopy = strategyMgr.getSpecifiedTree().Copy(filteredSubtree);
         if (strategyMgr.getSpecifiedTree().HasChild(filteredSubtreeCopy))
         {
             filteredSubtreeCopy = strategyMgr.getSpecifiedTree().Child(filteredSubtreeCopy);
             iteratedChildreen(filteredSubtreeCopy, templateObject, brailleNodeId);
         }
     }
 }
Exemple #9
0
 public virtual void createUiElementFromTemplate(Object filteredSubtree, TemplateUiObject templateObject, String brailleNodeId = null) //noch sollte eigenltich das OSM-Element reichen, aber bei Komplexeren Elementen wird wahrscheinlich ein Teilbaum benötigt
 {
     if (templateObject.Screens != null)
     {
         List <String> screenList = templateObject.Screens;
         foreach (String screen in screenList)
         {
             templateObject.Screens = new List <string>();
             templateObject.Screens.Add(screen);
             Object brailleNode = createSpecialUiElement(filteredSubtree, templateObject);
             if (!filteredSubtree.Equals(strategyMgr.getSpecifiedTree().NewTree()))
             {
                 addIdAndRelationship(brailleNode, filteredSubtree, templateObject);
             }
         }
     }
 }
Exemple #10
0
 /// <summary>
 /// Iterriert über die Kinder eines Knotens und erstellt für jedes Kind ein Ui-Element
 /// </summary>
 /// <param name="parentNode">gibt den Elternknoten an</param>
 /// <param name="templateObject">gibt das zu nutzende Template an</param>
 private void iteratedChildreen(Object parentNode, TemplateUiObject templateObject, String brailleNodeId)
 {
     if (strategyMgr.getSpecifiedTree().HasChild(parentNode))
     {
         parentNode = strategyMgr.getSpecifiedTree().Child(parentNode);
         createSpecialUiElement(parentNode, templateObject, brailleNodeId);
     }
     else
     {
         return;
     }
     while (strategyMgr.getSpecifiedTree().HasNext(parentNode))
     {
         parentNode = strategyMgr.getSpecifiedTree().Next(parentNode);
         createSpecialUiElement(parentNode, templateObject, brailleNodeId);
     }
     return;
 }
Exemple #11
0
        /// <summary>
        /// Creates all Ui elements to be shown on all screens (in this type of view)
        /// </summary>
        /// <param name="pathToXml">path of the used template (XML)</param>
        /// <param name="typeOfView">name of the type of view in which this elements should be added (current: "SymbolView", "TextView" or "LayoutView")</param>
        private void createUiElementsAllScreens(String pathToXml, String typeOfView)
        {
            XElement xmlDoc = XElement.Load(@pathToXml);

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

            if (uiElement == null || !uiElement.Any())
            {
                return;
            }
            List <String> screenList = treeOperation.searchNodes.getPosibleScreenNames(typeOfView);

            foreach (XElement e in uiElement)
            {
                TemplateUiObject templateObject = xmlUiElementToTemplateUiObject(e, typeOfView);
                Object           tree           = strategyMgr.getSpecifiedTree().NewTree(); // this is necessary if the braille node has no connection to a filtered node
                if (templateObject.osm.brailleRepresentation.displayedGuiElementType != null && !templateObject.osm.brailleRepresentation.displayedGuiElementType.Equals(""))
                {
                    GeneralProperties properties = new GeneralProperties();
                    properties.controlTypeFiltered = e.Attribute("name").Value;
                    List <Object> treefilteredElements = treeOperation.searchNodes.getNodesByProperties(grantTrees.filteredTree, properties, OperatorEnum.and);
                    foreach (Object t in treefilteredElements)
                    {
                        tree = t;
                        createsBrailleNodeForScreenList(screenList, ref tree, templateObject);
                    }
                }
                else
                {
                    createsBrailleNodeForScreenList(screenList, ref tree, templateObject);
                }
            }
        }
Exemple #12
0
        /// <summary>
        /// Updates all navigation bars in this type of view
        /// </summary>
        /// <param name="pathToXml">path of the used template(XML)</param>
        /// <param name="typeOfView">name of the type of view in which the navigation bar should be updated</param>
        public void updateNavigationbarScreens(string pathToXml, String typeOfView)
        {
            TemplateUiObject templateObject = getTemplateUiObjectOfNavigationbarScreen(pathToXml);

            if (templateObject.Equals(new TemplateUiObject()))
            {
                return;
            }
            List <String> screens = treeOperation.searchNodes.getPosibleScreenNames(typeOfView);
            // searches for navigation bars in the braille tree and adds new tabs
            List <Object> navigationbars = treeOperation.searchNodes.getListOfNavigationbars();
            List <String> screensForShowNavigationbar = new List <string>();

            foreach (Object nbar in navigationbars)
            {
                if (strategyMgr.getSpecifiedTree().HasChild(nbar))
                {
                    treeOperation.updateNodes.removeChildNodeInBrailleTree(nbar);
                    treeOperation.updateNodes.removeNodeInBrailleTree(strategyMgr.getSpecifiedTree().GetData(nbar).properties.IdGenerated);
                }
                screensForShowNavigationbar.Add(strategyMgr.getSpecifiedTree().GetData(nbar).brailleRepresentation.screenName);
            }
            templateObject.Screens = screensForShowNavigationbar;
            List <OSMElements.OSMElement> groupElements = calculatePositionOfScreenTab(screens, templateObject);

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

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

            generalUiInstance.createUiElementFromTemplate(tree, templateObject);
        }
Exemple #13
0
        private TemplateUiObject createTemplateObjectFromNode(Object nodeFiltered, RendererUiElementConnector connector, ref Rect rectLast, String screenName = null)
        {//TODO: a lot of assigned of variables are hard coded and only so because of testing
            OSMElements.OSMElement osmNodeFiltered = strategyMgr.getSpecifiedTree().GetData(nodeFiltered);
            TemplateUiObject       templObject     = new TemplateUiObject();
            List <String>          screens         = new List <string>();

            screens.Add(screenName == null ? "neuerScreen" : screenName);
            templObject.Screens  = screens;
            templObject.viewName = osmNodeFiltered.properties.IdGenerated;
            templObject.osm      = new OSMElements.OSMElement();
            //Attention: currently all elements are below the other
            rectLast.X      = 0;
            rectLast.Y      = rectLast.Height == 0 ? 0 : rectLast.Y + rectLast.Height + 1;
            rectLast.Height = connector.SizeElement.Height;
            rectLast.Width  = connector.SizeElement.Width;
            templObject.osm.properties.boundingRectangleFiltered = rectLast;
            templObject.osm.properties.controlTypeFiltered       = connector.RendererName;

            templObject.osm.brailleRepresentation.displayedGuiElementType = osmNodeFiltered.properties.nameFiltered != null ? "nameFiltered" : "valueFiltered";
            templObject.osm.brailleRepresentation.typeOfView = "blub";
            return(templObject);
        }
Exemple #14
0
        protected override Object createSpecialUiElement(Object filteredSubtree, TemplateUiObject templateObject, string brailleNodeId = null)
        {
            OSMElements.OSMElement createdParentNode = createParentBrailleNode(filteredSubtree, templateObject);
            Object brailleSubtree       = strategyMgr.getSpecifiedTree().NewTree();
            Object brailleSubtreeParent = strategyMgr.getSpecifiedTree().AddChild(brailleSubtree, createdParentNode);
            int    index = 0;

            foreach (OSMElements.OSMElement child in templateObject.groupElements)
            {
                TemplateUiObject childTemplate = new TemplateUiObject();
                childTemplate.osm     = child;
                childTemplate.Screens = templateObject.Screens;
                OSMElements.OSMElement childOsm = createChildBrailleNode(filteredSubtree, childTemplate, templateObject.viewName + "_" + index);
                if (!childOsm.Equals(new OSMElements.OSMElement()))
                {
                    strategyMgr.getSpecifiedTree().AddChild(brailleSubtreeParent, childOsm);
                    index++;
                }
            }

            return(brailleSubtree);
        }
Exemple #15
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);
            }
        }
Exemple #16
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);
        }
Exemple #17
0
        private void addIdAndRelationship(Object brailleSubtree, Object filteredSubtree, TemplateUiObject templateObject)
        {
            if (brailleSubtree == null || !strategyMgr.getSpecifiedTree().HasChild(brailleSubtree))
            {
                return;
            }
            OSMElements.OSMElement brailleNode = strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(brailleSubtree));
            brailleSubtree = strategyMgr.getSpecifiedTree().Child(brailleSubtree);
            String idGenerated = treeOperation.updateNodes.addNodeInBrailleTree(brailleNode);

            if (idGenerated == null)
            {
                return;
            }
            String parentId = idGenerated;

            if (filteredSubtree != null && strategyMgr.getSpecifiedTree().Count(filteredSubtree) > 0) //(templateObject.osm.brailleRepresentation.displayedGuiElementType != null && !templateObject.osm.brailleRepresentation.displayedGuiElementType.Trim().Equals(""))
            {
                treeOperation.osmTreeConnector.addOsmConnection(strategyMgr.getSpecifiedTree().GetData(filteredSubtree).properties.IdGenerated, idGenerated);
                treeOperation.updateNodes.updateNodeOfBrailleUi(ref brailleNode);
            }

            if (strategyMgr.getSpecifiedTree().HasChild(brailleSubtree))
            {
                brailleSubtree = strategyMgr.getSpecifiedTree().Child(brailleSubtree);
                idGenerated    = treeOperation.updateNodes.addNodeInBrailleTree(strategyMgr.getSpecifiedTree().GetData(brailleSubtree), parentId);

                while (strategyMgr.getSpecifiedTree().HasNext(brailleSubtree))
                {
                    brailleSubtree = strategyMgr.getSpecifiedTree().Next(brailleSubtree);
                    idGenerated    = treeOperation.updateNodes.addNodeInBrailleTree(strategyMgr.getSpecifiedTree().GetData(brailleSubtree), parentId);
                    if (idGenerated == null)
                    {
                        return;
                    }
                }
            }
        }
Exemple #18
0
        /// <summary>
        /// Calculates the positions of each tab in a navigation bar
        /// </summary>
        /// <param name="screens">specifies a list of screens to show this navigation bar</param>
        /// <param name="templateObject">The template object for the navigation bar</param>
        /// <param name="index">the index where the calculation should be start</param>
        /// <returns></returns>
        private List <OSMElements.OSMElement> calculatePositionOfScreenTab(List <String> screens, TemplateUiObject templateObject, int index = 0)
        {
            List <OSMElements.OSMElement> groupElementsStatic = new List <OSMElements.OSMElement>();

            if (screens == null || templateObject.Equals(new TemplateUiObject()))
            {
                return(null);
            }
            foreach (String s in screens)
            {
                OSMElements.OSMElement childOsm = new OSMElements.OSMElement();
                Rect rect = templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle;

                if (templateObject.orientation.Equals(OSMElements.UiElements.Orientation.Left) || templateObject.orientation.Equals(OSMElements.UiElements.Orientation.Right))
                {
                    rect.Y = (rect.Height + 1) * index + rect.Y + 1;
                }
                if (templateObject.orientation.Equals(OSMElements.UiElements.Orientation.Top) || templateObject.orientation.Equals(OSMElements.UiElements.Orientation.Bottom))
                {
                    rect.X = (rect.Width + 1) * index + rect.X + 1;
                }

                childOsm.properties.boundingRectangleFiltered = rect;
                childOsm.properties.controlTypeFiltered       = templateObject.osm.brailleRepresentation.groupelementsOfSameType.renderer;
                childOsm.properties.valueFiltered             = s;
                childOsm.brailleRepresentation.isGroupChild   = true;
                childOsm.brailleRepresentation.isVisible      = true;
                childOsm.brailleRepresentation.viewName       = "_" + s;//TODO
                childOsm.brailleRepresentation.typeOfView     = templateObject.osm.brailleRepresentation.typeOfView;
                OSMElements.UiElements.TabItem tabView = new OSMElements.UiElements.TabItem();
                tabView.orientation = templateObject.orientation;
                childOsm.brailleRepresentation.uiElementSpecialContent = tabView;
                groupElementsStatic.Add(childOsm);
                index++;
            }
            return(groupElementsStatic);
        }
Exemple #19
0
 protected abstract Object createSpecialUiElement(Object filteredSubtree, TemplateUiObject templateObject, String brailleNodeId = null);
Exemple #20
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);
        }
Exemple #21
0
        private OSMElements.OSMElement createParentBrailleNode(Object filteredSubtree, TemplateUiObject templateObject)
        {
            OSMElements.OSMElement brailleNode = new OSMElements.OSMElement();
            brailleNode.brailleRepresentation = templateObject.osm.brailleRepresentation;
            brailleNode.properties            = templateObject.osm.properties;

            brailleNode.properties.isEnabledFiltered        = false;
            brailleNode.properties.controlTypeFiltered      = "GroupElement";
            brailleNode.properties.isContentElementFiltered = false; //-> es ist Elternteil einer Gruppe
            brailleNode.brailleRepresentation.isVisible     = true;
            if (templateObject.Screens == null)
            {
                Debug.WriteLine("Achtung, hier wurde kein Screen angegeben!"); return(new OSMElements.OSMElement());
            }
            brailleNode.brailleRepresentation.screenName       = templateObject.Screens[0]; // hier wird immer nur ein Screen-Name übergeben
            brailleNode.brailleRepresentation.viewName         = "_" + templateObject.viewName + "_groupElementsStatic_Count_" + templateObject.groupElements.Count();
            brailleNode.brailleRepresentation.templateFullName = templateObject.groupImplementedClassTypeFullName;
            brailleNode.brailleRepresentation.templateNamspace = templateObject.groupImplementedClassTypeDllName;

            if (templateObject.osm.brailleRepresentation.boarder != null)
            {
                brailleNode.brailleRepresentation.boarder = templateObject.osm.brailleRepresentation.boarder;
            }
            if (templateObject.osm.brailleRepresentation.padding != null)
            {
                brailleNode.brailleRepresentation.padding = templateObject.osm.brailleRepresentation.padding;
            }
            if (templateObject.osm.brailleRepresentation.margin != null)
            {
                brailleNode.brailleRepresentation.margin = templateObject.osm.brailleRepresentation.margin;
            }

            String idGenerated = treeOperation.updateNodes.addNodeInBrailleTree(brailleNode);

            if (idGenerated == null)
            {
                Debug.WriteLine("Es konnte keine Id erstellt werden."); return(new OSMElements.OSMElement());
            }
            brailleNode.properties.IdGenerated = idGenerated;

            if (filteredSubtree != null && strategyMgr.getSpecifiedTree().GetData(filteredSubtree) != null)
            {
                treeOperation.osmTreeConnector.addOsmConnection(strategyMgr.getSpecifiedTree().GetData(filteredSubtree).properties.IdGenerated, idGenerated);
            }
            treeOperation.updateNodes.updateNodeOfBrailleUi(ref brailleNode);

            return(brailleNode);
        }
Exemple #22
0
        /// <summary>
        /// Converts a <see cref="XElement"/> to a <see cref="TemplateUiObject"/>
        /// </summary>
        /// <param name="xmlElement">a <see cref="XElement"/> from the template file (XML)</param>
        /// <param name="typeOfView">specifies the type of view</param>
        /// <returns>a TemplateUiObject</returns>
        private TemplateUiObject xmlUiElementToTemplateUiObject(XElement xmlElement, String typeOfView)
        {
            TemplateUiObject templetObject = new TemplateUiObject();

            templetObject.osm = new OSMElements.OSMElement();
            Int32 result;

            result = 0;

            templetObject.osm.brailleRepresentation.typeOfView = typeOfView;
            templetObject.allElementsOfType = xmlElement.Element("AllElementsOfType") == null ? false : Boolean.Parse(xmlElement.Element("AllElementsOfType").Value);
            templetObject.osm.properties.controlTypeFiltered = xmlElement.Element("Renderer").Value;
            templetObject.osm.brailleRepresentation.displayedGuiElementType = xmlElement.Element("TextFromUIElement").Value;
            XElement position        = xmlElement.Element("Position");
            bool     isConvertHeight = Int32.TryParse(position.Element("Height").Value, out result);
            Rect     rect            = new Rect();

            rect.Height = isConvertHeight ? result : strategyMgr.getSpecifiedDisplayStrategy().getActiveDevice().height;
            bool isConvertWidth = Int32.TryParse(position.Element("Width").Value, out result);

            rect.Width = isConvertWidth ? result : strategyMgr.getSpecifiedDisplayStrategy().getActiveDevice().width;
            bool isConvert = Int32.TryParse(position.Element("StartX").Value, out result);

            rect.X    = isConvert ? result : (strategyMgr.getSpecifiedDisplayStrategy().getActiveDevice().width - rect.Width);
            isConvert = Int32.TryParse(position.Element("StartY").Value, out result);
            rect.Y    = isConvert ? result : (strategyMgr.getSpecifiedDisplayStrategy().getActiveDevice().height - rect.Height);
            if (!isConvertHeight)
            {
                rect.Height -= rect.Y;
            }
            if (!isConvertWidth)
            {
                rect.Width -= rect.X;
            }
            templetObject.osm.properties.boundingRectangleFiltered = rect;

            if (!xmlElement.Element("BoxModel").IsEmpty)
            {
                XElement boxModel = xmlElement.Element("BoxModel");
                if (!boxModel.Element("Padding").IsEmpty)
                {
                    XElement padding = boxModel.Element("Padding");
                    templetObject.osm.brailleRepresentation.padding = new Padding(padding.Element("Left") == null ? 0 : Convert.ToInt32(padding.Element("Left").Value), padding.Element("Top") == null ? 0 : Convert.ToInt32(padding.Element("Top").Value), padding.Element("Right") == null ? 0 : Convert.ToInt32(padding.Element("Right").Value), padding.Element("Bottom") == null ? 0 : Convert.ToInt32(padding.Element("Bottom").Value));
                }
                if (!boxModel.Element("Margin").IsEmpty)
                {
                    XElement margin = boxModel.Element("Margin");
                    templetObject.osm.brailleRepresentation.margin = new Padding(margin.Element("Left") == null ? 0 : Convert.ToInt32(margin.Element("Left").Value), margin.Element("Top") == null ? 0 : Convert.ToInt32(margin.Element("Top").Value), margin.Element("Right") == null ? 0 : Convert.ToInt32(margin.Element("Right").Value), margin.Element("Bottom") == null ? 0 : Convert.ToInt32(margin.Element("Bottom").Value));
                }
                if (!boxModel.Element("Boarder").IsEmpty)
                {
                    XElement boarder = boxModel.Element("Boarder");
                    templetObject.osm.brailleRepresentation.boarder = new Padding(boarder.Element("Left") == null ? 0 : Convert.ToInt32(boarder.Element("Left").Value), boarder.Element("Top") == null ? 0 : Convert.ToInt32(boarder.Element("Top").Value), boarder.Element("Right") == null ? 0 : Convert.ToInt32(boarder.Element("Right").Value), boarder.Element("Bottom") == null ? 0 : Convert.ToInt32(boarder.Element("Bottom").Value));
                }
            }

            if (xmlElement.Element("IsGroup").HasElements)
            {
                templetObject.groupImplementedClassTypeFullName = typeof(TemplateSubtree).FullName;
                templetObject.groupImplementedClassTypeDllName  = typeof(TemplateSubtree).Module.Assembly.GetName().Name; // == Dll-Name
                GroupelementsOfSameType group = new GroupelementsOfSameType();
                group.isLinebreak = Convert.ToBoolean(xmlElement.Element("IsGroup").Element("Linebreak").Value);
                String orientation = xmlElement.Element("IsGroup").Element("Orientation").Value;
                group.orienataion = orientation.Equals(OSMElements.UiElements.Orientation.Vertical.ToString()) ? OSMElements.UiElements.Orientation.Vertical :
                                    orientation.Equals(OSMElements.UiElements.Orientation.Top.ToString()) ? OSMElements.UiElements.Orientation.Top :
                                    orientation.Equals(OSMElements.UiElements.Orientation.Right.ToString()) ? OSMElements.UiElements.Orientation.Right :
                                    orientation.Equals(OSMElements.UiElements.Orientation.Left.ToString()) ? OSMElements.UiElements.Orientation.Left :
                                    orientation.Equals(OSMElements.UiElements.Orientation.Horizontal.ToString()) ? OSMElements.UiElements.Orientation.Horizontal : OSMElements.UiElements.Orientation.Bottom;
                position = xmlElement.Element("IsGroup").Element("childBoundingRectangle");
                Rect childRect = new Rect();
                isConvertHeight  = Int32.TryParse(position.Element("Height").Value, out result);
                childRect.Height = isConvertHeight ? result : strategyMgr.getSpecifiedDisplayStrategy().getActiveDevice().height;
                isConvertWidth   = Int32.TryParse(position.Element("Width").Value, out result);
                childRect.Width  = isConvertWidth ? result : strategyMgr.getSpecifiedDisplayStrategy().getActiveDevice().width;
                childRect.X      = rect.X + templetObject.osm.brailleRepresentation.padding.Left + templetObject.osm.brailleRepresentation.margin.Left + templetObject.osm.brailleRepresentation.boarder.Left;
                childRect.Y      = rect.Y + templetObject.osm.brailleRepresentation.padding.Top + templetObject.osm.brailleRepresentation.margin.Top + templetObject.osm.brailleRepresentation.boarder.Top;
                if (!isConvertHeight)
                {
                    childRect.Height -= childRect.Y;
                }
                if (!isConvertWidth)
                {
                    childRect.Width -= childRect.X;
                }
                group.childBoundingRectangle = childRect;
                group.renderer = xmlElement.Element("Renderer").Value;
                templetObject.osm.brailleRepresentation.groupelementsOfSameType = group;
            }
            if (!xmlElement.Element("Screens").IsEmpty)
            {
                XElement screens = xmlElement.Element("Screens");
                templetObject.Screens = new List <string>();
                foreach (XElement s in screens.Elements("Screen"))
                {
                    templetObject.Screens.Add(s.Value);
                }
            }
            if (xmlElement.Element("Orientation") != null && !xmlElement.Element("Orientation").IsEmpty)
            {
                String value = xmlElement.Element("Orientation").Value;
                templetObject.orientation = (value.Equals(OSMElements.UiElements.Orientation.Left.ToString()) ? OSMElements.UiElements.Orientation.Left : (value.Equals(OSMElements.UiElements.Orientation.Bottom.ToString()) ? OSMElements.UiElements.Orientation.Bottom : (value.Equals(OSMElements.UiElements.Orientation.Right.ToString()) ? OSMElements.UiElements.Orientation.Right : OSMElements.UiElements.Orientation.Top)));
            }
            templetObject.osm.brailleRepresentation.isScrollbarShow = Convert.ToBoolean(xmlElement.Element("ShowScrollbar").Value);
            templetObject.viewName = xmlElement.Attribute("name").Value;
            return(templetObject);
        }
Exemple #23
0
        protected override Object createSpecialUiElement(Object filteredSubtree, TemplateUiObject templateObject, String brailleNodeId)
        {
            if (strategyMgr.getSpecifiedTree().GetData(filteredSubtree).properties.Equals(new GeneralProperties()))
            {
                return(strategyMgr.getSpecifiedTree().NewTree());
            }
            OSMElements.OSMElement brailleNode = templateObject.osm.DeepCopy();
            brailleNode.properties.resetIdGenerated = null; // zurücksetzen, da das die Id vom Elternknoten wäre
            // prop.controlTypeFiltered = templateObject.osm.brailleRepresentation.groupelementsOfSameType.renderer; // den Renderer der Kindelemente setzen
            brailleNode.properties.isEnabledFiltered    = false;
            brailleNode.brailleRepresentation.isVisible = true;
            if (templateObject.Screens == null)
            {
                Debug.WriteLine("Achtung, hier wurde kein Screen angegeben!"); return(strategyMgr.getSpecifiedTree().NewTree());
            }
            brailleNode.brailleRepresentation.screenName   = templateObject.Screens[0]; // hier wird immer nur ein Screen-Name übergeben
            brailleNode.brailleRepresentation.viewName     = "GroupChild" + strategyMgr.getSpecifiedTree().GetData(filteredSubtree).properties.IdGenerated;
            brailleNode.brailleRepresentation.isGroupChild = true;
            // if(templateObject.osm.brailleRepresentation.groupelementsOfSameType.renderer != null) {
            if (templateObject.osm.brailleRepresentation.groupelementsOfSameType.renderer.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;
                brailleNode.brailleRepresentation.uiElementSpecialContent = dropDownMenu;
            }
            if (templateObject.osm.brailleRepresentation.groupelementsOfSameType.renderer.Equals("ListItem"))
            {
                OSMElements.UiElements.ListMenuItem litItem = new ListMenuItem();
                if (strategyMgr.getSpecifiedTree().HasNext(filteredSubtree))
                {
                    litItem.hasNext = true;
                }
                //TODO: multi
                if (strategyMgr.getSpecifiedTree().HasChild(filteredSubtree))
                {
                    if (strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(filteredSubtree)).properties.controlTypeFiltered.Equals("CheckBox"))
                    {
                        litItem.isMultipleSelection = true;
                    }
                }
                brailleNode.brailleRepresentation.uiElementSpecialContent = litItem;
            }
            if (templateObject.osm.brailleRepresentation.groupelementsOfSameType.renderer.Equals("TabItem"))
            {
                OSMElements.UiElements.TabItem tabView = new OSMElements.UiElements.TabItem();
                tabView.orientation = templateObject.osm.brailleRepresentation.groupelementsOfSameType.orienataion; //templateObject.orientation;
                brailleNode.brailleRepresentation.uiElementSpecialContent = tabView;
                //                brailleNode.brailleRepresentation.uiElementSpecialContent = templateObject.osm.brailleRepresentation.uiElementSpecialContent;
            }

            OSMElements.OSMElement brailleGroupNode = treeOperation.searchNodes.getBrailleTreeOsmElementById(brailleNodeId);
            bool groupViewWithScrollbars            = false;

            if (!brailleGroupNode.Equals(new OSMElements.OSMElement()) && brailleGroupNode != null && brailleGroupNode.brailleRepresentation != null)
            {
                groupViewWithScrollbars = brailleGroupNode.brailleRepresentation.isScrollbarShow;
            }
            Rect rect;

            if (templateObject.osm.brailleRepresentation.groupelementsOfSameType.renderer.Equals("TabItem"))
            {
                Rect rectTmp = templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle;
                if (templateObject.osm.brailleRepresentation.groupelementsOfSameType.orienataion.Equals(OSMElements.UiElements.Orientation.Left) || templateObject.osm.brailleRepresentation.groupelementsOfSameType.orienataion.Equals(OSMElements.UiElements.Orientation.Right))
                {
                    rectTmp.Y = (rectTmp.Height + 1) * strategyMgr.getSpecifiedTree().BranchIndex(filteredSubtree) + rectTmp.Y + 1;
                }
                if (templateObject.osm.brailleRepresentation.groupelementsOfSameType.orienataion.Equals(OSMElements.UiElements.Orientation.Top) || templateObject.osm.brailleRepresentation.groupelementsOfSameType.orienataion.Equals(OSMElements.UiElements.Orientation.Bottom))
                {
                    rectTmp.X = (rectTmp.Width + 1) * strategyMgr.getSpecifiedTree().BranchIndex(filteredSubtree) + rectTmp.X + 1;
                }
                boxStartX = Convert.ToInt32(rectTmp.X);
                boxStartY = Convert.ToInt32(rectTmp.Y);
            }
            else
            {
                if (templateObject.osm.brailleRepresentation.groupelementsOfSameType.orienataion.Equals(OSMElements.UiElements.Orientation.Vertical))
                {
                    int column            = 0;
                    int subBoxModel       = (brailleGroupNode == null || brailleGroupNode.brailleRepresentation == null)? 0 : brailleGroupNode.brailleRepresentation.boarder.Top + brailleGroupNode.brailleRepresentation.boarder.Bottom + brailleGroupNode.brailleRepresentation.margin.Top + brailleGroupNode.brailleRepresentation.margin.Bottom + brailleGroupNode.brailleRepresentation.padding.Top + brailleGroupNode.brailleRepresentation.padding.Bottom;
                    int max               = Convert.ToInt32(templateObject.osm.properties.boundingRectangleFiltered.Height) - (groupViewWithScrollbars == true ? 3 : 0) - subBoxModel;
                    int elementsProColumn = max / Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.Height);
                    if (brailleNode.brailleRepresentation.groupelementsOfSameType.isLinebreak == true)
                    {
                        column = strategyMgr.getSpecifiedTree().BranchIndex(filteredSubtree) / elementsProColumn;
                    }
                    if (boxStartY == null)
                    {
                        boxStartY = Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.Y);
                    }
                    if (boxStartX == null)
                    {
                        boxStartX = Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.X);
                    }

                    boxStartY = Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.Y) + ((strategyMgr.getSpecifiedTree().BranchIndex(filteredSubtree) - (column * elementsProColumn)) * Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.Height));
                    boxStartX = Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.X) + (column * Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.Width));
                }
                else
                {  //horizontal
                    int line            = 0;
                    int subBoxModel     = (brailleGroupNode == null || brailleGroupNode.brailleRepresentation == null) ? 0 : brailleGroupNode.brailleRepresentation.boarder.Left + brailleGroupNode.brailleRepresentation.boarder.Right + brailleGroupNode.brailleRepresentation.margin.Left + brailleGroupNode.brailleRepresentation.margin.Right + brailleGroupNode.brailleRepresentation.padding.Left + brailleGroupNode.brailleRepresentation.padding.Right;
                    int max             = Convert.ToInt32(templateObject.osm.properties.boundingRectangleFiltered.Width) - (groupViewWithScrollbars == true ? 3 : 0) - subBoxModel;
                    int elementsProLine = max / Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.Width);
                    if (brailleNode.brailleRepresentation.groupelementsOfSameType.isLinebreak == true)
                    {
                        line = strategyMgr.getSpecifiedTree().BranchIndex(filteredSubtree) / elementsProLine;
                    }
                    if (boxStartY == null)
                    {
                        boxStartY = Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.Y);
                    }
                    if (boxStartX == null)
                    {
                        boxStartX = Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.X);
                    }
                    else
                    {
                        boxStartX = boxStartX + Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.Width);
                    }
                    if (templateObject.osm.brailleRepresentation.groupelementsOfSameType.isLinebreak == true)
                    {
                        boxStartY = Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.Y) + line * Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.Height);
                        if (line > 0)
                        {
                            boxStartX = Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.X) + ((strategyMgr.getSpecifiedTree().BranchIndex(filteredSubtree) - (elementsProLine * line))) * Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.Width);
                        }
                    }
                }
            }
            rect = new System.Windows.Rect(Convert.ToDouble(boxStartX), Convert.ToDouble(boxStartY), Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.Width), Convert.ToInt32(templateObject.osm.brailleRepresentation.groupelementsOfSameType.childBoundingRectangle.Height));
            brailleNode.properties.boundingRectangleFiltered = rect;

            if (!strategyMgr.getSpecifiedTree().HasParent(filteredSubtree))
            {
                return(strategyMgr.getSpecifiedTree().NewTree());
            }
            String idGenerated = treeOperation.updateNodes.addNodeInBrailleTree(brailleNode, brailleNodeId);

            if (idGenerated == null)
            {
                Debug.WriteLine("Es konnte keine Id erstellt werden."); return(strategyMgr.getSpecifiedTree().NewTree());
            }
            brailleNode.properties.IdGenerated = idGenerated;

            treeOperation.osmTreeConnector.addOsmConnection(strategyMgr.getSpecifiedTree().GetData(filteredSubtree).properties.IdGenerated, idGenerated);
            treeOperation.updateNodes.updateNodeOfBrailleUi(ref brailleNode);
            Object tree = strategyMgr.getSpecifiedTree().NewTree();

            strategyMgr.getSpecifiedTree().AddChild(tree, brailleNode);
            return(tree);
        }
Exemple #24
0
        protected override Object createSpecialUiElement(Object filteredSubtree, TemplateUiObject templateObject, String brailleNodeId = null)
        {
            OSMElements.OSMElement brailleNode = new OSMElements.OSMElement();
            brailleNode.properties            = templateObject.osm.properties;
            brailleNode.brailleRepresentation = templateObject.osm.brailleRepresentation;


            brailleNode.properties.controlTypeFiltered      = "GroupElement";
            brailleNode.properties.isContentElementFiltered = false; //-> es ist Elternteil einer Gruppe
            brailleNode.brailleRepresentation.isVisible     = true;
            if (templateObject.Screens == null)
            {
                Debug.WriteLine("Achtung, hier wurde kein Screen angegeben!"); return(strategyMgr.getSpecifiedTree().NewTree());
            }
            brailleNode.brailleRepresentation.screenName = templateObject.Screens[0]; // hier wird immer nur ein Screen-Name übergeben
            //braille.viewName = templateObject.name+"_"+ strategyMgr.getSpecifiedTree().GetData(filteredSubtree).properties.IdGenerated;

            brailleNode.brailleRepresentation.templateFullName = templateObject.groupImplementedClassTypeFullName;
            brailleNode.brailleRepresentation.templateNamspace = templateObject.groupImplementedClassTypeDllName;

            /*if (templateObject.osm.brailleRepresentation.boarder != null)
             * {
             *  braille.boarder = templateObject.osm.brailleRepresentation.boarder;
             * }
             * if (templateObject.osm.brailleRepresentation.padding != null)
             * {
             *  braille.padding = templateObject.osm.brailleRepresentation.padding;
             * }
             * if (templateObject.osm.brailleRepresentation.margin != null)
             * {
             *  braille.margin = templateObject.osm.brailleRepresentation.margin;
             * }*/

            List <Object> existingNodesWithProperties = treeOperation.searchNodes.getNodesByProperties(grantTrees.brailleTree, brailleNode);

            if (existingNodesWithProperties != null && !existingNodesWithProperties.Equals(new List <Object>()))
            {
                String idOsmFilteredSubtree = strategyMgr.getSpecifiedTree().GetData(filteredSubtree).properties.IdGenerated;
                foreach (Object o in existingNodesWithProperties)
                {
                    OSMElements.OSMElement tmpOsmBraille = strategyMgr.getSpecifiedTree().GetData(o);
                    String connectedIdFilteredTree       = treeOperation.searchNodes.getConnectedFilteredTreenodeId(tmpOsmBraille.properties.IdGenerated);
                    if (connectedIdFilteredTree != null && connectedIdFilteredTree.Equals(idOsmFilteredSubtree))
                    {
                        Debug.WriteLine("The node is already exist.");
                        return(strategyMgr.getSpecifiedTree().NewTree());;
                    }
                }
            }
            brailleNode.properties.isEnabledFiltered = false;
            if (!treeOperation.searchNodes.existViewInScreen(brailleNode.brailleRepresentation.screenName, templateObject.viewName, templateObject.osm.brailleRepresentation.typeOfView)) //!templateObject.allElementsOfType ||
            {
                brailleNode.brailleRepresentation.viewName = templateObject.viewName;
            }
            else
            {
                int    i        = 0;
                String viewName = templateObject.viewName + "_" + i;

                while (treeOperation.searchNodes.existViewInScreen(brailleNode.brailleRepresentation.screenName, viewName, templateObject.osm.brailleRepresentation.typeOfView))
                {
                    i++;
                    viewName += i;
                }
                brailleNode.brailleRepresentation.viewName = viewName;
            }
            String idGenerated = treeOperation.updateNodes.addNodeInBrailleTree(brailleNode);

            if (idGenerated == null)
            {
                Debug.WriteLine("Es konnte keine Id erstellt werden."); return(strategyMgr.getSpecifiedTree().NewTree());
            }
            brailleNode.properties.IdGenerated = idGenerated;

            treeOperation.osmTreeConnector.addOsmConnection(strategyMgr.getSpecifiedTree().GetData(filteredSubtree).properties.IdGenerated, idGenerated);
            treeOperation.updateNodes.updateNodeOfBrailleUi(ref brailleNode);
            Object tree = strategyMgr.getSpecifiedTree().NewTree();

            //strategyMgr.getSpecifiedTree().AddChild(tree, brailleNode);
            return(tree);
        }