Author: Alex.Kolonitsky
Date: 2010-07-19 09:23:14 -0400 (Mon, 19 Jul 2010)
New Revision: 18145
Modified:
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
root/ui/iteration/trunk/datascroller/ui/src/main/resources/META-INF/resources/script/datascroller.js
root/ui/iteration/trunk/tables/ui/src/main/resources/META-INF/resources/datatable.js
root/ui/iteration/trunk/tables/ui/src/main/resources/META-INF/resources/subtable.js
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanel.js
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanel.js
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanelBorders.js
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanelSizer.js
Log:
add extendClass function
fix refactoring for extend function
Modified:
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
===================================================================
---
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-07-19
12:28:10 UTC (rev 18144)
+++
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-07-19
13:23:14 UTC (rev 18145)
@@ -4,9 +4,9 @@
(function ($, richfaces, params) {
-
+
richfaces.blankFunction = function (){}; //TODO: add it to global library
-
+
/**
* @class Base class for all components.
* All RichFaces components should use this class as base or another RichFaces class
which based on it.
@@ -14,27 +14,27 @@
<pre><code>
//Inheritance example:
(function ($, richfaces, params) {
-
+
// Constructor definition
richfaces.MyComponent = function(componentId, [options]) {
// call constructor of parent class
$super.constructor.call(this, componentId, [options]);
};
-
+
// define private method
var myPrivateMethod = function () {
}
-
+
// Extend component class and add protected methods from parent class to our
container
richfaces.BaseComponent.extend(richfaces.BaseComponent, richfaces.MyComponent);
-
+
// define super class link
var $super = richfaces.MyComponent.$super;
-
+
// Add new properties and methods
$.extend(richfaces.MyComponent.prototype, (function (params) {
return {
- name:"MyComponent",
+ name:"MyComponent",
f:function (){alert("hello");
}
};
@@ -51,9 +51,9 @@
richfaces.BaseComponent = function(componentId) {
this.id = componentId;
};
-
+
var $p = {};
-
+
var extend = function (parent, child, h) {
h = h || {};
var F = richfaces.blankFunction;
@@ -64,9 +64,9 @@
if (child.$super == richfaces.BaseComponent.prototype) {
var r = jQuery.extend({}, $p, h||{});
}
-
+
var _parent = child;
-
+
// create wrapper with protected methods and variables
child.extend = function (_child, _h) {
_h = _h || {};
@@ -75,9 +75,9 @@
}
return r||h;
};
-
+
/**
- * Method extends child class prototype with parent prototype
+ * Method extends child class prototype with parent prototype
* and return the object with parent's protected methods
*
* @function
@@ -88,7 +88,62 @@
richfaces.BaseComponent.extend = function(child, h) {
return extend(richfaces.BaseComponent, child, h);
};
-
+
+
+ /**
+ * Easy way to create a subclass.
+ *
+ * Example:
+ *
+ * RichFaces.ui.MyClass = RichFaces.BaseComponent.extendClass({
+ * // Class name
+ * name: "MyClass",
+ *
+ * // Constructor
+ * init : function (...) {
+ * // ...
+ * },
+ *
+ * // public api
+ * publicFunction : function () {
+ * // ...
+ * },
+ *
+ * // private api
+ * // names of private methods should start with '__' (2 underscore
symbols)
+ * __privateFunction : function () {
+ * // ...
+ * },
+ *
+ * __overrideMethod : function () {
+ * // if you need to use method from parent class use link to parent
prototype
+ * // like in previous solution with extend method
+ * this.$super.__overrideMethod.call(this, ...params...);
+ *
+ * //...
+ * }
+ *
+ * });
+ *
+ * */
+ richfaces.BaseComponent.extendClass = function (methods) {
+ var EMPTY_FUNC = function () {};
+
+ var DerivedClass = methods.init || EMPTY_FUNC;
+ var SupperClass = this;
+
+ SupperClass.extend(DerivedClass);
+
+ DerivedClass.extendClass = SupperClass.extendClass;
+ DerivedClass.prototype.$super = SupperClass.prototype;
+
+ $.extend(DerivedClass.prototype, methods);
+
+ return DerivedClass;
+ },
+
+
+
$.extend(richfaces.BaseComponent.prototype, (function (params) {
return {
/**
@@ -98,7 +153,7 @@
* @type String
* */
name: "BaseComponent",
-
+
/**
* Method for converting object to string
*
@@ -115,7 +170,7 @@
result[result.length] = this.name;
return result.join(', ');
},
-
+
/**
* Method returns element's id for event handlers binding.
* Event API calls this method when binding by component object as selector
was used.
@@ -124,11 +179,11 @@
* @name RichFaces.BaseComponent#getEventElement
*
* @return {String}
- * */
+ * */
getEventElement: function() {
- return this.id;
+ return this.id;
},
-
+
/**
* Attach component object to DOM element by component id, DOM element or jQuery
object and returns the element
*
@@ -147,9 +202,9 @@
}
return element;
},
-
+
/**
- * Destroy method. Will be called before remove component from the page
+ * Destroy method. Will be called before remove component from the page
*
* @function
* @name RichFaces.BaseComponent#destroy
@@ -159,5 +214,5 @@
}
};
})(params));
-
+
})(jQuery, window.RichFaces || (window.RichFaces={}));
\ No newline at end of file
Modified:
root/ui/iteration/trunk/datascroller/ui/src/main/resources/META-INF/resources/script/datascroller.js
===================================================================
---
root/ui/iteration/trunk/datascroller/ui/src/main/resources/META-INF/resources/script/datascroller.js 2010-07-19
12:28:10 UTC (rev 18144)
+++
root/ui/iteration/trunk/datascroller/ui/src/main/resources/META-INF/resources/script/datascroller.js 2010-07-19
13:23:14 UTC (rev 18145)
@@ -1,4 +1,4 @@
-(function ($, richfaces) {
+(function ($, richfaces) {
richfaces.ui = richfaces.ui || {};
@@ -92,8 +92,8 @@
}
};
- var $super = richfaces.BaseComponent.extend(richfaces.BaseComponent,
richfaces.ui.DataScroller);
- var $p =
richfaces.BaseComponent.extend(richfaces.BaseComponent,richfaces.ui.DataScroller, {});
+ var $super = richfaces.BaseComponent.extend(richfaces.ui.DataScroller);
+ var $p = richfaces.BaseComponent.extend(richfaces.ui.DataScroller, {});
var $super = richfaces.ui.DataScroller.$super;
$.extend(richfaces.ui.DataScroller.prototype, (function (options) {
Modified:
root/ui/iteration/trunk/tables/ui/src/main/resources/META-INF/resources/datatable.js
===================================================================
---
root/ui/iteration/trunk/tables/ui/src/main/resources/META-INF/resources/datatable.js 2010-07-19
12:28:10 UTC (rev 18144)
+++
root/ui/iteration/trunk/tables/ui/src/main/resources/META-INF/resources/datatable.js 2010-07-19
13:23:14 UTC (rev 18145)
@@ -10,8 +10,8 @@
};
- var $super = richfaces.BaseComponent.extend(richfaces.BaseComponent,
richfaces.ui.DataTable);
- var $p =
richfaces.BaseComponent.extend(richfaces.BaseComponent,richfaces.ui.DataTable, {});
+ var $super = richfaces.BaseComponent.extend(richfaces.ui.DataTable);
+ var $p = richfaces.BaseComponent.extend(richfaces.ui.DataTable, {});
var $super = richfaces.ui.DataTable.$super;
$.extend(richfaces.ui.DataTable, {
Modified:
root/ui/iteration/trunk/tables/ui/src/main/resources/META-INF/resources/subtable.js
===================================================================
---
root/ui/iteration/trunk/tables/ui/src/main/resources/META-INF/resources/subtable.js 2010-07-19
12:28:10 UTC (rev 18144)
+++
root/ui/iteration/trunk/tables/ui/src/main/resources/META-INF/resources/subtable.js 2010-07-19
13:23:14 UTC (rev 18145)
@@ -22,8 +22,8 @@
expand: 1
})
- var $super = richfaces.BaseComponent.extend(richfaces.BaseComponent,
richfaces.ui.SubTable);
- var $p =
richfaces.BaseComponent.extend(richfaces.BaseComponent,richfaces.ui.SubTable, {});
+ var $super = richfaces.BaseComponent.extend(richfaces.ui.SubTable);
+ var $p = richfaces.BaseComponent.extend(richfaces.ui.SubTable, {});
var $super = richfaces.ui.SubTable.$super;
$.extend(richfaces.ui.SubTable.prototype, (function () {
Modified:
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanel.js
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanel.js 2010-07-19
12:28:10 UTC (rev 18144)
+++
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanel.js 2010-07-19
13:23:14 UTC (rev 18145)
@@ -24,48 +24,14 @@
rf.ui = rf.ui || {};
- /***************************** Constructor definition
*************************************************************/
- var DEFAULT_OPTIONS = {
- };
-
- /**
- * @class TogglePanel
- * @name TogglePanel
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- rf.ui.TogglePanel = function (componentId, options) {
- // call constructor of parent class
- $super.constructor.call(this, componentId);
- $p.attachToDom.call(this, componentId);
- this.options = $.extend({}, DEFAULT_OPTIONS, options);
-
- this.selectedItem = this.options.selectedItem;
- this.switchMode = this.options.switchMode;
- this.items = this.options.items;
- };
-
- var $p = {};
-
- // Extend component class and add protected methods from parent class to our
container
- $p = rf.BaseComponent.extend(rf.BaseComponent, rf.ui.TogglePanel, $p);
-
- var $super = rf.ui.TogglePanel.$super;
-
- /***************************** Private Static Area
****************************************************************/
-
-
/* SIMPLE INNER CLASS for handle switch operation*/
- function SwitchItems (comp) {
+ function SwitchItems(comp) {
this.comp = comp;
}
SwitchItems.prototype = {
/**
- * @param {TogglePanel} comp
* @param {TogglePanelItem} oldPanel
* @param {TogglePanelItem} newPanel
*
@@ -93,13 +59,13 @@
execServer : function (oldPanel, newPanel) {
var continueProcess = oldPanel.leave();
if (!continueProcess) {
-
+
return false;
}
- this.setSelectedItem(newPanel.getName());
+ this.__setSelectedItem(newPanel.getName());
- rf.submitForm(this.getParentForm(), null, {});
+ rf.submitForm(this.__getParentForm(), null, {});
return false;
},
@@ -114,9 +80,9 @@
execAjax : function (oldPanel, newPanel) {
var options = $.extend({}, this.comp.options["ajax"],
{}/*this.getParameters(newPanel)*/);
- this.setSelectedItem(newPanel.getName());
+ this.__setSelectedItem(newPanel.getName());
rf.ajax(this.comp.id, null, options);
- this.setSelectedItem(oldPanel.getName());
+ this.__setSelectedItem(oldPanel.getName());
return false;
},
@@ -136,10 +102,10 @@
return false;
}
- this.setSelectedItem(newPanel.getName());
+ this.__setSelectedItem(newPanel.getName());
newPanel.enter();
- fireItemChange(this.comp, oldPanel, newPanel);
+ this.__fireItemChange(oldPanel, newPanel);
return true;
},
@@ -147,255 +113,282 @@
/**
* @private
* */
- getParentForm : function () {
- return $(RichFaces.getDomElement(this.comp.id)).parent('form');
+ __getParentForm : function () {
+ return $(rf.getDomElement(this.comp.id)).parent('form');
},
/**
* @private
* */
- setSelectedItem : function (name) {
- rf.getDomElement(this.getValueInputId()).value = name;
+ __setSelectedItem : function (name) {
+ rf.getDomElement(this.__getValueInputId()).value = name;
this.comp.selectedItem = name;
},
/**
* @private
* */
- getValueInputId: function () {
+ __getValueInputId: function () {
return this.comp.id + "-value"
}
};
- /********************* Events *************************/
-
/**
- * Fire Concealable Event
+ * @class TogglePanel
+ * @name TogglePanel
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
* */
- function fireBeforeItemChange ($this, oldItem, newItem) {
- return rf.Event.fireById($this.id, "beforeitemchange", {
- id: $this.id,
- oldItem : oldItem,
- newItem : newItem
- });
- }
+ rf.ui.TogglePanel = rf.BaseComponent.extendClass({
- function fireItemChange ($this, oldItem, newItem) {
- return new rf.Event.fireById($this.id, "itemchange", {
- id: $this.id,
- oldItem : oldItem,
- newItem : newItem
- });
- }
+ // class name
+ name:"TogglePanel",
- /********************* Methods *************************/
+ init : function (componentId, options) {
+ // call constructor of parent class
+ this.$super.constructor.call(this, componentId);
+ this.attachToDom(componentId);
- var ITEMS_META_NAMES = {
- "@first" : function (comp) { return 0; },
- "@prev" : function (comp) { return getItemIndex(comp.items,
comp.selectedItem) - 1; },
- "@next" : function (comp) { return getItemIndex(comp.items,
comp.selectedItem) + 1; },
- "@last" : function (comp) { return comp.items.length - 1; }
- };
+ this.options = options;
+ this.selectedItem = this.options.selectedItem;
+ this.switchMode = this.options.switchMode;
+ this.items = this.options.items;
+ },
- function getItemIndex (items, itemName) {
- for (var i = 0; i < items.length; i++) {
- if (items[i].getName() === itemName) {
- return i;
+ /***************************** Public Methods
********************************************************************/
+
+ /**
+ * @methodOf
+ * @name TogglePanel#getSelectItem
+ *
+ * @return {String} name of current selected panel item
+ */
+ getSelectItem: function () {
+ return this.selectedItem;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#switchToItem
+ *
+ * @param {String} name - panel item name to switch
+ * we can use meta names @first, @prev, @next and @last
+ * @return {Boolean} - false if something wrong and true if all is ok
+ */
+ switchToItem: function (name) {
+ var newPanel = this.getNextItem(name);
+ if (newPanel == null) {
+ rf.log.warn("TogglePanel.switchToItems(" + name + "): item
with name '" + name + "' not found");
+ return false;
}
- }
- rf.log.info("TogglePanel.getItemIndex: item with name '" + itemName
+ "' not found");
- return -1;
- }
+ var oldPanel = this.__getItemByName(this.getSelectItem());
- /**
- * @param {TogglePanelItem[]} items
- * @param {Number} index - array index
- *
- * @return {TogglePanelItem}
- * null - if item not found
- * */
- function getItem (items, index) {
- if (index >= 0 && index < items.length) {
- return items[index]
- }
+ var continueProcess = this.__fireBeforeItemChange(oldPanel, newPanel);
+ if (!continueProcess) {
+ rf.log.warn("TogglePanel.switchToItems(" + name + "):
switch has been canceled by beforeItemChange event");
+ return false
+ }
- return null;
- }
+ return new SwitchItems(this).exec(oldPanel, newPanel);
+ },
- function getItemByName (items, name) {
- return getItem(items, getItemIndex(items, name));
- }
+ /**
+ * @methodOf
+ * @name TogglePanel#getNextItem
+ *
+ * @param {String} name of TogglePanelItem or meta name (@first | @prev | @next |
@last)
+ * @return {TogglePanelItem} null if item not found
+ */
+ getNextItem : function (name) {
+ if (name) {
+ var newItemIndex = this.__ITEMS_META_NAMES[name];
+ if (newItemIndex) {
+ return this.__getItem(newItemIndex(this));
+ } else {
+ return this.__getItemByName(name);
+ }
+ } else {
+ return this.__getItemByName(this.nextItem());
+ }
+ },
- function getItemName (items, index) {
- var item = getItem(items, index);
- if (item == null) {
- return null;
- }
-
- return item.getName();
- }
+ /**
+ * please, remove this method when client side ajax events will be added
+ *
+ * */
+ onCompleteHandler : function (oldItemName, newItemName) {
+ var oldItem = this.__getItemByName(this.items, oldItemName);
+ var newItem = this.__getItemByName(this.items, newItemName);
+ // Don't do like this and remove it ASAP
+ new SwitchItems(this).execClient(oldItem, newItem);
+ },
- /***************************** Public Methods
********************************************************************/
- $.extend(rf.ui.TogglePanel.prototype, (function () {
- return {
- // class name
- name:"TogglePanel",
+ /**
+ * @methodOf
+ * @name TogglePanel#getItems
+ *
+ * @return {TogglePanelItem[]} all defined panel items
+ */
+ getItems : function () {
+ return this.items;
+ },
- /**
- * @methodOf
- * @name TogglePanel#getSelectItem
- *
- * @return {String} name of current selected panel item
- */
- getSelectItem: function () {
- return this.selectedItem;
- },
+ /**
+ * @methodOf
+ * @name TogglePanel#getItemsNames
+ *
+ * @return {String[]} names of all defined items
+ */
+ getItemsNames: function () {
+ var res = [];
+ for (var item in this.items) {
+ res.push(this.items[item].getName());
+ }
- /**
- * @methodOf
- * @name TogglePanel#switchToItem
- *
- * @param {String} name - panel item name to switch
- * we can use meta names @first, @prev, @next and @last
- * @return {Boolean} - false if something wrong and true if all is ok
- */
- switchToItem: function (name) {
- var newPanel = this.getNextItem(name);
- if (newPanel == null) {
- rf.log.warn("TogglePanel.switchToItems(" + name + "):
item with name '" + name + "' not found");
- return false;
- }
+ return res;
+ },
- var oldPanel = getItemByName(this.items, this.getSelectItem());
+ /**
+ * @methodOf
+ * @name TogglePanel#nextItem
+ *
+ * @param {String} [itemName = selectedItem]
+ * @return {String} name of next panel item
+ */
+ nextItem: function (itemName) {
+ var itemIndex = this.__getItemIndex(itemName || this.selectedItem);
+ if (itemIndex == -1) {
+ return null;
+ }
- var continueProcess = fireBeforeItemChange(this, oldPanel, newPanel);
- if (!continueProcess) {
- rf.log.warn("TogglePanel.switchToItems(" + name + "):
switch has been canceled by beforeItemChange event");
- return false
- }
+ return this.__getItemName(this.items, itemIndex + 1);
+ },
- return new SwitchItems(this).exec(oldPanel, newPanel);
- },
+ /**
+ * @methodOf
+ * @name TogglePanel#firstItem
+ *
+ * @return {String} name of first panel item
+ */
+ firstItem: function () {
+ return this.__getItemName(this.items, 0);
+ },
- /**
- * @methodOf
- * @name TogglePanel#getNextItem
- *
- * @param {String} name of TogglePanelItem or meta name (@first | @prev |
@next | @last)
- * @return {TogglePanelItem} null if item not found
- */
- getNextItem : function (name) {
- if (name) {
- var newItemIndex = ITEMS_META_NAMES[name];
- if (newItemIndex) {
- return getItem(this.items, newItemIndex(this));
- } else {
- return getItemByName(this.items, name);
- }
- } else {
- return getItemByName(this.items, this.nextItem());
- }
- },
+ /**
+ * @methodOf
+ * @name TogglePanel#lastItem
+ *
+ * @return {String} name of last panel item
+ */
+ lastItem: function () {
+ return this.__getItemName(this.items, this.items.length - 1);
+ },
- /**
- * please, remove this method when client side ajax events will be added
- *
- * */
- onCompleteHandler : function (oldItemName, newItemName) {
- var oldItem = getItemByName(this.items, oldItemName);
- var newItem = getItemByName(this.items, newItemName);
+ /**
+ * @methodOf
+ * @name TogglePanel#prevItem
+ *
+ * @param {String} itemName
+ * @return {String} name of prev panel item
+ * null if it is first item
+ */
+ prevItem: function (itemName) {
+ var itemIndex = this.__getItemIndex(itemName || this.selectedItem);
+ if (itemIndex < 1) {
+ return null;
+ }
- // Don't do like this and remove it ASAP
- new SwitchItems(this).execClient(oldItem, newItem);
- },
+ return this.__getItemName(this.items, itemIndex - 1);
+ },
- /**
- * @methodOf
- * @name TogglePanel#getItems
- *
- * @return {TogglePanelItem[]} all defined panel items
- */
- getItems : function () {
- return this.items;
- },
+
/////////////////////////////////////////////////////////////////////////////////
+ //// Private
+
/////////////////////////////////////////////////////////////////////////////////
- /**
- * @methodOf
- * @name TogglePanel#getItemsNames
- *
- * @return {String[]} names of all defined items
- */
- getItemsNames: function () {
- var res = [];
- for (var item in this.items) {
- res.push(this.items[item].getName());
- }
+ /********************* Events *************************/
- return res;
- },
+ /**
+ * Fire Concealable Event
+ * */
+ __fireBeforeItemChange : function (oldItem, newItem) {
+ return rf.Event.fireById(this.id, "beforeitemchange", {
+ id: this.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ },
- /**
- * @methodOf
- * @name TogglePanel#nextItem
- *
- * @param {String} [itemName = selectedItem]
- * @return {String} name of next panel item
- */
- nextItem: function (itemName) {
- var itemIndex = getItemIndex(this.items, itemName || this.selectedItem);
- if (itemIndex == -1) {
- return null;
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.id, "itemchange", {
+ id: this.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ },
+
+ /********************* Methods *************************/
+
+ __ITEMS_META_NAMES : {
+ "@first" : function (comp) { return 0; },
+ "@prev" : function (comp) { return
comp.__getItemIndex(comp.selectedItem) - 1; },
+ "@next" : function (comp) { return
comp.__getItemIndex(comp.selectedItem) + 1; },
+ "@last" : function (comp) { return comp.items.length - 1; }
+ },
+
+ /**
+ * @private
+ * */
+ __getItemIndex : function (itemName) {
+ for (var i = 0; i < this.items.length; i++) {
+ if (this.items[i].getName() === itemName) {
+ return i;
}
+ }
- return getItemName(this.items, itemIndex + 1);
- },
+ rf.log.info("TogglePanel.getItemIndex: item with name '" +
itemName + "' not found");
+ return -1;
+ },
- /**
- * @methodOf
- * @name TogglePanel#firstItem
- *
- * @return {String} name of first panel item
- */
- firstItem: function () {
- return getItemName(this.items, 0);
- },
+ /**
+ * @private
+ * @param {Number} index - array index
+ *
+ * @return {TogglePanelItem}
+ * null - if item not found
+ * */
+ __getItem : function (index) {
+ if (index >= 0 && index < this.items.length) {
+ return this.items[index]
+ }
- /**
- * @methodOf
- * @name TogglePanel#lastItem
- *
- * @return {String} name of last panel item
- */
- lastItem: function () {
- return getItemName(this.items, this.items.length - 1);
- },
+ return null;
+ },
- /**
- * @methodOf
- * @name TogglePanel#prevItem
- *
- * @param {String} itemName
- * @return {String} name of prev panel item
- * null if it is first item
- */
- prevItem: function (itemName) {
- var itemIndex = getItemIndex(this.items, itemName || this.selectedItem);
- if (itemIndex < 1) {
- return null;
- }
-
- return getItemName(this.items, itemIndex - 1);
- },
+ __getItemByName : function (name) {
+ return this.__getItem(this.__getItemIndex(name));
+ },
- // class stuff
- destroy: function () {
- // rf.Event.unbindById(this.options.buttonId,
"."+this.namespace);
- // rf.Event.unbindById(this.componentId,
"."+this.namespace);
- // $super.destroy.call(this);
+ __getItemName : function (index) {
+ var item = this.__getItem(index);
+ if (item == null) {
+ return null;
}
- };
- })());
+
+ return item.getName();
+ },
+
+
+
+ // class stuff
+ destroy: function () {
+ // rf.Event.unbindById(this.options.buttonId,
"."+this.namespace);
+ // rf.Event.unbindById(this.componentId,
"."+this.namespace);
+ // $super.destroy.call(this);
+ }
+ });
})(jQuery, RichFaces);
Modified:
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js 2010-07-19
12:28:10 UTC (rev 18144)
+++
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js 2010-07-19
13:23:14 UTC (rev 18145)
@@ -25,23 +25,18 @@
/***************************** Stuff
******************************************************************************/
rf.ui = rf.ui || {};
- /***************************** Constructor definition
*************************************************************/
- var DEFAULT_OPTIONS = {
- };
-
rf.ui.TogglePanelItem = function(componentId, options) {
// call constructor of parent class
$super.constructor.call(this, componentId);
- $p.attachToDom.call(this, componentId);
- this.options = $.extend({}, DEFAULT_OPTIONS, options);
+ $super.attachToDom.call(this, componentId);
+ this.options = options;
this.name = this.options.name;
this.togglePanelId = this.options.togglePanelId;
this.switchMode = this.options.switchMode;
};
- // Extend component class and add protected methods from parent class to our
container
- var $p = rf.BaseComponent.extend(rf.BaseComponent, rf.ui.TogglePanelItem, {});
+ rf.BaseComponent.extend(rf.ui.TogglePanelItem);
// define super class link
var $super = rf.ui.TogglePanelItem.$super;
@@ -123,7 +118,7 @@
destroy: function () {
// rf.Event.unbindById(this.options.buttonId,
"."+this.namespace);
// rf.Event.unbindById(this.componentId,
"."+this.namespace);
- $super.destroy.call(this);
+// $super.destroy.call(this);
}
};
})());
Modified:
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanel.js
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanel.js 2010-07-19
12:28:10 UTC (rev 18144)
+++
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanel.js 2010-07-19
13:23:14 UTC (rev 18145)
@@ -79,8 +79,8 @@
};
- var $super = richfaces.BaseComponent.extend(richfaces.BaseComponent,
richfaces.ui.PopupPanel);
- var $p =
richfaces.BaseComponent.extend(richfaces.BaseComponent,richfaces.ui.PopupPanel, {});
+ var $super = richfaces.BaseComponent.extend(richfaces.ui.PopupPanel);
+ var $p = richfaces.BaseComponent.extend(richfaces.ui.PopupPanel, {});
var $super = richfaces.ui.PopupPanel.$super;
$.extend(richfaces.ui.PopupPanel.prototype, (function (options) {
Modified:
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanelBorders.js
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanelBorders.js 2010-07-19
12:28:10 UTC (rev 18144)
+++
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanelBorders.js 2010-07-19
13:23:14 UTC (rev 18145)
@@ -15,7 +15,7 @@
this.sizer = sizer;
};
- var $super = richfaces.BaseComponent.extend(richfaces.BaseComponent,
richfaces.ui.PopupPanel.Border);
+ var $super = richfaces.BaseComponent.extend(richfaces.ui.PopupPanel.Border);
var $super = richfaces.ui.PopupPanel.Border.$super;
$.extend(richfaces.ui.PopupPanel.Border.prototype, (function (options) {
Modified:
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanelSizer.js
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanelSizer.js 2010-07-19
12:28:10 UTC (rev 18144)
+++
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanelSizer.js 2010-07-19
13:23:14 UTC (rev 18145)
@@ -8,7 +8,7 @@
};
- var $super = richfaces.BaseComponent.extend(richfaces.BaseComponent,
richfaces.ui.PopupPanel.Sizer);
+ var $super = richfaces.BaseComponent.extend(richfaces.ui.PopupPanel.Sizer);
var $super = richfaces.ui.PopupPanel.Sizer.$super;
$.extend(richfaces.ui.PopupPanel.Sizer.prototype, (function (options) {
return {