testdev/ite/src/com.nokia.testfw.codegen.ui/src/com/nokia/testfw/codegen/ui/parser/model/UIClassNode.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 package com.nokia.testfw.codegen.ui.parser.model;
       
    18 
       
    19 import org.eclipse.cdt.core.model.ICElement;
       
    20 import org.eclipse.cdt.core.model.IStructure;
       
    21 
       
    22 import com.nokia.testfw.codegen.model.ClassNodeImpl;
       
    23 import com.nokia.testfw.codegen.model.INode;
       
    24 
       
    25 /**
       
    26  * @author k21wang
       
    27  * 
       
    28  */
       
    29 public class UIClassNode extends ClassNodeImpl implements IUINode {
       
    30 
       
    31 	private ICElement iCElement;
       
    32 
       
    33 	/**
       
    34 	 * @param classDec
       
    35 	 * @param parent
       
    36 	 */
       
    37 	public UIClassNode(IStructure classDec, UIProjectNode parent) {
       
    38 		super(classDec.getElementName(), parent);
       
    39 		iCElement = classDec;
       
    40 	}
       
    41 
       
    42 	/*
       
    43 	 * (non-Javadoc)
       
    44 	 * 
       
    45 	 * @see com.nokia.testfw.codegen.ui.parser.model.IUINode#getData()
       
    46 	 */
       
    47 	public ICElement getICElement() {
       
    48 		return iCElement;
       
    49 	}
       
    50 
       
    51 	/*
       
    52 	 * (non-Javadoc)
       
    53 	 * 
       
    54 	 * @see com.nokia.testfw.codegen.ui.parser.model.IUINode#isSelected()
       
    55 	 */
       
    56 	public boolean isSelected() {
       
    57 		boolean lSelected = false;
       
    58 		for (INode child : getChildren()) {
       
    59 			if (child instanceof IUINode) {
       
    60 				if (((IUINode) child).isSelected()) {
       
    61 					lSelected = true;
       
    62 					break;
       
    63 				}
       
    64 			} else {
       
    65 				lSelected = true;
       
    66 				break;
       
    67 			}
       
    68 		}
       
    69 		return lSelected;
       
    70 	}
       
    71 
       
    72 	/*
       
    73 	 * (non-Javadoc)
       
    74 	 * 
       
    75 	 * @see
       
    76 	 * com.nokia.testfw.codegen.ui.parser.model.IUINode#setSelected(boolean)
       
    77 	 */
       
    78 	public void setSelected(boolean selected) {
       
    79 		for (INode child : getChildren()) {
       
    80 			if (child instanceof IUINode) {
       
    81 				((IUINode) child).setSelected(selected);
       
    82 			}
       
    83 		}
       
    84 	}
       
    85 
       
    86 	public boolean isVisible() {
       
    87 		boolean isVisible = false;
       
    88 		for (INode child : getChildren()) {
       
    89 			if (child instanceof IUINode) {
       
    90 				if (((IUINode) child).isVisible()) {
       
    91 					isVisible = true;
       
    92 					break;
       
    93 				}
       
    94 			} else {
       
    95 				isVisible = true;
       
    96 				break;
       
    97 			}
       
    98 		}
       
    99 		return isVisible;
       
   100 	}
       
   101 
       
   102 	public void setVisible(boolean visible) {
       
   103 		for (INode child : getChildren()) {
       
   104 			if (child instanceof IUINode) {
       
   105 				((IUINode) child).setVisible(visible);
       
   106 			}
       
   107 		}
       
   108 	}
       
   109 }