|
@@ -216,131 +216,6 @@ UI.Panel = function () {
|
|
|
UI.Panel.prototype = Object.create( UI.Element.prototype );
|
|
|
UI.Panel.prototype.constructor = UI.Panel;
|
|
|
|
|
|
-
|
|
|
-// Collapsible Panel
|
|
|
-
|
|
|
-UI.CollapsiblePanel = function () {
|
|
|
-
|
|
|
- UI.Panel.call( this );
|
|
|
-
|
|
|
- this.setClass( 'Panel Collapsible' );
|
|
|
-
|
|
|
- var scope = this;
|
|
|
-
|
|
|
- this.static = new UI.Panel();
|
|
|
- this.static.setClass( 'Static' );
|
|
|
- this.static.onClick( function () {
|
|
|
-
|
|
|
- scope.toggle();
|
|
|
-
|
|
|
- } );
|
|
|
- this.dom.appendChild( this.static.dom );
|
|
|
-
|
|
|
- this.contents = new UI.Panel();
|
|
|
- this.contents.setClass( 'Content' );
|
|
|
- this.dom.appendChild( this.contents.dom );
|
|
|
-
|
|
|
- var button = new UI.Panel();
|
|
|
- button.setClass( 'Button' );
|
|
|
- this.static.add( button );
|
|
|
-
|
|
|
- this.isCollapsed = false;
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-UI.CollapsiblePanel.prototype = Object.create( UI.Panel.prototype );
|
|
|
-UI.CollapsiblePanel.prototype.constructor = UI.CollapsiblePanel;
|
|
|
-
|
|
|
-UI.CollapsiblePanel.prototype.addStatic = function () {
|
|
|
-
|
|
|
- this.static.add.apply( this.static, arguments );
|
|
|
- return this;
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-UI.CollapsiblePanel.prototype.removeStatic = function () {
|
|
|
-
|
|
|
- this.static.remove.apply( this.static, arguments );
|
|
|
- return this;
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-UI.CollapsiblePanel.prototype.clearStatic = function () {
|
|
|
-
|
|
|
- this.static.clear();
|
|
|
- return this;
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-UI.CollapsiblePanel.prototype.add = function () {
|
|
|
-
|
|
|
- this.contents.add.apply( this.contents, arguments );
|
|
|
- return this;
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-UI.CollapsiblePanel.prototype.remove = function () {
|
|
|
-
|
|
|
- this.contents.remove.apply( this.contents, arguments );
|
|
|
- return this;
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-UI.CollapsiblePanel.prototype.clear = function () {
|
|
|
-
|
|
|
- this.contents.clear();
|
|
|
- return this;
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-UI.CollapsiblePanel.prototype.toggle = function() {
|
|
|
-
|
|
|
- this.setCollapsed( ! this.isCollapsed );
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-UI.CollapsiblePanel.prototype.collapse = function() {
|
|
|
-
|
|
|
- this.setCollapsed( true );
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-UI.CollapsiblePanel.prototype.expand = function() {
|
|
|
-
|
|
|
- this.setCollapsed( false );
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-UI.CollapsiblePanel.prototype.setCollapsed = function( boolean ) {
|
|
|
-
|
|
|
- if ( boolean ) {
|
|
|
-
|
|
|
- this.dom.classList.add( 'collapsed' );
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- this.dom.classList.remove( 'collapsed' );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- this.isCollapsed = boolean;
|
|
|
-
|
|
|
- if ( this.onCollapsedChangeCallback !== undefined ) {
|
|
|
-
|
|
|
- this.onCollapsedChangeCallback( boolean );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-UI.CollapsiblePanel.prototype.onCollapsedChange = function ( callback ) {
|
|
|
-
|
|
|
- this.onCollapsedChangeCallback = callback;
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
// Text
|
|
|
|
|
|
UI.Text = function ( text ) {
|