All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
META-INF.resources.primefaces.panel.panel.js Maven / Gradle / Ivy
/**
* PrimeFaces Panel Widget
*/
PrimeFaces.widget.Panel = PrimeFaces.widget.BaseWidget.extend({
init: function(cfg) {
this._super(cfg);
this.header = this.jq.children('div.ui-panel-titlebar');
this.title = this.header.children('span.ui-panel-title');
this.content = $(this.jqId + '_content');
this.bindEvents();
},
bindEvents: function() {
if(this.cfg.toggleable) {
this.bindToggler();
}
if(this.cfg.closable) {
this.bindCloser();
}
if(this.cfg.hasMenu) {
$(this.jqId + '_menu').on('click.panel', function(e) {
e.preventDefault();
});
}
//visuals for action items
this.header.find('.ui-panel-titlebar-icon').on('mouseover.panel',function() {
$(this).addClass('ui-state-hover');
}).on('mouseout.panel',function() {
$(this).removeClass('ui-state-hover');
}).on('click.panel', function(e) {
e.preventDefault();
});
},
toggle: function() {
if(this.cfg.collapsed) {
this.expand();
PrimeFaces.invokeDeferredRenders(this.id);
}
else {
this.collapse();
}
},
expand: function() {
this.toggleState(false, 'ui-icon-plusthick', 'ui-icon-minusthick');
if(this.cfg.toggleOrientation === 'vertical')
this.slideDown();
else if(this.cfg.toggleOrientation === 'horizontal')
this.slideRight();
},
collapse: function() {
this.toggleState(true, 'ui-icon-minusthick', 'ui-icon-plusthick');
if(this.cfg.toggleOrientation === 'vertical')
this.slideUp();
else if(this.cfg.toggleOrientation === 'horizontal')
this.slideLeft();
},
slideUp: function() {
this.content.slideUp(this.cfg.toggleSpeed, 'easeInOutCirc');
},
slideDown: function() {
this.content.slideDown(this.cfg.toggleSpeed, 'easeInOutCirc');
},
slideLeft: function() {
var _self = this;
this.originalWidth = this.jq.width();
this.title.hide();
this.toggler.hide();
this.content.hide();
this.jq.animate({
width: '42px'
}, this.cfg.toggleSpeed, 'easeInOutCirc', function() {
_self.toggler.show();
_self.jq.addClass('ui-panel-collapsed-h');
});
},
slideRight: function() {
var _self = this,
expandWidth = this.originalWidth||'100%';
this.toggler.hide();
this.jq.animate({
width: expandWidth
}, this.cfg.toggleSpeed, 'easeInOutCirc', function() {
_self.jq.removeClass('ui-panel-collapsed-h');
_self.title.show();
_self.toggler.show();
_self.content.css({
'visibility': 'visible'
,'display': 'block'
,'height': 'auto'
});
});
},
toggleState: function(collapsed, removeIcon, addIcon) {
this.toggler.children('span.ui-icon').removeClass(removeIcon).addClass(addIcon);
this.cfg.collapsed = collapsed;
this.toggleStateHolder.val(collapsed);
this.fireToggleEvent();
},
fireToggleEvent: function() {
if(this.cfg.behaviors) {
var toggleBehavior = this.cfg.behaviors['toggle'];
if(toggleBehavior) {
toggleBehavior.call(this);
}
}
},
close: function() {
if(this.visibleStateHolder) {
this.visibleStateHolder.val(false);
}
var $this = this;
this.jq.fadeOut(this.cfg.closeSpeed,
function(e) {
if($this.cfg.behaviors) {
var closeBehavior = $this.cfg.behaviors['close'];
if(closeBehavior) {
closeBehavior.call($this);
}
}
}
);
},
show: function() {
var $this = this;
$(this.jqId).fadeIn(this.cfg.closeSpeed, function() {
PrimeFaces.invokeDeferredRenders($this.id);
});
this.visibleStateHolder.val(true);
},
bindToggler: function() {
var _self = this;
this.toggler = $(this.jqId + '_toggler');
this.toggleStateHolder = $(this.jqId + '_collapsed');
this.toggler.click(function() {_self.toggle();});
},
bindCloser: function() {
var $this = this;
this.closer = $(this.jqId + '_closer');
this.visibleStateHolder = $(this.jqId + "_visible");
this.closer.click(function(e) {
$this.close();
e.preventDefault();
});
}
});