changeset 25:f964a50bfe57

Restructured the application. Fixed layouts etc.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 08 May 2013 12:20:06 +0200
parents 72778ac34dbb
children 037e4a4c11b8
files app.js app/controller/Sql.js app/store/Proben.js app/view/Viewport.js app/view/proben/Edit.js app/view/proben/List.js app/view/sql/List.js app/view/sql/Variables.js
diffstat 8 files changed, 74 insertions(+), 83 deletions(-) [+]
line wrap: on
line diff
--- a/app.js	Tue May 07 17:20:11 2013 +0200
+++ b/app.js	Wed May 08 12:20:06 2013 +0200
@@ -2,61 +2,10 @@
     name: 'Lada',
     // Setting this variable to true should trigger loading the Viewport.js
     // file which sets ob the viewport. But this does not happen.
-    autoCreateViewprt: false,
+    autoCreateViewport: true,
     launch: function() {
         // Start the application.
         console.log('Launching the application');
-
-        // This code works here, but this should usually be done in the
-        // Viewport.js class.
-        Ext.create('Ext.panel.Panel', {
-            renderTo: Ext.getBody(),
-            title: '<center>Probenauswahlmaske</center>',
-            items:[
-                {
-                    xtype: 'panel',
-                    id: 'searchSelection',
-                    border: false,
-                    items: [
-                        // 1. SQL-Selection
-                        // 1.1 Just a small texttual field
-                        {
-                            xtype: 'displayfield',
-                            padding : '10 0',
-                            fieldLabel: '<b>SQL-Auswahl</b>'
-                        },
-                        // 1.2 Selection of prepared sql statements
-                        {
-                            xtype: 'sqllist'
-                        }
-                    ]
-                },
-                {
-                    xtype: 'panel',
-                    id: 'searchVariables',
-                    hidden: true,
-                    border: false,
-                    items: [
-                        // 2. Variable-Definition. Depending on the SQL-Selection we
-                        // need to show a small form to be able to diefine some values
-                        // within the preselected Search-statement.
-                        // 2.1 Just a small texttual field
-                        {
-                            xtype: 'displayfield',
-                            padding : '10 0',
-                            fieldLabel: '<b>Variablenbelegung (Zeiten in UTC)</b>',
-                            labelWidth: 500
-                        }
-
-                    ]
-                },
-                {
-                    xtype: 'probenlist',
-                    id: 'searchResult',
-                    hidden: true,
-                }
-            ]
-        });
     },
     // Define the controllers of the application. They will be initialized
     // first before the application "launch" function is called.
--- a/app/controller/Sql.js	Tue May 07 17:20:11 2013 +0200
+++ b/app/controller/Sql.js	Wed May 08 12:20:06 2013 +0200
@@ -24,26 +24,28 @@
     },
     selectSql: function(grid, record) {
         var selection = record.get('id');
-        var variables = Ext.getCmp('searchVariables');
-        console.log('Selected SQL' + selection);
-        // Set correct form for the current SQL-Selection
-        console.log('Length is ' + variables.items.length);
-        if (variables.items.length > 1) {
-            console.log('Length is > than 1');
-            variables.remove(currentVar.id);
-        }
-        if (selection == 1) {
-            currentVar = variables1;
-        }
-        else {
-            currentVar = variables2;
-        }
-        variables.add(currentVar);
-        // Show the panel for the variable definiton.
-        variables.show();
+        var variables = Ext.getCmp('variables');
+        var result = Ext.getCmp('result');
+        console.log('Selected SQL ' + selection);
+        //// Set correct form for the current SQL-Selection
+        //console.log('Length is ' + variables.items.length);
+        //if (variables.items.length > 1) {
+        //    console.log('Length is > than 1');
+        //    variables.remove(currentVar.id);
+        //}
+        //if (selection == 1) {
+        //    currentVar = variables1;
+        //}
+        //else {
+        //    currentVar = variables2;
+        //}
+        //variables.add(currentVar);
+        //// Show the panel for the variable definiton.
+        //variables.show();
 
         // Show the results.
-        Ext.getCmp('searchResult').show();
+        result.getStore().load();
+        result.show();
     }
 });
 
--- a/app/store/Proben.js	Tue May 07 17:20:11 2013 +0200
+++ b/app/store/Proben.js	Wed May 08 12:20:06 2013 +0200
@@ -7,8 +7,7 @@
             read: 'server/rest/proben'
         },
         reader: {
-            type: 'json',
-            contentType: "application/json; charset=utf-8;"
+            type: 'json'
         }
     }
 });
--- a/app/view/Viewport.js	Tue May 07 17:20:11 2013 +0200
+++ b/app/view/Viewport.js	Wed May 08 12:20:06 2013 +0200
@@ -1,17 +1,32 @@
 Ext.define('Lada.view.Viewport' ,{
     extend: 'Ext.container.Viewport',
     requires: [
-        'Lada.view.Sql',
-        'Lada.view.Proben'
+        'Lada.view.sql.List',
+        'Lada.view.sql.Variables',
+        'Lada.view.proben.List'
     ],
-    layout: 'fit',
     initComponent: function() {
         console.log('Setting up Viewport');
         this.items = {
-            xtype: 'probenlist'
-            //items: [{
-            //    xtype: 'probenlist'
-            //}]
+            xtype: 'panel',
+            title: '<center>Probenauswahlmaske</center>',
+            bodyPadding: '10 10',
+            items: [
+                {
+                    xtype: 'sqllist',
+                    margin: '0 0 10 0'
+                },
+                // Variables settings for the current selected sql statement.
+                //{
+                //    id: 'variables',
+                //    xtype: 'variables'
+                //},
+                // Resultlist for the query.
+                {
+                    id: 'result',
+                    xtype: 'probenlist'
+                }
+            ]
         };
         this.callParent(arguments);
     }
--- a/app/view/proben/Edit.js	Tue May 07 17:20:11 2013 +0200
+++ b/app/view/proben/Edit.js	Wed May 08 12:20:06 2013 +0200
@@ -3,15 +3,19 @@
     alias: 'widget.probenedit',
 
     title: 'Maske für §3-Proben',
-    width: 800,
-    layout: 'fit',
+    width: 600,
+    height: 600,
     autoShow: true,
+    autoScroll: true,
+    modal: true,
 
     initComponent: function() {
         this.items = [
             {
                 //Define the form
                 xtype: 'form',
+                bodyPadding: '10 10',
+                border: 0,
                 items: [
                     // Probenangaben
                     {
--- a/app/view/proben/List.js	Tue May 07 17:20:11 2013 +0200
+++ b/app/view/proben/List.js	Wed May 08 12:20:06 2013 +0200
@@ -1,8 +1,8 @@
 Ext.define('Lada.view.proben.List' ,{
     extend: 'Ext.grid.Panel',
     alias: 'widget.probenlist',
+    maxHeight: 350,
     store: 'Proben',
-
     initComponent: function() {
         this.columns = [
             {header: 'Datenbasis',  dataIndex: 'datenbasisId', width: 70},
--- a/app/view/sql/List.js	Tue May 07 17:20:11 2013 +0200
+++ b/app/view/sql/List.js	Wed May 08 12:20:06 2013 +0200
@@ -13,4 +13,3 @@
         this.callParent(arguments);
     }
 });
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/sql/Variables.js	Wed May 08 12:20:06 2013 +0200
@@ -0,0 +1,23 @@
+Ext.define('Lada.view.sql.Variables' ,{
+    extend: 'Ext.panel.Panel',
+    alias: 'widget.variables',
+    border: false,
+
+    initComponent: function() {
+        this.items = [
+            {
+                id: 'sqlVar1',
+                xtype: 'displayfield',
+                fieldLabel: 'Variables for SQL 1',
+                labelWidth: 300
+            },
+            {
+                id: 'sqlVar2',
+                xtype: 'displayfield',
+                fieldLabel: 'Variables for SQL 2',
+                labelWidth: 300
+            }
+        ];
+        this.callParent(arguments);
+    }
+});

http://lada.wald.intevation.org