Please Help me for right click delete in Treetable....Help me please

hey Guys Help me
I want right click menu in which add and delete option…
when i right click on parent name or down arrow than i will get delete option which delete that entry from database.
I can write database Query but I cant find way to Get Item ID of particular clicked item ???
can anybody help me ?
Please check my code and Image Attached at down of post…Image at Down Post…
and Reply Solution as soon as possible,here

thank you

public class Testone extends verticalLayout implements
private static final long serialVersionUID = 1L;

protected static final String NAME_PROPERTY = “Prenom”;

protected static final String Parent_PROPERTY = “parent”;
protected static final String Nom_PROPERTY = “Nom”;
protected static final String Type_PROPERTY = “Type”;

protected final TreeTable treetable;

public usermanagement(String Titre, Main slice) throws Exception {
super(“User Managment”, slice, false);

// Create the treetable
treetable = new TreeTable();


// Add Table columns
treetable.addContainerProperty(NAME_PROPERTY, String.class, “”);
treetable.addContainerProperty(Nom_PROPERTY, String.class, “”);
treetable.addContainerProperty(Parent_PROPERTY, String.class, “”);

Statement requete = MySQL.creeRequete();

String request = “select * from personne ,enfant where personne.login=enfant.login”;

final ResultSet resultat = requete.executeQuery(request);

try {
while (

// Populate table
Object parent = treetable.addItem(new Object { resultat.getString(“parent”),resultat.getString(“nom”),null,resultat.getString(“type”) }, null);
Object child = treetable.addItem(new Object {resultat.getString(“login”),resultat.getString(“nom”),resultat.getString(“parent”),resultat.getString(“genre”) }, null);

// Set hierarchy
treetable.setParent(child, parent);

// Expand all
treetable.setCollapsed(parent, true);
//treetable.setCollapsed(year2010, false);

final Action ACTION_Delete = new Action(“Delete”);
final Action ACTION_Add = new Action(“add”);

final Action ACTIONS = new Action
{ ACTION_Delete, ACTION_Add };

// Actions (a.k.a context menu)
treetable.addActionHandler(new Action.Handler() {
public Action getActions(Object target, Object sender) {
return ACTIONS;

public void handleAction(Action action, Object sender, Object target) {

System.out.print(“you click on red”+treetable.getItem(treetable.getValue()));
System.out.print(“you click on red”+treetable.getCaption());

//Do something when the user chooses a item from the popup menu.


catch (Exception e) {
System.out.println("pas d’enfants pour " );

public void buttonClick(ClickEvent event) {
// TODO Auto-generated method stub

public void valueChange(ValueChangeEvent event) {
// TODO Auto-generated method stub


12400.bmp (1.02 MB)