Revision 34305 branches/v2_0_0_prep/libraries/libRemoteServices/src/org/gvsig/remoteclient/wmts/struct/WMTSThemes.java

View differences:

WMTSThemes.java
24 24
import java.io.IOException;
25 25
import java.util.ArrayList;
26 26

  
27
import org.gvsig.remoteclient.wmts.WMTSStatus;
27
import org.gvsig.remoteclient.wmts.WMTSServerDescription;
28 28
import org.kxml2.io.KXmlParser;
29 29
import org.xmlpull.v1.XmlPullParserException;
30 30

  
......
59 59
	 * Loads this list of themes with the layer information
60 60
	 * @param layers
61 61
	 */
62
	public void loadThemesWithLayerInfo(ArrayList layers, WMTSStatus status) {
62
	public void loadThemesWithLayerInfo(ArrayList layers, WMTSServerDescription status) {
63 63
		if(size() == 0) {
64 64
			for (int i = 0; i < layers.size(); i++) {
65 65
				WMTSTheme theme = (WMTSTheme)status.createVersionObject("WMTSTheme");
......
71 71
			}
72 72
		}
73 73
	}
74
	
75
	/**
76
	 * Gets a node by its name
77
	 * @param name
78
	 * @return
79
	 */
80
	public WMTSTheme getNodeByName(String name) {
81
		WMTSTheme result = null;
82
		
83
		for (int i = 0; i < size(); i++) {
84
			WMTSTheme theme = ((WMTSTheme)get(i));
85
			String title = theme.getTitle();
86
			if(title.compareTo(name) == 0)
87
				result = ((WMTSTheme)get(i));
88
			else 
89
				result = theme.getNodeByName(name);
90
			if(result != null)
91
				return result;
92
		}
93
		return null;
94
	}
95
	
96
	/**
97
	 * Gets the number of nodes
98
	 * @param parent
99
	 * @return
100
	 */
101
	public int getChildCount() {
102
		int acum = 0;
103
		for (int i = 0; i < size(); i++) {
104
			acum += 1 + ((WMTSTheme)get(i)).getChildCount();
105
		}
106
		return acum;
107
	}
108
	
109
	/**
110
	 * Gets the children of the index position
111
	 * @param index
112
	 * @return
113
	 */
114
	public WMTSTheme getChildren(int index) {
115
		return (WMTSTheme)get(index);	
116
	}
117
	
118
	/**
119
	 * Gets the index of a children
120
	 * @param parent
121
	 * @param child
122
	 * @return
123
	 */
124
	public int getIndexOfChild(WMTSTheme child) {
125
		for (int i = 0; i < size(); i++)
126
			if (child == getChildren(i)) 
127
				return i;
128
		return -1;
129
	}
130
	
131
	public String toString() {
132
		return "Base";
133
	}
74 134
}

Also available in: Unified diff