9,6 → 9,7 |
import com.google.gwt.core.client.JavaScriptObject; |
import com.google.gwt.user.client.Window; |
import com.gwtext.client.core.EventObject; |
import com.gwtext.client.core.ExtElement; |
import com.gwtext.client.data.Node; |
import com.gwtext.client.data.NodeTraversalCallback; |
import com.gwtext.client.data.Tree; |
19,10 → 20,13 |
import com.gwtext.client.widgets.Button; |
import com.gwtext.client.widgets.Component; |
import com.gwtext.client.widgets.Container; |
import com.gwtext.client.widgets.Editor; |
import com.gwtext.client.widgets.Panel; |
import com.gwtext.client.widgets.event.ButtonListener; |
import com.gwtext.client.widgets.event.ButtonListenerAdapter; |
import com.gwtext.client.widgets.event.EditorListener; |
import com.gwtext.client.widgets.event.EditorListenerAdapter; |
import com.gwtext.client.widgets.form.Field; |
import com.gwtext.client.widgets.form.TextField; |
import com.gwtext.client.widgets.layout.RowLayout; |
import com.gwtext.client.widgets.layout.RowLayoutData; |
43,6 → 47,8 |
private TextField tfEdit = null ; |
private Button valider = null ; |
private String motsClesEnCours = "" ; |
private boolean ajoutNoeud = false ; |
private boolean modifNoeud = false ; |
|
public ArbreMotsClesVue(ImageMediateur im) |
{ |
64,7 → 70,7 |
|
tfEdit = new TextField() ; |
te = new TreeEditor(arbreMotsCles,tfEdit) ; |
valider = new Button("OK") ; |
valider = new Button("Appliquer") ; |
arbreMotsCles.add(te) ; |
this.add(arbreMotsCles,new RowLayoutData("90%")) ; |
this.add(valider,new RowLayoutData("10%")) ; |
105,6 → 111,7 |
|
public void onClick(TreeNode node, EventObject e) { |
|
e.stopEvent() ; |
gererClicNoeud(node); |
} |
|
118,18 → 125,39 |
|
public void onDblClick(TreeNode node, EventObject e) { |
|
modifNoeud = true ; |
te.startEdit(node); |
} |
|
public void onTextChange(TreeNode node, String text, String oldText) { |
|
|
TreeNode nd = node ; |
String[] usObject = new String[2] ; |
usObject[0] = text ; |
usObject[1] = ((String[])node.getUserObject())[1] ; |
node.setUserObject(usObject) ; |
usObject[1] = ((String[])nd.getUserObject())[1] ; |
nd.setUserObject(usObject) ; |
|
if(ajoutNoeud) |
{ |
GetIMediateur().ajouterMotCleDansArbre(nd,getArbreMotsCles().getTree()) ; |
ajoutNoeud = false ; |
} |
else |
{ |
modifNoeud = false ; |
GetIMediateur().modifierMotCleDansArbre(nd,getArbreMotsCles().getTree()) ; |
} |
|
} |
|
public void onMoveNode(Tree tree, TreeNode node, TreeNode oldParent, TreeNode newParent,int index) |
{ |
GetIMediateur().deplacerMotCleDansArbre(node, getArbreMotsCles().getTree()) ; |
} |
|
|
|
public void onCheckChange(TreeNode node, boolean checked) { |
|
if(checked) |
148,6 → 176,7 |
} |
}) ; |
|
|
valider.addListener(new ButtonListenerAdapter() { |
|
public void onClick(Button button, EventObject e) { |
172,7 → 201,7 |
|
}); |
|
GetIMediateur().mettreAjourMotsCles(motsClesEnCours) ; |
GetIMediateur().mettreAjourMotsCles(motsClesEnCours,arbreMotsCles.getTree()) ; |
} |
}) ; |
|
182,10 → 211,13 |
{ |
n.getParentNode().removeChild(n); |
n.destroy() ; |
GetIMediateur().supprimerMotCleDansArbre(n, arbreMotsCles.getTree()) ; |
} |
|
public void ajouterNoeud(TreeNode parent) |
{ |
|
ajoutNoeud = true ; |
TreeNode nd = new TreeNode(""); |
nd.setIcon("tela.png") ; |
nd.setChecked(true); |
203,11 → 235,11 |
{ |
if(node.getUI().isChecked()) |
{ |
node.setChecked(false) ; |
node.getUI().toggleCheck(false) ; |
} |
else |
{ |
node.setChecked(true) ; |
node.getUI().toggleCheck(true) ; |
} |
} |
|
237,7 → 269,7 |
} |
|
public void rafraichir(Object nouvelleDonnees, |
boolean repandreRaffraichissement) { |
boolean repandreRafraichissement) { |
|
if(nouvelleDonnees instanceof Tree) |
{ |