Reputation: 4979
I need to make a simple refresh button for a gui java program I have the button made but its not working properly. I just am not sure what the code needs to be to make the button work. Any help would be really appreciated.I figured the code below
`
refeshButton.addListener(new ButtonListenerAdapter() {
@Override
public void onClick(Button button, EventObject e) {
// Window.alert("text" + button.getText());
if (button.getText().equals("Refresh")) {
sendDataToServ1("Refresh");
}
}
public void sendDataToServ1(String action) {
System.out.println("ACTION :----->" + action);
AsyncCallback<com.viji.example.domain.Record> callback = new AsyncCallback<com.viji.example.domain.Record>() {
@Override
public void onFailure(Throwable caught) {
System.out.println("Failure");
}
public void onSuccess(com.viji.example.domain.Record result) {
CompanySampledetails(result, 1);
}
};
if (action.trim().equals("Refresh")) {
System.out.println("Before Refresh");
dbService.getRecords(callback);
}
}
});
Upvotes: 2
Views: 3683
Reputation: 7061
Warning: The local variable buttonClickListener
is never read.
After you create it, try saying refeshButton.addListener(buttonClickListener);
The method sendDataToServ(String action)
never references its parameter. This is the method called by your listener. Did you mean to call sendDataToServer(String action)
instead? If that's the case, it does practically nothing with its parameter either. All it does it tests action
against the string "Add".
You should try tossing around a liberal amount of logging statements.
Upvotes: 2