123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- com.cognos.admin.ObjectFactory("com.cognos.admin.widget");
-
- com.cognos.admin.widget.Builder = function (elt,frg){
- if (!elt) throw new Error("You cannot create a J2HTML Table widget without input element");
-
- this.fragment = frg;
- this.table = elt;
- this.publicVariables = {};
- this.recipe = new com.cognos.admin.util.Tools.Recipe();
- this.fragmentRecipe = new com.cognos.admin.util.Tools.Recipe();
- this._initDefaultFunc();
- this.event = new com.cognos.admin.widget.Event(this);
- };
- com.cognos.admin.widget.Builder.VERSION = "0.1.0";
- com.cognos.admin.widget.Builder.prototype = {
-
-
- _initDefaultFunc : function (){
-
- this.recipe.add("table_init","initTable","init");
- this.recipe.add("table_unload","unloadTable","unload");
- this.recipe.add("tooltip","showTooltip","mouseover");
- this.recipe.add("tooltip","showTooltip","focus");
- this.recipe.add("tooltip","hideTooltip","mouseout");
- this.recipe.add("tooltip","hideTooltip","blur");
- this.recipe.add("toggler","toggle","click");
- this.recipe.add("toggler","defaultCursor","init");
- this.recipe.add("checkbox_toggler","toggleCheckbox","click");
- this.recipe.add("all_toggler","toggleAll","click");
- this.recipe.add("all_toggler","defaultCursor","init");
- this.recipe.add("sort_column","sortColumn","keypress");
- this.recipe.add("sort_column","sortColumn","click");
- this.recipe.add("sort_column","mouseOverLink","init");
- this.recipe.add("mask","maskElement","init");
- this.recipe.add("sort_test","sortTest","click");
- this.recipe.add("filter_column","filterColumn","click");
- this.recipe.add("filter_column","initFilter","init");
- this.recipe.enableAction("action");
-
-
-
-
- this.fragmentRecipe.add("fragment","fgmtCreate","fragment.create");
- this.fragmentRecipe.add("fragment","fgmtDestroy","fragment.destroy");
- this.fragmentRecipe.add("fragment","fgmtError","fragment.error");
- this.fragmentRecipe.add("fragment","fgmtRefresh","fragment.refresh");
- this.fragmentRecipe.add("fragment","fgmtResize","fragment.resize");
- this.fragmentRecipe.add("fragment","fgmtLoad","fragment.load");
- this.fragmentRecipe.add("fragment","fgmtUnload","fragment.unload");
- this.fragmentRecipe.add("fragment","fgmtRetrieveBefore","fragment.retrieve.before");
- this.fragmentRecipe.add("fragment","fgmtRetrieveAfter","fragment.retrieve.after");
- this.fragmentRecipe.add("fragment","fgmtTitleChange","fragment.title.change");
- this.fragmentRecipe.add("fragment","fgmtWindowstateChange","fragment.windowstate.change");
- this.fragmentRecipe.add("fragment","fgmtModeChange","fragment.mode.change");
- this.fragmentRecipe.add("fragment","menuSelect","cognos.ui.menu.select");
-
-
- this.fragmentRecipe.add("fragment","cadminFragRefresh","com.cognos.cogadmin.load");
- this.fragmentRecipe.add("fragment","distCadminFragWschange","cogadmin.fragment.windowstate.change");
- this.fragmentRecipe.add("fragment","doAction","cogadmin.fragment.action.execute");
-
- },
-
-
- populateTable : function(){
-
-
- if((!_F_getFragmentByID(this.fragment.id)) || com.cognos.admin.publicParam.evtLoaded[this.fragment.id]) return;
- com.cognos.admin.publicParam.evtLoaded[this.fragment.id] = true;
- var ce = this.event;
- function walk (elt) {
- if (elt){
- if (elt.nodeType == 1) {
- if (elt.getAttribute("cogType")) {
- ce.mountEvent(elt);
- }
-
- if (elt.childNodes){
- var children = elt.childNodes;
- for (var i = 0; i < children.length; i++){
- walk (children[i]);
- }
- }
- }
- }
- };
-
- walk (this.table);
-
-
- for (var obj in com.cognos.admin.extension) {
- this.event.extensionFuncs[obj] = new com.cognos.admin.extension[obj](this.event);
- }
-
-
- ce.unregisterEvent();
- },
-
- addFunction : function (cogType,func,evt,cap){
- var capturing = cap || false;
- var funcName = "function"+com.cognos.admin.util.Tools.uniqueID();
-
- this.add(cogType,funcName,evt,capturing);
-
- if (typeof func == "function")
- this.event.addCogEvent(funcName,func);
- },
-
-
- setPublicVariables : function (vName,vValue){
- if (vName in this.publicVariables)
- throw new Error("Variable "+vName+" has already existed.");
-
- this.publicVariables[vName] = vValue;
- },
-
-
- getPublicVariables : function (vName){
- if (this.publicVariables[vName] != undefined)
- return this.publicVariables[vName];
- else
- return;
- }
- };
|