Пример #1
0
        void SyncNode(TreeNavigator navigator, bool forceExpansion = false)
        {
            var node = navigator.GetValue(nodeField);

            UpdateText(navigator, node);
            bool isExpanded = forceExpansion || view.IsRowExpanded(navigator.CurrentPosition);

            ClearChildNodes(navigator);
            syncedNodes.Remove(node);
            navigator.RemoveChildren();
            if (!node.HasVisibleChildren)
            {
                return;
            }
            if (isExpanded)
            {
                foreach (var childNode in node.Children.Where(child => child.Visible))
                {
                    navigator.AddChild();
                    SetNode(navigator, childNode);
                    SyncNode(navigator);
                    navigator.MoveToParent();
                }
            }
            else
            {
                AddDummyChild(navigator);
            }

            if (isExpanded)
            {
                syncedNodes.Add(node);
                view.ExpandRow(navigator.CurrentPosition, false);
            }
        }
Пример #2
0
			gf.CreateImplementation = true;
			gf.OutputPath = fi.Directory.FullName;
		}

		/// <summary>
		/// save to file
		/// </summary>
		/// <param name='fullname'>
		/// Fullname.
		/// </param>
		private void doSave(String fullname, bool clear)
		{
			XmlDocument d = new XmlDocument();

			if (clear)
			{
				d.Load(fullname);
				d.RemoveAll();
			}

			XmlElement config = d.CreateElement("configuration");
			d.AppendChild(config);

			XmlElement glade = d.CreateElement("glade");
			config.AppendChild(glade);

			TreeNavigator tn = TsData.GetFirstNode();
			do
			{
				GladeFile gf = (GladeFile)tn.GetValue(dfGladefile);
				gf.save(glade);
Пример #3
0
 void UpdateParents(TreeNavigator navigator)
 {
     do
     {
         var node = navigator.GetValue(nodeField);
         UpdateText(navigator, node);
     } while (navigator.MoveToParent());
 }
Пример #4
0
        TaskBindingTreeNode GetSelectedBindingNode()
        {
            TreeNavigator navigator = bindingsTreeStore.GetNavigatorAt(bindingsTreeView.SelectedRow);

            if (navigator != null)
            {
                return(navigator.GetValue(bindingNodeField));
            }
            return(null);
        }
Пример #5
0
        TreeNavigator GetNavigator(TaskBindingTreeNode node)
        {
            TreeNavigator       navigator   = bindingsTreeStore.GetFirstNode();
            TaskBindingTreeNode currentNode = navigator.GetValue(bindingNodeField);

            while (currentNode != node)
            {
                if (navigator.MoveNext())
                {
                    currentNode = navigator.GetValue(bindingNodeField);
                }
                else
                {
                    LoggingService.LogError("Unable to find TreeNavigator for binding tree node {0}", node.Name);
                    return(null);
                }
            }

            return(navigator);
        }
Пример #6
0
        void SelectAlgorithm(AlgorithmInfo algorithm)
        {
            TreeNavigator nav = store.GetFirstNode();

            do
            {
                if (nav.GetValue(infoCol) == algorithm)
                {
                    algorithmTree.SelectRow(nav.CurrentPosition);
                    break;
                }
            } while (nav.MoveNext());
        }
Пример #7
0
        void HandleSamplesTreeSelectionChanged(object sender, EventArgs e)
        {
            if (samplesTree.SelectedRow != null)
            {
                // Remove currentInteraction if there is one
                if (currentInteraction != null)
                {
                    // must already have a valid plot sample with the interaction added to it
                    PlotSample ps = (PlotSample)currentWidget;
                    PlotCanvas pc = ps.PlotCanvas;
                    // Remove current interaction from PlotCanvas
                    pc.RemoveInteraction(currentInteraction);
                    currentInteraction = null;
                }

                // get newSample from selected row
                TreePosition  viewRow   = samplesTree.SelectedRow;
                TreeNavigator storeRow  = store.GetNavigatorAt(viewRow);
                Sample        newSample = storeRow.GetValue(sampleCol);

                TreePosition newCategory = newSample.Category;
                if (newCategory == interactionCategory)
                {
                    // only allow interaction if there is already a plotSample
                    if (currentCategory == plotCategory)
                    {
                        PlotSample ps = (PlotSample)currentWidget;
                        PlotCanvas pc = ps.PlotCanvas;
                        // Add new interaction to existing PlotCanvas
                        currentInteraction = newSample.Interaction;
                        pc.AddInteraction(currentInteraction);
                    }
                }
                else
                {
                    // plotCategory or testCategory
                    currentCategory = newCategory;
                    if (currentWidget != null)
                    {
                        sampleBox.Remove(currentWidget);
                    }
                    if (newSample.Type != null)
                    {
                        currentWidget = (Widget)Activator.CreateInstance(newSample.Type);
                        sampleBox.PackStart(currentWidget, true);
                        Dump(currentWidget, 0);
                    }
                }
            }
        }
Пример #8
0
        public void SetExists(TreeNavigator titem, bool exists)
        {
            var item = titem.GetValue(_dataTag) as IProjectItem;

            if (item is PipelineProject)
            {
                return;
            }

            if (item is DirectoryItem)
            {
                var fex = exists;
                var nav = titem.Clone();

                if (nav.MoveToChild())
                {
                    do
                    {
                        if (!(titem.GetValue(_dataTag) as IProjectItem).Exists)
                        {
                            fex = false;
                        }
                    }while (nav.MoveNext());
                }

                titem.SetValue(_dataImage, Global.GetXwtDirectoryIcon(fex));
            }
            else
            {
                titem.SetValue(_dataImage, Global.GetXwtFileIcon(PipelineController.Instance.GetFullPath(item.OriginalPath), exists));
            }

            if (titem.MoveToParent())
            {
                SetExists(titem, exists);
            }
        }
Пример #9
0
        TaskBindingTreeNode GetBindingTreeNode(TreePosition position)
        {
            if (position == null)
            {
                return(null);
            }

            TreeNavigator navigator = bindingsTreeStore.GetNavigatorAt(position);

            if (navigator == null)
            {
                return(null);
            }

            return(navigator.GetValue(bindingNodeField));
        }
Пример #10
0
        TaskRunnerTreeNode GetTaskRunnerTreeNode(TreePosition position)
        {
            if (position == null)
            {
                return(null);
            }

            TreeNavigator navigator = tasksTreeStore.GetNavigatorAt(position);

            if (navigator == null)
            {
                return(null);
            }

            return(navigator.GetValue(taskRunnerField));
        }
        BaseViewModel GetBaseViewModel(TreePosition position)
        {
            if (position == null)
            {
                return(null);
            }

            TreeNavigator navigator = treeStore.GetNavigatorAt(position);

            if (navigator == null)
            {
                return(null);
            }

            return(navigator.GetValue(viewModelDataField));
        }
Пример #12
0
        void UpdateNextChildrenOffset(TreeNavigator node, CheckBoxState newCheck)
        {
            var iter   = node.Clone();
            var change = node.GetValue(nodeEditor);
            var diff   = change.NewText.Length - change.Span.Length;

            if (newCheck == CheckBoxState.Off)
            {
                diff = -diff;
            }

            while (iter.MoveNext())
            {
                var currentOffset = iter.GetValue(nodeOffset);
                iter.SetValue(nodeOffset, currentOffset + diff);
            }
        }
Пример #13
0
        void MoveBindingDown()
        {
            TaskBindingTreeNode bindingNode = GetSelectedBindingNode();

            if (bindingNode?.MoveDown() == true)
            {
                TreeNavigator navigator = bindingsTreeStore.GetNavigatorAt(bindingsTreeView.SelectedRow);
                navigator.MoveNext();

                TaskBindingTreeNode otherBindingNode = navigator.GetValue(bindingNodeField);
                navigator.SetValue(bindingNodeNameField, bindingNode.Name);
                navigator.SetValue(bindingNodeField, bindingNode);

                navigator.MovePrevious();
                navigator.SetValue(bindingNodeNameField, otherBindingNode.Name);
                navigator.SetValue(bindingNodeField, otherBindingNode);
            }
        }
Пример #14
0
 void ClearSiblingNodes(TreeNavigator navigator)
 {
     do
     {
         var node = navigator.GetValue(nodeField);
         if (node != null)
         {
             if (syncedNodes.Contains(node))
             {
                 syncedNodes.Remove(node);
             }
             if (nodePositions.ContainsKey(node))
             {
                 nodePositions.Remove(node);
             }
         }
         ClearChildNodes(navigator);
     } while (navigator.MoveNext());
 }
Пример #15
0
        TreeNavigator SearchNode(string name)
        {
            TreeNavigator navigator = store.GetFirstNode();

            if (navigator.CurrentPosition == null)
            {
                return(null);
            }

            do
            {
                if (name == navigator.GetValue(nameCol))
                {
                    return(navigator);
                }
            } while (navigator.MoveNext());

            return(null);
        }
Пример #16
0
        void RemoveBinding()
        {
            TreeNavigator navigator = bindingsTreeStore.GetNavigatorAt(bindingsTreeView.SelectedRow);

            if (navigator == null)
            {
                return;
            }

            TaskBindingTreeNode bindingNode = navigator.GetValue(bindingNodeField);

            if (bindingNode == null)
            {
                return;
            }

            bindingNode.RemoveBinding();
            navigator.Remove();

            TaskBindingTreeNode parentNode = GetBindingTreeNode(bindingNode.BindEvent);

            if (parentNode == null)
            {
                return;
            }

            navigator = GetNavigator(parentNode);
            if (navigator != null)
            {
                RefreshBindingNodeName(parentNode, navigator);
                if (!parentNode.AnyBindings())
                {
                    navigator.RemoveChildren();
                }
            }
        }
Пример #17
0
		void UpdateParents (TreeNavigator navigator)
		{
			do {
				var node = navigator.GetValue (nodeField);
				UpdateText (navigator, node);
			} while (navigator.MoveToParent ());
		}
Пример #18
0
		void SyncNode (TreeNavigator navigator, bool forceExpansion = false)
		{
			var node = navigator.GetValue (nodeField);
			UpdateText (navigator, node);
			bool isExpanded = forceExpansion || view.IsRowExpanded (navigator.CurrentPosition);
			ClearChildNodes (navigator);
			syncedNodes.Remove (node);
			navigator.RemoveChildren ();
			if (!node.HasVisibleChildren) 
				return;
			if (isExpanded) {
				foreach (var childNode in node.Children.Where (child => child.Visible)) {
					navigator.AddChild ();
					SetNode (navigator, childNode);
					SyncNode (navigator);
					navigator.MoveToParent ();
				}
			} else {
				AddDummyChild (navigator);
			}
			
			if (isExpanded) {
				syncedNodes.Add (node);
				view.ExpandRow (navigator.CurrentPosition, false);
			}
			
		}
Пример #19
0
		void ClearSiblingNodes (TreeNavigator navigator)
		{
			if (navigator.CurrentPosition == null)
				return;

			do {
				var node = navigator.GetValue (nodeField);
				if (node != null) {
					if (syncedNodes.Contains (node)) {
						syncedNodes.Remove (node);
					}
					if (nodePositions.ContainsKey (node)) {
						nodePositions.Remove (node);
					}
				}
				ClearChildNodes (navigator);
			} while (navigator.MoveNext ());
		}