Changeset 394
- Timestamp:
- 2015-03-16 00:56:05 (10 years ago)
- Location:
- trunk/AltUI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/AltUI/J_ALTUI_uimgr.js ¶
r393 r394 28 28 var cameraGlyph = glyphTemplate.format( "facetime-video", "Camera" ); 29 29 var onoffGlyph = glyphTemplate.format( "off", "On Off" ); 30 var scaleGlyph = glyphTemplate.format( "scale", "Gauge" ); 30 31 var smallbuttonTemplate = "<button id='{0}' type='button' class='{1} btn btn-default btn-sm' aria-label='tbd' title='{3}'>{2}</button>"; 31 32 var buttonTemplate = "<button id='{0}' type='button' class='{1} btn btn-{3}' aria-label='tbd'>{2}</button>"; … … 1538 1539 $(".altui-mainpanel div.altui-page-contents").html( Html ); 1539 1540 $("#"+activepage).addClass("active"); 1541 _updateDynamicDisplayTools( false ); 1540 1542 } 1541 1543 … … 2098 2100 _replaceElementKeepAttributes( $(".altui-custompage-canvas .altui-widget#"+real_widget.id) , _getWidgetHtml(real_widget,true) ); 2099 2101 }); 2102 }; 2103 2104 function _onDisplayGauge(widgetid,bEdit) 2105 { 2106 var data = google.visualization.arrayToDataTable([ 2107 ['Label', 'Value'], 2108 ['Memory', 80], 2109 ]); 2110 2111 var options = { 2112 width: 400, height: 120, 2113 redFrom: 90, redTo: 100, 2114 yellowFrom:75, yellowTo: 90, 2115 minorTicks: 5 2116 }; 2117 2118 var chart = new google.visualization.Gauge(document.getElementById(widgetid)); 2119 chart.draw(data, options); 2120 2121 setInterval(function() { 2122 data.setValue(0, 1, 40 + Math.round(60 * Math.random())); 2123 chart.draw(data, options); 2124 }, 1000); 2100 2125 }; 2101 2126 … … 2336 2361 } 2337 2362 } 2338 // ,{ id:80, 2339 // cls:'altui-widget-gauge', 2340 // html: _toolHtml(cameraGlyph,"Gauge"), 2341 // resizable: true, 2342 // aspectRatio: true, 2343 // property: _onPropertyCamera, 2344 // widgetdisplay: function(widget,bEdit) { 2345 // return (widget.properties.deviceid>0) ? _cameraDraw(widget.properties.deviceid,1) : "<img src='{0}'></img>".format(cameraURI); //"<div class='altui-camera-div'>xxx</div>"; 2346 // }, 2347 // properties: { //( deviceID, service, action, params, cbfunc ) 2348 // deviceid:0 2349 // } 2350 // } 2363 ,{ id:80, 2364 cls:'altui-widget-gauge', 2365 html: _toolHtml(scaleGlyph,"Gauge"), 2366 property: _onPropertyVariable, 2367 widgetdisplay: function(widget,bEdit) { 2368 return "<div class='altui-gauge-div' id='{0}'></div>".format(widget.id); 2369 }, 2370 onWidgetDisplay: _onDisplayGauge, 2371 properties: { //( deviceID, service, action, params, cbfunc ) 2372 deviceid:0, 2373 service:'', 2374 variable:'' 2375 } 2376 } 2351 2377 ]; 2352 2378 … … 2428 2454 }; 2429 2455 2456 function _updateDynamicDisplayTools( bEdit ) 2457 { 2458 $.each(tools, function(idx,tool) { 2459 if ($.isFunction( tool.onWidgetDisplay) ) 2460 { 2461 $(".altui-custompage-canvas ."+tool.cls).each( function(idx,elem) { 2462 var widgetid = $(elem).prop('id'); 2463 (tool.onWidgetDisplay)(widgetid, bEdit); // edit mode 2464 }) 2465 } 2466 }); 2467 }; 2468 2430 2469 // explicitly return public methods when this object is instantiated 2431 2470 return { … … 2435 2474 initEngine : _initEngine, 2436 2475 initCustomPages : _initCustomPages, 2476 loadScript : _loadScript, //(scriptLocationAndName) 2437 2477 2438 2478 // UI helpers … … 3141 3181 3142 3182 $(".altui-mainpanel").html( pageTabs + Html ); 3183 _updateDynamicDisplayTools( false ); 3184 3143 3185 $('#altui-page-tabs a:first').tab('show'); 3144 3186 }, … … 3229 3271 var pageEditorHtml = _createPageEditorHtml(); 3230 3272 $(".altui-mainpanel").html( pageEditorHtml ); 3231 3273 _updateDynamicDisplayTools( true ); //edit mode 3232 3274 // make all reloaded children draggable 3233 3275 $(".altui-mainpanel .altui-widget") 3234 3276 .draggable(_widgetOnCanvasDraggableOptions) 3235 3277 3236 // add resizable 3278 // add resizable & gauges 3237 3279 $.each(tools, function(idx,tool){ 3238 3280 if (tool.resizable==true) { … … 3314 3356 }); 3315 3357 } 3358 if ($.isFunction( tool.onWidgetDisplay) ) 3359 { 3360 (tool.onWidgetDisplay)(widgetid, true); // edit mode 3361 } 3316 3362 } 3317 3363 } … … 3591 3637 })( window );100 3592 3638 3593 // $("#menu_room,#menu_device,#menu_scene,#menu_plugins,#menu_custom,#menu_plugins").toggle();3639 // UIManager.loadScript('https://www.google.com/jsapi?autoload={"modules":[{"name":"visualization","version":"1","packages":["corechart","table","gauge"]}]}'); 3594 3640 $(document).ready(function() { 3595 3641 $(window).on('resize', function () { -
TabularUnified trunk/AltUI/L_ALTUI.lua ¶
r391 r394 531 531 <script src="J_ALTUI_verabox.js"></script> 532 532 <script src="J_ALTUI_uimgr.js"></script> 533 <script type="text/javascript" 534 src='https://www.google.com/jsapi?autoload={"modules":[{"name":"visualization","version":"1","packages":["gauge","table"]}]}'> 535 </script> 536 533 537 @optional_scripts@ 534 538 <script type='text/javascript'> 539 google.setOnLoadCallback(drawVisualization); 540 function drawVisualization() { 541 AltuiDebug.debug('google loaded'); 542 }; 535 543 var g_DeviceTypes = JSON.parse('@devicetypes@'); 536 544 var g_CustomPages = @custompages@;
Note: See TracChangeset
for help on using the changeset viewer.