Exemple #1
0
        protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue)
        {
            switch (propertyName)
            {
            case Properties.DETAILROWSEXPRESSION:
            case Properties.EXPRESSION:
                NeedsValidation = true;
                FormulaFixup.BuildDependencyTree(this);
                break;

            case Properties.KPI:
                Handler.Tree.OnStructureChanged(this);
                break;

            case Properties.NAME:
                if (Handler.Settings.AutoFixup)
                {
                    // Fixup is not performed during an undo operation. We rely on the undo stack to fixup the expressions
                    // affected by the name change (the undo stack should contain the expression changes that were made
                    // when the name was initially changed).
                    if (!Handler.UndoManager.UndoInProgress)
                    {
                        FormulaFixup.DoFixup(this, true);
                    }
                    FormulaFixup.BuildDependencyTree();
                    Handler.EndUpdate();     // This batch was started in OnPropertyChanging
                }
                break;
            }

            base.OnPropertyChanged(propertyName, oldValue, newValue);
        }
Exemple #2
0
        protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue)
        {
            if (propertyName == Properties.NAME)
            {
                if (Handler.Settings.AutoFixup)
                {
                    FormulaFixup.DoFixup(this);
                    Handler.UndoManager.EndBatch();
                }
                Handler.Tree.FolderCache.Clear(); // Clear folder cache when a table is renamed.

                // Update relationship "names" if this table participates in any relationships:
                var rels = UsedInRelationships.ToList();
                if (rels.Count > 1)
                {
                    Handler.Tree.BeginUpdate();
                }
                rels.ForEach(r => r.UpdateName());
                if (rels.Count > 1)
                {
                    Handler.Tree.EndUpdate();
                }
            }
            if (propertyName == Properties.DEFAULTDETAILROWSEXPRESSION)
            {
                FormulaFixup.BuildDependencyTree(this);
            }

            base.OnPropertyChanged(propertyName, oldValue, newValue);
        }
Exemple #3
0
        protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue)
        {
            switch (propertyName)
            {
            case Properties.DETAILROWSEXPRESSION:
            case Properties.EXPRESSION:
                NeedsValidation = true;
                FormulaFixup.BuildDependencyTree(this);
                break;

            case Properties.KPI:
                Handler.Tree.OnStructureChanged(this);
                break;

            case Properties.NAME:
                if (Handler.Settings.AutoFixup)
                {
                    FormulaFixup.DoFixup(this);
                    Handler.UndoManager.EndBatch();     // This batch was started in OnPropertyChanging
                }
                break;
            }

            base.OnPropertyChanged(propertyName, oldValue, newValue);
        }
Exemple #4
0
        protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue)
        {
            // Make sure only one column has the IsKey property set:
            if (propertyName == Properties.ISKEY && IsKey == true)
            {
                foreach (var c in Table.MetadataObject.Columns.Where(c => c.Type != TOM.ColumnType.RowNumber && c != this.MetadataObject))
                {
                    c.IsKey = false;
                }
            }

            // Make sure that Calculated Table Columns that originate from this column are updated to reflect name changes:
            if (propertyName == Properties.NAME)
            {
                // Fixup is not performed during an undo operation. We rely on the undo stack to fixup the expressions
                // affected by the name change (the undo stack should contain the expression changes that were made
                // when the name was initially changed).
                if (Handler.Settings.AutoFixup && !Handler.UndoManager.UndoInProgress)
                {
                    FormulaFixup.DoFixup(this, true);
                }
                FormulaFixup.BuildDependencyTree();
                foreach (var ctc in _originForCalculatedTableColumnsCache)
                {
                    if (ctc.IsNameInferred)
                    {
                        ctc.Name           = Name;
                        ctc.IsNameInferred = true;
                    }
                    // This will inform the TOM what the origin of the new column is:
                    ctc.SourceColumn = ctc.SourceColumn.Replace($"[{oldValue}]", $"[{newValue}]");
                }

                // End the batch that was started in OnPropertyChanging:
                if (Handler.Settings.AutoFixup || _originForCalculatedTableColumnsCache.Count > 0)
                {
                    Handler.EndUpdate();
                }

                // Update relationship "names" if this column participates in any relationships:
                var rels = UsedInRelationships.ToList();
                if (rels.Count > 1)
                {
                    Handler.Tree.BeginUpdate();
                }
                rels.ForEach(r => r.UpdateName());
                if (rels.Count > 1)
                {
                    Handler.Tree.EndUpdate();
                }
            }

            base.OnPropertyChanged(propertyName, oldValue, newValue);
        }
Exemple #5
0
        protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue)
        {
            // Make sure only one column has the IsKey property set:
            if (propertyName == Properties.ISKEY && IsKey == true)
            {
                foreach (var c in Table.MetadataObject.Columns.Where(c => c.Type != TOM.ColumnType.RowNumber && c != this.MetadataObject))
                {
                    c.IsKey = false;
                }
            }

            // Make sure that Calculated Table Columns that originate from this column are updated to reflect name changes:
            if (propertyName == Properties.NAME)
            {
                // Do formula fixup if enabled:
                if (Handler.Settings.AutoFixup)
                {
                    FormulaFixup.DoFixup(this);
                }

                foreach (var ctc in _originForCalculatedTableColumnsCache)
                {
                    if (ctc.IsNameInferred)
                    {
                        ctc.Name           = Name;
                        ctc.IsNameInferred = true;
                    }
                    // This will inform the TOM what the origin of the new column is:
                    ctc.SourceColumn = ctc.SourceColumn.Replace($"[{oldValue}]", $"[{newValue}]");
                }

                // End the batch that was started in OnPropertyChanging:
                if (Handler.Settings.AutoFixup || _originForCalculatedTableColumnsCache.Count > 0)
                {
                    Handler.UndoManager.EndBatch();
                }

                // Update relationship "names" if this column participates in any relationships:
                var rels = UsedInRelationships.ToList();
                if (rels.Count > 1)
                {
                    Handler.Tree.BeginUpdate();
                }
                rels.ForEach(r => r.UpdateName());
                if (rels.Count > 1)
                {
                    Handler.Tree.EndUpdate();
                }
            }

            base.OnPropertyChanged(propertyName, oldValue, newValue);
        }
Exemple #6
0
        protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue)
        {
            if (propertyName == Properties.NAME)
            {
                if (Handler.Settings.AutoFixup)
                {
                    FormulaFixup.DoFixup(this);
                    Handler.UndoManager.EndBatch();
                }
                Handler.Tree.FolderCache.Clear(); // Clear folder cache when a table is renamed.
            }
            if (propertyName == Properties.DEFAULTDETAILROWSEXPRESSION)
            {
                FormulaFixup.BuildDependencyTree(this);
            }

            base.OnPropertyChanged(propertyName, oldValue, newValue);
        }
Exemple #7
0
        protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue)
        {
            if (propertyName == Properties.NAME)
            {
                if (Handler.Settings.AutoFixup)
                {
                    // Fixup is not performed during an undo operation. We rely on the undo stack to fixup the expressions
                    // affected by the name change (the undo stack should contain the expression changes that were made
                    // when the name was initially changed).
                    if (!Handler.UndoManager.UndoInProgress)
                    {
                        FormulaFixup.DoFixup(this);
                    }

                    Handler.EndUpdate();
                }
                Handler.Tree.FolderCache.Clear(); // Clear folder cache when a table is renamed.

                // Update relationship "names" if this table participates in any relationships:
                var rels = UsedInRelationships.ToList();
                if (rels.Count > 1)
                {
                    Handler.Tree.BeginUpdate();
                }
                rels.ForEach(r => r.UpdateName());
                if (rels.Count > 1)
                {
                    Handler.Tree.EndUpdate();
                }
            }
            if (propertyName == Properties.DEFAULTDETAILROWSEXPRESSION)
            {
                FormulaFixup.BuildDependencyTree(this);
            }

            base.OnPropertyChanged(propertyName, oldValue, newValue);
        }