I've used an anon inner class to get a button obj:
Button modButton = new Button("Modify");
modButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
//TODO: link to a pop-up, and do a refresh on exit
}
});
I want to use this in an arbitrarily sized GWT FlexTable (which is basically an auto re-sizing table).
if i do something like this:
currentTable.setText(3, 0, "elec3");
currentTable.setWidget(3, 2, modButton);
currentTable.setText(4, 0, "elec4");
currentTable.setWidget(4, 2, modButton);
The button only shows up for the latter one (since there is only one instance). Since the table above will be populated programatically, its not really practical to define a new button for each possible instance.
I tried this the following:
currentTable.setText(4, 0, "elec4");
currentTable.setWidget(4, 2, new Button("Modify");
modButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
//TODO: link to a pop-up, and do a refresh on exit
}
});
);
However, this won't compile at all (the first; I guess), I'm a bit lost - how can I accomplish this effect?
Thanks