Changeset 1920
- Timestamp:
- 2011-08-03 06:53:07 (10 months ago)
- Location:
- trunk
- Files:
-
- 26 edited
-
modules/kauri-forms/kauri-forms-extra/src/main/kauri/static/autocomplete/js/autocomplete.js (modified) (2 diffs)
-
modules/kauri-forms/kauri-forms-extra/src/main/kauri/static/color/js/color.js (modified) (1 diff)
-
modules/kauri-forms/kauri-forms-extra/src/main/kauri/static/combobox/js/combobox.js (modified) (2 diffs)
-
modules/kauri-forms/kauri-forms-extra/src/main/kauri/static/dblselect/js/dblselect.js (modified) (2 diffs)
-
modules/kauri-forms/kauri-forms-extra/src/main/kauri/static/radioselection/js/radioselection.js (modified) (1 diff)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/basic-controls.js (modified) (5 diffs)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/basic-validators.js (modified) (1 diff)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/case.js (modified) (4 diffs)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/collection.js (modified) (2 diffs)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/composite.js (modified) (2 diffs)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/control.js (modified) (15 diffs)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/date.js (modified) (6 diffs)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/field.js (modified) (1 diff)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/form.js (modified) (1 diff)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/location.js (modified) (1 diff)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/numeric-range.js (modified) (3 diffs)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/registry.js (modified) (1 diff)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/upload.js (modified) (1 diff)
-
modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/validator.js (modified) (2 diffs)
-
modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/load/xdyna.js (modified) (1 diff)
-
modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-date.js (modified) (2 diffs)
-
modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-registry.js (modified) (12 diffs)
-
modules/kauri-jquery/src/main/kauri/static-{build}.key/kauri.util/core.js (modified) (2 diffs)
-
modules/kauri-jquery/src/test/kauri.util/test-core.js (modified) (5 diffs)
-
samples/kauri-tutorial-myblog/main-module/src/main/kauri/static/js/tagcontrol.js (modified) (2 diffs)
-
samples/kauri-tutorial-myblog/tinymce-module/src/main/kauri/static/forms/tinymce.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/kauri-forms/kauri-forms-extra/src/main/kauri/static/autocomplete/js/autocomplete.js
r1771 r1920 15 15 16 16 function AutocompleteControl(id, form, conf) { 17 this['<super.init>'](id, form, conf);17 kf.Control.init(this, id, form, conf); 18 18 } 19 19 … … 24 24 "<input type='text' kauri-role='input'/>" 25 25 }); 26 27 AutocompleteControl.prototype.initType = function(conf) {28 this["<super.call>"]("initType", [conf]);29 30 }31 26 32 27 AutocompleteControl.prototype.initElements = function(create) { -
trunk/modules/kauri-forms/kauri-forms-extra/src/main/kauri/static/color/js/color.js
r1641 r1920 19 19 20 20 function ColorControl(id, form, conf) { 21 this['<super.init>'](id, form, conf);21 kf.Control.init(this, id, form, conf); 22 22 } 23 23 -
trunk/modules/kauri-forms/kauri-forms-extra/src/main/kauri/static/combobox/js/combobox.js
r1680 r1920 23 23 24 24 function ComboboxControl(id, form, conf) { 25 this['<super.init>'](id, form, conf);25 kf.Control.init(this, id, form, conf); 26 26 27 27 this.availableOptions = { … … 55 55 56 56 ComboboxControl.prototype.initType = function(conf) { 57 this["<super.call>"]("initType", [conf]);58 59 57 this.getType().multivalue = false; 60 58 } -
trunk/modules/kauri-forms/kauri-forms-extra/src/main/kauri/static/dblselect/js/dblselect.js
r1818 r1920 34 34 35 35 function DoubleSelectControl(id, form, conf) { 36 this['<super.init>'](id, form, conf);36 kf.Control.init(this, id, form, conf); 37 37 38 38 this.availableOptions = { … … 78 78 79 79 DoubleSelectControl.prototype.initType = function(conf) { 80 this["<super.call>"]("initType", [conf]);81 80 // Force the field type to being multivalue 82 81 this.getType().multivalue = true; -
trunk/modules/kauri-forms/kauri-forms-extra/src/main/kauri/static/radioselection/js/radioselection.js
r1634 r1920 20 20 function RadioSelectionControl( id, form, type) { 21 21 22 this['<super.init>'](id, form, type);22 kf.Control.init(this, id, form, type); 23 23 } 24 24 -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/basic-controls.js
r1918 r1920 28 28 function InputControl( id, form, conf) { 29 29 30 this['<super.init>'](id, form, conf);30 kf.Control.init(this, id, form, conf); 31 31 } 32 32 … … 104 104 function OutputControl( id, form, conf) { 105 105 106 this['<super.init>'](id, form, conf);106 kf.Control.init(this, id, form, conf); 107 107 } 108 108 … … 161 161 function CheckBoxControl( id, form, type) { 162 162 163 this['<super.init>'](id, form, type);163 kf.Control.init(this, id, form, type); 164 164 } 165 165 … … 239 239 function SelectionControl( id, form, type) { 240 240 241 this['<super.init>'](id, form, type);241 kf.Control.init(this, id, form, type); 242 242 } 243 243 … … 391 391 function TextareaControl( id, form, type) { 392 392 393 this['<super.init>'](id, form, type);393 kf.Control.init(this, id, form, type); 394 394 } 395 395 -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/basic-validators.js
r1889 r1920 26 26 // | scheme | :// | user:password @ | ip adrress | 3rd level domain 2nd level domain top level domain | :portnumber | path | 27 27 28 kf.Validator.validateInt = function(me, value) { 29 if (value == undefined) 30 return me.notifySuccess(); 31 32 if (typeof value == 'number') 33 value = new Number(value); 34 35 if (value.constructor != Number || isNaN(value)) 36 return me.notifyFail("i18n:Not a number."); 37 38 var intValueStr = value.toFixed(0); 39 var valueStr = value.toString(); 40 41 if (intValueStr != valueStr) 42 return me.notifyFail("i18n:Not a valid integer!"); 43 44 return me.notifySuccess(); 45 } 46 28 47 validators.putAll( { 29 48 30 49 "isInt" : { 31 50 validate : function( value) { 32 33 if (value == undefined) 34 return this.notifySuccess(); 35 36 if (typeof value == 'number') 37 value = new Number(value); 38 39 if (value.constructor != Number || isNaN(value)) 40 return this.notifyFail("i18n:Not a number."); 41 42 var intValueStr = value.toFixed(0); 43 var valueStr = value.toString(); 44 45 if (intValueStr != valueStr) 46 return this.notifyFail("i18n:Not a valid integer!"); 47 48 return this.notifySuccess(); 51 kf.Validator.validateInt(this, value); 49 52 } 50 53 }, -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/case.js
r1879 r1920 27 27 */ 28 28 function CaseFieldType () { 29 this["<super.init>"]();29 kf.FieldType.init(this); 30 30 } 31 31 … … 127 127 */ 128 128 function CaseControl (id, form, conf) { 129 this["<super.init>"](id, form, conf);129 kf.Control.init(this, id, form, conf); 130 130 } 131 131 … … 207 207 if (includeAll) 208 208 return this._valueControls; 209 return this["<super.call>"]("getChildren");209 return kf.AbstractContainerControl.getChildren(this); 210 210 211 211 } … … 223 223 CaseControl.prototype.getChild = function(id) { 224 224 if (id == "case" || id == "value") { 225 return this["<super.call>"]("getChild", [id]);225 return kf.AbstractContainerControl.getChild(this, id); 226 226 } else if (id.substring(0,CASE_PFX.length)==CASE_PFX) { 227 227 var caseName = id.substring(CASE_PFX.length, id.length); -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/collection.js
r1862 r1920 24 24 * @constructor 25 25 */ 26 26 27 function CollectionFieldType() { 27 this['<super.init>']();28 kf.FieldType.init(this); 28 29 } 29 30 … … 57 58 */ 58 59 function CollectionControl( id, form, conf) { 59 this['<super.init>'](id, form, conf);60 kf.Control.init(this, id, form, conf); 60 61 } 61 62 -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/composite.js
r1597 r1920 26 26 function CompositeFieldType() { 27 27 28 this['<super.init>']();28 kf.FieldType.init(this); 29 29 } 30 30 … … 74 74 function CompositeControl( id, form, conf) { 75 75 76 this['<super.init>'](id, form, conf);76 kf.Control.init(this, id, form, conf); 77 77 } 78 78 -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/control.js
r1879 r1920 876 876 */ 877 877 function Control(id, form, conf){ 878 this._id = id; 879 this._form = form; 878 Control.init(this, id, form, conf); 879 } 880 881 Control.init = function(me, id, form, conf) { 882 me._id = id; 883 me._form = form; 880 884 881 885 if (conf != undefined) 882 this.initialize(conf);886 me.initialize(conf); 883 887 } 884 888 … … 895 899 Control.prototype.initialize = function(conf){ 896 900 897 this. initType(conf);901 this._initType(conf); 898 902 899 903 this.initElementConfigs(); … … 908 912 }; 909 913 914 915 910 916 /** 911 917 * Initializes the 'type' from the configuration object passed in (if that didn't happen yet). … … 913 919 * @final should not be overridden 914 920 */ 915 Control.prototype. initType = function(conf){921 Control.prototype._initType = function(conf){ 916 922 917 923 var type; … … 923 929 } 924 930 this.setType(type); 931 this.initType(); 932 } 933 934 Control.prototype.initType = function(conf){ 925 935 } 926 936 … … 1957 1967 */ 1958 1968 Control.prototype.hide = function(){ 1959 this.eachElement(function() { 1969 Control.hide(this); 1970 } 1971 1972 Control.hide = function(me) { 1973 me.eachElement(function() { 1960 1974 $(this).hide() 1961 1975 }); 1962 this.viewState = Control.STATE_HIDDEN;1976 me.viewState = Control.STATE_HIDDEN; 1963 1977 } 1964 1978 … … 1967 1981 */ 1968 1982 Control.prototype.show = function(){ 1969 this.eachElement(function() { 1983 Control.show(this); 1984 } 1985 1986 Control.show = function (me) { 1987 me.eachElement(function() { 1970 1988 $(this).show() 1971 1989 }); 1972 this.viewState = Control.STATE_VISIBLE;1990 me.viewState = Control.STATE_VISIBLE; 1973 1991 } 1974 1992 … … 1977 1995 */ 1978 1996 Control.prototype.enable = function(){ 1979 this.eachElement(function(){ 1997 Control.enable(this); 1998 } 1999 Control.enable = function(me) { 2000 me.eachElement(function(){ 1980 2001 var el = this; 1981 2002 if (el.is(":disabled")) { … … 1985 2006 }); 1986 2007 1987 this.operationalState = Control.STATE_ENABLED;2008 me.operationalState = Control.STATE_ENABLED; 1988 2009 // If the control isn't in STATE_INIT, we should re-validate to restore validation messages that may have been present when disable() was called 1989 if ( this.valueState != Control.STATE_INIT) {1990 this.newValidation(this.getValue(), this.getWireValue());2010 if (me.valueState != Control.STATE_INIT) { 2011 me.newValidation(me.getValue(), me.getWireValue()); 1991 2012 } 1992 2013 } … … 1996 2017 */ 1997 2018 Control.prototype.disable = function(){ 1998 this.eachElement(function(){ 2019 Control.disable(this); 2020 } 2021 Control.disable = function(me) { 2022 me.eachElement(function(){ 1999 2023 var el = this; 2000 2024 if (el.is(":enabled")) { … … 2004 2028 }); 2005 2029 2006 this.clearMessage();2007 this.updateValidationClasses();2008 this.operationalState = Control.STATE_DISABLED;2030 me.clearMessage(); 2031 me.updateValidationClasses(); 2032 me.operationalState = Control.STATE_DISABLED; 2009 2033 } 2010 2034 … … 2085 2109 function AbstractContainerControl(id, form, conf){ 2086 2110 2087 this['<super.init>'](id, form, conf);2111 Control.init(this, id, form, conf); 2088 2112 } 2089 2113 … … 2145 2169 AbstractContainerControl.prototype.hide = function(){ 2146 2170 this.eachChild(function(i, child){ child.hide();}); 2147 this['<super.call>']('hide');2171 Control.hide(this); 2148 2172 } 2149 2173 2150 2174 AbstractContainerControl.prototype.show = function(){ 2151 2175 this.eachChild(function(i, child){ child.show();}); 2152 this['<super.call>']('show');2176 Control.show(this); 2153 2177 } 2154 2178 2155 2179 AbstractContainerControl.prototype.disable = function() { 2156 2180 this.eachChild(function(i, child){ child.disable();}); 2157 this['<super.call>']('disable');2181 Control.disable(this); 2158 2182 }; 2159 2183 2160 2184 AbstractContainerControl.prototype.enable = function() { 2161 2185 this.eachChild(function(i, child){ child.enable();}); 2162 this['<super.call>']('enable');2186 Control.enable(this); 2163 2187 }; 2164 2188 … … 2398 2422 */ 2399 2423 AbstractContainerControl.prototype.getChildren = function(){ 2400 2401 return this._children; 2424 return AbstractContainerControl.getChildren(this); 2425 } 2426 AbstractContainerControl.getChildren = function(me) { 2427 return me._children; 2402 2428 } 2403 2429 … … 2409 2435 */ 2410 2436 AbstractContainerControl.prototype.getChild = function(id){ 2411 return this._children[id]; 2437 return AbstractContainerControl.getChild(this, id); 2438 } 2439 AbstractContainerControl.getChild = function (me, id) { 2440 return me._children[id]; 2412 2441 } 2413 2442 AbstractContainerControl.prototype.getChildByPathSegment = function(pathSegment){ -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/date.js
r1919 r1920 268 268 minDate : undefined, // minimum date 269 269 maxDate : undefined, // maximum date 270 step : 1, // we're using range as base we have to define steps271 base : "range",272 270 validate : function (value) { 273 271 if ($.isEmpty(value)) … … 277 275 return this.notifyFail(value + " is not a Date Object"); 278 276 279 // set min & max using the amount of millis found in min/maxDate 280 if (this.minDate != undefined && this.minDate.constructor == Date) this.min = this.minDate.getTime(); 281 if (this.maxDate != undefined && this.maxDate.constructor == Date) this.max = this.maxDate.getTime(); 282 283 // use the validate function found in the range base validator to check if the amount of millis 284 // in the date value is between the set min & max. 285 this["<super.call>"]("validate", [value.getTime()]); 277 if (((this.minDate != undefined) && value < this.minDate) || ((this.maxDate != undefined) && value > this.maxDate) ) 278 return this.notifyFail("i18n:Should be between {0} and {1}", [ this.minDate, this.maxDate ]); 279 280 return this.notifySuccess(); 286 281 } 287 282 }, … … 347 342 $.inherit(DateControl, kf.Control); 348 343 function DateControl( id, form, conf) { 349 this['<super.init>'](id, form, conf);344 kf.Control.init(this, id, form, conf); 350 345 } 351 346 … … 426 421 427 422 DateControl.prototype.enable = function(){ 428 this['<super.call>']('enable');423 kf.Control.enable(this); 429 424 if(this.useDatePicker) { 430 425 this.getElement().datepicker("enable"); … … 433 428 434 429 DateControl.prototype.disable = function(){ 435 this['<super.call>']('disable');430 kf.Control.disable(this); 436 431 if(this.useDatePicker) { 437 432 this.getElement().datepicker("disable"); … … 443 438 $.inherit(DateRangeControl, kf.CompositeControl); 444 439 function DateRangeControl( id, container, form, conf) { 445 this['<super.init>'](id, container, form, conf);440 kf.Control.init(this, id, container, form, conf); 446 441 447 442 if (this.forceOrder == undefined) { -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/field.js
r1916 r1920 343 343 */ 344 344 function FieldType() { 345 345 FieldType.init(this); 346 } 347 FieldType.init = function(me) { 346 348 } 347 349 -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/form.js
r1798 r1920 63 63 }); // first trigger to execute. 64 64 65 this['<super.init>'](id, form, conf);65 kf.Control.init(this, id, form, conf); 66 66 67 67 this.initComplete( function() { -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/location.js
r1577 r1920 37 37 */ 38 38 function GMapControl ( id, form, conf) { 39 this['<super.init>'](id, form, conf);39 kf.Control.init(this, id, form, conf); 40 40 } 41 41 -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/numeric-range.js
r1518 r1920 61 61 62 62 kf.validators.put("isIntRange", { 63 base : "isInt",64 63 validate : function( value) { 65 64 … … 70 69 return this.notifyFail("Not a range."); 71 70 72 var response = this["<super.call>"]("validate", [value.start]);71 var response = kf.Validator.validateInt(this, value.start); 73 72 if(response == true) 74 response = this["<super.call>"]("validate", [value.end]);73 response = kf.Validator.validateInt(this, value.end); 75 74 76 75 return response; … … 91 90 92 91 function SliderControl ( id, form, conf) { 93 this['<super.init>'](id, form, conf);92 kf.Control.init(this, id, form, conf); 94 93 } 95 94 SliderControl.prototype.elements = {}; -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/registry.js
r1856 r1920 307 307 308 308 var obj = this; 309 if ($.isFunction(customInit)) 309 if ($.isFunction(customInit)) { 310 310 customInit.apply(obj, arguments); 311 else { 312 var method = this['<super.init>']; 313 method.apply(obj, arguments); 311 } else { 312 baseConstructor.apply(obj, arguments); 314 313 } 315 314 } -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/upload.js
r1794 r1920 29 29 */ 30 30 function UploadControl(id, form, conf){ 31 this['<super.init>'](id, form, conf);31 kf.Control.init(this, id, form, conf); 32 32 } 33 33 -
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/validator.js
r1776 r1920 72 72 73 73 Validator.prototype.notify = function( result, msg) { 74 Validator.notify(this, result, msg); 75 } 76 77 Validator.notify = function(me, result, msg) { 74 78 75 if (! this.listener || !this.seqId)79 if (!me.listener || !me.seqId) 76 80 return result; 77 81 78 this.listener.report(this.seqId, result, msg);79 this.clearSequence();82 me.listener.report(me.seqId, result, msg); 83 me.clearSequence(); 80 84 81 85 return result; … … 83 87 84 88 Validator.prototype.notifyFail = function( msg, args) { 89 Validator.notifyFail(this, msg, args); 90 } 91 92 Validator.notifyFail = function(me, msg, args) { 85 93 86 msg = this.message || msg;94 msg = me.message || msg; 87 95 msg = kf.Message.build(msg, args, "Validator.notifyFail"); 88 return this.notify(false, msg);96 return Validator.notify(me, false, msg); 89 97 } 90 98 91 99 Validator.prototype.notifySuccess = function() { 92 return this.notify(true); 100 Validator.notifySuccess(this); 101 } 102 Validator.notifySuccess = function(me) { 103 return Validator.notify(me, true); 93 104 } 94 105 -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/load/xdyna.js
r447 r1920 9 9 10 10 function XDyna(c) { 11 this.c = c;11 XDyna.init(this,c); 12 12 } 13 13 14 XDyna.init(me, c) { me.c = c ;} 15 $.XDyna = XDyna; 16 14 17 XDyna.prototype.getC = function() {return this.c; }; 15 18 XDyna.prototype.check = "xdyna-loaded"; -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-date.js
r1919 r1920 190 190 base : 'date-range' 191 191 }; 192 192 193 193 var form = new $.org.kauriproject.forms.Form($form, fconf); 194 194 … … 266 266 base : fieldTypeName 267 267 }; 268 268 269 269 // create form 270 270 var $form = $('<form />').appendTo($main); -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-registry.js
r802 r1920 6 6 7 7 function XBase( x) { 8 9 this.x = x; 10 } 8 XBase.init(this, x); 9 } 10 11 XBase.init = function (me, x) { 12 me.x = x; 13 } 14 11 15 XBase.prototype.getX = function() { 12 16 … … 78 82 '<init>' : function( x, y) { 79 83 80 this['<super.init>'](x);84 XBase.init(this, x); 81 85 this.y = y; 82 86 }, … … 95 99 }); 96 100 97 101 function X2init(me) { 102 XBase.init(me, 0); 103 } 104 98 105 test("testing a registered extension with constructor - normal instance", function() { 99 106 … … 101 108 cr.put("x2", { 102 109 base :"xbase", 103 '<init>' : function() { 104 105 this['<super.init>'](0); 106 }, 110 '<init>' : X2init, 107 111 calc : function( b) { 108 112 … … 116 120 117 121 122 function X3extra(me) { 123 return "ok"; 124 } 125 126 118 127 test("testing a registered 2nd level extension with constructor - normal instance", function() { 119 128 … … 122 131 base :"x2", 123 132 '<init>' : function() { 124 125 this['<super.init>'](); 126 }, 127 extra : function() { 128 129 return "ok"; 130 } 133 X2init(); 134 }, 135 extra : X3extra 131 136 }); 132 137 var t = cr.getInstance("x3"); … … 149 154 extra : function( b) { 150 155 151 return "" + this['<super.call>']("extra") + this.calc(b);156 return "" + X3extra(this) + this.calc(b); 152 157 } 153 158 }); … … 166 171 '<init>' : function( y) { 167 172 168 this['<super.init>']();173 X2init(); 169 174 this.getY = function() { 170 175 … … 186 191 function MyXBase( x, y) { 187 192 188 this['<super.init>'](x);193 XBase.init(this, x); 189 194 this.y = y; 190 195 } … … 229 234 this.a = a; 230 235 this.b = b; 231 this['<super.init>'](c);236 $.XDyna.init(this, c); 232 237 }, 233 238 calc : function( s) { … … 281 286 return this.data * y; 282 287 } 283 }, 284 288 } 289 /* 290 , 285 291 "myx" : { 286 292 "<init>" : function() { … … 289 295 } 290 296 } 297 */ 291 298 } 292 299 }); -
trunk/modules/kauri-jquery/src/main/kauri/static-{build}.key/kauri.util/core.js
r1602 r1920 201 201 } 202 202 203 var SUPER = "<super>";204 var SINIT = "<super.init>";205 var SCALL = "<super.call>";206 var STACK = "<super.call.stack>";207 203 /** 208 204 * Creates the necessary links between a sub-class deriving from a super-class … … 217 213 if (!($.isFunction(subConstr) && $.isFunction(baseConstr))) 218 214 return; 219 220 subConstr.prototype = new baseConstr(); 221 subConstr.prototype[SUPER] = baseConstr.prototype; 215 216 subConstr.prototype = new baseConstr(); 222 217 subConstr.prototype.constructor = subConstr; 223 224 subConstr.prototype[STACK] = []; 225 subConstr.prototype[SCALL] = SUPERCALL; 226 subConstr.prototype[SINIT] = SUPERINIT; 227 } 228 229 function SUPERINIT() { 230 231 this[SCALL]("constructor", arguments); 232 } 233 234 // TODO possibly add a check method $.isTypeOf(subInstance, baseConstrcutor) that allows checking if baseConstructor is 235 // somewhere in the '<super>' prototype chain 236 237 function SUPERCALL( methodName, argsArray) { 238 239 /* 240 * Note the hacking that is going on here. Since the called implementations can only refer to simply 'this' we manually 241 * addapt the actual current level of the parent-bubbling-up in a so called stack-variable on the object itself. Without 242 * this trick the calls to this['<super.init>'] would endlessly recurse to the initial constructor. 243 * 244 * Also note this implementation expects the execution to be absolutely single-threaded. Current implementation can fail 245 * in multithreaded environments. (Should be ok for javascript in browsers though) 246 */ 247 248 var me = this; 249 var stackPrototype = me[SUPER]; 250 if (methodName == undefined || stackPrototype == undefined) 251 return; 252 253 254 var restoreStack = me[STACK]; 255 if (restoreStack[0] == methodName) { 256 stackPrototype = restoreStack[1][SUPER]; 257 } 258 259 260 me[STACK] = [ methodName, stackPrototype ]; 261 var method = stackPrototype[methodName]; 262 // ie - jscript doesn't like it when the args passed are undefined 263 argsArray = argsArray || []; 264 var result = method.apply(me, argsArray); 265 me[STACK] = restoreStack; 266 267 return result; 268 } 218 } 219 269 220 270 221 /* ---------------------- debugging stuff ------------------------- */ -
trunk/modules/kauri-jquery/src/test/kauri.util/test-core.js
r1915 r1920 57 57 58 58 function Base( x) { 59 Base.init(this,x); 60 } 59 61 60 this.inits = {}; 61 this.x = x; 62 this.init(x); 63 } 64 Base.prototype.init = function( x) { 65 66 this.inits['x-deco'] = this.deco(x); 62 Base.init = function(me, x) { 63 me.x = x; 64 me.inits = {}; 65 me.inits['x-deco'] = me.deco(x); 67 66 } 68 67 Base.prototype.deco = function( x) { … … 76 75 }; 77 76 Base.prototype.fn = function(){ 77 return Base.fn(this); 78 } 79 Base.fn = function(me) { 78 80 return "Base"; 79 81 } … … 81 83 $.inherit(Sub, Base); 82 84 function Sub( x, y) { 83 84 this.y = y; 85 this['<super.init>'](x); 85 Sub.init(this, x, y); 86 86 } 87 88 Sub.init = function(me, x, y) { 89 Base.init(me, x); 90 me.y = y; 91 me.inits['y-deco'] = me.deco(me.y); 92 } 93 87 94 Sub.prototype.init = function( x) { 88 89 this['<super.call>']("init", [ x ]); 90 this.inits['y-deco'] = this.deco(this.y); 95 Sub.init(this, x); 91 96 } 92 97 Sub.prototype.deco = function( x) { … … 100 105 }; 101 106 Sub.prototype.fn = function(){ 102 return this['<super.call>']("fn") + "Sub";107 return Base.fn(this) + "Sub"; 103 108 } 104 109 … … 106 111 function SubSub( x, y) { 107 112 108 this['<super.init>'](x, y);113 Sub.init(this, x, y); 109 114 } 110 115 SubSub.prototype.S = true; -
trunk/samples/kauri-tutorial-myblog/main-module/src/main/kauri/static/js/tagcontrol.js
r1843 r1920 15 15 16 16 function TagControl(id, form, conf) { 17 this['<super.init>'](id, form, conf);17 kf.Control.init(this, id, form, conf); 18 18 } 19 19 … … 24 24 "<input type='text' kauri-role='input'/>" 25 25 }); 26 27 TagControl.prototype.initType = function(conf) {28 this["<super.call>"]("initType", [conf]);29 30 }31 26 32 27 TagControl.prototype.getWireValue = function() { -
trunk/samples/kauri-tutorial-myblog/tinymce-module/src/main/kauri/static/forms/tinymce.js
r1858 r1920 15 15 16 16 function TinyMCEControl(id, form, conf) { 17 this['<super.init>'](id, form, conf);17 kf.Control.init(this, id, form, conf); 18 18 } 19 19 … … 24 24 "<textarea type='text' kauri-role='input'/>" 25 25 }); 26 27 TinyMCEControl.prototype.initType = function(conf) {28 this["<super.call>"]("initType", [conf]);29 30 }31 26 32 27 TinyMCEControl.prototype.initElements = function(create) {
Note: See TracChangeset
for help on using the changeset viewer.