Beispiel #1
0
        /// <summary>
        /// new root
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _addRootButton_Click(object sender, EventArgs e)
        {
            MCS.Web.Responsive.WebControls.DeluxeTreeNode oItem = new MCS.Web.Responsive.WebControls.DeluxeTreeNode();
            oItem.Text = "New Root";

            Items.Add(oItem);

            TreeNode oNewTreeNode = new TreeNode("New Root");

            oNewTreeNode.Tag = oItem;
            _treeView.Nodes.Add(oNewTreeNode);

            _treeView.SelectedNode = _treeView.Nodes[_treeView.Nodes.Count - 1];
        }
Beispiel #2
0
        private void InitRootTreeNode()
        {
            IOrganization innerRoot = this.Root;

            ServiceBrokerContext.Current.SaveContextStates();

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

                if (innerRoot == null)
                {
                    var tmpRootPath = this.RootPath;
                    if (string.IsNullOrEmpty(tmpRootPath))
                    {
                        tmpRootPath = OguPermissionSettings.GetConfig().RootOUPath;
                    }
                    innerRoot = UserOUControlSettings.GetConfig().UserOUControlQuery.GetOrganizationByPath(tmpRootPath);                     // OguMechanismFactory.GetMechanism().GetRoot();
                }

                DeluxeTreeNode rootNode = new DeluxeTreeNode();

                BindOguObjToTreeNode((IOrganization)OguBase.CreateWrapperObject(innerRoot), rootNode, MultiSelect, SelectMask);

                rootNodesData.Add(rootNode);

                if (RootExpanded)
                {
                    rootNode.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal;
                    rootNode.Expanded = true;
                    BindChildren(rootNode.Nodes, OnGetChildren(innerRoot), MultiSelect, ListMask, SelectMask);
                }
            }
            finally
            {
                ServiceBrokerContext.Current.RestoreSavedStates();
            }
        }
		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);
				}
			}
		}
Beispiel #4
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);
            }
        }
		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);
		}