Sha256: ea4d8650ab23e2aef933894e61983acdc2b2d0b9936c0b1cada51d5cb839b34a

Contents?: true

Size: 1.38 KB

Versions: 8

Compression:

Stored size: 1.38 KB

Contents

rio.Application.require("components/box");

rio.components.TabPanel = rio.Component.create(rio.components.Box, "TabPanel", {
	require: ["components/panel", "components/tab_bar"],
	requireCss: "tab_panel",
	attrReaders: [
		["resizable", false],
		"maxWidth",
		"minWidth",
		"maxHeight",
		"minHeight",
		["layout", false],
		["tabs", []],
		"panel"
	],
	attrHtmls: ["tab"],
	methods: {
		initialize: function() {
			this._panel = new rio.components.Panel({
				resizable: this.getResizable(),
				maxWidth: this.getMaxWidth(),
				minWidth: this.getMinWidth(),
				maxHeight: this.getMaxHeight(),
				minHeight: this.getMinHeight(),
				layout: this.getLayout(),
				region: this.getRegion(),
				className: "tabPanel"
			});
		},
		
		buildHtml: function() {
			this.getPanel().buildTitleHtml = function() {
				return this.tabHtml();
			}.bind(this);
			return this.getPanel().html();
		},
		
		buildTabHtml: function() {
			return new rio.components.TabBar({ 
				className: "tabPanelTabBar",
				tabs: this.getTabs().map(function(tab) {
					var tabComponent = new rio.components.Tab({ name: tab.title, selected: tab.selected });
					tabComponent.selected.bind(function(selected) {
						if (selected) {
							this.getPanel().setItems(tab.items);
						}
					}.bind(this));
					return tabComponent;
				}.bind(this))
			}).html();
		},

		resize: function() {
			this.getPanel().resize();
		}
	}
});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
riojs-0.0.7 public/javascripts/components/tab_panel.js
riojs-0.0.6 public/javascripts/components/tab_panel.js
riojs-0.0.5 public/javascripts/components/tab_panel.js
riojs-0.0.4 public/javascripts/components/tab_panel.js
riojs-0.0.3 public/javascripts/components/tab_panel.js
riojs-0.0.2 public/javascripts/components/tab_panel.js
riojs-0.0.1 public/javascripts/components/tab_panel.js
riojs-0.0.0 public/javascripts/components/tab_panel.js