Return to Snippet

Revision: 56171
at April 23, 2013 00:59 by laurenceosx


Updated Code
def recurseComp( aComp, results = [] ) {
    if ( (aComp != null) && !(aComp in results) ) {
        results << aComp;    
        if ( aComp.properties.components ) {
            aComp.components.each {
                recurseComp( it, results );
            }   
        }  
    }
    return results;
}

def recurseCompByLevel( aComp, results = [], levels = [] ) {
    if ( (aComp != null) && !(aComp in results) ) {
        results << aComp;    
        if ( aComp.properties.components ) {
        
             levels << aComp.components.collect { it };
        
            aComp.components.each {
                recurseCompByLevel( it, results, levels );
            }   
        }  
    }
    return levels;
}

Revision: 56170
at April 23, 2013 00:42 by laurenceosx


Updated Code
def recurseComp( aComp, results = [] ) {
    if ( (aComp != null) && !(aComp in results) ) {
        results << aComp;    
        if ( aComp.properties.components ) {
            aComp.components.each {
                recurseComp( it, results );
            }   
        }  
    }
    return results;
}

def recurseCompByLevel( aComp, levels = [] ) {
    if ( aComp.properties.components ) {
        levels << aComp.components.collect { it };
        aComp.components.each {
            recurseCompByLevel( it, levels );
        }   
    }  
    return levels;
}

Revision: 56169
at March 14, 2012 05:45 by laurenceosx


Updated Code
def recurseComp( aComp, results = [] ) {
    results << aComp;    
    if ( aComp?.components ) {
        aComp.components.each {
            recurseComp( it, results );
        }   
    }  
    return results;
}

def recurseCompByLevel( aComp, levels = [] ) {
    if ( aComp?.components ) {
        levels << aComp.components.collect { it };
        aComp.components.each {
            recurseCompByLevel( it, levels );
        }   
    }  
    return levels;
}

Revision: 56168
at March 14, 2012 05:40 by laurenceosx


Initial Code
def recurseComp( aComp, results = [] ) {
    if ( !(aComp in results) )
        results << aComp;    
    if ( aComp?.components ) {
        aComp.components.each {
            recurseComp( it, results );
        }   
    }  
    return results;
}

def recurseCompByLevel( aComp, levels = [] ) {
    if ( aComp?.components ) {
        levels << aComp.components.collect { it };
        aComp.components.each {
            recurseCompByLevel( it, levels );
        }   
    }  
    return levels;
}

Initial URL

                                

Initial Description
Groovy Swing Recurse Components

Initial Title
Groovy Swing Recurse Components

Initial Tags
groovy

Initial Language
Groovy