
net.watchee.PoiAttribConfig=function(id){this.id=id;this.row=-1;this.label="";this.type="string";this.editable=false;this.defaultValue="";this.list="";this.flag="";}
net.watchee.PoiAttribConfig.prototype.getId=function(){return this.id;}
net.watchee.PoiAttribConfig.prototype.setId=function(id){this.id=id||null;}
net.watchee.PoiAttribConfig.prototype.getRow=function(){return this.row;}
net.watchee.PoiAttribConfig.prototype.setRow=function(row){this.row=row;}
net.watchee.PoiAttribConfig.prototype.getLabel=function(){return this.label;}
net.watchee.PoiAttribConfig.prototype.setLabel=function(label){this.label=label||"";}
net.watchee.PoiAttribConfig.prototype.getType=function(){return this.type;}
net.watchee.PoiAttribConfig.prototype.setType=function(type){this.type=type||net.watchee.PoiAttribConfig.STRING;}
net.watchee.PoiAttribConfig.prototype.getEditable=function(){return this.editable;}
net.watchee.PoiAttribConfig.prototype.setEditable=function(editable){if(editable===undefined||editable==null)
this.editable=false;else
this.editable=editable;}
net.watchee.PoiAttribConfig.prototype.isEditable=function(){return this.editable;}
net.watchee.PoiAttribConfig.prototype.getValue=function(){return this.defaultValue;}
net.watchee.PoiAttribConfig.prototype.getDefaultValue=function(){return this.defaultValue;}
net.watchee.PoiAttribConfig.prototype.setDefaultValue=function(defaultValue){this.defaultValue=defaultValue;}
net.watchee.PoiAttribConfig.prototype.setValue=function(value){this.defaultValue=value;}
net.watchee.PoiAttribConfig.prototype.getList=function(){return this.list;}
net.watchee.PoiAttribConfig.prototype.setList=function(list){this.list=list;}
net.watchee.PoiAttribConfig.prototype.getFlag=function(){return this.flag;}
net.watchee.PoiAttribConfig.prototype.setFlag=function(flag){this.flag=flag;}
net.watchee.PoiAttribConfig.prototype.setFlagPair=function(key,value){this.flag=null;this.addFlagPair(key,value);}
net.watchee.PoiAttribConfig.prototype.addFlag=function(flag){if(this.flag==null||this.flag.length==0){this.flag=flag;}
else{this.flag+=";"+flag;}}
net.watchee.PoiAttribConfig.prototype.addFlagPair=function(key,value){var key=key||null;var value=value||"true";var pair=key+":"+value;this.addFlag(pair);}
net.watchee.PoiAttribConfig.prototype.toCSV=function(){var csv="";csv+="id="+this.getId();if(this.getRow()>=0){csv+=",";csv+="row="+this.getRow();}
if(this.getLabel()!=null&&this.getLabel().length>0){csv+=",";csv+="label="+org.xmlBlaster.util.escapeCsvValue(this.getLabel());}
csv+=",";csv+="type="+this.getType();csv+=",";csv+="editable="+this.getEditable();if(this.getDefaultValue()!=null&&this.getDefaultValue().length>0){csv+=",";csv+="value="+org.xmlBlaster.util.escapeCsvValue(this.getDefaultValue());}
if(this.getList()!=null&&this.getList().length>0){csv+=",";csv+="list="+org.xmlBlaster.util.escapeCsvValue(this.getList());}
if(this.getFlag()!=null&&this.getFlag().length>0){csv+=",";csv+="flag="+this.getFlag();}
return csv;}
net.watchee.PoiAttribConfig.parseCSV=function(csv,localeId){var localeId=localeId||"";var hash=org.xmlBlaster.util.Hashtable.parseCSV(csv);var id=hash.get("id");var poiAttribConfig=new net.watchee.PoiAttribConfig(id);poiAttribConfig.row=hash.getNumber("row",poiAttribConfig.row);var tmp=org.xmlBlaster.util.unescapeCsvValue(poiAttribConfig.label);poiAttribConfig.label=hash.getLocaleSpecific("label",tmp,localeId);poiAttribConfig.type=hash.get("type",poiAttribConfig.type);poiAttribConfig.editable=hash.getBoolean("editable",poiAttribConfig.editable);poiAttribConfig.defaultValue=org.xmlBlaster.util.unescapeCsvValue(hash.get("value",poiAttribConfig.defaultValue));poiAttribConfig.flag=hash.get("flag",poiAttribConfig.flag);if(poiAttribConfig.type=="list")poiAttribConfig.list=org.xmlBlaster.util.unescapeCsvValue(hash.get("list",poiAttribConfig.list));return poiAttribConfig;}
net.watchee.PoiAttribConfig.parseCSVLines=function(csvLines){var attribConfigHashtable=new org.xmlBlaster.util.Hashtable();var lines=org.xmlBlaster.util.trim(csvLines).split("\n");for(var i=0,l=lines.length;i<l;i++){var poiAttribConfig=net.watchee.PoiAttribConfig.parseCSV(lines[i]);attribConfigHashtable.put(poiAttribConfig.id,poiAttribConfig);}
return attribConfigHashtable;}
net.watchee.PoiAttribConfig.STRING="string";net.watchee.PoiAttribConfig.HTML="html";net.watchee.PoiAttribConfig.DATE="date";net.watchee.PoiAttribConfig.TIME="time";net.watchee.PoiAttribConfig.INT="int";net.watchee.PoiAttribConfig.FLOAT="float";net.watchee.PoiAttribConfig.BOOL="bool";net.watchee.PoiAttribConfig.LIST="list";net.watchee.PoiAttribConfig.IMAGE="image";net.watchee.PoiAttribConfig.AUDIO="audio";net.watchee.PoiAttribConfig.BARCODE="barcode";net.watchee.PoiAttribConfig.SIGNATURE="signature";net.watchee.PoiAttribConfig.MAP="map";net.watchee.PoiConfig=function(namespaceStr,containerId,menuLabel){this.namespaceStr=namespaceStr;this.containerId=containerId;this.menuLabel=menuLabel||"";this.containerTitle="";this.icon="";this.attribConfigHashtable=null;}
net.watchee.PoiConfig.inputConfigSeperatedByNewLine=false;net.watchee.PoiConfig.prototype.getNamespaceStr=function(){return this.namespaceStr;}
net.watchee.PoiConfig.prototype.getContainerId=function(){return this.containerId;}
net.watchee.PoiConfig.prototype.getMenuLabel=function(defaultValue){return(this.menuLabel=="")?defaultValue:this.menuLabel;}
net.watchee.PoiConfig.prototype.getContainerTitle=function(defaultValue){return(this.containerTitle=="")?defaultValue:this.containerTitle;}
net.watchee.PoiConfig.prototype.getIcon=function(){return this.icon;}
net.watchee.PoiConfig.prototype.getIconWithPath=function(){return net.watchee.STATIC_ICON_URL_PATH+this.getIcon();}
net.watchee.PoiConfig.prototype.getPoiAttribConfigArr=function(){return this.attribConfigHashtable.getValues();}
net.watchee.PoiConfig.prototype.addPoiAttribConfig=function(id,label,type,editable){var poiAttribConfig=new net.watchee.PoiAttribConfig(id);poiAttribConfig.setLabel(label);poiAttribConfig.setType(type);poiAttribConfig.setEditable(editable);this.attribConfigHashtable.put(poiAttribConfig.id,poiAttribConfig);}
net.watchee.PoiConfig.prototype.getPoiAttribArr=function(key){var poiAttribConfigArr=this.attribConfigHashtable.getValues();var arr=new Array();for(var i=0,l=poiAttribConfigArr.length;i<l;++i){var poiAttribConfig=poiAttribConfigArr[i];if(poiAttribConfig.getId()==net.watchee.PoiAttribConfig.MAP){continue;}
if(poiAttribConfig.hasOwnProperty(key)){arr.push(poiAttribConfig[key])}else{arr.push(null);}}
return arr;}
net.watchee.PoiConfig.prototype.getIdArr=function(){return this.getPoiAttribArr("id");}
net.watchee.PoiConfig.prototype.getLabelArr=function(){return this.getPoiAttribArr("label");}
net.watchee.PoiConfig.prototype.getTypeArr=function(){return this.getPoiAttribArr("type");}
net.watchee.PoiConfig.prototype.getEditableArr=function(){return this.getPoiAttribArr("editable");}
net.watchee.PoiConfig.prototype.getListArr=function(index){var list=this.getPoiAttribArr("list");var listArr=list[index].split(";");return listArr;}
net.watchee.PoiConfig.prototype.getPoiAttribConfig=function(id){var poiAttribConfig=this.attribConfigHashtable.get(id,null);return poiAttribConfig;}
net.watchee.PoiConfig.prototype.getLabelFromId=function(id){var poiAttribConfig=this.attribConfigHashtable.get(id,null);if(poiAttribConfig!=null){var label=poiAttribConfig.getLabel();if(label.length>0)return label;}
return id;}
net.watchee.PoiConfig.prototype.getFromId=function(id,key,defaultValue){var defaultValue=defaultValue||null;var key=key||null;if(key==null)
return defaultValue;var poiAttribConfig=this.attribConfigHashtable.get(id,null);if(poiAttribConfig!=null){if(poiAttribConfig.hasOwnProperty(key)){var ret=poiAttribConfig[key];return ret;}}
return defaultValue;}
net.watchee.PoiConfig.prototype.toPropertyCollection=function(){return null;}
net.watchee.PoiConfig.parsePropertyCollection=function(propertyCollection){var setContainerValue=propertyCollection.getStr("setContainerValue");var setContainerValueHash=org.xmlBlaster.util.Hashtable.parseCSV(setContainerValue);var namespaceStr=setContainerValueHash.get("namespace","");var containerId=setContainerValueHash.get("containerId");var poiConfig=new net.watchee.PoiConfig(namespaceStr,containerId);poiConfig.menuLabel=setContainerValueHash.get("label",poiConfig.menuLabel);poiConfig.containerTitle=setContainerValueHash.get("containerTitle",poiConfig.containerTitle);poiConfig.icon=setContainerValueHash.get("icon",poiConfig.icon);var addInputControl=propertyCollection.getStr("addInputControl");if(addInputControl!=null){poiConfig.attribConfigHashtable=net.watchee.PoiAttribConfig.parseCSVLines(addInputControl);}
else{var propertyPairArr=propertyCollection.getStartsWith("addInputControl:");poiConfig.attribConfigHashtable=new org.xmlBlaster.util.Hashtable();for(var i=0,l=propertyPairArr.length;i<l;i++){var propertyPair=propertyPairArr[i];var csv=propertyPair.getValue();var poiAttribConfig=net.watchee.PoiAttribConfig.parseCSV(csv);poiConfig.attribConfigHashtable.put(poiAttribConfig.id,poiAttribConfig);}}
return poiConfig;}
net.watchee.PoiConfigManager=function(){this.poiConfigHashtable=new org.xmlBlaster.util.Hashtable();}
net.watchee.PoiConfigManager.prototype.addPoiConfig=function(poiConfig){this.poiConfigHashtable.put(poiConfig.getContainerId(),poiConfig);}
net.watchee.PoiConfigManager.prototype.getPoiConfigArr=function(){return this.poiConfigHashtable.getValues();}
net.watchee.PoiConfigManager.prototype.getPoiConfig=function(containerId){return this.poiConfigHashtable.get(containerId,null);}
