0
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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 |
|
|
19 |
/**
|
|
20 |
*
|
|
21 |
*/
|
|
22 |
package com.nokia.s60tools.appdep.ui.wizards;
|
|
23 |
|
|
24 |
import java.util.ArrayList;
|
|
25 |
import java.util.Iterator;
|
|
26 |
|
|
27 |
|
|
28 |
/**
|
|
29 |
* SDK Selection tree view's invisible root component used to add
|
|
30 |
* actual user visible data.
|
|
31 |
*/
|
|
32 |
class InvisibleRootNode extends TreeViewNode{
|
|
33 |
|
|
34 |
/**
|
|
35 |
* SDK node objects owned by the root node.
|
|
36 |
*/
|
|
37 |
private ArrayList<SdkTreeViewNode> sdkList = null;
|
|
38 |
|
|
39 |
/**
|
|
40 |
* Adds new node.
|
|
41 |
* @param sdkNode Node to add.
|
|
42 |
*/
|
|
43 |
public void addSdkNode(SdkTreeViewNode sdkNode){
|
|
44 |
sdkList.add(sdkNode);
|
|
45 |
}
|
|
46 |
|
|
47 |
/**
|
|
48 |
* Constructor.
|
|
49 |
*/
|
|
50 |
public InvisibleRootNode(){
|
|
51 |
super(null);
|
|
52 |
sdkList = new ArrayList<SdkTreeViewNode>();
|
|
53 |
}
|
|
54 |
|
|
55 |
/* (non-Javadoc)
|
|
56 |
* @see com.nokia.s60tools.appdep.ui.wizards.TreeViewNode#getChildren()
|
|
57 |
*/
|
|
58 |
public Object[] getChildren() {
|
|
59 |
return sdkList.toArray();
|
|
60 |
}
|
|
61 |
|
|
62 |
/* (non-Javadoc)
|
|
63 |
* @see com.nokia.s60tools.appdep.ui.wizards.TreeViewNode#hasChildren()
|
|
64 |
*/
|
|
65 |
public boolean hasChildren() {
|
|
66 |
return (sdkList.size() > 0);
|
|
67 |
}
|
|
68 |
|
|
69 |
/* (non-Javadoc)
|
|
70 |
* @see java.lang.Object#toString()
|
|
71 |
*/
|
|
72 |
public String toString() {
|
|
73 |
return ""; //$NON-NLS-1$
|
|
74 |
}
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Tries to find tree viewer node that matches
|
|
78 |
* with the given parameters.
|
|
79 |
* @param sdkIdString Id string of the SDK.
|
|
80 |
* @return Returns the matching object if it was found,
|
|
81 |
* otherwise return <code>null</code>.
|
|
82 |
*/
|
|
83 |
public Object find(String sdkIdString) {
|
|
84 |
for (Iterator<SdkTreeViewNode> iter = sdkList.iterator(); iter.hasNext();) {
|
|
85 |
SdkTreeViewNode sdkNode = iter.next();
|
|
86 |
Object obj = sdkNode.find(sdkIdString);
|
|
87 |
if(obj != null){
|
|
88 |
return obj;
|
|
89 |
}
|
|
90 |
}
|
|
91 |
// No matches were found
|
|
92 |
return null;
|
|
93 |
}
|
|
94 |
} |