SR Technology WTK Repo
Check-in [d092328cde]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Start of private SAPUI5 branch edits.
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1: d092328cde6167b91b087d52f1334bfdd400992f
User & Date: gerald 2013-03-07 04:11:32
Context
2013-03-07
04:11
Start of private SAPUI5 branch edits. Leaf check-in: d092328cde user: gerald tags: trunk
2013-03-05
00:01
De-snitted a lot of the event handlers Added a new "options_dict" method for introspecting options. The odie way of handling properties collapsed horribly if there happened to be an option named -options (as we see in the combobox...) Added "my variable" to methods that were relying on the "variable" keyword in the class definition magically working Developed a TclOO implementation of traced variable event linking Updated to the latest ODIE, which adds mutexes, fixes a few bugs with properties, etc. (See odie fossil timeline) check-in: 9a05a8cffa user: seandeelywoods tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to index.html.

     9      9   <h1>wtk (web Tk) demo</h1>
    10     10   
    11     11   <h2>Demo wtk applications</h2>
    12     12   <ul>
    13     13     <li><a href="demo.tcl">demo.tcl</a> (click link to run widget demo app)
    14     14     <li><a href="sketch.tcl">sketch.tcl</a> (click link to run freehand sketch on canvas demo)
    15     15   </ul>
           16  +
           17  +<h2>SAPUI5 demo</h2>
           18  +<ul>
           19  +  <li><a href="sapui5.html">Hello World</a>
           20  +</ul>
    16     21   
    17     22   <h2>Code overview</h2>
    18     23   <table>
    19     24   <tr><td><a href="src.html?f=index.html">index.html</a></td><td>This page.</td></tr>
    20     25   <tr><td><a href="src.html?f=server.tcl">server.tcl</a></td><td>Main demo application; it manages the webserver communication and creates wtk interpreters which
    21     26   	actually run demos for a client.</td></tr>
    22     27   <tr><td><a href="src.html?f=lib/wtkcoreapp.html">lib/wtkcoreapp.html</a></td><td>Web page for an application, which initializes the Javascript side of wtk and connects to the

Changes to lib/wtk-base.tcl.

    39     39           init $_sender
    40     40           return ""
    41     41       }
    42     42   
    43     43       proc toclient {cmd} {uplevel #0 $::wtk::_sender [list $cmd]}
    44     44   
    45     45       proc fromclient {cmd} {
    46         -        switch -exact -- [lindex $cmd 0] {
           46  +        set lcmd [split $cmd]
           47  +        switch -exact -- [lindex $lcmd 0] {
    47     48               "EVENT" {
           49  +<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<
           50  +                [getwidget [lindex $lcmd 1]] _event {*}[lrange $lcmd 2 end]
           51  +======= COMMON ANCESTOR content follows ============================
           52  +                [getwidget [lindex $cmd 1]] _event {*}[lrange $cmd 2 end]
           53  +======= MERGED IN content follows ==================================
    48     54                   [getwidget [lindex $cmd 1]] wtk_event {*}[lrange $cmd 2 end]
           55  +>>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    49     56               }
    50     57               "LOG" {
    51         -                ::log::log [lindex $cmd 1] [lrange $cmd 2 end]
           58  +                ::log::log [lindex $lcmd 1] [join [lrange $lcmd 2 end]]
    52     59               }
    53     60           }
    54     61       }
    55     62   
    56     63       # 'Generic' widget object, which handles routines common to all widgets like
    57     64       # assigning it an id, keeping track of whether or not its been created, etc.
    58     65       # Purely for convenience, we also include some code here that manages widgets

Changes to lib/wtkcoreapp.html.

            1  +<!DOCTYPE html>
     1      2   <html>
     2      3   <head>
     3         -%%%FAVICON%%%
            4  +    %%%FAVICON%%%
     4      5   
            6  +    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
     5      7   
     6         -<style type="text/css">
     7         -* {outline:none;  appearance: none; -moz-appearance: none; border-radius: 5px;}
     8         -::-moz-focus-inner { border: 2px; outline: none;-moz-apperance:none;}
            8  +    <script src="lib/jquery.min.js"></script>
            9  +    <script src="widgets/wtk.js"></script>
     9     10   
    10         -</style>
    11         -<script src="lib/jquery.min.js"></script>
    12         -<script src="widgets/wtk.js"></script>
           11  +    <script id="sap-ui-bootstrap"
           12  +        type="text/javascript"
           13  +        src="resources/sap-ui-core.js"
           14  +        data-sap-ui-theme="sap_goldreflection"
           15  +        data-sap-ui-libs="sap.ui.commons">
           16  +    </script>
           17  +
    13     18   </head>
    14         -<body>
           19  +
           20  +<body class="sapUiBody">
           21  +
    15     22   <div id=obj0></div>
    16     23   <script>
    17     24   $(document).ready(function() {wtk.init(%%%SESSIONID%%%)});
    18     25   </script>
           26  +
           27  +<div id="uiArea"></div>
           28  +
    19     29   </body>
    20     30   </html>

Changes to widgets/wtk.js.

    66     66   
    67     67   
    68     68       },
    69     69   
    70     70       server_log :function(logLevel,msg) {
    71     71           wtk.sendto('LOG '+logLevel+' '+wtk.sessionid+' '+msg);
    72     72       },
           73  +
           74  +
    73     75   
    74     76       poller : function() {$.ajax({type:'GET', url:'wtkpoll.html?sessionid='+wtk.sessionid, dataType:'script',
    75     77                                   complete: function() {setTimeout(wtk.poller,100);},
    76     78                                   error: function(jqXHR, textStatus, errorThrown) {
    77     79   																	//alert("AJAX server connection interrupted\nPress OK to reconnect.");
    78     80   																	console.log('AJAX server connecton interrupted '+textStatus+' '+errorThrown);
    79     81   																	setTimeout(location.reload(1),200);}
................................................................................
    89     91   		},
    90     92   
    91     93       /*
    92     94        * Generic widget creation; each widget is an HTML element of a certain type, and is given an
    93     95        * id by the wtk code on the server side which is used to uniquely identify it.
    94     96        */
    95     97       CreateWidget : function(id,type,txt,attr) {
    96         -        var w = document.createElement(type);
    97         -        w.id = id;
    98         -        if(txt!='') {if (attr=='innerHTML') {w.innerHTML=txt;} else {w.value=txt;};}
           98  +        wtk.server_log('debug','Type = "'+type+'". Id = "'+id+'". Index is: '+id.indexOf('sapui5'));
           99  +        if (type == "button") {
          100  +            wtk.server_log('debug','Attempting to create an SAPUI5 button with id of {' + id +'} and label of {' + txt +'}');
          101  +            //var w = document.createElement('div');
          102  +            //w.id = 'div_' + id;
          103  +            var o = new sap.ui.commons.Button(id);
          104  +            wtk.server_log('debug','Created SAPUI5 button "'+id+'"!');
          105  +            o.setText(txt);
          106  +            //o.placeAt('div_' + id);
          107  +            wtk.server_log('debug','Text set, calling render.');
          108  +            o.rerender();
          109  +            var w = o.getDomRef();
          110  +            wtk.server_log('debug','w = ' + w);
          111  +            wtk.server_log('debug','type of = ' +  typeof(w));
          112  +            wtk.server_log('debug','w.tagName = ' + w.tagName);
          113  +            wtk.server_log('debug','w.nodeName = ' + w.nodeName);
          114  +        } else {
          115  +            var w = document.createElement(type);
          116  +            w.id = id;
          117  +            if(txt!='') {
          118  +                if (attr=='innerHTML') {
          119  +                    w.innerHTML=txt;
          120  +                } else {
          121  +                    w.value=txt;
          122  +                }
          123  +            ;};
          124  +        };
    99    125           wtk.widgets[id] = w;
   100    126           return w;
   101    127       },
   102    128   
   103    129       /*
   104    130        * Buttons, labels and entries, oh my!
   105    131        */
................................................................................
   106    132   
   107    133   
   108    134   		createMisc   : function(id, type, txt, attr) {
   109    135   			wtk.CreateWidget(id, type, txt, attr).onclick = function() {wtk.miscClicked(id);};
   110    136   			},
   111    137   		miscClicked : function(id) { wtk.sendto('EVENT '+id+' pressed'+' value '+wtk.widgets[id].value); },
   112    138   
   113         -    createButton  : function(id,txt) { wtk.CreateWidget(id,'button',txt,'innerHTML').onclick = function() {wtk.buttonClicked(id);}; },
          139  +    createButton  : function(id,txt) {
          140  +        wtk.CreateWidget(id,'button',txt,'innerHTML').onclick = function() {wtk.buttonClicked(id);};
          141  +    },
   114    142       buttonClicked : function(id) { wtk.sendto('EVENT '+id+' pressed'); },
   115    143   
   116    144       createCombobox  : function(id,txt) {
   117    145       	  wtk.CreateWidget(id,'select',txt,'value').onchange = function() {wtk.comboboxClicked(id);};
   118    146       },
   119    147       comboboxClicked : function(id) { wtk.sendto('EVENT '+id+' value '+wtk.widgets[id].value); },
   120    148