File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ $(document).ready(function() {
8383 else if ( pyState == 'js' ) {
8484 backend_script = js_backend_script ;
8585 }
86+ else if ( pyState == 'java' ) {
87+ backend_script = java_backend_script ;
88+ }
8689 assert ( backend_script ) ;
8790
8891 // David Pritchard's code for resizeContainer option ...
Original file line number Diff line number Diff line change @@ -134,22 +134,35 @@ function initAceEditor(height) {
134134 setAceMode ( ) ;
135135}
136136
137- function setAceMode ( ) {
138- var mod = 'python' ;
139- if ( $ ( '#pythonVersionSelector' ) . val ( ) === 'js' ) {
140- mod = 'javascript' ;
141- } else if ( $ ( '#pythonVersionSelector' ) . val ( ) === 'java' ) {
142- mod = 'java' ;
143-
144- // if empty, initialize to a Java skeleton:
145- if ( $ . trim ( pyInputGetValue ( ) ) == '' ) {
146- pyInputSetValue ( 'public class YourClassNameHere {\n\
137+ var JAVA_BLANK_TEMPLATE = 'public class YourClassNameHere {\n\
147138 public static void main(String[] args) {\n\
148139\n\
149140 }\n\
150- }' ) ;
141+ }'
142+
143+ function setAceMode ( ) {
144+ var mod ;
145+ if ( $ ( '#pythonVersionSelector' ) . val ( ) === 'java' ) {
146+ mod = 'java' ;
147+ // if blank empty, then initialize to a Java skeleton:
148+ if ( $ . trim ( pyInputGetValue ( ) ) === '' ) {
149+ pyInputSetValue ( JAVA_BLANK_TEMPLATE ) ;
150+ }
151+ } else if ( $ ( '#pythonVersionSelector' ) . val ( ) === 'js' ) {
152+ mod = 'javascript' ;
153+ // if it's just a Java skeleton, then reset to blank:
154+ if ( pyInputGetValue ( ) === JAVA_BLANK_TEMPLATE ) {
155+ pyInputSetValue ( '' ) ;
156+ }
157+ } else {
158+ mod = 'python' ;
159+ // if it's just a Java skeleton, then reset to blank:
160+ if ( pyInputGetValue ( ) === JAVA_BLANK_TEMPLATE ) {
161+ pyInputSetValue ( '' ) ;
151162 }
152163 }
164+ assert ( mod ) ;
165+
153166 var s = pyInputAceEditor . getSession ( ) ;
154167 s . setMode ( "ace/mode/" + mod ) ;
155168}
Original file line number Diff line number Diff line change @@ -527,7 +527,7 @@ ExecutionVisualizer.prototype.render = function() {
527527 if ( this . params . lang === 'js' ) {
528528 this . domRoot . find ( '#langDisplayDiv' ) . html ( 'JavaScript' ) ;
529529 } else if ( this . params . lang === 'java' ) {
530- this . domRoot . find ( '#langDisplayDiv' ) . html ( 'Java 7 ' ) ;
530+ this . domRoot . find ( '#langDisplayDiv' ) . html ( 'Java' ) ;
531531 } else if ( this . params . lang === 'py2' ) {
532532 this . domRoot . find ( '#langDisplayDiv' ) . html ( 'Python 2.7' ) ;
533533 } else if ( this . params . lang === 'py3' ) {
@@ -4231,7 +4231,7 @@ ExecutionVisualizer.prototype.activateJavaFrontend = function() {
42314231 "end_render" ,
42324232 function ( args ) {
42334233 var myViz = args . myViz ;
4234- myViz . domRoot . find ( '#pyStdout' ) . attr ( 'cols' , 1 ) ;
4234+ // myViz.domRoot.find('#pyStdout').attr('cols', 1); // commented out by pgbovine
42354235 myViz . domRoot . find ( '#pyStdout' ) . attr ( 'rows' , Math . min ( 10 , myViz . stdoutLines ) ) ;
42364236
42374237 if ( myViz . params . stdin && myViz . params . stdin != "" ) {
You can’t perform that action at this time.
0 commit comments