View Javadoc

1   /*
2    *  soapui, copyright (C) 2005 Ole Matzura / eviware.com 
3    *
4    *  SoapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of the GNU Lesser General Public License as published by the Free Software Foundation; 
6    *  either version 2.1 of the License, or (at your option) any later version.
7    *
8    *  SoapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.model.tree.nodes;
14  
15  import com.eviware.soapui.model.testsuite.TestCase;
16  import com.eviware.soapui.model.tree.AbstractTreeNode;
17  import com.eviware.soapui.model.tree.SoapUITreeNode;
18  
19  /***
20   * SoapUITreeNode for TestCase implementations
21   * 
22   * @author Ole.Matzura
23   */
24  
25  public class TestCaseTreeNode extends AbstractTreeNode 
26  {
27     public TestCaseTreeNode(TestCase testCase )
28     {
29        super( testCase, testCase.getTestSuite() );
30     }
31  
32     public TestCase getTestCase()
33     {
34        return (TestCase) getModelItem();
35     }
36     
37     public int getChildCount()
38     {
39       return getTestCase().getTestStepCount();
40     }
41  
42     public int getIndexOfChild(Object child)
43     {
44        for( int c = 0; c < getTestCase().getTestStepCount(); c++ )
45        {
46           if( getTestCase().getTestStepAt( c ).getTreeNode() == child ) return c;
47        }
48        
49        return -1;
50     }
51  
52     public SoapUITreeNode getChildNode(int index)
53     {
54        return getTestCase().getTestStepAt(index ).getTreeNode();
55     }
56     
57     
58  }