]>
git.proxmox.com Git - sencha-touch.git/blob - src/src/mixin/Identifiable.js
2 //@require Ext.dom.Helper
5 * An Identifiable mixin.
8 Ext
.define('Ext.mixin.Identifiable', {
15 mixinId
: 'identifiable',
17 idCleanRegex
: /\.|[^\w\-]/g,
19 defaultIdPrefix
: 'ext-',
21 defaultIdSeparator
: '-',
23 getOptimizedId: function() {
27 getUniqueId: function() {
29 prototype, separator
, xtype
, uniqueIds
, prefix
;
32 prototype = this.self
.prototype;
33 separator
= this.defaultIdSeparator
;
35 uniqueIds
= Ext
.mixin
.Identifiable
.uniqueIds
;
37 if (!prototype.hasOwnProperty('identifiablePrefix')) {
41 prefix
= this.defaultIdPrefix
+ xtype
+ separator
;
44 prefix
= prototype.$className
.replace(this.idCleanRegex
, separator
).toLowerCase() + separator
;
47 prototype.identifiablePrefix
= prefix
;
50 prefix
= this.identifiablePrefix
;
52 if (!uniqueIds
.hasOwnProperty(prefix
)) {
53 uniqueIds
[prefix
] = 0;
56 id
= this.id
= prefix
+ (++uniqueIds
[prefix
]);
59 this.getUniqueId
= this.getOptimizedId
;
69 * Retrieves the id of this component. Will autogenerate an id if one has not already been set.
76 id
= this.getUniqueId();
79 this.getId
= this.getOptimizedId
;