Subversion Repositories eFlore/Archives.cel-v2

Rev

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

Rev 27 Rev 28
Line 7... Line 7...
7
import org.tela_botanica.client.modeles.MotsClesAsynchroneDAO;
7
import org.tela_botanica.client.modeles.MotsClesAsynchroneDAO;
Line 8... Line 8...
8
 
8
 
9
import com.google.gwt.core.client.JavaScriptObject;
9
import com.google.gwt.core.client.JavaScriptObject;
10
import com.google.gwt.user.client.Window;
10
import com.google.gwt.user.client.Window;
-
 
11
import com.gwtext.client.core.EventObject;
11
import com.gwtext.client.core.EventObject;
12
import com.gwtext.client.core.ExtElement;
12
import com.gwtext.client.data.Node;
13
import com.gwtext.client.data.Node;
13
import com.gwtext.client.data.NodeTraversalCallback;
14
import com.gwtext.client.data.NodeTraversalCallback;
14
import com.gwtext.client.data.Tree;
15
import com.gwtext.client.data.Tree;
15
import com.gwtext.client.dd.DD;
16
import com.gwtext.client.dd.DD;
16
import com.gwtext.client.dd.DragData;
17
import com.gwtext.client.dd.DragData;
17
import com.gwtext.client.dd.DragDrop;
18
import com.gwtext.client.dd.DragDrop;
18
import com.gwtext.client.widgets.BoxComponent;
19
import com.gwtext.client.widgets.BoxComponent;
19
import com.gwtext.client.widgets.Button;
20
import com.gwtext.client.widgets.Button;
20
import com.gwtext.client.widgets.Component;
21
import com.gwtext.client.widgets.Component;
-
 
22
import com.gwtext.client.widgets.Container;
21
import com.gwtext.client.widgets.Container;
23
import com.gwtext.client.widgets.Editor;
22
import com.gwtext.client.widgets.Panel;
24
import com.gwtext.client.widgets.Panel;
23
import com.gwtext.client.widgets.event.ButtonListener;
25
import com.gwtext.client.widgets.event.ButtonListener;
24
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
26
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-
 
27
import com.gwtext.client.widgets.event.EditorListener;
-
 
28
import com.gwtext.client.widgets.event.EditorListenerAdapter;
25
import com.gwtext.client.widgets.event.EditorListener;
29
import com.gwtext.client.widgets.form.Field;
26
import com.gwtext.client.widgets.form.TextField;
30
import com.gwtext.client.widgets.form.TextField;
27
import com.gwtext.client.widgets.layout.RowLayout;
31
import com.gwtext.client.widgets.layout.RowLayout;
28
import com.gwtext.client.widgets.layout.RowLayoutData;
32
import com.gwtext.client.widgets.layout.RowLayoutData;
29
import com.gwtext.client.widgets.menu.Menu;
33
import com.gwtext.client.widgets.menu.Menu;
Line 41... Line 45...
41
	private TreePanel arbreMotsCles = null ;
45
	private TreePanel arbreMotsCles = null ;
42
	private TreeEditor te = null ;
46
	private TreeEditor te = null ;
43
	private TextField tfEdit = null ;
47
	private TextField tfEdit = null ;
44
	private Button valider = null ;
48
	private Button valider = null ;
45
	private String motsClesEnCours = "" ;
49
	private String motsClesEnCours = "" ;
-
 
50
	private boolean ajoutNoeud = false ;
-
 
51
	private boolean modifNoeud = false ;
Line 46... Line 52...
46
	
52
	
47
	public ArbreMotsClesVue(ImageMediateur im)
53
	public ArbreMotsClesVue(ImageMediateur im)
48
	{
54
	{
49
		super("Mots clés") ;
55
		super("Mots clés") ;
Line 62... Line 68...
62
		arbreMotsCles.setRootVisible(true) ;
68
		arbreMotsCles.setRootVisible(true) ;
63
		arbreMotsCles.getRootNode().setIcon("tela.png") ;
69
		arbreMotsCles.getRootNode().setIcon("tela.png") ;
Line 64... Line 70...
64
		
70
		
65
		tfEdit = new TextField() ;
71
		tfEdit = new TextField() ;
66
		te = new TreeEditor(arbreMotsCles,tfEdit) ;
72
		te = new TreeEditor(arbreMotsCles,tfEdit) ;
67
		valider = new Button("OK") ;
73
		valider = new Button("Appliquer") ;
68
		arbreMotsCles.add(te) ;
74
		arbreMotsCles.add(te) ;
69
		this.add(arbreMotsCles,new RowLayoutData("90%")) ;
75
		this.add(arbreMotsCles,new RowLayoutData("90%")) ;
Line 70... Line 76...
70
		this.add(valider,new RowLayoutData("10%")) ;
76
		this.add(valider,new RowLayoutData("10%")) ;
Line 103... Line 109...
103
	{
109
	{
104
		arbreMotsCles.addListener(new TreePanelListenerAdapter() {
110
		arbreMotsCles.addListener(new TreePanelListenerAdapter() {
Line 105... Line 111...
105
			
111
			
Line -... Line 112...
-
 
112
			public void onClick(TreeNode node, EventObject e) {
106
			public void onClick(TreeNode node, EventObject e) {
113
				
107
				
114
				e.stopEvent() ;
Line 108... Line 115...
108
				gererClicNoeud(node);
115
				gererClicNoeud(node);
Line 116... Line 123...
116
				
123
				
Line 117... Line 124...
117
			}
124
			}
Line -... Line 125...
-
 
125
		
118
		
126
			public void onDblClick(TreeNode node, EventObject e) {
119
			public void onDblClick(TreeNode node, EventObject e) {
127
				
Line 120... Line 128...
120
				
128
				modifNoeud = true ;
-
 
129
				te.startEdit(node);
Line -... Line 130...
-
 
130
			}
121
				te.startEdit(node);
131
			
122
			}
132
			public void onTextChange(TreeNode node, String text, String oldText) {
123
			
133
 
124
			public void onTextChange(TreeNode node, String text, String oldText) {
134
				
-
 
135
				TreeNode nd = node ;
-
 
136
				String[] usObject = new String[2] ;
-
 
137
				usObject[0] = text ;
-
 
138
				usObject[1] = ((String[])nd.getUserObject())[1] ;
-
 
139
				nd.setUserObject(usObject) ;
-
 
140
				
-
 
141
				if(ajoutNoeud)
-
 
142
				{
-
 
143
					GetIMediateur().ajouterMotCleDansArbre(nd,getArbreMotsCles().getTree()) ;
-
 
144
					ajoutNoeud = false ;
-
 
145
				}
Line 125... Line 146...
125
				
146
				else
Line -... Line 147...
-
 
147
				{
-
 
148
					modifNoeud = false ;
-
 
149
					GetIMediateur().modifierMotCleDansArbre(nd,getArbreMotsCles().getTree()) ;
-
 
150
				}
-
 
151
				
-
 
152
			}
-
 
153
			
126
				String[] usObject = new String[2] ;
154
			public void onMoveNode(Tree tree, TreeNode node, TreeNode oldParent, TreeNode newParent,int index)
Line 127... Line 155...
127
				usObject[0] = text ;
155
			{
128
				usObject[1] = ((String[])node.getUserObject())[1] ;
156
				GetIMediateur().deplacerMotCleDansArbre(node, getArbreMotsCles().getTree()) ;
129
				node.setUserObject(usObject) ;
157
			}
Line 146... Line 174...
146
					}) ;
174
					}) ;
147
				}
175
				}
148
			}
176
			}
149
		}) ;
177
		}) ;
Line -... Line 178...
-
 
178
		
150
		
179
		
Line 151... Line 180...
151
		valider.addListener(new ButtonListenerAdapter() {
180
		valider.addListener(new ButtonListenerAdapter() {
Line 152... Line 181...
152
 
181
 
Line 170... Line 199...
170
							return true ;
199
							return true ;
171
					}
200
					}
Line 172... Line 201...
172
					
201
					
Line 173... Line 202...
173
				});
202
				});
174
				
203
				
175
				GetIMediateur().mettreAjourMotsCles(motsClesEnCours) ;
204
				GetIMediateur().mettreAjourMotsCles(motsClesEnCours,arbreMotsCles.getTree()) ;
Line 176... Line 205...
176
			}
205
			}
Line 177... Line 206...
177
		}) ;
206
		}) ;
178
		
207
		
179
	}
208
	}
180
	
209
	
-
 
210
	public void supprimerNoeud(TreeNode n)
181
	public void supprimerNoeud(TreeNode n)
211
	{
Line 182... Line 212...
182
	{
212
		n.getParentNode().removeChild(n);
183
		n.getParentNode().removeChild(n);
213
		n.destroy() ;
-
 
214
		GetIMediateur().supprimerMotCleDansArbre(n, arbreMotsCles.getTree()) ;
-
 
215
	}
184
		n.destroy() ;
216
	
185
	}
217
	public void ajouterNoeud(TreeNode parent)
186
	
218
	{
187
	public void ajouterNoeud(TreeNode parent)
219
		
188
	{
220
		ajoutNoeud = true ;
Line 201... Line 233...
201
	
233
	
202
	public void gererClicNoeud(TreeNode node)
234
	public void gererClicNoeud(TreeNode node)
203
	{
235
	{
204
		if(node.getUI().isChecked())
236
		if(node.getUI().isChecked())
205
		{
237
		{
206
			node.setChecked(false) ;
238
			node.getUI().toggleCheck(false) ;
207
		}
239
		}
208
		else
240
		else
209
		{
241
		{
210
			node.setChecked(true) ;
242
			node.getUI().toggleCheck(true) ;
211
		}
243
		}
Line 212... Line 244...
212
	}
244
	}
213
	
245
	
Line 235... Line 267...
235
			
267
			
236
		}) ;
268
		}) ;
Line 237... Line 269...
237
	}
269
	}
238
	
270
	
Line 239... Line 271...
239
	public void rafraichir(Object nouvelleDonnees,
271
	public void rafraichir(Object nouvelleDonnees,
240
			boolean repandreRaffraichissement) {
272
			boolean repandreRafraichissement) {
241
		
273
		
242
		if(nouvelleDonnees instanceof Tree)
274
		if(nouvelleDonnees instanceof Tree)