ko-archetype/src/main/resources/archetype-resources/src/main/resources/index.html
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Wed, 15 May 2013 11:14:39 +0200
changeset 1213 022099dee442
parent 1209 bf622f485775
permissions -rw-r--r--
Controlling the loadingIndicator via loading property
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 
     3 <!--
     4     Copied from knockout.js Twitter example:
     5     http://knockoutjs.com/examples/twitter.html
     6 -->
     7 
     8 <!DOCTYPE html>
     9 <html xmlns="http://www.w3.org/1999/xhtml">
    10     <head>
    11         <title>Bck2Brwsr's Twitter</title>
    12     </head>
    13     <body>
    14         <link href='twitterExample.css' rel='Stylesheet' ></link>
    15         
    16         <style type='text/css'>
    17            .liveExample select { height: 1.7em; }
    18            .liveExample button { height: 2em; }
    19         </style>
    20         
    21         
    22         <h2>Bck2Brwsr's Twitter</h2>
    23         
    24         <p>
    25         This code is based on original 
    26         <a href="http://knockoutjs.com/examples/twitter.html">knockout.js
    27         Twitter example</a> and
    28         uses almost unmodified HTML page. It just changes the model. The model
    29         is written in Java language with the help of 
    30         <a href="http://bck2brwsr.apidesign.org/javadoc/net.java.html.json/">
    31             Knockout/Java binding library
    32         </a>. The Java source code has about 180 lines and seems more 
    33         dense and shorter than the original JavaScript model.
    34         </p>
    35         <p>
    36         The project has two profiles. Either it executes in real Java virtual
    37         machine and renders using JavaFX's WebView (use <code>fxbrwsr</code> profile
    38         - the default). It can also run directly in a browser via
    39         <a href="http://bck2brwsr.apidesign.org">Bck2Brwsr</a> virtual machine
    40         (use <code>bck2brwsr</code> profile).
    41         </p>
    42         
    43         <div class='liveExample'>
    44             <div class='configuration'>
    45                 <div class='listChooser'>
    46                     <button data-bind='click: deleteList, enable: activeTweetersName'>Delete</button>
    47                     <button data-bind='click: saveChanges, enable: hasUnsavedChanges'>Save</button> 
    48                     <select data-bind='options: savedLists, optionsValue: "name", value: activeTweetersName'> </select>
    49                 </div>
    50 
    51                 <p>Currently viewing <span data-bind='text: activeTweetersCount'> </span> user(s):</p>
    52                 <div class='currentUsers' >
    53                     <ul data-bind='foreach: activeTweeters'>
    54                         <li>
    55                             <button data-bind='click: $root.removeUser'>Remove</button>
    56                             <div data-bind='text: $data'> </div>
    57                         </li>
    58                     </ul>
    59                 </div>
    60 
    61                 <form data-bind='submit: addUser'>
    62                     <label>Add user:</label>
    63                     <input data-bind='value: userNameToAdd, valueUpdate: "keyup", css: { invalid: !userNameToAddIsValid() }' />
    64                     <button data-bind='enable: userNameToAddIsValid' type='submit'>Add</button>
    65                 </form>
    66             </div>
    67             <div class='tweets'>
    68                 <div class='loadingIndicator' data-bind="visible: loading">Loading...</div>
    69                 <table data-bind='foreach: currentTweets' width='100%'>
    70                     <tr>
    71                         <td><img data-bind='attr: { src: profile_image_url }' /></td>
    72                         <td>
    73                             <a class='twitterUser' data-bind='attr: { href: userUrl }, text: from_user'> </a>
    74                             <span data-bind='html: html'> </span>
    75                             <div class='tweetInfo' data-bind='text: created_at'> </div>
    76                         </td>
    77                     </tr>
    78                 </table>
    79             </div>
    80         </div>
    81         
    82         <script src="bck2brwsr.js"></script>
    83         <script type="text/javascript">
    84             var vm = bck2brwsr('${artifactId}-${version}.jar');
    85             vm.loadClass('${package}.TwitterClient');
    86         </script>
    87 
    88 
    89     </body>
    90 </html>