how to remove notification?

The only way I see now is to Reflect on this:

private LinkedList<Notification> notifications;

and remove the desired notification (or all)

Thoughts?

What notifications are you talking about? From where is that piece of code taken? What is the current behavior and what is the behavior that you want?

any

getWindow().showNotification(notification);

goes to

 public void showNotification(Notification notification) {
        addNotification(notification);
    }

facade in the Window class, which delegates to itself

private void addNotification(Notification notification) {
        if (notifications == null) {
            notifications = new LinkedList<Notification>();
        }
        notifications.add(notification);
        requestRepaint();
    }

where we can notice this

 notifications.add(notification);

which is declared like this

private LinkedList<Notification> notifications;


There isn’t a remove functionality.

It could also use a setImmediate(false) functionality as I explain below.

Basicly something like:

public void removeNotification(notification){
        notifications.remove(notification);
        requestRepaint();
}

would’ve probably been sufficient.

My use case is this (
I need to be able to remove notifications on demand, not just delay and user click
):

One logical functionality can be done; the ability to setImmediate(false), such as the request to remove the notification doesn’t leave to the client but in the next response.
I’m not familiar with Vaadin terminal, but it could use a queue/buffer with non-immediate components that wait for a response to get to the client.

private void signUp() {

		String _username = (String) username.getValue();
		String _email = (String) email.getValue();
		String _password = (String) password.getValue();
		String _passwordVerification = (String) passwordVerification.getValue();

		StringBuffer description = new StringBuffer();

		if (_password.length() < Cache.MIN_PASSWORD_LENGTH) {
			description.append(Lang.getMessage("PASSWORD_TOO_SMALL"));
		} else if (!_password.equals(_passwordVerification))
			description.append(Lang.getMessage("PASSWORD_MISSMATCH"));

		if (_username.length() < Cache.MIN_USERNAME_LENGTH)
			description.append(Lang.getMessage("USERNAME_TOO_SMALL"));
		else if (UsersManager.userExists(_username))
			description.append(Lang.getMessage("USERNAME_IN_USE"));

		if (_email.length() < Cache.MIN_EMAIL_LENGTH)
			description.append(Lang.getMessage("EMAIL_TOO_SMALL"));
		else if (UsersManager.userExists(_username))
			description.append(Lang.getMessage("EMAIL_IN_USE"));
		// TODO: do email regex check

		if (description.length() != 0) {
			Window.Notification notification = new Window.Notification(
					Lang.getMessage("SIGN_UP_FORM_ERRORS_CAPTION"),
					description.toString(), Notification.TYPE_TRAY_NOTIFICATION);
			notification.setDelayMsec(60000);
			getWindow().showNotification(notification);
			return;
		}

There’s one more functionality that I need that needs that collection exposed:

The ability to know if there’s a notification already open
(to not add duplicates client side, it seems you can stack them up uselessly)

Currently, notifications are a one-way mechanism - the server triggers them on a window and then forgets about them.

You can
create enhancement requests
about these issues if you feel the features would be useful for others as well.