Esempio n. 1
0
        public LocateObjectData LocateObject(object obj, ObjectStyle style, int locateOptions)
        {
            LocateObjectData result = default(LocateObjectData);

            if (style == ObjectStyle.TrackingObject)
            {
                RowCol rowCol = (RowCol)obj;
                result.Row     = rowCol.Row;
                result.Column  = rowCol.Col;
                result.Options = 1;
            }
            else
            {
                if (style == ObjectStyle.ExpandedBranch)
                {
                    OperationParameterTree parameterTreeAdapter  = (OperationParameterTree)obj;
                    OperationParameterTree parameterTreeAdapter2 = parameterTreeAdapter.m_Parent;
                    result.Row = -1;
                    for (int i = 0; i < parameterTreeAdapter2.m_Children.Length; i++)
                    {
                        if (parameterTreeAdapter2.m_Children[i] == parameterTreeAdapter)
                        {
                            result.Row = i;
                        }
                    }

                    result.Column  = 0;
                    result.Options = result.Row == m_RelativeRow ? 0 : 1;
                }
            }
            return(result);
        }
            object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
            {
                Debug.Assert(style == ObjectStyle.ExpandedBranch);
                if (style != ObjectStyle.ExpandedBranch)
                {
                    return(null);
                }
                SnippetsType type = myTypes[row];
                int          firstTargetedType  = type.FirstTargetedType;
                int          targetedTypesCount = type.LastTargetedType - firstTargetedType;

                if (targetedTypesCount != 0)
                {
                    TargetedTypeData[] typeData = new TargetedTypeData[targetedTypesCount];
                    for (int i = 0; i < targetedTypesCount; ++i)
                    {
                        typeData[i] = new TargetedTypeData(GetVerbalizationTargetDisplayName(myTargetedTypes[firstTargetedType + i + 1].Target), firstTargetedType + i + 1);
                    }
                    return(new TypeBranchWithExplicitTargets(this, firstTargetedType, typeData));
                }
                else
                {
                    return(new TypeBranch(this, firstTargetedType));
                }
            }
Esempio n. 3
0
                    public LocateObjectData LocateObject(object obj, ObjectStyle style, int locateOptions)
                    {
                        LocateObjectData data = myBaseBranch.LocateObject(obj, style, locateOptions);

                        if (data.Row != VirtualTreeConstant.NullIndex)
                        {
                            data.Row -= myFirstItem;
                        }
                        return(data);
                    }
Esempio n. 4
0
 public override object GetObject(int row, int column, ObjectStyle style, ref int options)
 {
     if (style == ObjectStyle.ExpandedBranch)
     {
         if (RowStyle.Generator == TranslateRow(ref row))
         {
             return(this._branches.Values[row]);
         }
     }
     return(base.GetObject(row, column, style, ref options));
 }
 object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
 {
     if (style == ObjectStyle.ExpandedBranch)
     {
         int baseItemCount = base.VisibleItemCount;
         if (row >= baseItemCount)
         {
             return(new TypeBranch(ParentBranch, myExpansions[row - baseItemCount].TargetedTypeIndex));
         }
     }
     return(null);
 }
 object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
 {
     switch (style)
     {
     case ObjectStyle.TrackingObject:
         if (row < myErrors.Length)
         {
             return(myErrors[row]);
         }
         return(null);
     }
     return(null);
 }
Esempio n. 7
0
        public object /* IBranch */ GetObject(int row, int column, ObjectStyle style, ref int options)
        {
            switch ((int)style)
            {
            case (int)ObjectStyle.ExpandedBranch:
            {
                try
                {
                    // HACK: demand loading can cause re-entrancy when we access this list for the first time.
                    InVirtualTreeEdit = true;

                    Debug.Assert(column == 0);         // Simple-celled columns shouldn't ask for an expansion
                    // Use the override to get the appropriate branch
                    var newBranch = GetExpandedBranch(row);
                    if (newBranch != null)
                    {
                        return(newBranch);
                    }
                }
                finally
                {
                    InVirtualTreeEdit = false;
                }
                break;
            }

            case (int)ObjectStyle.TrackingObject:
                if (row < ElementCount)
                {
                    return(GetElement(row));
                }
                options = (int)TrackingObjectAction.NotTracked;
                break;

            default:
                if (style == BrowsingObject)
                {
                    if (row < ElementCount)
                    {
                        return(GetBrowsingObject(row));
                    }
                    else
                    {
                        return(GetBrowsingCreatorObject());
                    }
                }
                break;
            }
            return(null);
        }
Esempio n. 8
0
 public object GetObject(int row, int column, ObjectStyle style, ref int options)
 {
     if (style == ObjectStyle.TrackingObject)
     {
         return(new RowCol(row, column));
     }
     if (IsExpandable(row, column))
     {
         MemberInfo memberInfo = m_Parameters[row];
         Class      @class     = memberInfo.Member.Definition as Class;
         return(AddChild(row, @class, memberInfo.Value));
     }
     return(null);
 }
Esempio n. 9
0
            object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
            {
                BranchPartitionSection section;

                row = TranslateRow(row, out section);
                if (row == -1)
                {
                    if (style == ObjectStyle.ExpandedBranch)
                    {
                        options = 0;
                        return(new BranchPartition(myInnerBranch, myIndexer, new BranchPartitionSection(section.Start, section.Count)));
                    }
                    return(null);
                }
                return(myInnerBranch.GetObject(row, column, style, ref options));
            }
                LocateObjectData IBranch.LocateObject(object obj, ObjectStyle style, int locateOptions)
                {
                    switch (style)
                    {
                    case ObjectStyle.ExpandedBranch:
                        if (obj is ReferenceModeKindsBranch)
                        {
                            return(new LocateObjectData(0, 0, (int)BranchLocationAction.KeepBranch));
                        }
                        return(new LocateObjectData(0, 0, (int)BranchLocationAction.DiscardBranch));

                    default:
                        Debug.Fail("Shouldn't be here");
                        return(new LocateObjectData());
                    }
                }
Esempio n. 11
0
        LocateObjectData IBranch.LocateObject(object obj, ObjectStyle style, int locateOptions)
        {
            var locateData = new LocateObjectData();

            locateData.Row = -1;
            foreach (IBranch branch in _branchList)
            {
                locateData = branch.LocateObject(obj, style, locateOptions);
                if (locateData.Row != -1)
                {
                    return(locateData);
                }
            }

            return(locateData);
        }
Esempio n. 12
0
        /// <summary>
        ///     IBranch interface implementation.
        /// </summary>
        public LocateObjectData /* IBranch */ LocateObject(object obj, ObjectStyle style, int locateOptions)
        {
            var locateData = new LocateObjectData(-1, 0, 0);

            switch (style)
            {
            case ObjectStyle.ExpandedBranch:
            case ObjectStyle.SubItemExpansion:
                locateData.Options = (int)BranchLocationAction.DiscardBranch;
                break;

            case ObjectStyle.TrackingObject:
                locateData = LocateTrackingObject(obj, locateData);
                break;
            }
            return(locateData);
        }
                object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
                {
                    if (style == ObjectStyle.ExpandedBranch)
                    {
                        switch ((Headers)row)
                        {
                        case Headers.ReferenceModeKinds:
                            return(this.myReferenceModeKindsBranch);

                        case Headers.CustomReferenceModes:
                            return(this.myCustomBranch);

                        case Headers.IntrinsicReferenceModes:
                            return(myIntrinsicBranch);
                        }
                    }
                    return(null);
                }
 object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
 {
     switch (style)
     {
     case ObjectStyle.ExpandedBranch:
     case ObjectStyle.TrackingObject:
         Category[] categories = myCategories;
         if (row < categories.Length)
         {
             if (style == ObjectStyle.ExpandedBranch)
             {
                 return(new ErrorBranch(categories[row], myErrors));
             }
             return(categories[row]);
         }
         break;
     }
     return(null);
 }
Esempio n. 15
0
        /// <summary>
        ///     Derived classes may override to provide custom object location.  The base class
        ///     provides implementation for ExpandedBranch and TrackingObject styles
        /// </summary>
        /// <param name="row"></param>
        /// <param name="column"></param>
        /// <param name="style"></param>
        protected virtual object GetObject(int row, int column, ObjectStyle style)
        {
            switch (style)
            {
            case ObjectStyle.ExpandedBranch:
                Debug.Assert(column == 0);     // Simple-celled columns shouldn't ask for an expansion
                return(_currentBranches[row].Branch);

            case ObjectStyle.TrackingObject:
                return(_currentBranches[row].Id);

            default:
                if (style == TreeGridDesignerBranch.BrowsingObject)
                {
                    goto case ObjectStyle.TrackingObject;
                }
                break;
            }
            return(null);
        }
Esempio n. 16
0
        /// <summary>
        ///     IBranch interface implementation.
        /// </summary>
        public virtual LocateObjectData LocateObject(object obj, ObjectStyle style, int locateOptions)
        {
            var row     = -1;
            var column  = 0;
            var options = 0;

            switch (style)
            {
            case ObjectStyle.ExpandedBranch:
            case ObjectStyle.SubItemExpansion:
                options = (int)BranchLocationAction.DiscardBranch;
                for (var i = 0; i < _currentBranches.Count; i++)
                {
                    if (_currentBranches[i].Branch == obj)
                    {
                        return(new LocateObjectData(i, 0, (int)BranchLocationAction.KeepBranch));
                    }
                }
                break;

            case ObjectStyle.TrackingObject:
                for (var i = 0; i < _currentBranches.Count; i++)
                {
                    if (obj != null &&
                        obj == _currentBranches[i].Id)
                    {
                        return(new LocateObjectData(i, 0, (int)TrackingObjectAction.ThisLevel));
                    }

                    var data = _currentBranches[i].Branch.LocateObject(obj, ObjectStyle.TrackingObject, locateOptions);
                    if (data.Options != (int)TrackingObjectAction.NotTracked)
                    {
                        return(new LocateObjectData(i, 0, (int)TrackingObjectAction.NextLevel));
                    }
                }
                break;
            }
            return(new LocateObjectData(row, column, options));
        }
        /// <summary>
        ///     IBranch interface implementation.
        /// </summary>
        public LocateObjectData /* IBranch */ LocateObject(object obj, ObjectStyle style, int locateOptions)
        {
            var locateData = new LocateObjectData(-1, 0, 0);
            switch (style)
            {
                case ObjectStyle.ExpandedBranch:
                case ObjectStyle.SubItemExpansion:
                    locateData.Options = (int)BranchLocationAction.DiscardBranch;
                    break;

                case ObjectStyle.TrackingObject:
                    locateData = LocateTrackingObject(obj, locateData);
                    break;
            }
            return locateData;
        }
Esempio n. 18
0
				object IDetailHandler.GetDetailObject(PartitionChange change, int detailColumn, ObjectStyle style)
				{
					if (style == ObjectStyle.SubItemRootBranch)
					{
						RolePlayerChangedEventArgs args = (RolePlayerChangedEventArgs)change.ChangeArgs;
						return new RolePlayerChangeDetailBranch(args.DomainRole, args.OldRolePlayerId, args.NewRolePlayerId);
					}
					return null;
				}
Esempio n. 19
0
			object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
			{
				switch (style)
				{
					case ObjectStyle.ExpandedBranch:
						if (column == (int)ColumnContent.ChangeType)
						{
							return RedirectDetailHandler.Instance.GetDetailObject(GetChange(row), -1, style);
						}
						break;
					case ObjectStyle.SubItemExpansion:
					case ObjectStyle.SubItemRootBranch:
						PartitionChange change = GetChange(row);
						switch ((ColumnContent)column)
						{
							case ColumnContent.Class:
								if (style == ObjectStyle.SubItemRootBranch)
								{
									GenericEventArgs genericArgs;
									DomainClassInfo classInfo;
									DomainClassInfo baseClassInfo;
									if (null != (baseClassInfo = RedirectDetailHandler.Instance.GetBaseDomainClassInfo(change)) &&
										null != (genericArgs = change.ChangeArgs as GenericEventArgs) &&
										null != (classInfo = genericArgs.DomainClass))
									{
										return new ClassDetailBranch(baseClassInfo, classInfo);
									}
								}
								break;
							default:
								column -= (int)ColumnContent.Detail1;
								if (RedirectDetailHandler.Instance.GetDetailColumnCount(change) > column &&
									((style == ObjectStyle.SubItemRootBranch) ? SubItemCellStyles.Complex : SubItemCellStyles.Expandable) == RedirectDetailHandler.Instance.GetDetailColumnStyle(change, column))
								{
									return RedirectDetailHandler.Instance.GetDetailObject(change, column, style);
								}
								break;
						}
						break;
				}
				return null;
			}
Esempio n. 20
0
        object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
        {
            var branch = FindBranchForRow(ref row);

            return(branch.GetObject(row, column, style, ref options));
        }
Esempio n. 21
0
 public virtual LocateObjectData LocateObject(object obj, ObjectStyle style, int locateOptions)
 {
     return new LocateObjectData();
 }
Esempio n. 22
0
 private TREENODE ExpandTreeNode(
     TREENODE parentNode, TREENODE startNode, int row, int column, ObjectStyle branchStyle, bool insertNewChild,
     out ExpansionOptions expansionOptions, out int itemIncr, out int subItemIncr)
 {
     bool requireInitialSubItemExpansion;
     subItemIncr = 0;
     var retVal = ExpandTreeNode(
         parentNode,
         startNode,
         row,
         column,
         branchStyle,
         insertNewChild,
         out expansionOptions,
         out itemIncr,
         out requireInitialSubItemExpansion);
     if (retVal != null && requireInitialSubItemExpansion)
     {
         try
         {
             // UNDONE_MC: The full subitem gain will be higher than the immediate
             // gain if the expanded items are also complex
             ExpandInitialComplexSubItems(retVal as TREENODE_Multi, out subItemIncr);
         }
         catch (Exception ex)
         {
             Debug.Assert(false, ex.Message, ex.StackTrace);
             // Swallow this exception. The tree is left in a very bad state
             // if we get this far into an expansion and then throw.
         }
         finally
         {
             // These values may be positive already set if startnode is set,
             // so increment instead of blindly setting to subItemIncr.
             retVal.FullSubItemGain += subItemIncr;
         }
     }
     return retVal;
 }
Esempio n. 23
0
        LocateObjectData IBranch.LocateObject(object obj, ObjectStyle style, int locateOptions)
        {
            var locateData = new LocateObjectData();
            locateData.Row = -1;
            foreach (IBranch branch in _branchList)
            {
                locateData = branch.LocateObject(obj, style, locateOptions);
                if (locateData.Row != -1)
                {
                    return locateData;
                }
            }

            return locateData;
        }
Esempio n. 24
0
				LocateObjectData IBranch.LocateObject(object obj, ObjectStyle style, int locateOptions)
				{
					switch (style)
					{
						case ObjectStyle.ExpandedBranch:
							if (obj is ReferenceModeKindsBranch)
							{
								return new LocateObjectData(0, 0, (int)BranchLocationAction.KeepBranch);
							}
							return new LocateObjectData(0, 0, (int)BranchLocationAction.DiscardBranch);
						default:
							Debug.Fail("Shouldn't be here");
							return new LocateObjectData();
					}
				}
 public object GetObject(int row, int column, ObjectStyle style, ref int options)
 {
     if (style == ObjectStyle.TrackingObject)
     {
         return new RowCol(row, column);
     }
     if (IsExpandable(row, column))
     {
         MemberInfo memberInfo = m_Parameters[row];
         Class @class = memberInfo.Member.Definition as Class;
         return AddChild(row, @class, memberInfo.Value);
     }
     return null;
 }
        public LocateObjectData LocateObject(object obj, ObjectStyle style, int locateOptions)
        {
            LocateObjectData result = default(LocateObjectData);
            if (style == ObjectStyle.TrackingObject)
            {
                RowCol rowCol = (RowCol)obj;
                result.Row = rowCol.Row;
                result.Column = rowCol.Col;
                result.Options = 1;
            }
            else
            {
                if (style == ObjectStyle.ExpandedBranch)
                {
                    OperationParameterTree parameterTreeAdapter = (OperationParameterTree)obj;
                    OperationParameterTree parameterTreeAdapter2 = parameterTreeAdapter.m_Parent;
                    result.Row = -1;
                    for (int i = 0; i < parameterTreeAdapter2.m_Children.Length; i++)
                    {
                        if (parameterTreeAdapter2.m_Children[i] == parameterTreeAdapter)
                        {
                            result.Row = i;
                        }
                    }

                    result.Column = 0;
                    result.Options = result.Row == m_RelativeRow ? 0 : 1;
                }
            }
            return result;
        }
Esempio n. 27
0
			object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
			{
				switch (style)
				{
					case ObjectStyle.ExpandedBranch:
					case ObjectStyle.TrackingObject:
						Category[] categories = myCategories;
						if (row < categories.Length)
						{
							if (style == ObjectStyle.ExpandedBranch)
							{
								return new ErrorBranch(categories[row], myErrors);
							}
							return categories[row];
						}
						break;
				}
				return null;
			}
Esempio n. 28
0
			object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
			{
				switch (style)
				{
					case ObjectStyle.TrackingObject:
						if (row < myErrors.Length)
						{
							return myErrors[row];
						}
						return null;
				}
				return null;
			}
Esempio n. 29
0
				object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
				{
					Debug.Fail("Should override.");
					return null;
				}
Esempio n. 30
0
				object IDetailHandler.GetDetailObject(PartitionChange change, int detailColumn, ObjectStyle style)
				{
					if (style == ObjectStyle.ExpandedBranch && detailColumn == -1)
					{
						return new InitialPropertyExpansionBranch(change.Partition.Store, ((ElementAddedEventArgs)change.ChangeArgs).GetAssignments());
					}
					else if (style == ObjectStyle.SubItemRootBranch)
					{
						ElementAddedEventArgs args = (ElementAddedEventArgs)change.ChangeArgs;
						DomainRelationshipInfo relationshipInfo = (DomainRelationshipInfo)args.DomainClass;
						RoleAssignment[] assignments = change.RoleAssignments;
						RoleAssignment assignment = assignments[0];
						return new RoleAssignmentDetailBranch(change.Partition.Store, relationshipInfo.DomainRoles[detailColumn].Id == assignment.DomainRoleId ? assignment : assignments[1]);
					}
					return null;
				}
Esempio n. 31
0
 /// <summary>
 ///     IBranch interface implementation.
 /// </summary>
 public object GetObject(int row, int column, ObjectStyle style, ref int options)
 {
     return(GetObject(row, column, style));
 }
Esempio n. 32
0
			object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
			{
				return null;
			}
Esempio n. 33
0
 object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
 {
     var branch = FindBranchForRow(ref row);
     return branch.GetObject(row, column, style, ref options);
 }
Esempio n. 34
0
			public override object GetObject(int row, int column, ObjectStyle style, ref int options)
			{
				if (style == ObjectStyle.ExpandedBranch)
				{
					if (RowStyle.Generator == TranslateRow(ref row))
					{
						return this._branches.Values[row];
					}
				}
				return base.GetObject(row, column, style, ref options);
			}
 object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
 {
     Debug.Fail("Should override.");
     return(null);
 }
Esempio n. 36
0
 LocateObjectData IBranch.LocateObject(object obj, ObjectStyle style, int locateOptions)
 {
     Debug.Assert(false);
     // UNDONE: This would require an UntranslateRow to do correctly, not worth it for now
     return(default(LocateObjectData));
 }
Esempio n. 37
0
				object IDetailHandler.GetDetailObject(PartitionChange change, int detailColumn, ObjectStyle style)
				{
					if (style == ObjectStyle.SubItemRootBranch && detailColumn == 1)
					{
						return new ChangeToFromBranch((ElementPropertyChangedEventArgs)change.ChangeArgs);
					}
					return null;
				}
Esempio n. 38
0
        private TREENODE ExpandTreeNode(
            TREENODE parentNode, TREENODE startNode, int row, int column, ObjectStyle branchStyle, bool insertNewChild,
            out ExpansionOptions expansionOptions, out int itemIncr, out bool requireInitialSubItemExpansion)
        {
            TREENODE tnCur;
            TREENODE tn1;
            TREENODE tn2;
            TREENODE newChildNode = null;
            // Don't test expandable while loading a complex column, the request can be ambiguous.
            // Just go ahead and fire off the request. A null return will leave the cell as a simple item.
            Debug.Assert(
                branchStyle == ObjectStyle.SubItemRootBranch || parentNode.Branch.IsExpandable(row, column),
                "GetExpandable should be called before this is attempted");
            IBranch newBranch;
            try
            {
                SetStateFlag(TreeStateFlags.InExpansion, true);
                var options = 0;
                newBranch = parentNode.Branch.GetObject(row, column, branchStyle, ref options) as IBranch;
                expansionOptions = (ExpansionOptions)options;
            }
            finally
            {
                SetStateFlag(TreeStateFlags.InExpansion, false);
            }

            itemIncr = 0;
            requireInitialSubItemExpansion = false;
            newChildNode = null;
            if (newBranch != null)
            {
                itemIncr = newBranch.VisibleItemCount; //ExpansionCount can be 0 on success, don't check
                // UNDONE_MC: Only allow multi-column children if the parent branch does,
                // or if this is the root node of a complex item in the last column of a tree.
                var allowMultiColumn = true;
                tnCur = CreateTreeNode(startNode, newBranch, this, allowMultiColumn, parentNode.InSubItemColumn, parentNode.MultiColumn);
                tnCur.Index = row;
                tnCur.ImmedCount = tnCur.FullCount = itemIncr;
                if (allowMultiColumn
                    && tnCur.MultiColumn
                    && tnCur.ComplexColumns)
                {
                    requireInitialSubItemExpansion = true;
                }
                tnCur.Expanded = true;
                tnCur.AllowRecursion = (expansionOptions & ExpansionOptions.BlockRecursion) == 0;
                tnCur.UpdateDelayed = false;
                tnCur.Parent = parentNode;
                if (tnCur.Dynamic)
                {
                    AddTrackedNode(newBranch, tnCur);
                }
                newChildNode = tnCur;
                if (insertNewChild && startNode == null)
                {
                    //Place node in proper position in child chain based on index
                    tn1 = parentNode.FirstChild;
                    tn2 = null;
                    if (tn1 != null)
                    {
                        while (row >= tn1.Index)
                        {
                            Debug.Assert(tn1.Index != row, "TrackIndex screwed up");
                            tn2 = tn1;
                            if (null == (tn1 = tn2.NextSibling))
                            {
                                break;
                            }
                        }
                        if (tn2 != null)
                        {
                            tn2.NextSibling = tnCur;
                        }
                        else
                        {
                            parentNode.FirstChild = tnCur;
                        }
                        tnCur.NextSibling = tn1; //tn1 May be null, not worth the check
                    }
                    else
                    {
                        parentNode.FirstChild = tnCur;
                    }
                }
            }
            return newChildNode;
        }
Esempio n. 39
0
 /// <summary>
 /// Retrieve an object associated with this branch. See ObjectStyle
 /// for descriptions of the different object styles that the tree will request.
 /// </summary>
 /// <param name="row">Target row</param>
 /// <param name="column">Target column</param>
 /// <param name="style">Style of object to retrieve</param>
 /// <param name="options">Placeholder for setting/returns options. Contents depend on the style.</param>
 /// <returns>
 /// An object or null, with the type of the object determined by the style parameter.
 /// </returns>
 public object GetObject(int row, int column, ObjectStyle style, ref int options)
 {
     return(myBaseBranch.GetObject(row + myFirstItem, column, style, ref options));
 }
Esempio n. 40
0
				object IDetailHandler.GetDetailObject(PartitionChange change, int detailColumn, ObjectStyle style)
				{
					return myDetailHandlers[change.ChangeArgs.GetType()].GetDetailObject(change, detailColumn, style);
				}
Esempio n. 41
0
			public virtual LocateObjectData LocateObject(object obj, ObjectStyle style, int locateOptions)
			{
				return default(LocateObjectData);
			}
Esempio n. 42
0
				object IDetailHandler.GetDetailObject(PartitionChange change, int detailColumn, ObjectStyle style)
				{
					if (style == ObjectStyle.SubItemRootBranch)
					{
						RolePlayerOrderChangedEventArgs args = (RolePlayerOrderChangedEventArgs)change.ChangeArgs;
						return (detailColumn == 0) ?
							(IBranch)(new CounterpartRolePlayerDetailBranch(args.CounterpartDomainRole, args.CounterpartRolePlayerId)) :
							new PositionDetailBranch(args.NewOrdinal, args.OldOrdinal);
					}
					return null;
				}
Esempio n. 43
0
        /// <summary>
        ///     Derived classes may override to provide custom object location.  The base class
        ///     provides implementation for ExpandedBranch and TrackingObject styles
        /// </summary>
        /// <param name="row"></param>
        /// <param name="column"></param>
        /// <param name="style"></param>
        protected virtual object GetObject(int row, int column, ObjectStyle style)
        {
            switch (style)
            {
                case ObjectStyle.ExpandedBranch:
                    Debug.Assert(column == 0); // Simple-celled columns shouldn't ask for an expansion
                    return _currentBranches[row].Branch;

                case ObjectStyle.TrackingObject:
                    return _currentBranches[row].Id;

                default:
                    if (style == TreeGridDesignerBranch.BrowsingObject)
                    {
                        goto case ObjectStyle.TrackingObject;
                    }
                    break;
            }
            return null;
        }
        public object /* IBranch */ GetObject(int row, int column, ObjectStyle style, ref int options)
        {
            switch ((int)style)
            {
                case (int)ObjectStyle.ExpandedBranch:
                    {
                        try
                        {
                            // HACK: demand loading can cause re-entrancy when we access this list for the first time.
                            InVirtualTreeEdit = true;

                            Debug.Assert(column == 0); // Simple-celled columns shouldn't ask for an expansion
                            // Use the override to get the appropriate branch
                            var newBranch = GetExpandedBranch(row);
                            if (newBranch != null)
                            {
                                return newBranch;
                            }
                        }
                        finally
                        {
                            InVirtualTreeEdit = false;
                        }
                        break;
                    }

                case (int)ObjectStyle.TrackingObject:
                    if (row < ElementCount)
                    {
                        return GetElement(row);
                    }
                    options = (int)TrackingObjectAction.NotTracked;
                    break;

                default:
                    if (style == BrowsingObject)
                    {
                        if (row < ElementCount)
                        {
                            return GetBrowsingObject(row);
                        }
                        else
                        {
                            return GetBrowsingCreatorObject();
                        }
                    }
                    break;
            }
            return null;
        }
Esempio n. 45
0
 /// <summary>
 ///     IBranch interface implementation.
 /// </summary>
 public object GetObject(int row, int column, ObjectStyle style, ref int options)
 {
     return GetObject(row, column, style);
 }
Esempio n. 46
0
				object IDetailHandler.GetDetailObject(PartitionChange change, int detailColumn, ObjectStyle style)
				{
					if (style == ObjectStyle.SubItemRootBranch)
					{
						ElementEventArgs args = (ElementEventArgs)change.ChangeArgs;
						DomainRelationshipInfo relationshipInfo = (DomainRelationshipInfo)args.DomainClass;
						RoleAssignment[] assignments = change.RoleAssignments;
						RoleAssignment assignment = assignments[0];
						return new RoleAssignmentDetailBranch(change.Partition.Store, relationshipInfo.DomainRoles[detailColumn].Id == assignment.DomainRoleId ? assignment : assignments[1]);
					}
					return null;
				}
Esempio n. 47
0
        /// <summary>
        ///     IBranch interface implementation.
        /// </summary>
        public virtual LocateObjectData LocateObject(object obj, ObjectStyle style, int locateOptions)
        {
            var row = -1;
            var column = 0;
            var options = 0;
            switch (style)
            {
                case ObjectStyle.ExpandedBranch:
                case ObjectStyle.SubItemExpansion:
                    options = (int)BranchLocationAction.DiscardBranch;
                    for (var i = 0; i < _currentBranches.Count; i++)
                    {
                        if (_currentBranches[i].Branch == obj)
                        {
                            return new LocateObjectData(i, 0, (int)BranchLocationAction.KeepBranch);
                        }
                    }
                    break;

                case ObjectStyle.TrackingObject:
                    for (var i = 0; i < _currentBranches.Count; i++)
                    {
                        if (obj != null
                            && obj == _currentBranches[i].Id)
                        {
                            return new LocateObjectData(i, 0, (int)TrackingObjectAction.ThisLevel);
                        }

                        var data = _currentBranches[i].Branch.LocateObject(obj, ObjectStyle.TrackingObject, locateOptions);
                        if (data.Options != (int)TrackingObjectAction.NotTracked)
                        {
                            return new LocateObjectData(i, 0, (int)TrackingObjectAction.NextLevel);
                        }
                    }
                    break;
            }
            return new LocateObjectData(row, column, options);
        }
 object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
 {
     return(null);
 }
Esempio n. 49
0
			public virtual object GetObject(int row, int column, ObjectStyle style, ref int options)
			{
				return null;
			}
Esempio n. 50
0
			LocateObjectData IBranch.LocateObject(object obj, ObjectStyle style, int locateOptions)
			{
				return default(LocateObjectData);
			}
Esempio n. 51
0
				object IBranch.GetObject(int row, int column, ObjectStyle style, ref int options)
				{
					if (style == ObjectStyle.ExpandedBranch)
					{
						switch ((Headers)row)
						{
							case Headers.ReferenceModeKinds:
								return this.myReferenceModeKindsBranch;

							case Headers.CustomReferenceModes:
								return this.myCustomBranch;

							case Headers.IntrinsicReferenceModes:
								return myIntrinsicBranch;
						}
					}
					return null;
				}
Esempio n. 52
0
 public virtual object GetObject(int row, int column, ObjectStyle style, ref int options)
 {
     return(null);
 }
Esempio n. 53
0
 public virtual LocateObjectData LocateObject(object obj, ObjectStyle style, int locateOptions)
 {
     return(default(LocateObjectData));
 }
 LocateObjectData IBranch.LocateObject(object obj, ObjectStyle style, int locateOptions)
 {
     return(default(LocateObjectData));
 }
Esempio n. 55
0
			LocateObjectData IBranch.LocateObject(object obj, ObjectStyle style, int locateOptions)
			{
				Debug.Assert(false);
				// UNDONE: This would require an UntranslateRow to do correctly, not worth it for now
				return default(LocateObjectData);
			}