Example #1
0
 public static CswNbtViewNode makeViewNode( CswNbtResources CswNbtResources, CswNbtView View, CswDelimitedString ViewNodeString )
 {
     CswNbtViewNode newNode = null;
     CswEnumNbtViewNodeType type = (CswEnumNbtViewNodeType) ViewNodeString[0];
     if( type == CswEnumNbtViewNodeType.CswNbtViewRelationship )
     {
         newNode = new CswNbtViewRelationship( CswNbtResources, View, ViewNodeString );
     }
     else if( type == CswEnumNbtViewNodeType.CswNbtViewProperty )
     {
         newNode = new CswNbtViewProperty( CswNbtResources, View, ViewNodeString );
     }
     else if( type == CswEnumNbtViewNodeType.CswNbtViewPropertyFilter )
     {
         newNode = new CswNbtViewPropertyFilter( CswNbtResources, View, ViewNodeString );
     }
     else if( type == CswEnumNbtViewNodeType.CswNbtViewRoot )
     {
         newNode = new CswNbtViewRoot( CswNbtResources, View, ViewNodeString );
     }
     else
     {
         throw new CswDniException( CswEnumErrorType.Error, "Invalid ViewNode", "CswNbtViewNode.makeViewNode() got an invalid ViewNodeString: " + ViewNodeString.ToString() );
     }
     return newNode;
 } // makeViewNode()
Example #2
0
        private void GetAllChildrenOfTypeRecursive( CswEnumNbtViewNodeType ChildrenViewNodeType, CswNbtViewNode CurrentViewNode, ref ArrayList Results )
        {
            if( CurrentViewNode.ViewNodeType == ChildrenViewNodeType )
                Results.Add( CurrentViewNode );

            // Recurse
            if( CurrentViewNode.ViewNodeType == CswEnumNbtViewNodeType.CswNbtViewRoot )
            {
                foreach( CswNbtViewRelationship Child in ( (CswNbtViewRoot) CurrentViewNode ).ChildRelationships )
                {
                    GetAllChildrenOfTypeRecursive( ChildrenViewNodeType, Child, ref Results );
                }
            }
            else if( CurrentViewNode.ViewNodeType == CswEnumNbtViewNodeType.CswNbtViewRelationship )
            {
                foreach( CswNbtViewRelationship Child in ( (CswNbtViewRelationship) CurrentViewNode ).ChildRelationships )
                {
                    GetAllChildrenOfTypeRecursive( ChildrenViewNodeType, Child, ref Results );
                }
                foreach( CswNbtViewProperty Child in ( (CswNbtViewRelationship) CurrentViewNode ).Properties )
                {
                    GetAllChildrenOfTypeRecursive( ChildrenViewNodeType, Child, ref Results );
                }
            }
            else if( CurrentViewNode.ViewNodeType == CswEnumNbtViewNodeType.CswNbtViewProperty )
            {
                foreach( CswNbtViewPropertyFilter Child in ( (CswNbtViewProperty) CurrentViewNode ).Filters )
                {
                    GetAllChildrenOfTypeRecursive( ChildrenViewNodeType, Child, ref Results );
                }
            }
        } // GetAllChildrenOfTypeRecursive()
Example #3
0
        public ICollection GetChildrenOfType( CswEnumNbtViewNodeType ChildrenViewNodeType )
        {
            ICollection ret = null;
            bool bError = true;
            if( this is CswNbtViewRoot && ChildrenViewNodeType == CswEnumNbtViewNodeType.CswNbtViewRelationship )
            {
                bError = false;
                ret = ( (CswNbtViewRoot) this ).ChildRelationships;
            }
            else if( this is CswNbtViewRelationship )
            {
                if( ChildrenViewNodeType == CswEnumNbtViewNodeType.CswNbtViewRelationship )
                {
                    bError = false;
                    ret = ( (CswNbtViewRelationship) this ).ChildRelationships;
                }
                else if( ChildrenViewNodeType == CswEnumNbtViewNodeType.CswNbtViewProperty )
                {
                    bError = false;
                    ret = ( (CswNbtViewRelationship) this ).Properties;
                }
            }
            else if( this is CswNbtViewProperty && ChildrenViewNodeType == CswEnumNbtViewNodeType.CswNbtViewPropertyFilter )
            {
                bError = false;
                ret = ( (CswNbtViewProperty) this ).Filters;
            }

            if( bError )
                throw new CswDniException( CswEnumErrorType.Error, "Invalid Operation", "CswNbtViewNode attempted to perform an invalid GetChildrenOfType with parameter: " + ChildrenViewNodeType.ToString() + " on ViewNode: " + this.ToString() );

            return ret;
        }
Example #4
0
 /// <summary>
 /// Returns all children of a given ViewNodeType beneath this node in the view, recursively
 /// </summary>
 public ArrayList GetAllChildrenOfType( CswEnumNbtViewNodeType ChildrenViewNodeType )
 {
     ArrayList Results = new ArrayList();
     GetAllChildrenOfTypeRecursive( ChildrenViewNodeType, this, ref Results );
     return Results;
 }