Ignore:
Timestamp:
Dec 26, 2007, 5:44:01 PM (17 years ago)
Author:
fnevgeny
Branch:
default
Phase:
public
Message:

Each tab is rendered by its own function. Added two dummy tabs, "Compare" and
"Plot". More small geometry tunings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/class/pf/Application.js

    r20 r21  
    947947        },
    948948
    949         /**
    950          * TODOC
    951          *
    952          * @type member
    953          * @param e {Event} TODOC
    954          * @return {void}
    955          */
    956         main : function(e)
    957         {
    958             this.base(arguments);
    959            
    960             // Define alias for custom resource path
    961             qx.io.Alias.getInstance().add("pf",
    962                 qx.core.Setting.get("pf.resourceUri"));
    963 
    964             // Defaults
    965            
    966             this.r = new pf.base.Species("r", 1.0,           0, 0,    1.0, null);
    967             this.e = new pf.base.Species("e", (1.0/1836.2), -1, 1e16, 1.0, this.r);
    968             this.i = new pf.base.Species("i", 1.0,          +1, 1e16, 1.0, this.r);
    969            
    970             this.P_r = 0;
    971 
    972             this.B   = 0;
    973            
    974             this.n_u = 2;
    975             this.n_l = 1;
    976            
    977             if (this.updatePlasmaParameters() != true) {
    978                 alert("Error!");
    979             }
    980            
    981             // Favorites
    982             this.favorites = new Array;
    983 
    984             // Top-level container
    985             this.bl_top = new qx.ui.layout.VerticalBoxLayout("vertical");
    986             this.bl_top.setWidth("100%");
    987             this.bl_top.setHeight("auto");
    988 
    989             this.bl_top.addToDocument();
    990 
    991 
    992             // The toolbar
    993             var tb = new qx.ui.toolbar.ToolBar;
    994             this.bl_top.add(tb);
    995 
    996             // ... and the buttons themselves
    997 
    998             var sep = new qx.ui.toolbar.Separator;
    999             tb.add(sep);
    1000 
    1001             var btn = new qx.ui.toolbar.Button("About...");
    1002             tb.add(btn);
    1003             // btn.addEventListener("execute", this.aboutCB, this);
    1004 
    1005             var tf1 = new qx.ui.pageview.tabview.TabView;
    1006             this.bl_top.add(tf1);
    1007 
    1008             this.tabbar  = tf1.getBar();
    1009             this.tabpane = tf1.getPane();
    1010             this.tabpane.setPadding(0, 0, 0, 0);
    1011 
     949        renderTabPage : function(label, icon, checked)
     950        {
    1012951            var tab_id, page_id;
    1013             var fr, gl;
    1014             var l, e;
    1015            
    1016             var tab_id = new qx.ui.pageview.tabview.Button("Parameters",
    1017                 "pf/image/tab-parameters.png");
     952           
     953            tab_id = new qx.ui.pageview.tabview.Button(label, icon);
    1018954            this.tabbar.add(tab_id);
    1019955            page_id = new qx.ui.pageview.tabview.Page(tab_id);
     
    1023959            this.tabpane.add(page_id);
    1024960
     961            if (checked) {
     962                tab_id.setChecked(true);
     963            }
     964           
     965            return page_id;
     966        },
     967
     968        renderParametersTab : function()
     969        {
     970            var page_id = this.renderTabPage("Parameters",
     971                "pf/image/tab-parameters.png", true);
     972
     973            var fr, gl;
     974           
    1025975            fr = new qx.ui.groupbox.GroupBox("Electrons",
    1026976                "pf/image/e_small.png");
     
    1041991
    1042992            fr.add(gl);
     993
     994            var l, e;
    1043995
    1044996            // N_e
     
    12431195            gl.add(e, 1, 2);
    12441196            e.addEventListener("change", changeN_l, this);
    1245 
    1246             tab_id.setChecked(true);
    1247 
    1248 
    1249             tab_id = new qx.ui.pageview.tabview.Button("Explorer",
     1197        },
     1198
     1199        renderExplorerTab : function()
     1200        {
     1201            var page_id = this.renderTabPage("Explorer",
    12501202                "pf/image/tab-explorer.png");
    1251             this.tabbar.add(tab_id);
    1252             page_id = new qx.ui.pageview.tabview.Page(tab_id);
    1253             page_id.setHeight("auto");
    1254             page_id.setPadding(10, 10, 10, 10);
    1255             page_id.setBackgroundColor("white");
    1256             this.tabpane.add(page_id);
    1257            
    1258             var pageLayout = new qx.ui.layout.CanvasLayout;
    1259             pageLayout.set(
    1260             {
    1261                 width:  "100%",
    1262                 height: 600,
    1263                 backgroundColor: "grey"
    1264             });
    1265             page_id.add(pageLayout);
    12661203           
    12671204            var sp = new qx.ui.splitpane.HorizontalSplitPane(300, "1*");
     
    12761213                showKnob        : true
    12771214            });
    1278             pageLayout.add(sp);
     1215            page_id.add(sp);
    12791216                       
    12801217            var left_pane  = sp.getLeftArea();
     
    12871224                border          : "inset-thin",
    12881225                overflow        : "scroll",
    1289                 height          : "100%",
     1226                height          : 530,
    12901227                width           : "100%",
    12911228                paddingLeft     : 4,
     
    13821319
    13831320
    1384             gl = new qx.ui.layout.GridLayout;
     1321            var gl = new qx.ui.layout.GridLayout;
    13851322            gl.set(
    13861323            {
     
    14011338            gl.setRowHeight(2, 30);
    14021339
     1340            var l, e;
     1341
    14031342            l = new qx.ui.basic.Label("Name:");
    14041343            gl.add(l, 0, 0);
     
    14281367
    14291368            right_pane.add(gl);
     1369        },
     1370       
     1371        renderCompareTab : function()
     1372        {
     1373            var page_id = this.renderTabPage("Compare",
     1374                "pf/image/tab-compare.png");
     1375        },
     1376       
     1377        renderPlotTab : function()
     1378        {
     1379            var page_id = this.renderTabPage("Plot",
     1380                "pf/image/tab-plot.png");
     1381        },
     1382       
     1383        /**
     1384         * TODOC
     1385         *
     1386         * @type member
     1387         * @param e {Event} TODOC
     1388         * @return {void}
     1389         */
     1390        main : function(e)
     1391        {
     1392            this.base(arguments);
     1393           
     1394            // Define alias for custom resource path
     1395            qx.io.Alias.getInstance().add("pf",
     1396                qx.core.Setting.get("pf.resourceUri"));
     1397
     1398            // Defaults
     1399           
     1400            this.r = new pf.base.Species("r", 1.0,           0, 0,    1.0, null);
     1401            this.e = new pf.base.Species("e", (1.0/1836.2), -1, 1e16, 1.0, this.r);
     1402            this.i = new pf.base.Species("i", 1.0,          +1, 1e16, 1.0, this.r);
     1403           
     1404            this.P_r = 0;
     1405
     1406            this.B   = 0;
     1407           
     1408            this.n_u = 2;
     1409            this.n_l = 1;
     1410           
     1411            if (this.updatePlasmaParameters() != true) {
     1412                alert("Error!");
     1413            }
     1414           
     1415            // Favorites
     1416            this.favorites = new Array;
     1417
     1418            // Top-level container
     1419            this.bl_top = new qx.ui.layout.VerticalBoxLayout("vertical");
     1420            this.bl_top.setWidth("100%");
     1421            this.bl_top.setHeight("100%");
     1422
     1423            this.bl_top.addToDocument();
     1424
     1425
     1426            // The toolbar
     1427            var tb = new qx.ui.toolbar.ToolBar;
     1428            this.bl_top.add(tb);
     1429
     1430            // ... and the buttons themselves
     1431
     1432            var sep = new qx.ui.toolbar.Separator;
     1433            tb.add(sep);
     1434
     1435            var btn = new qx.ui.toolbar.Button("About...");
     1436            tb.add(btn);
     1437            // btn.addEventListener("execute", this.aboutCB, this);
     1438
     1439            var tf1 = new qx.ui.pageview.tabview.TabView;
     1440            tf1.set({ width : '100%', height : 'auto' });
     1441
     1442            this.bl_top.add(tf1);
     1443
     1444            this.tabbar  = tf1.getBar();
     1445            this.tabpane = tf1.getPane();
     1446            this.tabpane.setHeight('auto');
     1447            this.tabpane.setPadding(0, 0, 0, 0);
     1448
     1449            // The "Parameters" tab
     1450            this.renderParametersTab();
     1451           
     1452            // The "Explorer" tab
     1453            this.renderExplorerTab();
     1454           
     1455            // The "Compare" tab
     1456            this.renderCompareTab();
     1457           
     1458            // The "Plot" tab
     1459            this.renderPlotTab();
    14301460        },
    14311461   
Note: See TracChangeset for help on using the changeset viewer.