Exemplo n.º 1
0
        TaskBindingTreeNode AddBindingsTreeNode(TaskRunnerBindEvent bindEvent)
        {
            var node = new TaskBindingTreeNode(bindEvent);

            TreeNavigator navigator = bindingsTreeStore.AddNode();

            navigator.SetValue(bindingNodeNameField, node.Name);
            navigator.SetValue(bindingNodeField, node);

            return(node);
        }
 void SetNodeText(TreeNavigator nav, string text, TextSpan span, Color color, object node)
 {
     nav.SetValues(
         markupField,
         $"<span color='{color.ToHexString ()}'>{GLib.Markup.EscapeText (text)} [{span.Start}-{span.End}]</span>",
         spanField,
         span,
         nodeField,
         node
         );
 }
Exemplo n.º 3
0
        TreePosition AddInteraction(TreePosition category, string name, Interaction interaction)
        {
            Sample sample = new Sample(category, name, interaction);

            TreeNavigator node            = store.AddNode(category);
            TreeNavigator nameNavigator   = node.SetValue(nameCol, name);
            TreeNavigator iconNavigator   = nameNavigator.SetValue(iconCol, icon);
            TreeNavigator sampleNavigator = iconNavigator.SetValue(sampleCol, sample);

            return(sampleNavigator.CurrentPosition);
        }
Exemplo n.º 4
0
        void UpdateChildrenForRootCheck(TreeNavigator rootnode, CheckBoxState newCheck)
        {
            if (!rootnode.MoveToChild())
            {
                return;
            }

            do
            {
                rootnode.SetValue(nodeCheck, newCheck);
            } while (rootnode.MoveNext());
        }
Exemplo n.º 5
0
        public void AddChildTemplateCategory(
            TemplateCategoryViewModel parentCategory,
            TemplateCategoryViewModel category)
        {
            TreeNavigator navigator = FindCategoryNavigator(parentCategory);

            if (navigator != null)
            {
                AddTemplateCategory(navigator.CurrentPosition, category);
                treeView.ExpandRow(navigator.CurrentPosition, true);
            }
        }
Exemplo n.º 6
0
        private void TreenavigatorItemsUpdate(TreeNavigator sender, SelectionStateChangedEventArgs e)
        {
            TreeNavigator tree = sender as TreeNavigator;
            int           i    = 2;

            if (e.SelectedItem.Text.Equals("Desktop"))
            {
                string[] folders = System.IO.Directory.GetDirectories(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "*", System.IO.SearchOption.TopDirectoryOnly);
                foreach (string folder in folders)
                {
                    (tree.Items[0] as TreeMenuItem).Items.Add(new TreeMenuItem()
                    {
                        Text = folder
                    });
                }
            }
            if (e.SelectedItem.Text.Equals("Documents"))
            {
                string[] folders = System.IO.Directory.GetDirectories(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "*", System.IO.SearchOption.TopDirectoryOnly);
                foreach (string folder in folders)
                {
                    (tree.Items[1] as TreeMenuItem).Items.Add(new TreeMenuItem()
                    {
                        Text = folder
                    });
                }
            }
            foreach (string s in drives)
            {
                if (s.Equals(e.SelectedItem.Text))
                {
                    string[] folders = System.IO.Directory.GetDirectories(s, "*", SearchOption.TopDirectoryOnly);
                    foreach (string folder in folders)
                    {
                        DirectoryInfo info = new DirectoryInfo(folder);
                        try
                        {
                            if ((info.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden || (info.Attributes & FileAttributes.System) != FileAttributes.System)
                            {
                                (tree.Items[i] as TreeMenuItem).Items.Add(new TreeMenuItem()
                                {
                                    Text = folder
                                });
                            }
                        }
                        catch (UnauthorizedAccessException)
                        {
                        }
                    }
                }
                i++;
            }
        }
Exemplo n.º 7
0
        void AddTaskChildNodes(TreeNavigator navigator, TaskRunnerTreeNode node)
        {
            foreach (TaskRunnerTreeNode childNode in node.GetChildNodes())
            {
                TreeNavigator childNavigator = navigator.AddChild();
                childNavigator.SetValue(taskRunnerNodeNameField, childNode.Name);
                childNavigator.SetValue(taskRunnerField, childNode);

                AddTaskChildNodes(childNavigator, childNode);
                navigator.MoveToParent();
            }
        }
        void LoadModes()
        {
            storeModes.Clear();
            var  currentMode  = SelectedExecutionMode;
            bool nodeSelected = false;
            var  ctx          = new CommandExecutionContext(item, h => item.CanExecute(new ExecutionContext(h, null, IdeApp.Workspace.ActiveExecutionTarget), IdeApp.Workspace.ActiveConfiguration, SelectedConfiguration));

            foreach (var modeSet in Runtime.ProcessService.GetExecutionModes())
            {
                TreeNavigator setNode = null;
                foreach (var mode in modeSet.ExecutionModes)
                {
                    if (ctx.CanExecute(mode.ExecutionHandler))
                    {
                        if (setNode == null)
                        {
                            setNode = storeModes.AddNode();
                            setNode.SetValue(modeNameField, modeSet.Name);
                            setNode.SetValue(modeField, mode);
                            setNode.SetValue(modeSetField, modeSet);
                            if (mode.Id == currentMode?.Id)
                            {
                                treeModes.SelectRow(setNode.CurrentPosition);
                                nodeSelected = true;
                            }
                        }
                        var node = storeModes.AddNode(setNode.CurrentPosition);
                        node.SetValue(modeNameField, mode.Name);
                        node.SetValue(modeField, mode);
                        node.SetValue(modeSetField, modeSet);
                        if (!nodeSelected && mode.Id == currentMode?.Id)
                        {
                            treeModes.SelectRow(node.CurrentPosition);
                            nodeSelected = true;
                        }
                    }
                }
                // If the mode only has one child, remove it, we don't need to show it
                if (setNode != null && setNode.MoveToChild())
                {
                    var pos = setNode.Clone();
                    if (!setNode.MoveNext())
                    {
                        pos.Remove();
                    }
                }
            }
            if (!nodeSelected && storeModes.GetFirstNode()?.CurrentPosition != null)
            {
                treeModes.SelectRow(storeModes.GetFirstNode().CurrentPosition);
            }
        }
Exemplo n.º 9
0
        void SelectAlgorithm(AlgorithmInfo algorithm)
        {
            TreeNavigator nav = store.GetFirstNode();

            do
            {
                if (nav.GetValue(infoCol) == algorithm)
                {
                    algorithmTree.SelectRow(nav.CurrentPosition);
                    break;
                }
            } while (nav.MoveNext());
        }
Exemplo n.º 10
0
        public void AddItem(TreeNavigator root, IProjectItem citem, string path, string currentPath)
        {
            var split = path.Split('/');
            var item  = GetorAddItem(root, split.Length > 1 ? new DirectoryItem(split[0], currentPath)
            {
                Exists = citem.Exists
            } : citem);

            if (path.Contains("/"))
            {
                AddItem(item, citem, string.Join("/", split, 1, split.Length - 1), (currentPath + Path.DirectorySeparatorChar + split[0]));
            }
        }
Exemplo n.º 11
0
 public static void ShowToken(IApp app, IDataModel model, IPEImage image, MDToken token)
 {
     TreeNavigator.Create()
     .Path <dnModuleModel>(m => m.Module.Image == image ? NavigationState.In : NavigationState.Next)
     .Path <MetaDataModel>(m => NavigationState.In)
     .Path <MDTablesStreamModel>(m => NavigationState.In)
     .Path <MDTableHeapModel>(m => NavigationState.Done)
     .Handler(node => {
         var targetView = (MDTableHeapView)app.Views.LocateViews(node.Model).Single();
         targetView.SelectItem(token);
     })
     .Goto(model);
 }
Exemplo n.º 12
0
        private TreeNavigator setData(TreeNavigator tn, object[] data)
        {
            TreeNavigator ret = null;

            int i = 0;

            foreach (DatafieldContainer dc in Fields)
            {
                ret = SetValue(tn, new object[] { dc.Field, data[i] }, dc.Typename);
                i++;
            }

            return(ret);
        }
Exemplo n.º 13
0
        public void AddTopLevelCategory(TemplateCategoryViewModel category)
        {
            TreePosition position = AddTemplateCategory(null, category);

            treeView.ExpandRow(position, true);

            // Ensure last child is visible and selected.
            TreeNavigator navigator = treeStore.GetNavigatorAt(position);

            navigator.MoveToChild();
            navigator.MoveToChild();
            treeView.ScrollToRow(navigator.CurrentPosition);
            treeView.SelectRow(navigator.CurrentPosition);
        }
Exemplo n.º 14
0
 private void treeNavigator1_SelectionChanged(TreeNavigator sender, SelectionStateChangedEventArgs e)
 {
     if (e.SelectedItem == thisPCtreeMenuItem)
     {
         groupView1.Visible     = false;
         openTabPCPanel.Visible = true;
         FillThisPCItems(this.treeNavigator4);
     }
     else
     {
         groupView1.Visible     = true;
         openTabPCPanel.Visible = false;
     }
 }
Exemplo n.º 15
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);
                    }
                }
            }
        }
        void SetTreeNodeValues(TreeNavigator navigator, BaseViewModel viewModel)
        {
            if (viewModel is NodeViewModel nodeViewModel)
            {
                navigator.SetValue(textDataField, GetTreeNodeText(nodeViewModel));
                navigator.SetValue(imageDataField, GetTreeNodeImage(nodeViewModel));
            }
            else
            {
                navigator.SetValue(textDataField, GLib.Markup.EscapeText(viewModel.Text));
            }

            navigator.SetValue(viewModelDataField, viewModel);
        }
Exemplo n.º 17
0
		{
			saveAs();
		}

		/// <summary>
		/// remove the selected files from the treestore
		/// </summary>
		/// <param name='sender'>
		/// Sender.
		/// </param>
		/// <param name='e'>
		/// E.
		/// </param>
		void HandleBtnRemoveClicked (object sender, EventArgs e)
		{
//			TreePosition[] tp = Treeview1.SelectedRows;
//			foreach (TreePosition p in tp)
//			{
//				TsData.GetNavigatorAt(p).Remove();
//			}

			TreeNavigator tn = TsData.GetFirstNode();
			do
			{
Exemplo n.º 18
0
        public TreeNavigator InitNode(BaseItem documentItem, TreeNavigator paretn = null)
        {
            var tn = paretn == null?Store.AddNode() : Store.AddNode(paretn.CurrentPosition);

            tn.SetValues(dfName, documentItem.GetType().FullName,
                         dfTag, documentItem);
            if (documentItem is DocumentElementCollection)
            {
                foreach (BaseItem item in (DocumentElementCollection)documentItem)
                {
                    InitNode(item, tn);
                }
            }
            return(tn);
        }
Exemplo n.º 19
0
        void SetNode(TreeNavigator navigator, IIssueTreeNode node)
        {
            if (navigator == null)
            {
                throw new ArgumentNullException("navigator");
            }
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            navigator.SetValue(nodeField, node);
            Debug.Assert(!nodePositions.ContainsKey(node));
            var position = navigator.CurrentPosition;

            nodePositions.Add(node, position);

            node.ChildAdded += (sender, e) => {
                Debug.Assert(e.Parent == node);
                Application.Invoke(delegate {
                    var newNavigator = store.GetNavigatorAt(position);
                    newNavigator.AddChild();
                    SetNode(newNavigator, e.Child);
                    SyncNode(newNavigator);
                });
            };
            node.ChildrenInvalidated += (sender, e) => {
                Application.Invoke(delegate {
                    SyncNode(store.GetNavigatorAt(position));
                });
            };
            node.TextChanged += (sender, e) => {
                lock (queueLock) {
                    if (!updateQueue.Contains(e.Node))
                    {
                        updateQueue.Enqueue(e.Node);
                    }
                }
            };
            node.VisibleChanged += (sender, e) => {
                lock (queueLock) {
                    if (!updateQueue.Contains(e.Node))
                    {
                        updateQueue.Enqueue(e.Node);
                    }
                }
            };
        }
Exemplo n.º 20
0
        TaskRunnerTreeNode GetTaskRunnerTreeNode(TreePosition position)
        {
            if (position == null)
            {
                return(null);
            }

            TreeNavigator navigator = tasksTreeStore.GetNavigatorAt(position);

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

            return(navigator.GetValue(taskRunnerField));
        }
Exemplo n.º 21
0
        protected object GetValue(TreeNavigator navigator, String fieldname)
        {
            if (navigator.CurrentPosition == null)
            {
                return(null);
            }

            foreach (DatafieldContainer df in Fields)
            {
                if (df.Title.Equals(fieldname, StringComparison.OrdinalIgnoreCase))
                {
                    return(GetValue(navigator, df.Field, df.Typename));
                }
            }
            return(null);
        }
Exemplo n.º 22
0
        void AddTaskNodes(TaskRunnerInformation task)
        {
            var rootNode = new TaskRunnerTreeNode(task);

            TreeNavigator navigator = tasksTreeStore.AddNode();
            IconId        icon      = rootNode.Icon;

            if (!icon.IsNull)
            {
                navigator.SetValue(taskRunnerNodeIconField, ImageService.GetIcon(icon, Gtk.IconSize.Menu));
            }
            navigator.SetValue(taskRunnerNodeNameField, rootNode.Name);
            navigator.SetValue(taskRunnerField, rootNode);

            AddTaskChildNodes(navigator, rootNode);
        }
        BaseViewModel GetBaseViewModel(TreePosition position)
        {
            if (position == null)
            {
                return(null);
            }

            TreeNavigator navigator = treeStore.GetNavigatorAt(position);

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

            return(navigator.GetValue(viewModelDataField));
        }
Exemplo n.º 24
0
        public void SelectItem(MDToken token)
        {
            var table = Model.Stream.Get(token.Table);
            var rid   = token.Rid;

            if (table == null || !table.IsValidRID(rid))
            {
                MessageBox.Show("Invalid token.", App.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            TreeNavigator.Create()
            .Path <MDTableModel>(m => m.MDTable == table ? NavigationState.In : NavigationState.Next)
            .Path <MDRowModel>(m => m.Rid == rid ? NavigationState.Done : NavigationState.Next)
            .Goto(treeView);
        }
Exemplo n.º 25
0
        private bool FindItem(TreeNavigator root, string path, out TreeNavigator item)
        {
            var split = path.Split('/');

            if (GetItem(root, split[0], out item))
            {
                if (split.Length != 1)
                {
                    return(FindItem(item, string.Join("/", split, 1, split.Length - 1), out item));
                }

                return(true);
            }

            return(false);
        }
Exemplo n.º 26
0
        TreePosition AddTemplateCategory(
            TreePosition position,
            TemplateCategoryViewModel categoryViewModel)
        {
            TreeNavigator node = treeStore.AddNode(position);

            node.SetValue(nameColumn, categoryViewModel.GetNameWithIsNewMessage());
            node.SetValue(categoryColumn, categoryViewModel);

            foreach (TemplateCategoryViewModel childCategory in categoryViewModel.GetChildCategories())
            {
                AddTemplateCategory(node.CurrentPosition, childCategory);
            }

            return(node.CurrentPosition);
        }
Exemplo n.º 27
0
        TaskBindingTreeNode GetBindingTreeNode(TreePosition position)
        {
            if (position == null)
            {
                return(null);
            }

            TreeNavigator navigator = bindingsTreeStore.GetNavigatorAt(position);

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

            return(navigator.GetValue(bindingNodeField));
        }
Exemplo n.º 28
0
//		void HandleButtonPressed (object sender, ButtonEventArgs e)
//		{
//			if (e.MultiplePress == 2)
//			{
//				TreeView tv = sender as TreeView;
//
//				TreePosition tp = tv.SelectedRow;
//				TreeNavigator tn = DataStore.GetNavigatorAt (tp);
//				//SetValue(tn,new object[] { true },"System.Boolean");
//
//				//SetValue(tn,
//
//				SetValue(tn,new object[] {Fields[2].Field,true},"System.Boolean");
//
//
//				//Tree.Columns[0].Views[0]
//			}
//
//		}


        public override void afterSetData(VirtualGridRow row, string columnName, object data)
        {
            base.afterSetData(row, columnName, data);

            if (data == null)
            {
                throw new Exception("data is null");
            }

            TreeNavigator tn = GetNavigator(row);

            if (tn != null)
            {
                SetValue(tn, columnName, data);
            }
        }
Exemplo n.º 29
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);
            }
        }
Exemplo n.º 30
0
 private void FillThisPCItems(TreeNavigator tree)
 {
     tree.Items.Add(new TreeMenuItem()
     {
         Text = "Desktop"
     });
     tree.Items.Add(new TreeMenuItem()
     {
         Text = "Documents"
     });
     foreach (string s in drives)
     {
         tree.Items.Add(new TreeMenuItem()
         {
             Text = s
         });
     }
 }
Exemplo n.º 31
0
 protected void SetValue(TreeNavigator navigator,String fieldname, object value)
 {
     foreach (DatafieldContainer df in Fields)
     {
         if (df.Title.Equals(fieldname,StringComparison.OrdinalIgnoreCase))
         {
             SetValue(navigator,new object[] {df.Field, value }, df.Typename);
             return;
         }
     }
 }
Exemplo n.º 32
0
		void SetChunkStyle (TreeNavigator navigator, ChunkStyle oldStyle)
		{
			var newStyle = new ChunkStyle (oldStyle);
			newStyle.Foreground = GetColorFromButton (colorbuttonPrimary);
			newStyle.Background = GetColorFromButton (colorbuttonSecondary);

			if (togglebuttonBold.Active) {
				newStyle.FontWeight = FontWeight.Bold;
			} else {
				newStyle.FontWeight = FontWeight.Normal;
			}

			if (togglebuttonItalic.Active) {
				newStyle.FontStyle = FontStyle.Italic;
			} else {
				newStyle.FontStyle = FontStyle.Normal;
			}

			navigator.SetValue (styleField, newStyle);

			var newscheme = colorScheme.Clone ();
			ApplyStyle (newscheme);

			this.textEditor.TextViewMargin.PurgeLayoutCache ();
			this.textEditor.Document.MimeType = "text/x-csharp";
			this.textEditor.GetTextEditorData ().ColorStyle = newscheme;
			this.textEditor.QueueDraw ();
		}
Exemplo n.º 33
0
        private object GetValue(TreeNavigator navigator, IDataField datafield, String typenmae)
        {
            //DataStore.AddNode().SetValue
            MethodInfo method = typeof(TreeNavigator).GetMethod("GetValue");
            MethodInfo generic = method.MakeGenericMethod(Type.GetType(typenmae));

            return (generic.Invoke(navigator,new object[] {datafield}));
        }
Exemplo n.º 34
0
        private TreeNavigator GetNavigator(VirtualGridRow row,TreeNavigator parent=null)
        {
            TreeNavigator first = null;
            if (parent != null)
            {
                first = parent;
            } else
            {
                first = DataStore.GetFirstNode();
            }

            if (first.CurrentPosition != null)
            {
                do
                {
                    VirtualGridRow o = (VirtualGridRow)GetValue(first,"row");

                    if (o == row)
                    {
                        return first;
                    }

                    if (first.MoveToChild())
                    {
                        TreeNavigator tn = GetNavigator(row,first);
                        if (tn != null)
                        {
                            return tn;
                        }
                        first.MoveToParent();
                    }

                } while(first.MoveNext());
            }

            return null;
        }
Exemplo n.º 35
0
        /// <summary>
        /// set a value of a xwt treenavigator
        /// </summary>
        /// <returns>
        /// The value.
        /// </returns>
        /// <param name='navigator'>
        /// Navigator.
        /// </param>
        /// <param name='data'>
        /// Data.
        /// </param>
        /// <param name='typenmae'>
        /// Typenmae.
        /// </param>
        private TreeNavigator SetValue(TreeNavigator navigator, object[] data, String typenmae)
        {
            //DataStore.AddNode().SetValue
            MethodInfo method = typeof(TreeNavigator).GetMethod("SetValue");
            MethodInfo generic = method.MakeGenericMethod(Type.GetType(typenmae));

            return (generic.Invoke(navigator,data) as TreeNavigator);
        }
Exemplo n.º 36
0
        private TreeNavigator setData(TreeNavigator tn, object[] data)
        {
            TreeNavigator ret = null;

            int i=0;
            foreach (DatafieldContainer dc in Fields)
            {
                ret = SetValue(tn,new object[] {dc.Field,data[i]},dc.Typename);
                i++;
            }

            return ret;
        }
Exemplo n.º 37
0
		void AddDummyChild (TreeNavigator navigator)
		{
			navigator.AddChild ();
			navigator.SetValue (textField, "Loading...");
			navigator.MoveToParent ();
		}
Exemplo n.º 38
0
		void UpdateParents (TreeNavigator navigator)
		{
			do {
				var node = navigator.GetValue (nodeField);
				UpdateText (navigator, node);
			} while (navigator.MoveToParent ());
		}
Exemplo n.º 39
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);
			}
			
		}
Exemplo n.º 40
0
		void UpdateText (TreeNavigator navigator, IIssueTreeNode node)
		{
			navigator.SetValue (textField, node.Text);
		}
Exemplo n.º 41
0
		void ClearChildNodes (TreeNavigator navigator)
		{
			if (navigator.MoveToChild ()) {
				ClearSiblingNodes (navigator);
				navigator.MoveToParent ();
			}
		}
Exemplo n.º 42
0
        protected object GetValue(TreeNavigator navigator,String fieldname)
        {
            if (navigator.CurrentPosition == null)
            {
                return null;
            }

            foreach (DatafieldContainer df in Fields)
            {
                if (df.Title.Equals(fieldname,StringComparison.OrdinalIgnoreCase))
                {
                    return GetValue(navigator,df.Field,df.Typename);
                }
            }
            return null;
        }
 private void AddChilds(TreeNavigator node, List<HierarchyItem> children)
 {
     foreach (var child in children)
     {
         node.AddChild().SetValue(_name, child.Name).SetValue(_path, child.ServerPath);
         AddChilds(node, child.Children);
         node.MoveToParent();
     }
 }
Exemplo n.º 44
0
		public TreeViewCellBounds ()
		{
			MinHeight = 120;
			MinWidth = 100;

			container = new VBox ();
			TreeView = new TreeView ();
			TreeStore = new TreeStore (triState, check, text, desc);
			TreeView.GridLinesVisible = GridLines.Both;

			TreeView.Columns.Add ("TriCheck", triState);
			TreeView.Columns.Add ("Check", check);
			TreeView.Columns.Add ("Item", text);
			TreeView.Columns.Add ("Desc", desc, check, text);

			TreeView.DataSource = TreeStore;

			TreeStore.AddNode ().SetValue (text, "One").SetValue (desc, "First").SetValue (triState, CheckBoxState.Mixed);
			TreeStore.AddNode ().SetValue (text, "Two").SetValue (desc, "Second").AddChild ()
				.SetValue (text, "Sub two").SetValue (desc, "Sub second");
			TreeStore.AddNode ().SetValue (text, "Three").SetValue (desc, "Third").AddChild ()
				.SetValue (text, "Sub three").SetValue (desc, "Sub third");

			TreeView.ExpandAll ();


			TreeView.SelectionChanged += (sender, e) => UpdateTracker (TreeView.SelectedRow);
			TreeView.MouseMoved += (sender, e) => UpdateTracker (TreeView.GetRowAtPosition (e.X, e.Y));

			drawer = new TreeTrackingCanvas (this);

			container.PackStart (TreeView, true);
			container.PackStart (drawer);
			AddChild (container);

			if (currentRow == null)
				currentRow = TreeStore.GetFirstNode ();
		}
Exemplo n.º 45
0
		void SetAmbientColor (TreeNavigator navigator, AmbientColor oldStyle)
		{
			var newStyle = new AmbientColor ();
			newStyle.Color = GetColorFromButton (colorbuttonPrimary);
			newStyle.SecondColor = GetColorFromButton (colorbuttonSecondary);

			navigator.SetValue (styleField, newStyle);

			var newscheme = colorScheme.Clone ();
			ApplyStyle (newscheme);

			this.textEditor.TextViewMargin.PurgeLayoutCache ();
			this.textEditor.Document.MimeType = "text/x-csharp";
			this.textEditor.GetTextEditorData ().ColorStyle = newscheme;
			this.textEditor.QueueDraw ();
		}
Exemplo n.º 46
0
		void SetNode (TreeNavigator navigator, IIssueTreeNode node)
		{
			if (navigator == null)
				throw new ArgumentNullException ("navigator");
			if (node == null)
				throw new ArgumentNullException ("node");
			
			navigator.SetValue (nodeField, node);
			Debug.Assert (!nodePositions.ContainsKey (node));
			var position = navigator.CurrentPosition;
			nodePositions.Add (node, position);
			
			node.ChildAdded += (sender, e) => {
				Debug.Assert (e.Parent == node);
				Application.Invoke (delegate {
					var newNavigator = store.GetNavigatorAt (position);
					newNavigator.AddChild ();
					SetNode (newNavigator, e.Child);
					SyncNode (newNavigator);
				});
			};
			node.ChildrenInvalidated += (sender, e) => {
				Application.Invoke (delegate {
					SyncNode (store.GetNavigatorAt (position));
				});
			};
			node.TextChanged += (sender, e) => {
				lock (queueLock) {
					if (!updateQueue.Contains (e.Node)) {
						updateQueue.Enqueue (e.Node);
					}
				}
			};
			node.VisibleChanged += (sender, e) => {
				lock (queueLock) {
					if (!updateQueue.Contains (e.Node)) {
						updateQueue.Enqueue (e.Node);
					}
				}
			};
		}
Exemplo n.º 47
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 ());
		}
Exemplo n.º 48
0
 private void AddLesson(TreeNavigator navigator, Lesson lesson)
 {
     navigator.AddChild()
         .SetValue(imageCol, LessonIcon)
         .SetValue(nameCol, lesson.Title)
         .SetValue(subjectCol, lesson.Subject)
         .SetValue(lessonCol, lesson)
         .MoveToParent();
 }
Exemplo n.º 49
0
        //        public VirtualGridRow GetSelectedGridRow()
        //        {
        //            TreePosition tp = Tree.SelectedRow;
        //
        //            foreach (VirtualGridRow row in Rows)
        //            {
        //                TreeNavigator tn = DataStore.GetNavigatorAt (tp);
        //                //DataStore.
        //                //VirtualGridRow rw = (VirtualGridRow)GetValue(tn,"");
        //                //tn.GetValue(
        //            }
        //            return null;
        //        }
        public void addData(TreeNavigator navigator, VirtualTreeRow row)
        {
            if (navigator == null)
            {
                throw new ArgumentNullException("navigator");
            }

            if (row == null)
            {
                throw new ArgumentNullException("row");
            }

            //add children
            if ((row.Children != null) && (row.Children.Count > 0))
            {
                TreeNavigator current = navigator;
                int idx = 0;
                foreach (KeyValuePair<String,VirtualTreeRow> kp in row.Children)
                {
                    if (idx > 0)
                    {
                        current.InsertAfter();
                    }

                    setData(current,kp.Value.Data);

                    if (kp.Value.Children.Count > 0)
                    {
                        addData(current.AddChild(),kp.Value);
                        current.MoveToParent();
                    } else
                    {
                        if (kp.Value.Rows.Count > 0)
                        {
                            addData(current.AddChild(),kp.Value);
                            current.MoveToParent();
                        }
                    }

                    idx++;
                }
            }

            //if no children available add the assigned rows
            if ((row.Children == null) || (row.Children.Count < 1))
            {
                int idx = 0;
                foreach (VirtualGridRow rw in row.Rows)
                {
                    if (idx > 0)
                    {
                        navigator.InsertAfter();
                    }

                    setData(navigator,rw.Datas);

                    idx++;
                }
            }
        }