Example usage for com.vaadin.ui Notification DELAY_FOREVER

List of usage examples for com.vaadin.ui Notification DELAY_FOREVER

Introduction

In this page you can find the example usage for com.vaadin.ui Notification DELAY_FOREVER.

Prototype

int DELAY_FOREVER

To view the source code for com.vaadin.ui Notification DELAY_FOREVER.

Click Source Link

Usage

From source file:edu.vserver.exercises.videoMcq.QuestionWindow.java

License:Apache License

/**
 * Sets a Notification about the correctness of the given answer to the browser window.
 * //w  w w. ja  va2s . c  o  m
 * @param question latest answered question.
 */
private void informUser(Question question) {
    if (this.isInformative()) {
        Notification n;
        if (question.isCorrectAnswer()) {
            n = new Notification("CORRECT", Notification.Type.HUMANIZED_MESSAGE);
            n.setIcon(new ThemeResource(SPH_Theme.CORRECT_ICON_48PX));
            n.setStyleName("correctAnswer");
        } else {
            n = new Notification("INCORRECT", Notification.Type.HUMANIZED_MESSAGE);
            n.setIcon(new ThemeResource(SPH_Theme.INCORRECT_ICON_48PX));
            n.setStyleName("incorrectAnswer");
        }
        if (question.containsAnswerDescription()) {
            n.setDescription(question.getAnswerDescription());
            n.setDelayMsec(Notification.DELAY_FOREVER);
        } else {
            n.setDelayMsec(500);
        }
        n.setPosition(com.vaadin.shared.Position.MIDDLE_CENTER);
        n.show(Page.getCurrent());
    }

}