public void SetUp()
        {
            this.permissionService = new Mock <IPermissionService>();
            this.permissionService.Setup(x => x.CanRead(It.IsAny <Thing>())).Returns(true);
            this.permissionService.Setup(x => x.CanWrite(It.IsAny <Thing>())).Returns(true);
            var uri     = new Uri("http://test.com");
            var domain  = new DomainOfExpertise(Guid.NewGuid(), null, uri);
            var siteDir = new SiteDirectory(Guid.NewGuid(), null, uri)
            {
                Name = "SiteDir"
            };

            siteDir.Domain.Add(domain);
            this.domainRow = new TestRowViewModel(domain, this.session.Object, null);
            var domains = new List <TestRowViewModel> {
                this.domainRow
            };

            this.treelistControl = new TreeListControl();
            this.gridColumn      = new TreeListColumn {
                FieldName = "Name"
            };
            this.treelistControl.Columns.Add(this.gridColumn);
            this.treelistControl.ItemsSource = domains;

            this.cellEditBehaviour = new TreeCellEditBehavior();
            this.cellEditBehaviour.Attach(this.treelistControl.View);
        }
        public override void AddNodeToTree(TreeListControl treeList)
        {
            treeList.BeginDataUpdate();

            var rel = _db.RelationManager.GetRelationById(Id);

            AddToInstances(treeList, rel.FirstBlockId);

            if (rel.FirstBlock is Idea)
            {
                var tag = _db.TagsManager.GetTagWithIdeaId(rel.FirstBlockId);
                if (tag != null)
                    AddToInstances(treeList, tag.Id);
            }

            AddToInstances(treeList, rel.SecondBlockId);

            if (rel.SecondBlock is Idea)
            {
                var tag = _db.TagsManager.GetTagWithIdeaId(rel.SecondBlockId);
                if (tag != null)
                    AddToInstances(treeList, tag.Id);
            }

            treeList.EndDataUpdate();
        }
Beispiel #3
0
        // Load hierarchical data from XML and display it in a TreeListControl
        void LoadHierarchicalXmlData()
        {
            var treeListControl = new TreeListControl();

            treeListControl.Dock            = DockStyle.Fill;
            treeListControl.ShowRoot        = false;
            treeListControl.LabelEditMode   = TreeControl.LabelEditModes.EditOnF2 | TreeControl.LabelEditModes.EditOnClick;
            treeListControl.NodeDataEdited += treeListControl_NodeDataEdited;
            Controls.Add(treeListControl);

            Assembly assembly    = Assembly.GetExecutingAssembly();
            string   startupPath = Path.GetDirectoryName(new Uri(assembly.GetName().CodeBase).LocalPath);
            var      xmlPath     = Path.Combine(startupPath, "CoolSUVs.xml");

            var treeView           = new TreeView(xmlPath, new DataEditorTheme(treeListControl.Font));
            var treeControlAdapter = new TreeControlAdapter(treeListControl);

            treeControlAdapter.TreeView = treeView;

            treeListControl.ItemRenderer = new TreeListItemRenderer(treeView);

            treeListControl.Columns.Add(new TreeListView.Column("MPG", 80));
            treeListControl.Columns.Add(new TreeListView.Column("Weight", 80));
            treeListControl.Columns.Add(new TreeListView.Column("Color", 80));
            treeListControl.Columns.Add(new TreeListView.Column("MSRP", 80));
            treeListControl.ExpandAll();
        }
 void AttachToTreeListControl(TreeListControl treeListControl)
 {
     if (this.treeListControl != null)
     {
         this.treeListControl.View.CustomNodeFilter      -= new TreeListNodeFilterEventHandler(OnTreeListCustomNodeFilter);
         this.treeListControl.SortInfo.CollectionChanged -= new NotifyCollectionChangedEventHandler(OnSortInfoCollectionChanged);
         this.treeListControl.View.FocusedRowChanged     -= new FocusedRowChangedEventHandler(OnTreeListControlFocusedRowChanged);
         TypeDescriptor.GetProperties(typeof(GridControl))[GridControl.FilterCriteriaProperty.Name].RemoveValueChanged(treeListControl, OnTreeListControlFilterCriteriaChanged);
     }
     this.treeListControl = treeListControl;
     if (treeListControl == null)
     {
         return;
     }
     treeListControl.AutoPopulateColumns = AutoPopulateColumns;
     if (CollectionView == null)
     {
         return;
     }
     treeListControl.ItemsSource = CollectionView.SourceCollection;
     treeListControl.BeginInit();
     try {
         treeListControl.View.CustomNodeFilter      += new TreeListNodeFilterEventHandler(OnTreeListCustomNodeFilter);
         treeListControl.SortInfo.CollectionChanged += new NotifyCollectionChangedEventHandler(OnSortInfoCollectionChanged);
         treeListControl.View.FocusedRowChanged     += new FocusedRowChangedEventHandler(OnTreeListControlFocusedRowChanged);
         TypeDescriptor.GetProperties(typeof(GridControl))[GridControl.FilterCriteriaProperty.Name].AddValueChanged(treeListControl, OnTreeListControlFilterCriteriaChanged);
         SyncSorting();
         SyncFocusedRowHandle();
         SyncFilter();
         treeListControl.View.AllowSorting = collectionView.CanSort;
     }
     finally {
         treeListControl.EndInit();
     }
 }
Beispiel #5
0
        /// <summary>
        /// Sets the <see cref="TargetItem"/> to the row that the mouse is over.
        /// </summary>
        /// <param name="treeListControl">
        /// The <see cref="TreeListControl"/> that the mouse is moving over
        /// </param>
        private void SetTargetItem(TreeListControl treeListControl, DragEventArgs e)
        {
            try
            {
                var treeListViewHitInfo = treeListControl.View.CalcHitInfo(this.DropPosition);
                var rowHandle           = treeListViewHitInfo.RowHandle;
                if (treeListViewHitInfo.InNodeExpandButton)
                {
                    treeListControl.View.ExpandNode(rowHandle);
                }

                if (treeListViewHitInfo.InRow)
                {
                    var dropPosition = treeListControl.View.GetCellElementByRowHandleAndColumn(rowHandle, treeListViewHitInfo.Column);
                    var row          = treeListControl.GetRow(rowHandle);

                    if (dropPosition != null)
                    {
                        this.targetHeight           = dropPosition.ActualHeight;
                        this.RelativePositionToDrop = e.GetPosition(dropPosition);
                    }

                    this.TargetItem = row;
                }
            }
            catch (NullReferenceException ex)
            {
                Logger.Debug(ex);
                this.TargetItem = null;
            }
        }
Beispiel #6
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            GridCellData    data       = (GridCellData)item;
            TreeListControl grid       = (TreeListControl)data.View.DataControl;
            string          editorType = grid.GetCellValue(data.RowData.RowHandle.Value, "TemplateName") as string;

            return(string.IsNullOrEmpty(editorType) ? null : (DataTemplate)grid.Resources[editorType]);
        }
        static void OnTreeListControlDataModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TreeListControl          treeListControl = (TreeListControl)d;
            TreeListControlDataModel model           = (TreeListControlDataModel)e.NewValue;

            if (model != null)
            {
                model.AttachToTreeListControl(treeListControl);
            }
        }
        static void OnCollectionViewChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TreeListControl treeListControl = (TreeListControl)d;
            ICollectionView view            = (ICollectionView)e.NewValue;

            SetTreeListControlDataModel(treeListControl, new TreeListControlDataModel()
            {
                CollectionView = view
            });
        }
Beispiel #9
0
        public override void AnnihilateNode(TreeListControl treeList)
        {
            treeList.BeginDataUpdate();

            var nodes = TagTreeHelper.FindNode(treeList.View, Id);
            foreach (var node in nodes)
                treeList.View.DeleteNode(node);

            treeList.EndDataUpdate();
        }
 protected override object GetModuleDataContext()
 {
     if (TreeListControl == null)
     {
         TreeListControl = FindTreeList();
         if (TreeListControl != null)
         {
             TreeListControl.ShowBorder = ShowBorder;
         }
     }
     return(TreeListControl);
 }
        public override void AddNodeToTree(TreeListControl treeList)
        {
            treeList.BeginDataUpdate();

            var insts = TagTreeHelper.FindNode(treeList.View, SecondBlockId);
            foreach (var inst in insts)
            {
                inst.IsExpandButtonVisible = DefaultBoolean.True;
                var treeNode = TagTreeHelper.NodeFromItem(this);
                inst.Nodes.Add(treeNode);
            }
            treeList.EndDataUpdate();
        }
Beispiel #12
0
        public override void AddNodeToTree(TreeListControl treeList)
        {
            treeList.BeginDataUpdate();

            var nodes = TagTreeHelper.FindNode(treeList.View, _targetId);
            foreach (var node in nodes)
            {
                node.IsExpandButtonVisible = DefaultBoolean.True;
                var treeNode = TagTreeHelper.NodeFromItem(this);
                node.Nodes.Add(treeNode);
            }

            treeList.EndDataUpdate();
        }
Beispiel #13
0
        public SearchPanel()
        {
            InitializeComponent();
            txtSearch.KeyUp += txtSearch_KeyUp;
            Text             = "Search".Localize();

            list              = new Sce.Atf.Controls.TreeListControl();
            list.ShowRoot     = false;
            view              = new TreeView();
            list.Dock         = DockStyle.Fill;
            list.ItemRenderer = new TreeListItemRenderer(view);
            list.Columns.Add(new TreeListView.Column("Detail", 80));
            splitter.Panel2.Controls.Add(list);
        }
Beispiel #14
0
        public override void AddNodeToTree(TreeListControl treeList)
        {
            treeList.BeginDataUpdate();
            var myTags = _db.MaterialManager.GetMaterialById(Id).Tags.ToList();

            if (myTags.Count > 0)
                foreach (var myTag in myTags)
                {
                    var nodes = TagTreeHelper.FindNode(treeList.View, myTag.Id);
                    foreach (var node in nodes)
                    {
                        if (IsContainsIn(node.Nodes)) continue;
                        node.IsExpandButtonVisible = DefaultBoolean.True;
                        var treeNode = TagTreeHelper.NodeFromItem(this);
                        node.Nodes.Add(treeNode);
                    }
                }

            treeList.EndDataUpdate();
        }
Beispiel #15
0
        /// <summary>
        /// Sets the <see cref="TargetItem"/> to the row that the mouse is over.
        /// </summary>
        /// <param name="treeListControl">
        /// The <see cref="TreeListControl"/> that the mouse is moving over
        /// </param>
        private void SetTargetItem(TreeListControl treeListControl)
        {
            try
            {
                var treeListViewHitInfo = treeListControl.View.CalcHitInfo(this.DropPosition);
                var rowHandle           = treeListViewHitInfo.RowHandle;
                if (treeListViewHitInfo.InNodeExpandButton)
                {
                    treeListControl.View.ExpandNode(rowHandle);
                }

                if (treeListViewHitInfo.InRow)
                {
                    var row = treeListControl.GetRow(rowHandle);
                    this.TargetItem = row;
                }
            }
            catch (NullReferenceException ex)
            {
                Logger.Debug(ex);
                this.TargetItem = null;
            }
        }
Beispiel #16
0
        public override void AddNodeToTree(TreeListControl treeList)
        {
            treeList.BeginDataUpdate();
            var myTags = _db.IdeaManager.GetIdeaById(Id).Tags.ToList();

            if (myTags.Count > 0)
                foreach (var myTag in myTags)
                {
                    var nodes = TagTreeHelper.FindNode(treeList.View, myTag.Id);
                    foreach (var node in nodes)
                    {
                        node.IsExpandButtonVisible = DefaultBoolean.True;
                        var treeNode = TagTreeHelper.NodeFromItem(this);
                        node.Nodes.Add(treeNode);
                    }
                }
            else
            {
                var treeNode = TagTreeHelper.NodeFromItem(this);
                treeList.View.Nodes.Add(treeNode); //add to root
            }

            treeList.EndDataUpdate();
        }
 public static void SetTreeListControlDataModel(TreeListControl treeListControl, TreeListControlDataModel value)
 {
     treeListControl.SetValue(TreeListControlDataModelProperty, value);
 }
Beispiel #18
0
 void ShowExamplesInTreeList(TreeListControl treeList1, List <CodeExampleGroup> examples)
 {
     treeList1.ItemsSource = examples;
 }
Beispiel #19
0
 /// <summary>
 /// The add tree list control.
 /// </summary>
 /// <param name="treeListControl">
 /// The tree list control.
 /// </param>
 public void AddTreeListControl(TreeListControl treeListControl)
 {
     treeListControl.FilterString = DeprecatedFilterString;
     this.OpenTreeListControls[treeListControl.Name] = treeListControl;
 }
Beispiel #20
0
 public abstract void AddNodeToTree(TreeListControl treeList);
 public static ICollectionView GetCollectionView(TreeListControl treeList)
 {
     return((ICollectionView)treeList.GetValue(CollectionViewProperty));
 }
Beispiel #22
0
 public abstract void AnnihilateNode(TreeListControl treeList);
Beispiel #23
0
 public TreeListItem(TreeListControl parentControl, TreeListItem parent)
 {
     ParentControl = parentControl;
     Parent        = parent;
 }
Beispiel #24
0
 public override void AnnihilateNode(TreeListControl treeList)
 {
     throw new NotImplementedException();
 }
Beispiel #25
0
        public void UpdateMaterialInTree(TreeListControl treeList)
        {
            treeList.BeginDataUpdate();
            var me = _db.MaterialManager.GetMaterialById(Id);

            var nodes = TagTreeHelper.FindNode(treeList.View, Id);
            foreach (var node in nodes)
            {
                node.IsExpandButtonVisible = DefaultBoolean.False;
                var toDel = node.Nodes.ToList();
                foreach (var td in toDel)
                    treeList.View.DeleteNode(td);

                var children = GetChildren().ToList();
                if (children.Any())
                {
                    foreach (var child in children)
                        node.Nodes.Add(TagTreeHelper.NodeFromItem(child));
                    node.IsExpandButtonVisible = DefaultBoolean.True;
                }
            }

            treeList.EndDataUpdate();
        }
Beispiel #26
0
 private void AddToInstances(TreeListControl treeList, Guid id)
 {
     var instances = TagTreeHelper.FindNode(treeList.View, id);
     foreach (var t in instances)
     {
         t.IsExpandButtonVisible = DefaultBoolean.True;
         var treeNode = TagTreeHelper.NodeFromItem(this);
         t.Nodes.Add(treeNode);
     }
 }
 public static bool GetIsSynchronizedWithCurrentItem(TreeListControl treeList)
 {
     return((bool)treeList.GetValue(IsSynchronizedWithCurrentItemProperty));
 }
        public void SetUp()
        {
            RxApp.MainThreadScheduler = Scheduler.CurrentThread;
            this.serviceLocator       = new Mock <IServiceLocator>();

            var treeList = new TreeListControl {
                View = new TreeListView()
            };

            this.dataViewBase      = treeList.View;
            this.dataViewBase.Name = "DataViewBase";

            this.dialogNavigationService = new Mock <IDialogNavigationService>();
            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);
            this.serviceLocator.Setup(x => x.GetInstance <IDialogNavigationService>()).Returns(this.dialogNavigationService.Object);

            this.savedUserPreferenceService = new Mock <ISavedUserPreferenceService>();
            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);
            this.serviceLocator.Setup(x => x.GetInstance <ISavedUserPreferenceService>()).Returns(this.savedUserPreferenceService.Object);

            this.session = new Mock <ISession>();

            this.category1 = new Category(Guid.NewGuid(), null, null)
            {
                Name = CategoryName1
            };

            this.category2 = new Category(Guid.NewGuid(), null, null)
            {
                Name = CategoryName2
            };

            this.parentRow = new CategoryTestRowViewModel(this.category1, this.session.Object, null);
            this.childRow  = new CategoryTestRowViewModel(this.category2, this.session.Object, this.parentRow);

            this.parentRow.ContainedRows.Add(this.childRow);

            this.filterEditorQueryOperatorsEventArgs =
                this.CreateInstance <FilterEditorQueryOperatorsEventArgs>(CriteriaOperator.And(), nameof(CategoryTestRowViewModel.Category));

            var filterEditorOperatorItem = new List <FilterEditorOperatorItem>
            {
                new FilterEditorOperatorItem(FilterEditorOperatorType.AboveAverage),
                new FilterEditorOperatorItem(FilterEditorOperatorType.Equal),
                new FilterEditorOperatorItem(FilterEditorOperatorType.Greater),
                new FilterEditorOperatorItem(FilterEditorOperatorType.AnyOf)
            };

            this.filterEditorOperatorItemList = this.CreateInstance <FilterEditorOperatorItemList>(filterEditorOperatorItem);
            this.filterEditorQueryOperatorsEventArgs.Operators = this.filterEditorOperatorItemList;

            this.customFilterOperatorsViewModel = new Mock <IHaveCustomFilterOperators>();

            var customFilterOperators = new Dictionary <DataViewBase, Dictionary <string, (CustomFilterOperatorType, IEnumerable <IRowViewModelBase <Thing> >)> >();
            var browserDictionary     = new Dictionary <string, (CustomFilterOperatorType, IEnumerable <IRowViewModelBase <Thing> >)>();

            browserDictionary.Add(nameof(CategoryTestRowViewModel.Category), (CustomFilterOperatorType.Category, new [] { this.parentRow }));

            customFilterOperators.Add(this.dataViewBase, browserDictionary);

            this.customFilterOperatorsViewModel.Setup(x => x.CustomFilterOperators).Returns(customFilterOperators);

            this.dataViewBase.DataContext = this.customFilterOperatorsViewModel.Object;
        }
 public static void SetIsSynchronizedWithCurrentItem(TreeListControl treeList, bool value)
 {
     treeList.SetValue(IsSynchronizedWithCurrentItemProperty, value);
 }
 public TagTreeHelper(TreeListControl treeListControl, AllDb db)
 {
     _treeListControl = treeListControl;
     _db = db;
 }
Beispiel #31
0
 public override void AddNodeToTree(TreeListControl treeList)
 {
 }
 public static TreeListControlDataModel GetTreeListControlDataModel(TreeListControl treeList)
 {
     return((TreeListControlDataModel)treeList.GetValue(TreeListControlDataModelProperty));
 }
Beispiel #33
0
 public override void AnnihilateNode(TreeListControl treeList)
 {
 }
Beispiel #34
0
 public ProductStructureViewer(TreeListControl uiViewer)
 {
     mProductUIViewer = uiViewer;
 }
 public static void SetCollectionView(TreeListControl treeList, ICollectionView value)
 {
     treeList.SetValue(CollectionViewProperty, value);
 }