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.iface.Operation;
16  import com.eviware.soapui.model.tree.AbstractTreeNode;
17  import com.eviware.soapui.model.tree.SoapUITreeNode;
18  
19  /***
20   * SoapUITreeNode for Operation implementations
21   * 
22   * @author Ole.Matzura
23   */
24  
25  public class OperationTreeNode extends AbstractTreeNode
26  {
27     public OperationTreeNode(Operation operation)
28     {
29        super( operation, operation.getInterface() );
30     }
31  
32     public int getChildCount()
33     {
34        return getOperation().getRequestCount();
35     }
36  
37     public int getIndexOfChild(Object child)
38     {
39        Operation operation = getOperation();
40  		for( int c = 0; c < operation.getRequestCount(); c++ )
41        {
42           if( operation.getRequestAt( c ).getTreeNode() == child ) return c;
43        }
44        
45        return -1;
46     }
47  
48     public Operation getOperation()
49     {
50     	return (Operation) getModelItem();
51     }
52     
53     public SoapUITreeNode getChildNode(int index)
54     {
55        return getOperation().getRequestAt(index ).getTreeNode();
56     }
57  }