All Downloads are FREE. Search and download functionalities are using the official Maven repository.

butor.js.butor-panels.js Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2013-2018 butor.com
 *
 * Licensed 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.
 */
butor = butor || {};

/**
 * @namespace butor.panel
 */
butor.panel = butor.panel || {};

/**
 * @class MsgPanel
 * @memberof butor.panel
 * @description Displays messages in the application UI (by default: **on the top**).
 *
 * The msgPanel open a panel on the top of its parent.
 * It is widely used in the butor framework to display info, warning and error message dedicated to the user.
 * Some properties of the panel can be edited before showing it :
 * {@link butor.panel.MsgPanel#setPosition position},
 * {@link butor.panel.MsgPanel#setDelay delay} and
 * {@link butor.panel.MsgPanel#setErrorDelay errorDelay}.
 *
 * @param {Object} parent - Parent panel of this one.
 * @param {Number} width - Width of the panel.
 * @param {Number} top - Top position of the panel.
 * @param {Number} bundleID - ID of the bundle linked with the panel.
 *
 * @example
 * var panel = new butor.panel.MsgPanel($('body'), '400px', '100px');
 */
butor.panel.MsgPanel = butor.panel.MsgPanel || butor.Class.define({
	_parent: null,
	_autoHideTimer: null,
	_appId: null,
	_panel: null,
	_close: null,
	_sign: null,
	_strong: null,
	_msg: null,
	_errorDelay: 12000,
	_delay: 9000,
	construct: function(parent, width, top, appId) {
		this.base();
		this._parent = parent || $('body');
		this._appId = appId;
		this._panel = $(
			'