Class: Netzke::Basepack::BorderLayoutPanel

Inherits:
Netzke::Base
  • Object
show all
Defined in:
lib/netzke/basepack/border_layout_panel.rb

Overview

Panel with border layout.

Features

* When persistence enabled, remembers the sizes and collapsed/expanded states of its regions.

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}
]

Instance Method Summary collapse

Instance Method Details

#itemsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/netzke/basepack/border_layout_panel.rb', line 17

def items
  @border_layout_items ||= begin
    updated_items = super

    if config[:persistence]
      updated_items.each do |item|
        region = item[:region] || components[item[:netzke_component]][:region]
        item.merge!({
          :width => state[:"#{region}_region_width"],
          :height => state[:"#{region}_region_height"],
          :collapsed => state[:"#{region}_region_collapsed"]
        })
      end
    end

    updated_items
  end
end