@@ -24,7 +24,7 @@ goog.require('cwc.soy.ui.Runner');
2424goog . require ( 'cwc.ui.RunnerInfobar' ) ;
2525goog . require ( 'cwc.ui.RunnerMonitor' ) ;
2626goog . require ( 'cwc.ui.RunnerTerminal' ) ;
27- goog . require ( 'cwc.ui.RunnerToolbar ' ) ;
27+ goog . require ( 'cwc.ui.StatusButton ' ) ;
2828goog . require ( 'cwc.ui.Statusbar' ) ;
2929goog . require ( 'cwc.ui.StatusbarState' ) ;
3030goog . require ( 'cwc.ui.Turtle' ) ;
@@ -88,6 +88,9 @@ cwc.ui.Runner = function(helper) {
8888 /** @type {cwc.ui.StatusbarState } */
8989 this . status = cwc . ui . StatusbarState . UNKNOWN ;
9090
91+ /** @type {cwc.ui.StatusButton } */
92+ this . statusButton = new cwc . ui . StatusButton ( this . helper ) ;
93+
9194 /** @type {cwc.ui.RunnerInfobar } */
9295 this . infobar = null ;
9396
@@ -97,9 +100,6 @@ cwc.ui.Runner = function(helper) {
97100 /** @type {cwc.ui.RunnerTerminal } */
98101 this . terminal = null ;
99102
100- /** @type {cwc.ui.RunnerToolbar } */
101- this . toolbar = null ;
102-
103103 /** @type {cwc.ui.Turtle } */
104104 this . turtle = null ;
105105
@@ -139,7 +139,6 @@ cwc.ui.Runner.prototype.decorate = function(node) {
139139
140140 goog . soy . renderElement ( this . node , cwc . soy . ui . Runner . template , {
141141 prefix : this . prefix ,
142- toolbarPrefix : this . helper . getPrefix ( 'runner-toolbar' ) ,
143142 } ) ;
144143
145144 // Runtime
@@ -148,25 +147,40 @@ cwc.ui.Runner.prototype.decorate = function(node) {
148147 // Turtle
149148 this . nodeTurtle = goog . dom . getElement ( this . prefix + 'turtle' ) ;
150149
151- // Toolbar
152- let nodeToolbar = goog . dom . getElement ( this . prefix + 'toolbar-chrome' ) ;
153- if ( nodeToolbar ) {
154- this . toolbar = new cwc . ui . RunnerToolbar ( this . helper ) ;
155- this . toolbar . decorate ( nodeToolbar ) ;
156- }
157-
158150 // Statusbar
159151 let nodeStatusbar = goog . dom . getElement ( this . prefix + 'statusbar' ) ;
160152 if ( nodeStatusbar ) {
161153 this . statusbar = new cwc . ui . Statusbar ( this . helper ) ;
162154 this . statusbar . decorate ( nodeStatusbar ) ;
163155 }
164156
157+ // Status Button and actions buttons
158+ let nodeStatusButton = goog . dom . getElement ( this . prefix + 'statusbutton' ) ;
159+ if ( nodeStatusButton ) {
160+ this . statusButton . decorate ( nodeStatusButton )
161+ . setFullscreenAction ( ( ) => {
162+ this . helper . getInstance ( 'layout' ) . setFullscreenPreview ( true ) ;
163+ } )
164+ . setFullscreenExitAction ( ( ) => {
165+ this . helper . getInstance ( 'layout' ) . setFullscreenPreview ( false ) ;
166+ } )
167+ . setReloadAction ( ( ) => {
168+ this . refresh ( ) ;
169+ } )
170+ . setTerminateAction ( this . terminate . bind ( this ) )
171+ . setRunAction ( ( ) => {
172+ this . run ( ) ;
173+ } )
174+ . setStopAction ( this . stop . bind ( this ) ) ;
175+ }
176+
165177 // Monitor
166178 this . nodeMonitor = goog . dom . getElement ( this . prefix + 'monitor' ) ;
167- this . monitor = new cwc . ui . RunnerMonitor ( this . helper ) ;
168- this . monitor . decorate ( this . nodeMonitor ) ;
169- this . enableMonitor ( false ) ;
179+ if ( this . nodeMonitor ) {
180+ this . monitor = new cwc . ui . RunnerMonitor ( this . helper ) ;
181+ this . monitor . decorate ( this . nodeMonitor ) ;
182+ this . enableMonitor ( false ) ;
183+ }
170184
171185 // Terminal
172186 this . nodeTerminal = goog . dom . getElement ( this . prefix + 'terminal' ) ;
@@ -351,8 +365,9 @@ cwc.ui.Runner.prototype.run = function() {
351365 if ( this . status == cwc . ui . StatusbarState . LOADING ||
352366 this . status == cwc . ui . StatusbarState . UNRESPONSIVE ) {
353367 this . terminate ( ) ;
368+ } else {
369+ this . stop ( ) ;
354370 }
355- this . stop ( ) ;
356371 goog . dom . removeChildren ( this . nodeRuntime ) ;
357372 }
358373 this . setStatus_ ( cwc . ui . StatusbarState . PREPARE ) ;
@@ -466,8 +481,12 @@ cwc.ui.Runner.prototype.handleConsoleMessage_ = function(e) {
466481
467482/**
468483 * Displays the start of load event.
484+ * @param {Event } e
469485 */
470- cwc . ui . Runner . prototype . handleLoadStart = function ( ) {
486+ cwc . ui . Runner . prototype . handleLoadStart = function ( e ) {
487+ if ( e && e [ 'url' ] === 'about:blank' ) {
488+ return ;
489+ }
471490 this . startTime = new Date ( ) . getTime ( ) ;
472491 this . setStatus_ ( cwc . ui . StatusbarState . LOADING ) ;
473492} ;
@@ -580,16 +599,6 @@ cwc.ui.Runner.prototype.send = function(command, optValue) {
580599} ;
581600
582601
583- /**
584- * @param {boolean } visible
585- */
586- cwc . ui . Runner . prototype . showRunButton = function ( visible ) {
587- if ( this . toolbar ) {
588- this . toolbar . showRunButton ( visible ) ;
589- }
590- } ;
591-
592-
593602/**
594603 * @param {!cwc.ui.StatusbarState } status
595604 * @private
@@ -601,8 +610,8 @@ cwc.ui.Runner.prototype.setStatus_ = function(status) {
601610 if ( this . statusbar ) {
602611 this . statusbar . setStatus ( status , this . startTime , this . stopTime ) ;
603612 }
604- if ( this . toolbar ) {
605- this . toolbar . setStatus ( status ) ;
613+ if ( this . statusButton ) {
614+ this . statusButton . setStatus ( status ) ;
606615 }
607616 if ( this . monitor ) {
608617 this . monitor . setStatus ( status ) ;
0 commit comments