77 < meta http-equiv ="Content-Type " content ="text/html; charset=UTF-8 ">
88 < meta name ="viewport " content ="width=device-width, initial-scale=1, shrink-to-fit=no ">
99
10- < link rel ="stylesheet " href ="/bootstrap-5.1.3/css/bootstrap.min.css ">
11- < link rel ="stylesheet " href ="/jstree3.3.12/themes/default/style.min.css " />
12- < link rel ="stylesheet " href ="/codemirror-5.64.0/lib/codemirror.css ">
10+ < link rel ="stylesheet " href ="/bootstrap-5.1.3/css/bootstrap.min.css "/ >
11+ < link rel ="stylesheet " href ="/jstree3.3.12/themes/default/style.min.css "/>
12+ < link rel ="stylesheet " href ="/codemirror-5.64.0/lib/codemirror.css "/ >
1313
1414 < script src ="/jquery-3.6.0/jquery-3.6.0.min.js "> </ script >
1515 < script src ="/bootstrap-5.1.3/js/bootstrap.bundle.min.js "> </ script >
1616 < script src ="/jstree3.3.12/jstree.min.js "> </ script >
1717 < script src ="/codemirror-5.64.0/lib/codemirror.js "> </ script >
1818 < script src ="/codemirror-5.64.0/mode/clike/clike.js "> </ script > <!--Java代码高亮-->
1919
20- < style >
21- </ style >
2220 < title > Web IDE</ title >
2321</ head >
2422
2523< body class ="container-fluid ">
26- < div class ="row border ">
27- < div class ="col ">
28- < ul class ="nav nav-pills ">
29- < li class ="nav-item dropdown ">
30- < a class ="nav-link dropdown-toggle text-dark " data-toggle ="dropdown " href ="# " role ="button " aria-expanded ="false "> File</ a >
31- < div class ="dropdown-menu ">
32- < a class ="dropdown-item " href ="# "> Create File</ a >
33- < a class ="dropdown-item " href ="# "> Delete File</ a >
34- < a class ="dropdown-item " href ="# "> Rename File</ a >
35- < div class ="dropdown-divider "> </ div >
36- < a class ="dropdown-item " href ="# "> Create folder</ a >
37- </ div >
38- </ li >
39- < li class ="nav-item dropdown ">
40- < a class ="nav-link dropdown-toggle text-dark " data-toggle ="dropdown " href ="# " role ="button " aria-expanded ="false "> Git</ a >
41- < div class ="dropdown-menu ">
42- < a class ="dropdown-item " href ="# "> Commit</ a >
43- < a class ="dropdown-item " href ="# "> Pull</ a >
44- < a class ="dropdown-item " href ="# "> Push</ a >
45- </ div >
46- </ li >
47- < li class ="nav-item ">
48- < a id ="execute " class ="nav-link text-dark " role ="button ">
49- Run
50- < span id ="loading " class ="spinner-border spinner-border-sm " role ="status " aria-hidden ="true "
51- style ="display: none "> </ span > </ a >
52- </ li >
53- </ ul >
54- </ div >
55- </ div >
56- < div class ="row ">
57- < div class ="col-2 border " style ="padding-right:0px;padding-left:0px; ">
58- < div id ="jstree "> </ div >
59- </ div >
60- < div class ="col-10 border " style ="padding-right:0px;padding-left:0px; ">
61- < div class ="editor_control ">
62- < textarea class ="form-control " id ="code " name ="code " style ="display: none; " rows ="30 ">
24+ < div class ="row border ">
25+ < div class ="col ">
26+ < ul class ="nav nav-pills ">
27+ < li class ="nav-item dropdown ">
28+ < a class ="nav-link dropdown-toggle text-dark " data-toggle ="dropdown " href ="# " role ="button "
29+ aria-expanded ="false "> File</ a >
30+ < div class ="dropdown-menu ">
31+ < a class ="dropdown-item " href ="# "> Create File</ a >
32+ < a class ="dropdown-item " href ="# "> Delete File</ a >
33+ < a class ="dropdown-item " href ="# "> Rename File</ a >
34+ < div class ="dropdown-divider "> </ div >
35+ < a class ="dropdown-item " href ="# "> Create folder</ a >
36+ </ div >
37+ </ li >
38+ < li class ="nav-item dropdown ">
39+ < a class ="nav-link dropdown-toggle text-dark " data-toggle ="dropdown " href ="# " role ="button "
40+ aria-expanded ="false "> Git</ a >
41+ < div class ="dropdown-menu ">
42+ < a class ="dropdown-item " href ="# "> Commit</ a >
43+ < a class ="dropdown-item " href ="# "> Pull</ a >
44+ < a class ="dropdown-item " href ="# "> Push</ a >
45+ </ div >
46+ </ li >
47+ < li class ="nav-item ">
48+ < a id ="execute " class ="nav-link text-dark " role ="button ">
49+ Run
50+ < span id ="loading " class ="spinner-border spinner-border-sm " role ="status " aria-hidden ="true "
51+ style ="display: none "> </ span > </ a >
52+ </ li >
53+ </ ul >
54+ </ div >
55+ </ div >
56+ < div class ="row ">
57+ < div class ="col-2 border " style ="padding-right:0px;padding-left:0px; ">
58+ < div id ="jstree "> </ div >
59+ </ div >
60+ < div class ="col-10 border " style ="padding-right:0px;padding-left:0px; ">
61+ < div class ="editor_control ">
62+ < textarea class ="form-control " id ="code " name ="code " style ="display: none; " rows ="30 ">
6363/**
6464 * 简单示例
6565 *
7171 System.out.println("HelloWorld");
7272 }
7373}
74- </ textarea >
75- </ div >
76- </ div >
74+ </ textarea >
7775 </ div >
78- < div class =" row border " >
79- < div class =" col " style =" padding-right:0px;padding-left:0px; " >
80- < div class ="form-group ">
81- < textarea name =" executeResult " class =" form-control " id =" exampleFormControlTextarea1 " rows =" 10 "
82- placeholder =" 控制台 " readonly > </ textarea >
83- </ div >
84- </ div >
76+ </ div >
77+ </ div >
78+ < div class ="row border ">
79+ < div class =" col " style =" padding-right:0px;padding-left:0px; " >
80+ < div class =" form-group " >
81+ < textarea name =" executeResult " class =" form-control " id =" exampleFormControlTextarea1 " rows =" 10 "
82+ placeholder =" 控制台 " readonly > </ textarea >
8583 </ div >
84+ </ div >
85+ </ div >
8686
87- < div id ="SourceCodeFileName " hidden > HelloWorld</ div >
87+ < div id ="SourceCodeFileName " hidden > HelloWorld</ div >
8888<!-- <div id="sourceCodeList">模板: </div>-->
8989
90- < script >
91- $ ( function ( ) {
92- $ ( '#jstree' ) . jstree ( { 'core' : {
93- 'data' : [
94- { "id" : "测试文件夹" , "parent" : "#" , "text" : "测试文件夹" } ,
95- { "id" : "测试文件1" , "parent" : "测试文件夹" , "text" : "测试文件1" } ,
96- { "id" : "测试文件2" , "parent" : "测试文件夹" , "text" : "测试文件2" } ,
97- { "id" : "HelloWorld" , "parent" : "#" , "text" : "HelloWorld.java" , "icon" : "jstree-file" } ,
98- { "id" : "RemoteClassLoader" , "parent" : "#" , "text" : "RemoteClassLoader.java" , "icon" : "jstree-file" } ,
99- { "id" : "RemoteMonitor" , "parent" : "#" , "text" : "RemoteMonitor.java" , "icon" : "jstree-file" }
100- ]
101- } } ) ;
102- $ ( '#jstree' ) . on ( "changed.jstree" , function ( e , data ) {
103- console . log ( data . selected ) ;
104- getSourceCodeByFileName ( data . selected ) ;
105- } ) ;
106- } ) ;
90+ < script >
91+ $ ( function ( ) {
92+ $ ( '#jstree' ) . jstree ( { 'core' : {
93+ 'data' : [
94+ { "id" : "测试文件夹" , "parent" : "#" , "text" : "测试文件夹" } ,
95+ { "id" : "测试文件1" , "parent" : "测试文件夹" , "text" : "测试文件1" } ,
96+ { "id" : "测试文件2" , "parent" : "测试文件夹" , "text" : "测试文件2" } ,
97+ { "id" : "HelloWorld" , "parent" : "#" , "text" : "HelloWorld.java" , "icon" : "jstree-file" } ,
98+ { "id" : "RemoteClassLoader" , "parent" : "#" , "text" : "RemoteClassLoader.java" , "icon" : "jstree-file" } ,
99+ { "id" : "RemoteMonitor" , "parent" : "#" , "text" : "RemoteMonitor.java" , "icon" : "jstree-file" }
100+ ]
101+ } } ) ;
102+ $ ( '#jstree' ) . on ( "changed.jstree" , function ( e , data ) {
103+ console . log ( data . selected ) ;
104+ getSourceCodeByFileName ( data . selected ) ;
105+ } ) ;
106+ } ) ;
107107
108- var editor = CodeMirror . fromTextArea ( document . getElementById ( "code" ) , {
109- mode : "text/x-java" ,
110- lineNumbers : true ,
111- matchBrackets : true ,
112- indentUnit : 4 ,
113- indentWithTabs : true ,
114- } ) ;
115- editor . setSize ( 'auto' , '630' ) ;
108+ var editor = CodeMirror . fromTextArea ( document . getElementById ( "code" ) , {
109+ mode : "text/x-java" ,
110+ lineNumbers : true ,
111+ matchBrackets : true ,
112+ indentUnit : 4 ,
113+ indentWithTabs : true ,
114+ } ) ;
115+ editor . setSize ( 'auto' , '630' ) ;
116116
117- function getSourceCodeByFileName ( name ) {
118- console . log ( name ) ;
119- var settings = {
120- "url" : "/sourceCode/" + name ,
121- "method" : "POST" ,
122- "timeout" : 0 ,
123- "processData" : false ,
124- "mimeType" : "multipart/form-data" ,
125- "contentType" : false ,
126- "data" : null
127- } ;
128- $ . ajax ( settings ) . done ( function ( response ) {
129- $ ( '#SourceCodeFileName' ) . text ( name ) ;
130- editor . setValue ( response ) ;
131- } ) ;
132- }
117+ function getSourceCodeByFileName ( name ) {
118+ console . log ( name ) ;
119+ var settings = {
120+ "url" : "/sourceCode/" + name ,
121+ "method" : "POST" ,
122+ "timeout" : 0 ,
123+ "processData" : false ,
124+ "mimeType" : "multipart/form-data" ,
125+ "contentType" : false ,
126+ "data" : null
127+ } ;
128+ $ . ajax ( settings ) . done ( function ( response ) {
129+ $ ( '#SourceCodeFileName' ) . text ( name ) ;
130+ editor . setValue ( response ) ;
131+ } ) ;
132+ }
133133
134- $ ( '#execute' ) . click ( function ( ) {
135- $ ( '#execute' ) . attr ( "disabled" , true ) ;
136- $ ( '#loading' ) . show ( ) ;
137- var form = new FormData ( ) ;
138- form . append ( "className" , $ ( '#SourceCodeFileName' ) . text ( ) ) ;
139- form . append ( "sourceCode" , editor . getValue ( ) ) ;
134+ $ ( '#execute' ) . click ( function ( ) {
135+ $ ( '#execute' ) . attr ( "disabled" , true ) ;
136+ $ ( '#loading' ) . show ( ) ;
137+ var form = new FormData ( ) ;
138+ form . append ( "className" , $ ( '#SourceCodeFileName' ) . text ( ) ) ;
139+ form . append ( "sourceCode" , editor . getValue ( ) ) ;
140140
141- var settings = {
142- "url" : "/remote/executeJavaSourceCode" ,
143- "method" : "POST" ,
144- "timeout" : 0 ,
145- "processData" : false ,
146- "mimeType" : "multipart/form-data" ,
147- "contentType" : false ,
148- "data" : form
149- } ;
150- $ . ajax ( settings ) . done ( function ( response ) {
151- $ ( "textarea[name='executeResult']" ) . val ( response ) ;
152- $ ( '#execute' ) . attr ( "disabled" , false ) ;
153- $ ( '#loading' ) . hide ( ) ;
154- } ) ;
155- } ) ;
156- </ script >
141+ var settings = {
142+ "url" : "/remote/executeJavaSourceCode" ,
143+ "method" : "POST" ,
144+ "timeout" : 0 ,
145+ "processData" : false ,
146+ "mimeType" : "multipart/form-data" ,
147+ "contentType" : false ,
148+ "data" : form
149+ } ;
150+ $ . ajax ( settings ) . done ( function ( response ) {
151+ $ ( "textarea[name='executeResult']" ) . val ( response ) ;
152+ $ ( '#execute' ) . attr ( "disabled" , false ) ;
153+ $ ( '#loading' ) . hide ( ) ;
154+ } ) ;
155+ } ) ;
156+ </ script >
157157</ body >
158-
159158</ html >
0 commit comments