private void ApplyAllNodes(DbTreeNodeUI item, Action <DbTreeNodeUI> action) { if (item == null) { return; } action(item); foreach (DbTreeNodeUI theItem in item.Items) { ApplyAllNodes(theItem, action); } }
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); } }
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); } }
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); } }
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)); } }