/// <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);// }
/// <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); }
/// <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); }
/// <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); }