Esempio n. 1
0
        private void tree_GetChildrenData(DeluxeTreeNode parentNode, DeluxeTreeNodeCollection result, string callBackContext)
        {
            ServiceBrokerContext.Current.SaveContextStates();
            try
            {
                InnerTreeContext context = JSONSerializerExecute.Deserialize <InnerTreeContext>(callBackContext);

                if (context.ShowDeletedObjects)
                {
                    ServiceBrokerContext.Current.UseLocalCache       = false;
                    ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.All;
                }
                else
                {
                    ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.Common;
                }

                OguObjectCollection <IOguObject> parents = UserOUControlSettings.GetConfig().UserOUControlQuery.GetObjects(((IOguObject)parentNode.ExtendedData).ID);
                //; OguMechanismFactory.GetMechanism().GetObjects<IOguObject>(
                //    SearchOUIDType.Guid, ((IOguObject)parentNode.ExtendedData).ID);

                BindChildren(result, OnGetChildren(parents[0]), context.MultiSelect, context.ListMask, context.SelectMask);
            }
            finally
            {
                ServiceBrokerContext.Current.RestoreSavedStates();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// unindent the node
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _unindentButton_Click(object sender, EventArgs e)
        {
            TreeNode       node  = this._treeView.SelectedNode;
            DeluxeTreeNode oItem = (DeluxeTreeNode)_treeView.SelectedNode.Tag;

            if (node != null)
            {
                TreeNode       node2  = node.Parent;
                DeluxeTreeNode oItem2 = oItem.Parent;
                if (node2 != null)
                {
                    TreeNodeCollection       collection1     = this._treeView.Nodes;
                    DeluxeTreeNodeCollection oItemCollection = _navBar.Nodes;
                    if (node2.Parent != null)
                    {
                        collection1     = node2.Parent.Nodes;
                        oItemCollection = oItem2.Parent.Nodes;
                    }
                    if (node2 != null)
                    {
                        node.Remove();
                        RemoveTreeItem(oItem);
                        collection1.Insert(node2.Index + 1, node);
                        oItemCollection.AddAt(oItemCollection.IndexOf(oItem2) + 1, oItem);
                        this._treeView.SelectedNode = node;
                    }
                }
            }
        }
Esempio n. 3
0
        private void PreloadTreeNodesImages(DeluxeTreeNodeCollection treeNodes)
        {
            foreach (DeluxeTreeNode node in treeNodes)
            {
                this.PreloadImage(node.NodeOpenImg, node.NodeOpenImg);
                this.PreloadImage(node.NodeCloseImg, node.NodeCloseImg);

                this.PreloadTreeNodesImages(node.Nodes);
            }
        }
Esempio n. 4
0
        public DeluxeTreeNodeCollection GetChildren(DeluxeTreeNode paretnNode, string callBackContext)
        {
            DeluxeTreeNodeCollection result = new DeluxeTreeNodeCollection(paretnNode);

            if (GetChildrenData != null)
            {
                GetChildrenData(paretnNode, result, callBackContext);
            }

            return(result);
        }
		protected void tree_GetChildrenData(DeluxeTreeNode parentNode, DeluxeTreeNodeCollection result, string callBackContext)
		{
			if (parentNode.Text == "加载子节点会出现异常")
				throw new System.ApplicationException("加载子节点出现异常");
			else
				if (parentNode.Text == "很多子节点,小心打开!")
					CreateSubTreeNodes(result, 300);
				else
				{
					Thread.Sleep(1000);
					Random rnd = new Random();
					CreateSubTreeNodes(result, rnd.Next(5));
				}
		}
Esempio n. 6
0
        public DeluxeTreeItemsEditorForm(DeluxeTree oMenu)
        {
            InitializeComponent();

            this._firstActivate = true;
            _navBar             = oMenu;
            Items            = oMenu.Nodes;
            _serviceProvider = oMenu.Site;
            // add pre-existing nodes
            foreach (MCS.Web.Responsive.WebControls.DeluxeTreeNode oRoot in Items)
            {
                TreeNode oRootNode = new TreeNode(oRoot.Text);
                LoadNodes(oRoot, oRootNode);
                _treeView.Nodes.Add(oRootNode);
            }
            this.propertyGrid1.Site = new FormPropertyGridSite(_serviceProvider, this.propertyGrid1);
            _treeView.HideSelection = false;
        }
		private static void CreateSubTreeNodes(DeluxeTreeNodeCollection parent, int subNodesCount)
		{
			for (int i = 0; i < subNodesCount; i++)
			{
				string text = "动态子节点" + i;
				DeluxeTreeNode node = new DeluxeTreeNode(text, text);

				node.ExtendedData = new ExtendedData();
				node.ShowCheckBox = true;

				if (i != 1)
					node.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.LazyLoading;

				parent.Add(node);

				if (i == 1)
				{
					DeluxeTreeNode subNode = new DeluxeTreeNode("固定孙节点", text);
					node.Nodes.Add(subNode);
				}
			}
		}
Esempio n. 8
0
        private void BindChildren(DeluxeTreeNodeCollection nodes, IEnumerable <IOguObject> objects, bool multiSelect, UserControlObjectMask listMask, UserControlObjectMask selectMask)
        {
            OguDataCollection <IOguObject> wrappedObjects = CreateWrappedObjects(objects);

            foreach (IOguObject obj in wrappedObjects)
            {
                DeluxeTreeNode treeNode = new DeluxeTreeNode();
                bool           cancel   = false;

                BindOguObjToTreeNode(obj, treeNode, multiSelect, selectMask);

                FilterObjectToTreeNode(obj, treeNode, listMask, ref cancel);

                if (cancel == false)
                {
                    if (LoadingObjectToTreeNode != null)
                    {
                        LoadingObjectToTreeNode(this, obj, treeNode, ref cancel);
                    }
                }

                if (this.selectedOuUserData.FindSingleObjectByFullPath(obj.FullPath) != null)
                {
                    treeNode.Checked = true;
                }

                if (cancel == false)
                {
                    nodes.Add(treeNode);
                }
            }

            if (ObjectsLoaded != null)
            {
                ObjectsLoaded(this, wrappedObjects);
            }
        }
 public DeluxeTreeItemsEditorForm(DeluxeTree oMenu)
 {
     InitializeComponent();
   
     this._firstActivate = true;
     _navBar = oMenu;
     Items = oMenu.Nodes;
     _serviceProvider = oMenu.Site;
     // add pre-existing nodes
     foreach (MCS.Web.Responsive.WebControls.DeluxeTreeNode oRoot in Items)
     {
         TreeNode oRootNode = new TreeNode(oRoot.Text);
         LoadNodes(oRoot, oRootNode);
         _treeView.Nodes.Add(oRootNode);
     }
     this.propertyGrid1.Site = new FormPropertyGridSite(_serviceProvider, this.propertyGrid1);
     _treeView.HideSelection = false;
 }
Esempio n. 10
0
        private void PreloadTreeNodesImages(DeluxeTreeNodeCollection treeNodes)
        {
            foreach (DeluxeTreeNode node in treeNodes)
            {
                this.PreloadImage(node.NodeOpenImg, node.NodeOpenImg);
                this.PreloadImage(node.NodeCloseImg, node.NodeCloseImg);

                this.PreloadTreeNodesImages(node.Nodes);
            }
        }
Esempio n. 11
0
        public DeluxeTreeNodeCollection GetChildren(DeluxeTreeNode paretnNode, string callBackContext)
        {
            DeluxeTreeNodeCollection result = new DeluxeTreeNodeCollection(paretnNode);

            if (GetChildrenData != null)
                GetChildrenData(paretnNode, result, callBackContext);

            return result;
        }
		private void BindChildren(DeluxeTreeNodeCollection nodes, IEnumerable<IOguObject> objects, bool multiSelect, UserControlObjectMask listMask, UserControlObjectMask selectMask)
		{
			OguDataCollection<IOguObject> wrappedObjects = CreateWrappedObjects(objects);

			foreach (IOguObject obj in wrappedObjects)
			{
				DeluxeTreeNode treeNode = new DeluxeTreeNode();
				bool cancel = false;

				BindOguObjToTreeNode(obj, treeNode, multiSelect, selectMask);

				FilterObjectToTreeNode(obj, treeNode, listMask, ref cancel);

				if (cancel == false)
				{
					if (LoadingObjectToTreeNode != null)
						LoadingObjectToTreeNode(this, obj, treeNode, ref cancel);
				}

				if (this.selectedOuUserData.FindSingleObjectByFullPath(obj.FullPath) != null)
					treeNode.Checked = true;

				if (cancel == false)
					nodes.Add(treeNode);
			}

			if (ObjectsLoaded != null)
				ObjectsLoaded(this, wrappedObjects);
		}
		private void tree_GetChildrenData(DeluxeTreeNode parentNode, DeluxeTreeNodeCollection result, string callBackContext)
		{
			ServiceBrokerContext.Current.SaveContextStates();
			try
			{
				InnerTreeContext context = JSONSerializerExecute.Deserialize<InnerTreeContext>(callBackContext);

				if (context.ShowDeletedObjects)
				{
					ServiceBrokerContext.Current.UseLocalCache = false;
					ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.All;
				}
				else
					ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.Common;

				OguObjectCollection<IOguObject> parents = UserOUControlSettings.GetConfig().UserOUControlQuery.GetObjects(((IOguObject)parentNode.ExtendedData).ID);
				//; OguMechanismFactory.GetMechanism().GetObjects<IOguObject>(
				//    SearchOUIDType.Guid, ((IOguObject)parentNode.ExtendedData).ID);

				BindChildren(result, OnGetChildren(parents[0]), context.MultiSelect, context.ListMask, context.SelectMask);
			}
			finally
			{
				ServiceBrokerContext.Current.RestoreSavedStates();
			}
		}