예제 #1
0
        protected virtual void OnNodeSelect(ListExplorerNode node)
        {
            Text = node.ToString();
            Selection.Current = node;
            toolTree.Field.DropDown.Hide();
            toolTree.DataValue = node;

            node.Apply(Editor);

            if (!node.Check)
            {
                OnNodeCheck(node);
            }
        }
예제 #2
0
        private void InitializeTree()
        {
            Tree.Nodes.Clear();
            Tree.Tag = DataSource;
            if (DataSource == null)
            {
                Editor.DataSource = null;
                return;
            }

            var node = new ListExplorerNode()
            {
                Text       = Locale.Get(DataSource.GetType().FullName, DataSource.GetType().Name),
                DataSource = DataSource
            };

            Tree.Nodes.Add(node);
            Tree.SelectedNode = node;
        }
예제 #3
0
        protected virtual void OnEditorItemSelect(object sender, ListEditorEventArgs e)
        {
            if (Current != null)
            {
                e.Cancel = true;

                foreach (ListExplorerNode node in Tree.SelectedNode.Nodes)
                {
                    if (node.DataSource == e.Item)
                    {
                        Current = node;
                        return;
                    }
                }
                var newNode = new ListExplorerNode(e.Item.ToString())
                {
                    Text       = e.Item.ToString(),
                    DataSource = e.Item,
                    Group      = Current
                };
                Current = newNode;
            }
        }
예제 #4
0
        protected virtual void OnNodeCheck(ListExplorerNode node)
        {
            if (node.DataSource == null)
            {
                return;
            }

            foreach (var property in node.DataSource.GetType().GetProperties())
            {
                if (TypeHelper.GetBrowsable(property) && TypeHelper.IsList(property.PropertyType) && !TypeHelper.IsIndex(property))
                {
                    Node propertyNode = InitNode(property, EmitInvoker.GetValue(property, node.DataSource));
                    if (propertyNode != null)
                    {
                        propertyNode.Group = node;
                    }
                    else
                    {
                        Tree.Nodes.Add(propertyNode);
                    }
                }
            }
            node.Check = true;
        }