Sha256: dd2f8b0e4130a205fcd012945b7392333d7d3670745fcedbe3416883f6c4d80d

Contents?: true

Size: 1.84 KB

Versions: 10

Compression:

Stored size: 1.84 KB

Contents

// ========================================================================
// SproutCore
// copyright 2006-2008 Sprout Systems, Inc.
// ========================================================================

require('foundation/path_module') ;

/**
  @class SC.Page
  
  The Page object is used to store a set of views that can be lazily 
  configured on page load.  Page assumes that all of its properties are
  basically outlets and will try to configure them as such.

  @extends SC.Object
*/
SC.Page = SC.Object.extend(
  /** @scope SC.Page.prototype */
  {
  
  get: function(key) {
    var value = this[key] ;
    if (value && (value instanceof Function) && (value.isOutlet)) {
      var ret = this.outlet(key) ;
      if (SC.window && !ret.parentNode) {
        SC.window._insertBefore(ret, null, false) ;
        SC.window._rebuildChildNodes();
      }
      ret.awake() ;
      return ret ;
    } else return sc_super() ;
  },
  
  // in addition to activating bindings, calling awake on the page object
  // will cause any outlet properties to be loaded.
  awake: function() {
    arguments.callee.base.call(this) ;
    for(var key in this) {
      if (this.hasOwnProperty(key) && this[key] && this[key].isOutlet) {
        this.get(key) ; // convert to outlet.
      } 
    }
  },
  
  init: function() {
    sc_super() ;
    var el = this.rootElement = $('resources') ;
    SC.callOnLoad(function() {
      if (el && el.parentNode) el.parentNode.removeChild(el) ;
			el = null;
    }) ;
  },
  
  // returns the property, but only if it is already configured.
  getIfConfigured: function(key) {
    var value = this[key] ;
    if (value && (value instanceof Function) && (value.isOutlet)) {
      return null ;
    } else return value ;
  },
  
  _insertBefore: function() {},
  _rebuildChildNodes: function() {}
  
}) ;

Object.extend(SC.Page.prototype, SC.PathModule) ;

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sproutcore-0.9.15 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.14 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.18 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.19 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.17 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.16 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.22 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.21 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.23 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.20 frameworks/sproutcore/foundation/page.js