<commit_before><html ng-app="weatherApp">
<head>
  <script data-main="../../dolphin/opendolphin.js" src="../../libs/require.js"></script>
  <script src="lib/angular.min.js"></script>
  <link  href="../../css/bootstrap.min.css" rel="stylesheet">
</head>
<body ng-controller="WeatherTableController">

<div class="container">
    <div class="offset1 span4">
        <h3>Weather Observations</h3>
        <button id="addButton" class="btn btn-primary"> + </button>
        <table class="table table-bordered table-condensed span4">
            <thead> <tr>
                <th>Temperature</th>
                <th>Humidity</th>
            </tr> </thead>
            <tbody>
            <tr ng-repeat="measurement in measurements">
                <td>{{measurement.temp}}</td>
                <td>{{measurement.humid}}</td>
            </tr>
            </tbody>
        </table>
    </div>
    <hr>
    <a href="https://github.com/canoo/open-dolphin/blob/master/dolphin-grails/web-app/demo/angular/AngularTable.html">source code</a>
</div>
</body>
<script>

    // angular binding to from widget model to view

    var weatherApp = angular.module('weatherApp', []);
    weatherApp.controller('WeatherTableController', function ($scope) {
        $scope.measurements = [];

        $scope.addRow = function (measurement) {
            $scope.measurements.push(measurement);
            $scope.$apply()
        };

        // dolphin binding from presentation model to widget model

        require([ 'opendolphin' ], function (dol) {
            var dolphin = dol.dolphin("http://localhost:8080/dolphin-grails/dolphin/", true);
            var addButton = document.getElementById("addButton");
            addButton.addEventListener("click", function () {
              dolphin.send("org.opendolphin.demo.Tutorial.add", {onFinished: function (models) {
                models.forEach(function (model) {
                    $scope.addRow( {
                        temp : model.getAt("temperature").getValue(),
                        humid: model.getAt("humidity").getValue()
                    })
                })
              }});
            });
        });

    });
</script>


</html>
<commit_msg>make Angular demo use ModelStoreListener<commit_after><html ng-app="weatherApp">
<head>
  <script data-main="../../dolphin/opendolphin.js" src="../../libs/require.js"></script>
  <script src="lib/angular.min.js"></script>
  <link  href="../../css/bootstrap.min.css" rel="stylesheet">
</head>
<body ng-controller="WeatherTableController">

<div class="container">
    <div class="offset1 span4">
        <h3>Weather Observations</h3>
        <button id="addButton" class="btn btn-primary"> + </button>
        <table class="table table-bordered table-condensed span4">
            <thead> <tr>
                <th>Temperature</th>
                <th>Humidity</th>
            </tr> </thead>
            <tbody>
            <tr ng-repeat="measurement in measurements">
                <td>{{measurement.temp}}</td>
                <td>{{measurement.humid}}</td>
            </tr>
            </tbody>
        </table>
    </div>
    <hr>
    <a href="https://github.com/canoo/open-dolphin/blob/master/dolphin-grails/web-app/demo/angular/AngularTable.html">source code</a>
</div>
</body>
<script>

    // angular binding to from widget model to view

    var weatherApp = angular.module('weatherApp', []);
    weatherApp.controller('WeatherTableController', function ($scope) {
        $scope.measurements = [];

        $scope.addRow = function (measurement) {
            $scope.measurements.push(measurement);
            $scope.$apply()
        };

        // dolphin binding from presentation model to widget model

        require([ 'opendolphin' ], function (dol) {
            var dolphin = dol.dolphin("http://localhost:8080/dolphin-grails/dolphin/", true);

            var addButton = document.getElementById("addButton");
            addButton.addEventListener("click", function () {
              dolphin.send("org.opendolphin.demo.Tutorial.add", null);
            });

            dolphin.getClientModelStore().onModelStoreChange(function (modelStoreEvent) {
                if (modelStoreEvent.eventType != 'ADDED') return;
                var cpm = modelStoreEvent.clientPresentationModel
                if (cpm.presentationModelType != "weather") return;
                $scope.addRow( {
                    temp : cpm.getAt("temperature").getValue(),
                    humid: cpm.getAt("humidity").getValue()
                })
            });
        });
    });
</script>


</html>

{'fraction_non_alphanumeric': 0.15907118055555555, 'fraction_numerical': 0.00390625, 'mean_word_length': 2.118403247631935, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 0, '>': 87, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1786293', 'n_tokens_mistral': 1375, 'n_tokens_neox': 1278, 'n_words': 231}