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.
How to delegate Notification message from client class to server class??
I am using server RPC for this delegation but nothing is fired.
step 1 : create server rpc .
public interface UploadServerRpc extends ServerRpc{
public void clicked(String buttonName);
}
step 2 : create connector class
@Connect(UploadComponent.class)
public class UploadComponentConnector extends UploadConnector {
UploadServerRpc rpc = RpcProxy.create(UploadServerRpc.class, this);
public UploadComponentConnector(){
if(getWidget().isSubClick()) {
rpc.clicked(getWidget().getNotificationName());
}
}
}
step 3 : server side class:
public class UploadComponent extends Upload{
private UploadServerRpc srpc = new UploadServerRpc(){
@Override
public void clicked(String name) {
Notification notification = new Notification(name);
UI.getCurrent().getPage().showNotification(notification);
}
};
public UploadComponent() {
registerRpc(srpc);
}
Note : inside VUpload class hanling some restriction itsworking but cannot delegate notification messsage
Nothing happened ....when i clicked vaadin Upload button .
Hi,
Your code looks ok except for one thing: The only potential problem is calling rpc.clicked(...). I assume calling the event handler in the constructor like this is for testing purposes. Are you then sure that the method getWidget().isSubClick() returns true? In general to handle events from a button you need to register an event handler for it. Some tips for developing client-side code: 1) make sure your widgetset is re-compiled before testing 2) Enable superdevmode and use Chrome developer tools to debug the client-side Java code, see https://vaadin.com/book/-/page/clientside.debugging.html.
Best regards,
Pontus