Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package de.agilecoders.wicket.core.markup.html.bootstrap.common;
 
 
public class NotificationAlert extends Alert {
    private final Duration duration;
    private Component message;

    
Construct.

Parameters:
markupId The component id
message The feedback message
    public NotificationAlert(final String markupIdfinal FeedbackMessage message) {
        this(markupIdmessage.);
    }

    
Construct.

Parameters:
markupId The component id
message The feedback message
duration amount of time when message should be closed
    public NotificationAlert(final String markupIdfinal FeedbackMessage messagefinal Duration duration) {
        super(markupId, Model.of(""));
        this. = duration;
        this. = Model.of();
        type(Alert.Type.from(message.getLevelAsString()));
        if (message.getMessage() instanceof INotificationMessage) {
            withNotificationMessage((INotificationMessagemessage.getMessage());
        } else {
            withMessage(Model.of(String.valueOf(message.getMessage())));
            hideAfter(duration);
        }
    }

    
sets the notification message

Parameters:
notificationMessage The notification message
Returns:
this instance for chaining.
    private NotificationAlert withNotificationMessage(final INotificationMessage notificationMessage) {
        .setObject(notificationMessage);
        hideAfter(notificationMessage.hideAfter() == null ?  : notificationMessage.hideAfter());
        useInlineHeader(notificationMessage.inlineHeader());
        withHeader(notificationMessage.header());
        withMessage(notificationMessage.message());
        this..setEscapeModelStrings(notificationMessage.escapeModelStrings());
        return this;
    }
    @Override
    protected Component createMessage(String markupIdIModel<Stringmessage) {
        this. = super.createMessage(markupIdmessage);
        return this.;
    }
    @Override
    public void detachModels() {
        super.detachModels();
        .detach();
    }
New to GrepCode? Check out our FAQ X