testdev/ite/src/com.nokia.testfw.stf.scripteditor/src/com/nokia/testfw/stf/scripteditor/utils/SectionTag.java
changeset 1 96906a986c3b
equal deleted inserted replaced
0:f1112f777ce9 1:96906a986c3b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 package com.nokia.testfw.stf.scripteditor.utils;
       
    19 
       
    20 import static org.w3c.dom.Node.ELEMENT_NODE;
       
    21 
       
    22 import java.util.ArrayList;
       
    23 
       
    24 import org.w3c.dom.Node;
       
    25 import org.w3c.dom.NodeList;
       
    26 
       
    27 public class SectionTag {
       
    28 
       
    29 	//passing "section" node, create section object 
       
    30 	//containig list of commands pressent in that section
       
    31 	public SectionTag(Node list, String sectionName, String sectionEndName, String proposal) {
       
    32 
       
    33 		NodeList sectionNode = list.getChildNodes();
       
    34 		this.name = sectionName;
       
    35 		this.endName = sectionEndName;
       
    36 		this.commandList = new ArrayList<Command>();
       
    37 		this.proposal = proposal;
       
    38 
       
    39 		for (int i = 0; i < sectionNode.getLength(); i++) {
       
    40 
       
    41 			short typeC = sectionNode.item(i).getNodeType();
       
    42 			if (typeC == ELEMENT_NODE) {
       
    43 
       
    44 				Command text = new Command(sectionNode.item(i).getAttributes()
       
    45 						.getNamedItem("id").getNodeValue(), sectionNode.item(i));
       
    46 				commandList.add(text);
       
    47 				
       
    48 				
       
    49 			}
       
    50 		}
       
    51 		
       
    52 	}
       
    53 	
       
    54 	public String getName() {
       
    55 		return name;
       
    56 
       
    57 	}
       
    58 	public String getEndName() {
       
    59 		return endName;
       
    60 
       
    61 	}
       
    62 	
       
    63 	public ArrayList<Command> getCommandList() {
       
    64 		return commandList;
       
    65 
       
    66 	}
       
    67 	
       
    68 	public String getProposal() {
       
    69 		return proposal;
       
    70 	}
       
    71 
       
    72 
       
    73 	//begining of section (ex. [Test])
       
    74 	private String name;
       
    75 	
       
    76 	//end of section (ex. [EndTest])
       
    77 	private String endName;
       
    78 
       
    79 	//list of all commands in section
       
    80 	private ArrayList<Command> commandList;
       
    81 	
       
    82 	private String proposal;
       
    83 	
       
    84 
       
    85 }