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

net.sf.xmlform.web.panel.js Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
/*

Author: Liu Zhikun
http://javaxmlform.sourceforge.net/
*/
(function(global,factory){
	if (typeof module !== 'undefined' && typeof exports === 'object' && define.cmd) {
		module.exports = factory();
	} else if (typeof define === 'function' && define.amd) {
		define("xmlform/panel",factory);
	} else {
		global.xmlformPanel = factory();
	}
})(typeof window!=="undefined" ? window:this,function(){
	
var panelObj={};
panelObj.locale="en";
panelObj.loadReference=function(){
	alert("Please provide panel.loadReference=function([{id:,action:,form:,field:,fieldArgs:,valueArgs]){...}");
};
panelObj.getFileUploadUrl=null;
panelObj.getFileDownloadUrl=function(id){return id;};
panelObj.XmlformPanel=function(config){
	/*
	config["xmlformForm"]=xmlform;
	config["xmlformLayout"]=layout;
	setXmlformRecordset:function(recordSet)
	getXmlformRecordset:function()
	*/
};
panelObj.getFormCssCls=function(formName){
	return "xfform-"+formName.toLowerCase().replace(/\./g,"-");
};
panelObj.getFormCaptionCls=function(formName){
	return "xfform-formcaption";
};
panelObj.getFieldCssCls=function(fieldName){
	return "xffield-"+fieldName.toLowerCase();
};
panelObj.getFieldRequiredCls=function(fieldType){
	return "xfrequiredfield";
};
panelObj.getFieldReadonlyCls=function(fieldType){
	return "xfreadonlyfield";
};
panelObj.getFieldInvalidCls=function(fieldType){
	return "xfinvalidfield";
};
panelObj.getRowSeverityCls=function(severity){
	return "xfrowseverity"+severity;
};
panelObj.getFieldSeverityCls=function(severity){
	return "xffieldseverity"+severity;
};
panelObj.getLayoutCssCls=function(cls){
	return cls;
};
panelObj.getTypeHAlign=function(type){
	var align="";
	if(type=="date"||type=="datetime"||type=="yearmonth"||type=="time"||type=="boolean"){
		align="center";
	}else if(type=="byte"||type=="decimal"||type=="double"||type=="float"
		||type=="integer"||type=="int"||type=="long"||type=="short"){
		align="right";
	}else{
		align="left";
	}
	return align;
};

panelObj.getDefaultWidgetParams=function(){
	return {autofirst:"0",autosingle:"1",emptyclean:"1"};
};
panelObj.getInputBestWidth=function(){
	return 150;
};
panelObj.getInputMinWidth=function(){
	return 50;
};
panelObj.getInputBestHeight=function(){
	return 150;
};
panelObj.getGridColWidth=function(){
	return 150;
};
panelObj.getFormHeightByWidth=function(w){
	return w*3/4;
};
panelObj.isFixedTableColumnWidth=function(){
	return false;
};
panelObj.isAutoResizeTableColumnWidth=function(){
	return true;
};
panelObj.isTableCellOverflowEllipsis=function(){
	return false;
};
panelObj.isShowDropDownButtonByFocus=function(){
	return false;
};
panelObj.isSelectTextOnFocus=function(){
	return true;
};
panelObj.isSelectTextOnClick=function(){
	return true;
};
panelObj.isCssStyle=function(name){
	return false;
};
panelObj.findLocale=function(locale,map){
	var m=findLocale(locale,map);
	if(m==null){
		return findLocale("en",map);
	}
	return m;
};
panelObj.createFormFieldWidget=function(param){
	/*
	 * param={
	 * 	form:
	 * 	field:{
	 * 		
	 * 	},
	 * 	widget:{
	 * 		type:
	 * 		
	 * 	}
	 * }
	 */
};
panelObj.createFormSubformWidget=function(param){
	/*
	 * param={
	 * 	form:
	 * 	field:{
	 * 		
	 * 	},
	 * 	widget:{
	 * 		type:
	 * 		
	 * 	}
	 * }
	 */
};

function findLocale(locale,map){
	var ls=locale.split("_");
	var arr=[];
	var len=ls.length;
	for(var i=0;i0){
				str+="_";
			}
			str+=ls[s];
		}
		arr[i]=str;
		len--;
	}
	for(var i=0;i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy