Subversion Repositories eFlore/Archives.cel-v2

Rev

Rev 28 | Rev 36 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28 Rev 30
Line 22... Line 22...
22
import com.gwtext.client.widgets.Container;
22
import com.gwtext.client.widgets.Container;
23
import com.gwtext.client.widgets.Editor;
23
import com.gwtext.client.widgets.Editor;
24
import com.gwtext.client.widgets.Panel;
24
import com.gwtext.client.widgets.Panel;
25
import com.gwtext.client.widgets.event.ButtonListener;
25
import com.gwtext.client.widgets.event.ButtonListener;
26
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
26
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-
 
27
import com.gwtext.client.widgets.event.ComponentListener;
-
 
28
import com.gwtext.client.widgets.event.ComponentListenerAdapter;
-
 
29
import com.gwtext.client.widgets.event.ContainerListener;
-
 
30
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
27
import com.gwtext.client.widgets.event.EditorListener;
31
import com.gwtext.client.widgets.event.EditorListener;
28
import com.gwtext.client.widgets.event.EditorListenerAdapter;
32
import com.gwtext.client.widgets.event.EditorListenerAdapter;
-
 
33
import com.gwtext.client.widgets.event.PanelListenerAdapter;
29
import com.gwtext.client.widgets.form.Field;
34
import com.gwtext.client.widgets.form.Field;
30
import com.gwtext.client.widgets.form.TextField;
35
import com.gwtext.client.widgets.form.TextField;
31
import com.gwtext.client.widgets.layout.RowLayout;
36
import com.gwtext.client.widgets.layout.RowLayout;
32
import com.gwtext.client.widgets.layout.RowLayoutData;
37
import com.gwtext.client.widgets.layout.RowLayoutData;
33
import com.gwtext.client.widgets.menu.Menu;
38
import com.gwtext.client.widgets.menu.Menu;
Line 45... Line 50...
45
	private TreePanel arbreMotsCles = null ;
50
	private TreePanel arbreMotsCles = null ;
46
	private TreeEditor te = null ;
51
	private TreeEditor te = null ;
47
	private TextField tfEdit = null ;
52
	private TextField tfEdit = null ;
48
	private Button valider = null ;
53
	private Button valider = null ;
49
	private String motsClesEnCours = "" ;
54
	private String motsClesEnCours = "" ;
-
 
55
	private String[] motsClesEnAttente ; 
50
	private boolean ajoutNoeud = false ;
56
	private boolean ajoutNoeud = false ;
51
	private boolean modifNoeud = false ;
57
	private boolean modifNoeud = false ;
-
 
58
	private boolean estInstancie = false ;
-
 
59
	private boolean motsCleInitialises ;
Line 52... Line 60...
52
	
60
	
53
	public ArbreMotsClesVue(ImageMediateur im)
61
	public ArbreMotsClesVue(ImageMediateur im)
54
	{
62
	{
55
		super("Mots clés") ;
63
		super("Mots clés") ;
56
		this.setLayout(new RowLayout());
64
		this.setLayout(new RowLayout());
Line 57... Line 65...
57
		iMediateur = im ;
65
		iMediateur = im ;
58
		
66
		
Line 59... Line 67...
59
		arbreMotsCles = new TreePanel() ;
67
		arbreMotsCles = new TreePanel() ;
60
		arbreMotsCles.setEnableDD(true) ;
68
		arbreMotsCles.setEnableDD(true) ;
61
		
69
		
62
		TreeNode root = new TreeNode("Mots clés") ;
70
		TreeNode root = new TreeNode("Tags") ;
Line 63... Line 71...
63
		root.setId("racine") ;
71
		root.setId("racine") ;
64
		String[] usObject = {"Mots clés" , "racine" } ;
72
		String[] usObject = {"Mots clés" , "racine" } ;
65
		root.setUserObject(usObject) ;
73
		root.setUserObject(usObject) ;
Line 66... Line 74...
66
		
74
		
67
		arbreMotsCles.setRootNode(root) ;
75
		arbreMotsCles.setRootNode(root) ;
68
		arbreMotsCles.setRootVisible(true) ;
76
		arbreMotsCles.setRootVisible(false) ;
69
		arbreMotsCles.getRootNode().setIcon("tela.png") ;
77
		arbreMotsCles.getRootNode().setIcon("tela.png") ;
70
		
78
		
71
		tfEdit = new TextField() ;
79
		tfEdit = new TextField() ;
Line 72... Line 80...
72
		te = new TreeEditor(arbreMotsCles,tfEdit) ;
80
		te = new TreeEditor(arbreMotsCles,tfEdit) ;
-
 
81
		valider = new Button("Appliquer") ;
73
		valider = new Button("Appliquer") ;
82
		arbreMotsCles.add(te) ;
Line 74... Line 83...
74
		arbreMotsCles.add(te) ;
83
		this.add(arbreMotsCles,new RowLayoutData("90%")) ;
Line 75... Line 84...
75
		this.add(arbreMotsCles,new RowLayoutData("90%")) ;
84
		this.add(valider,new RowLayoutData("10%")) ;
Line 155... Line 164...
155
			{
164
			{
156
				GetIMediateur().deplacerMotCleDansArbre(node, getArbreMotsCles().getTree()) ;
165
				GetIMediateur().deplacerMotCleDansArbre(node, getArbreMotsCles().getTree()) ;
157
			}
166
			}
Line 158... Line -...
158
 
-
 
159
 
167
 
Line 160... Line 168...
160
			
168
 
161
			public void onCheckChange(TreeNode node, boolean checked) {
169
			public void onCheckChange(TreeNode node, boolean checked) {
162
				
170
				
Line 172... Line 180...
172
							return true ;
180
							return true ;
173
						}
181
						}
174
					}) ;
182
					}) ;
175
				}
183
				}
176
			}
184
			}
177
		}) ;
-
 
Line -... Line 185...
-
 
185
			
Line 178... Line 186...
178
		
186
		}) ;
Line 179... Line 187...
179
		
187
		
Line 205... Line 213...
205
			}
213
			}
206
		}) ;
214
		}) ;
Line 207... Line 215...
207
		
215
		
Line -... Line 216...
-
 
216
	}
-
 
217
	
-
 
218
	public void obtenirArbreMotsCles() {
-
 
219
		
-
 
220
		GetIMediateur().obtenirArbreMotsCles(this) ;
-
 
221
		
-
 
222
	}
208
	}
223
 
209
	
224
 
-
 
225
	public void supprimerNoeud(TreeNode n)
-
 
226
	{
-
 
227
		
210
	public void supprimerNoeud(TreeNode n)
228
		if(!n.getId().equals(getArbreMotsCles().getRootNode().getId()))
211
	{
229
		{
212
		n.getParentNode().removeChild(n);
230
			n.getParentNode().removeChild(n);
213
		n.destroy() ;
231
			n.destroy() ;
-
 
232
			GetIMediateur().supprimerMotCleDansArbre(n, arbreMotsCles.getTree()) ;
-
 
233
		}
-
 
234
		else
-
 
235
		{
-
 
236
			Window.alert("Impossible de supprimer la racine de l'arbre") ;
Line 214... Line 237...
214
		GetIMediateur().supprimerMotCleDansArbre(n, arbreMotsCles.getTree()) ;
237
		}
215
	}
238
	}
Line 216... Line 239...
216
	
239
	
Line 243... Line 266...
243
		}
266
		}
244
	}
267
	}
Line 245... Line 268...
245
	
268
	
246
	public void cocherMotsCles(final String[] motsClesIds)
269
	public void cocherMotsCles(final String[] motsClesIds)
-
 
270
	{
-
 
271
		if(getArbreMotsCles() != null && getArbreMotsCles().getRootNode() != null)
247
	{
272
		{
Line 248... Line 273...
248
		getArbreMotsCles().getRootNode().cascade(new NodeTraversalCallback() {
273
			getArbreMotsCles().getRootNode().cascade(new NodeTraversalCallback() {
Line 249... Line 274...
249
 
274
	
Line 265... Line 290...
265
				return true;
290
						return true;
266
			}
291
				}
Line 267... Line 292...
267
			
292
				
268
		}) ;
293
			}) ;
-
 
294
		}
Line 269... Line 295...
269
	}
295
	}
270
	
296
	
Line 271... Line 297...
271
	public void rafraichir(Object nouvelleDonnees,
297
	public void rafraichir(Object nouvelleDonnees,
272
			boolean repandreRafraichissement) {
298
			boolean repandreRafraichissement) {
273
		
299
		
-
 
300
		if(nouvelleDonnees instanceof Tree)
274
		if(nouvelleDonnees instanceof Tree)
301
		{
-
 
302
				Tree nouvelArbre = (Tree)nouvelleDonnees ;
-
 
303
				
-
 
304
					getArbreMotsCles().getRootNode().appendChild(nouvelArbre.getRootNode()) ;
-
 
305
					getArbreMotsCles().expandAll() ;
-
 
306
					estInstancie = true ;
-
 
307
					
-
 
308
					if(motsCleInitialises == false && motsClesEnAttente != null)
-
 
309
					{
275
		{
310
						cocherMotsCles(motsClesEnAttente) ;
Line 276... Line 311...
276
			Tree nouvelArbre = (Tree)nouvelleDonnees ;
311
						motsCleInitialises = true ; 
277
			getArbreMotsCles().setRootNode(nouvelArbre.getRootNode()) ;
312
					}
-
 
313
		}
-
 
314
		
278
		}
315
		if(nouvelleDonnees instanceof String[])
279
		
316
		{
-
 
317
			if(estInstancie && nouvelleDonnees != null)
-
 
318
			{
-
 
319
				String[] motsClesIds = (String[])nouvelleDonnees ;		
-
 
320
				cocherMotsCles(motsClesIds) ;
-
 
321
				
-
 
322
			}
280
		if(nouvelleDonnees instanceof String[])
323
			else
Line 281... Line 324...
281
		{
324
			{
Line 282... Line 325...
282
			String[] motsClesIds = (String[])nouvelleDonnees ;
325
				motsClesEnAttente = (String[])nouvelleDonnees ;