17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
*/
ListController.containerElement = undefined;
/**
* @property itemControllerProto
*/
ListController.itemControllerProto = undefined;
/**
* @property {Number} nextItemID
* The ID for the next item created within this list. Each ID will be
* unique for the existence of this ListController
*/
ListController.nextItemID = 1;
ListController.nextListID = 1;
|
>
>
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
*/
ListController.containerElement = undefined;
/**
* @property itemControllerProto
*/
ListController.itemControllerProto = undefined;
// ListController.textContentFrom = undefined;
/**
* @property {Number} nextItemID
* The ID for the next item created within this list. Each ID will be
* unique for the existence of this ListController
*/
ListController.nextItemID = 1;
ListController.nextListID = 1;
|
408
409
410
411
412
413
414
415
416
417
418
419
420
421
|
ListItemController.setItemTemplate = function(itemTemplate) {
if(isString(itemTemplate)) {
itemTemplate = elementByID(itemTemplate);
}
this.itemTemplate = itemTemplate;
};
/**
* Link a property, which is assumed to be text, from the model of this
* list item to the content of an element specified with 'idPrefix'.
* The ID should end with "_#n" after 'idPrefix'.
*/
ListItemController.linkTextProperty = function(modelProperty, idPrefix) {
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
|
ListItemController.setItemTemplate = function(itemTemplate) {
if(isString(itemTemplate)) {
itemTemplate = elementByID(itemTemplate);
}
this.itemTemplate = itemTemplate;
};
/**
* Links the 'modelProperty' property from the model to the text content of the
* HTML element for this list item.
* Note that this overrides all other content from the element (any other
* content from the HTML template for this list item), and thus nullifies
* things like linkTextProperty(). If this is not desired, linkTextProperty()
* should be used instead and linked to a suitable HTML element (e.g.
* a <span>).
*/
ListItemController.linkTextContent = function(modelProperty) {
this.textContentProperty = modelProperty;
};
/**
* Link a property, which is assumed to be text, from the model of this
* list item to the content of an element specified with 'idPrefix'.
* The ID should end with "_#n" after 'idPrefix'.
*/
ListItemController.linkTextProperty = function(modelProperty, idPrefix) {
|
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
|
}
//console.debug("refresh", this.myElement);
this._refreshTextProperties();
this._refreshTextPropertyMethods();
this._refreshAttributesProperties();
this._refreshMapAttributes();
this._refreshPropertyMethods();
};
/**
* @private
*/
ListItemController._refreshTextProperties = function() {
for (var key in this.textProperties) {
//console.log("createElement, key: " + key);
if (this.textProperties[key] != undefined) {
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
|
}
//console.debug("refresh", this.myElement);
this._refreshTextProperties();
this._refreshTextPropertyMethods();
this._refreshAttributesProperties();
this._refreshMapAttributes();
this._refreshPropertyMethods();
this._refreshTextContent();
};
ListItemController._refreshTextContent = function() {
console.log(this.textContentProperty);
console.log(this.myElement);
if ( (this.textContentProperty != undefined) &&
(this.myElement != undefined)) {
this.myElement.textContent =
this.model.getProperty(this.textContentProperty);
}
};
/**
* @private
*/
ListItemController._refreshTextProperties = function() {
for (var key in this.textProperties) {
//console.log("createElement, key: " + key);
if (this.textProperties[key] != undefined) {
|