Exemplo n.º 1
0
        public override void Refresh()
        {
            try
            {
                if ((this.TreeView != null) && (this.TreeView.InvokeRequired))
                {
                    this.TreeView.Invoke(new EmptyDelegate(this.Refresh));
                    return;
                }

                var tableComponent = ((TableComponent)this.Object);

                this.Text = tableComponent.ToString();
                this.Name = tableComponent.Key;

                this.SelectedImageIndex = this.ImageIndex;

                if ((tableComponent.Columns != null) && (mColumnCollectionNode == null))
                {
                    var element = new ColumnCollectionController(tableComponent.Columns);
                    mColumnCollectionNode = element.Node;
                    this.Nodes.Add(element.Node);
                }
                else
                {
                    mColumnCollectionNode.Refresh();
                }

                //Update the TableCollection list
                if (this.Parent != null)
                {
                    ((TableComponentCollectionNode)this.Parent).Refresh();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public override void Refresh()
        {
            try
            {
                if ((this.TreeView != null) && (this.TreeView.InvokeRequired))
                {
                    this.TreeView.Invoke(new EmptyDelegate(this.Refresh));
                    return;
                }

                var table = ((Table)this.Object);

                this.Text = table.ToString();
                this.Name = table.Key;
                if (!table.Generated)
                {
                    this.ImageIndex = ImageHelper.GetImageIndex(TreeIconConstants.TableNonGen);
                }
                else if (table.AssociativeTable)
                {
                    this.ImageIndex = ImageHelper.GetImageIndex(TreeIconConstants.TableAssociative);
                }
                else if (table.IsTypeTable)
                {
                    this.ImageIndex = ImageHelper.GetImageIndex(TreeIconConstants.TableType);
                }
                else if (table.ParentTable != null)
                {
                    this.ImageIndex = ImageHelper.GetImageIndex(TreeIconConstants.TableDerived);
                }
                else
                {
                    this.ImageIndex = ImageHelper.GetImageIndex(TreeIconConstants.Table);
                }

                this.SelectedImageIndex = this.ImageIndex;
                this.ToolTipText        = table.Description;

                //Columns
                if ((table.Columns != null) && (_columnCollectionNode == null))
                {
                    var element = new ColumnCollectionController(table.Columns);
                    _columnCollectionNode = element.Node;
                    this.Nodes.Add(element.Node);
                }
                else
                {
                    _columnCollectionNode.Refresh();
                }

                //Retrieve rules
                if ((table.CustomRetrieveRules != null) && (_customRetrieveRulesNode == null))
                {
                    var element = new CustomRetrieveRuleCollectionController(table.CustomRetrieveRules);
                    _customRetrieveRulesNode = element.Node;
                    this.Nodes.Add(element.Node);
                }
                else
                {
                    _customRetrieveRulesNode.Refresh();
                }

                //Composites
                //if (table.CompositeList != null)
                //{
                //  TableCompositeCollectionController element = null;
                //  if (mCompositeCollectionNode == null)
                //  {
                //    element = new TableCompositeCollectionController(((Table)_object).CompositeList);
                //    mCompositeCollectionNode = element.Node;
                //    this.Nodes.Add(element.Node);
                //  }
                //  else
                //  {
                //    element = (TableCompositeCollectionController)mCompositeCollectionNode.Controller;
                //  }
                //  mCompositeCollectionNode.Nodes.Clear();
                //  element.Node.Refresh();
                //}

                //Components
                if (table.ComponentList != null)
                {
                    TableComponentCollectionController element = null;
                    if (_componentCollectionNode == null)
                    {
                        element = new TableComponentCollectionController(((Table)_object).ComponentList);
                        _componentCollectionNode = element.Node;
                        this.Nodes.Add(element.Node);
                    }
                    else
                    {
                        element = (TableComponentCollectionController)_componentCollectionNode.Controller;
                    }
                    _componentCollectionNode.Nodes.Clear();
                    element.Node.Refresh();
                }

                ////Relations
                //if (table.Relationships != null)
                //{
                //  RelationCollectionController element = null;
                //  if (_relationshipCollectionNode == null)
                //  {
                //    element = new RelationCollectionController(((Table)_object).Relationships);
                //    _relationshipCollectionNode = element.Node;
                //    this.Nodes.Add(element.Node);
                //  }
                //  else
                //  {
                //    element = (RelationCollectionController)_relationshipCollectionNode.Controller;
                //  }
                //  _relationshipCollectionNode.Nodes.Clear();
                //  element.Node.Refresh();
                //}

                //Update the TableCollection list
                if (this.Parent != null)
                {
                    ((TableCollectionNode)this.Parent).Refresh();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }