예제 #1
0
파일: DbTreeUI.cs 프로젝트: fjiang2/sqlcon
        private void ApplyAllNodes(DbTreeNodeUI item, Action <DbTreeNodeUI> action)
        {
            if (item == null)
            {
                return;
            }

            action(item);
            foreach (DbTreeNodeUI theItem in item.Items)
            {
                ApplyAllNodes(theItem, action);
            }
        }
예제 #2
0
        public void ExpandNode()
        {
            DbTreeNodeUI theItem = this;
            DatabaseName dname   = theItem.Path as DatabaseName;

            if (theItem.Items.Count > 0)
            {
                return;
            }

            foreach (TableName tname in dname.GetTableNames())
            {
                DbTreeNodeUI item = new DbTableNodeUI(tree, tname);
                theItem.Items.Add(item);
            }
        }
예제 #3
0
        public void ExpandNode()
        {
            DbTreeNodeUI theItem = this;
            TableName    tname   = theItem.Path as TableName;

            if (theItem.Items.Count > 0)
            {
                return;
            }

            TableSchema schema = new TableSchema(tname);

            foreach (ColumnSchema column in schema.Columns)
            {
                DbTreeNodeUI item = new DbColumnNodeUI(tree, column);
                theItem.Items.Add(item);
            }
        }
예제 #4
0
        public void ExpandNode()
        {
            DbTreeNodeUI theItem = this;
            ServerName   sname   = theItem.Path as ServerName;

            if (theItem.Items.Count > 0)
            {
                return;
            }

            if (sname.Disconnected)
            {
                theItem.ChangeImage("server_error.png");
                return;
            }

            foreach (DatabaseName dname in sname.GetDatabaseNames().OrderBy(d => d.Name))
            {
                DbTreeNodeUI item = new DbDatabaseNodeUI(tree, dname);
                theItem.Items.Add(item);
            }
        }
예제 #5
0
파일: DbTreeUI.cs 프로젝트: fjiang2/sqlcon
        private bool SetVisibility(DbTreeNodeUI item, string wildcard)
        {
            bool matched = item.IsMatch(wildcard);

            //leave node
            if (item.Items.Count == 0)
            {
                return(SetVisibility(item, matched));
            }

            //current node is matched
            if (matched)
            {
                foreach (DbTreeNodeUI theItem in item.Items)
                {
                    SetVisibility(theItem, wildcard);
                }

                //must be visible
                return(SetVisibility(item, true));
            }
            else
            {
                bool found = false;
                foreach (DbTreeNodeUI theItem in item.Items)
                {
                    if (SetVisibility(theItem, wildcard))
                    {
                        if (!found)
                        {
                            found = true;
                        }
                    }
                }

                //be visible if any child node is visible
                return(SetVisibility(item, found));
            }
        }