com.googlecode.wicket.kendo.ui.console.Console Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.googlecode.wicket.kendo.ui.console;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.model.IModel;
/**
* Provides a Kendo UI console widget
* Note about the capacity: the capacity allows to define a maximum number of messages.
* Elder messages will be automatically removed from the model object on insertion.
* However, this is only reflected when the component is (re-)rendered ({@link #onBeforeRender()} has to be invoked)
*
* @author Sebastien Briquet - sebfz1
*/
public class Console extends AbstractConsole
{
private static final long serialVersionUID = 1L;
/**
* Constructor with a default capacity ({@link ConsoleMessages#CAPACITY})
*
* @param id the markup id
*/
public Console(String id)
{
super(id);
}
/**
* Constructor
*
* @param id the markup id
* @param capacity the max capacity
*/
public Console(String id, int capacity)
{
super(id, capacity);
}
/**
* Constructor
*
* @param id the markup id
* @param model the {@link ConsoleMessages} model
*/
public Console(String id, IModel model)
{
super(id, model);
}
// Method //
/**
* Helper method that logs an info message
*
* @param message the message to log
*/
public void info(String message)
{
this.log(message, false);
}
/**
* Helper method that logs an info message
*
* @param message the message to log
* @param target the {@link AjaxRequestTarget}
*/
public void info(String message, AjaxRequestTarget target)
{
this.info(message);
target.appendJavaScript(this.consoleBehavior.$(message, false));
}
/**
* Helper method that logs an error message
*
* @param message the message to log
*/
public void error(String message)
{
this.log(message, true);
}
/**
* Helper method that logs an error message
*
* @param message the message to log
* @param target the {@link AjaxRequestTarget}
*/
public void error(String message, AjaxRequestTarget target)
{
this.error(message);
target.appendJavaScript(this.consoleBehavior.$(message, true));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy