Sha256: dcbbcd0a16ebe2fa1b99d6c5a5df7cf50aa39437c796ea9ad04c351e20cd6298

Contents?: true

Size: 1.49 KB

Versions: 1

Compression:

Stored size: 1.49 KB

Contents

module Netzke
  module Basepack
    # Panel with border layout
    # == Example configuration:
    # 
    #     :items => [
    #       {:title => "Item One", :class_name => "Basepack::Panel", :region => :center},
    #       {:title => "Item Two", :class_name => "Basepack::Panel", :region => :west, :width => 300, :split => true}
    #     ]
    class BorderLayoutPanel < Netzke::Base
      
      def self.js_properties
        {
          :layout => 'border',
          :init_component => <<-END_OF_JAVASCRIPT.l,
            function(){
              Ext.each(['center', 'west', 'east', 'south', 'north'], function(r){
                // A function to access a region component (even if the component gets reloaded, the function will work).
                // E.g.: getEastComponent()
                var methodName = 'get'+r.capitalize()+'Component';
                this[methodName] = function(){
                  Netzke.deprecationWarning("Instead of '" + methodName + "' use getChildComponent('<name of your component>').");
                  return this.find('region', r)[0];
                }.createDelegate(this);
              }, this);

              // Now let Ext.Panel do the rest
              #{js_full_class_name}.superclass.initComponent.call(this);

              // First time on "afterlayout", set resize events
              if (this.persistentConfig) {this.on('afterlayout', this.setResizeEvents, this, {single: true});}
            }
          END_OF_JAVASCRIPT
        }
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
netzke-basepack-0.6.0 app/components/netzke/basepack/border_layout_panel.rb