Subversion Repositories eFlore/Applications.coel

Rev

Rev 912 | Rev 932 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 912 Rev 913
Line 114... Line 114...
114
			for (int i = 0; i < nbreAppletteNoeud ; i++) {
114
			for (int i = 0; i < nbreAppletteNoeud ; i++) {
115
				Element appletteNoeud = (Element) listeAppletteNoeud.item(i);
115
				Element appletteNoeud = (Element) listeAppletteNoeud.item(i);
116
				int colonne = Integer.parseInt(appletteNoeud.getAttribute("colonne"));
116
				int colonne = Integer.parseInt(appletteNoeud.getAttribute("colonne"));
117
				int index = Integer.parseInt(appletteNoeud.getAttribute("index"));
117
				int index = Integer.parseInt(appletteNoeud.getAttribute("index"));
118
				HashMap<String, String> infoApplette = new HashMap<String, String>();
118
				HashMap<String, String> infoApplette = new HashMap<String, String>();
-
 
119
				infoApplette.put("reduite", appletteNoeud.getAttribute("reduite"));
-
 
120
				infoApplette.put("epingle", appletteNoeud.getAttribute("epingle"));
119
				infoApplette.put("type", appletteNoeud.getAttribute("type"));
121
				infoApplette.put("type", appletteNoeud.getAttribute("type"));
120
				infoApplette.put("colonne", appletteNoeud.getAttribute("colonne"));
122
				infoApplette.put("colonne", appletteNoeud.getAttribute("colonne"));
121
				infoApplette.put("index", appletteNoeud.getAttribute("index"));
123
				infoApplette.put("index", appletteNoeud.getAttribute("index"));
122
				infoApplette.put("contenu", appletteNoeud.getAttribute("contenu"));
124
				infoApplette.put("contenu", appletteNoeud.getAttribute("contenu"));
123
				tableApplettes.put(colonne+"-"+index, infoApplette);
125
				tableApplettes.put(colonne+"-"+index, infoApplette);
124
			}
126
			}
125
			Iterator<String> it = tableApplettes.keySet().iterator();
127
			Iterator<String> it = tableApplettes.keySet().iterator();
126
			while (it.hasNext()) {
128
			while (it.hasNext()) {
127
				String id = it.next();
129
				String id = it.next();
128
				HashMap<String, String> infoApplette = tableApplettes.get(id);
130
				HashMap<String, String> infoApplette = tableApplettes.get(id);
-
 
131
				boolean reduite = (infoApplette.get("reduite") != null && infoApplette.get("reduite").equals("true")) ? true : false;
-
 
132
				boolean epingle = (infoApplette.get("epingle") != null && infoApplette.get("epingle").equals("true")) ? true : false;
-
 
133
				int index = Integer.parseInt(infoApplette.get("index"));
-
 
134
				int colonne = Integer.parseInt(infoApplette.get("colonne"));
129
				ajouterPortlet(infoApplette.get("type"), Integer.parseInt(infoApplette.get("colonne")), Integer.parseInt(infoApplette.get("index")), infoApplette.get("contenu"));
135
				ajouterPortlet(reduite, epingle, infoApplette.get("type"), colonne, index, infoApplette.get("contenu"));
130
			}
136
			}
131
		}
137
		}
132
		Debug.log("Nbre aplletes c0 :"+portail.getItem(0).getItemCount());
138
		Debug.log("Nbre aplletes c0 :"+portail.getItem(0).getItemCount());
133
		layout();
139
		layout();
134
	}
140
	}
Line 162... Line 168...
162
		}
168
		}
Line 163... Line 169...
163
		
169
		
164
		// Ajout des noeuds "applette" au noeud "accueil"
170
		// Ajout des noeuds "applette" au noeud "accueil"
165
		while (it.hasNext()) {
171
		while (it.hasNext()) {
-
 
172
			Portlet applette = it.next();
-
 
173
			String reduite = (applette.isCollapsed() ? "true" : "false");
166
			Portlet applette = it.next();
174
			String epingle = (applette.isPinned() ? "true" : "false");
167
			String index = Integer.toString(portail.getPortletIndex(applette));
175
			String index = Integer.toString(portail.getPortletIndex(applette));
168
			String colonne = Integer.toString(portail.getPortletColumn(applette));
176
			String colonne = Integer.toString(portail.getPortletColumn(applette));
-
 
177
			String contenu = applette.getData("contenu");
169
			String contenu = applette.getData("contenu");
178
			
-
 
179
			Element appletteElement = paramXml.createElement("applette");
-
 
180
			appletteElement.setAttribute("reduite", reduite);
170
			Element appletteElement = paramXml.createElement("applette");
181
			appletteElement.setAttribute("epingle", epingle);
171
			appletteElement.setAttribute("type", "statistique");
182
			appletteElement.setAttribute("type", "statistique");
172
			appletteElement.setAttribute("colonne", colonne);
183
			appletteElement.setAttribute("colonne", colonne);
173
			appletteElement.setAttribute("index", index);
184
			appletteElement.setAttribute("index", index);
-
 
185
			appletteElement.setAttribute("contenu", contenu);
174
			appletteElement.setAttribute("contenu", contenu);
186
			
175
			accueilNoeud.appendChild(appletteElement);
187
			accueilNoeud.appendChild(appletteElement);
Line 176... Line 188...
176
		}
188
		}
177
		
189
		
Line 192... Line 204...
192
		}
204
		}
193
		return applettes;
205
		return applettes;
194
	}
206
	}
Line 195... Line 207...
195
	
207
	
196
	private void ajouterPortlet() {
208
	private void ajouterPortlet() {
197
		ajouterPortlet("statistique", 0, 0, null);
209
		ajouterPortlet(false, false, "statistique", 0, 0, null);
Line 198... Line 210...
198
	}
210
	}
199
	
211
	
200
	private void ajouterPortlet(String type, int colonne, int index, String contenu) {
212
	private void ajouterPortlet(boolean reduite, boolean epingle, String type, int colonne, int index, String contenu) {
201
		Debug.log("Ajout:"+type+"-"+colonne+"-"+index+"-"+contenu);
213
		Debug.log("Ajout:"+reduite+"-"+epingle+"-"+type+"-"+colonne+"-"+index+"-"+contenu);
202
		Portlet portlet = null;
214
		Applette applette = null;
203
		if (type.equals("statistique")) {
215
		if (type.equals("statistique")) {
-
 
216
			applette = new AppletteStatistique(contenu);
-
 
217
		}
-
 
218
		if (reduite) {
-
 
219
			applette.collapse();
204
			portlet = new AppletteStatistique(contenu);
220
		}
-
 
221
		
205
		}
222
		portail.insert(applette, index, colonne);
206
		portail.insert(portlet, index, colonne);
223
		applette.setEpingler(epingle);
Line 207... Line 224...
207
		layout();
224
		layout();
208
	}
225
	}