{
    "type": "Ext.app.Controller",
    "reference": {
        "name": "items",
        "type": "array"
    },
    "codeClass": null,
    "userConfig": {
        "designer|userClassName": "GUIController"
    },
    "designerId": "11da9ea8-16fe-45b4-ab3b-66ca1df94e39",
    "cn": [
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "treegrid",
                "selector": "#treegrid"
            },
            "designerId": "e447d7a5-5a10-47c0-9ab3-aa31a813ed57"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "deleterule",
                "selector": "#deleteRuleButton"
            },
            "designerId": "06a3e1c8-29dc-4b7e-94fd-c02391a45350"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "addrole",
                "selector": "#addRoleButton"
            },
            "designerId": "a569b166-b667-44d9-b91b-c68d5d5ea678"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "deleterole",
                "selector": "#removeRoleButton"
            },
            "designerId": "fb12f8ec-8494-4b81-b487-0a2b7b4e1e0c"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "copyRuleButton",
                "selector": "#copyRuleButton"
            },
            "designerId": "ea8738f6-304d-4cfe-b7e7-6db4f551baa7"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "editRuleButton",
                "selector": "#editRuleButton"
            },
            "designerId": "0d74d638-3ce4-496f-91da-976387da156a"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "deleteGroupButton",
                "selector": "#deleteGroupButton"
            },
            "designerId": "18e5a0cb-9bbc-4277-88f4-28fe5bbb5b35"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "clearselection",
                "selector": "#clearselection"
            },
            "designerId": "741feeae-45e3-4eed-b424-1ac27993edff"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "viewRuleHistoryButton",
                "selector": "#viewRuleHistoryButton"
            },
            "designerId": "9eb2d44c-fccb-4a15-965b-18858194d2c8"
        },
        {
            "type": "fixedfunction",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "designer|params": [
                    "application"
                ],
                "fn": "init",
                "implHandler": [
                    "//add listener to treegrid\r",
                    "this.control({\r",
                    "    '#treegrid': {\r",
                    "        selectionchange: function(model, selected, eOpts) {\r",
                    "\t\t\tthis.selectionHasChanged(model, selected, eOpts);\r",
                    "\t\t}\r",
                    "    }\r",
                    "});\r",
                    "\r",
                    "//clear selection button\r",
                    "this.control({\r",
                    "    '#clearselection': {\r",
                    "        click: function() {\r",
                    "            this.getTreegrid().getSelectionModel().deselectAll();\r",
                    "            this.getClearselection().blur();\r",
                    "        }\r",
                    "    }\r",
                    "});\r",
                    ""
                ]
            },
            "designerId": "adb3d318-fca2-4844-8615-2379e00ca3b8"
        },
        {
            "type": "fixedfunction",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "fn": "onLaunch",
                "implHandler": [
                    "/*\r",
                    "var task = new Ext.util.DelayedTask(function(args){\r",
                    "    var mygrid = args.grid;\r",
                    "    mygrid.getStore().load();\r",
                    "    mygrid.expandAll();\r",
                    "});\r",
                    "var mygrid = this.getTreegrid();\r",
                    "task.delay(3000, null, null, [{grid: mygrid}]);\r",
                    "*/"
                ]
            },
            "designerId": "a43e4431-1d57-42cb-af9a-98a1db220d84"
        },
        {
            "type": "basicfunction",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "designer|params": [
                    "model, selected, eOpts"
                ],
                "fn": "selectionHasChanged",
                "implHandler": [
                    "this.disableAll();\r",
                    "/*\r",
                    "this.getEditGroupButton().disable();\r",
                    "this.getDeleteGroupButton().disable();\r",
                    "this.getActivateGroupButton().disable();\r",
                    "this.getDeactivateGroupButton().disable();\r",
                    "*/\r",
                    "//console.log(selected);\r",
                    "\r",
                    "if(!Ext.isEmpty(selected)) {\r",
                    "    this.getClearselection().enable();\r",
                    "\r",
                    "\tvar selNode = selected.length > 1? selected[selected.length-1] : selected[0];\r",
                    "\r",
                    "\tif(selNode.isLeaf()) {\r",
                    "\t\t//role\r",
                    "\t\tthis.getDeleterole().enable();\r",
                    "\t}\r",
                    "\telse if (selNode.data.ruleId !== null && selNode.data.ruleId !== undefined && selNode.data.ruleId !== \"\") {\r",
                    "\t\t//rule\r",
                    "\t\tthis.getAddrole().enable();\r",
                    "\t\tthis.getEditRuleButton().enable();\r",
                    "\t\tthis.getCopyRuleButton().enable();\r",
                    "\t\tthis.getViewRuleHistoryButton().enable();\r",
                    "\t\tthis.getRiskDetailsPDF().enable();\r",
                    "\r",
                    "\t\tif(selNode.get('statusId') != \"Active\") {\r",
                    "\t\t\tthis.getDeleterule().enable();\r",
                    "\t\t}\r",
                    "\r",
                    "\t}\r",
                    "\telse {\r",
                    "\t\t//group\r",
                    "\t\tif(selNode.childNodes.length < 1 && selNode.get('id') !== 0) {\r",
                    "\t\t\tthis.getDeleteGroupButton().enable();\r",
                    "\t\t}\r",
                    "\t\telse {\r",
                    "\t\t\tthis.getActivateGroupButton().enable();\r",
                    "\t\t\tthis.getDeactivateGroupButton().enable();\r",
                    "\t\t}\r",
                    "\t\tif (selNode.get('id') !== 0) {\r",
                    "\t\t\tthis.getEditGroupButton().enable();\r",
                    "\t\t}\r",
                    "\t\telse {\r",
                    "\t\t\tthis.getEditGroupButton().disable();\r",
                    "\t\t}\r",
                    "\t}\r",
                    "\t//selNode.expand(); //creates problems with double click expansion of the tree\r",
                    "}\r",
                    "else {\r",
                    "\tthis.getClearselection().disable();\r",
                    "}"
                ]
            },
            "designerId": "36f48f66-bc4c-4426-927b-1bd1fdfae54f"
        },
        {
            "type": "basicfunction",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "fn": "disableAll",
                "implHandler": [
                    "if(this.getEditRuleButton() !== undefined) {\r",
                    "\tthis.getEditRuleButton().disable();\r",
                    "\tthis.getCopyRuleButton().disable();\r",
                    "\tthis.getDeleterule().disable();\r",
                    "\r",
                    "\tthis.getAddrole().disable();\r",
                    "\tthis.getDeleterole().disable();\r",
                    "\r",
                    "\tthis.getRiskDetailsPDF().disable();\r",
                    "\r",
                    "\tthis.getEditGroupButton().disable();\r",
                    "\tthis.getDeleteGroupButton().disable();\r",
                    "\tthis.getActivateGroupButton().disable();\r",
                    "\tthis.getDeactivateGroupButton().disable();\r",
                    "\r",
                    "\tthis.getViewRuleHistoryButton().disable();\r",
                    "\r",
                    "}"
                ]
            },
            "designerId": "9920b0aa-d4cf-43ad-8a2d-80831261274b"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "activateGroupButton",
                "selector": "#activateGroupButton"
            },
            "designerId": "082fdf79-3d2c-4f3c-a719-2ebfafa17645"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "deactivateGroupButton",
                "selector": "#deactivateGroupButton"
            },
            "designerId": "5b29e01a-d186-43a6-b854-8b68ef693862"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "editGroupButton",
                "selector": "#editGroupButton"
            },
            "designerId": "69189812-06b8-464f-b81e-6a8dde45d2d9"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "riskDetailsPDF",
                "selector": "#riskDetailsPDF"
            },
            "designerId": "fbeed0d8-589c-4003-b4db-83a55f34162e"
        }
    ]
}