var WhatPanel = Namespace.declare("com.twitter.Bootstrap",
    class WhatPanel extends UcpComponent {
        static start() {}
        static dependencies() {
            return [
                "/EAMD.ucp/Components/com/twitter/Bootstrap/Panel/1.0.0/Panel.component.xml"
            ];
        }


        constructor() {
            super();
            this.controller.eventSupport.addEventListener("newView",this, this.newView);
            
            this.model = {
                css: "col-sm-2 fullHeight",
                panel: {
                    classes: "fullHeight",
                    heading: "What",
                    footer: "Select what you want to do"
                },
                items: [
                    { "name": "EAMD.ucp", "onclick": "javascript:TheLastApp.goToRepository()" },
                    { "name": "Structr Schema", onclick: "javascript:TheLastApp.structrSchema()"},
                    { "name": "TheLastApp", "onclick": "http://structr.cerulean.it:6082/EAMD.ucp/Components/com/ceruleanCircle/EAM/5_ux/WODA/0.3.0/src/html/WODA.html" },
                    { "name": "UcpComponents", "onclick": "javascript:TheLastApp.what.select(Namespaces.discover())" },
                    { "name": "ONCE", "onclick": "javascript:TheLastApp.what.select(ONCE.discover())" },
                    { "name": "Once", onclick: "javascript:TheLastApp.what.pop()" }
                ]
            }
        }

        init() {
            if (this.isInitialized)
                return;
			super.init();
			return this;
        }

        get container() {
            return this.defaultView.container;
        }
        get panel() {
            return this.documentElement.children[0].weBeanNode.model.ucpComponent;
        }

        push(item) {
            this.properties.items.unshift(item);
            this.defaultView.update();
        }
        pop(item) {
            this.properties.items.shift();
            this.defaultView.update();
        }

        get itemView() {
            return this;
        }

        newView(event, item) {
            console.log("newView",event,item);
        }

        handleSelection(event, item) {
            console.log(this.constructor.name+": handleSelection",item);
        }
    }
);