Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Notify Parent Class from Context menu
I have a following code, how can I notify the Parent class, the EDIT function was selected in MyDataGrid class.
Basically I am creating a context menu and I want to notify the Parent class which context menu Item was selected and on which Table row, how can I create and event to notify the Parent class?
Thank You
Peter.
public class Parent extends Window implements ClickListener {
public Parent() {
MyDataGrid mdg = new MyDataGrid();
addComponent(mdg);
}
}
public class MyDataGrid extends VerticalLayout {
private final Table _table = new Table();
static final Action ACTION_ADD = new Action("Add New");
static final Action ACTION_EDIT = new Action("Edit");
static final Action ACTION_DELETE = new Action("Delete");
static final Action ACTION_CANCEL = new Action("Cancel Menu");
static final Action[] ACTIONS = new Action[]{ACTION_ADD, ACTION_EDIT, ACTION_DELETE, ACTION_CANCEL};
public MyDataGrid() {
addComponent(_table);
_table.addActionHandler(new Action.Handler() {
@Override
public Action[] getActions(Object target, Object sender) {
return ACTIONS;
}
@Override
public void handleAction(Action action, Object sender, Object target) {
if (ACTION_EDIT.equals(action)) {
//
// I want to notify the parent about this event
//
}
_table.requestRepaint();
}
});
}
}