Skip to content

Commit 3d99a5d

Browse files
committed
add gwt dependency and working foundation
1 parent 604e9ca commit 3d99a5d

6 files changed

Lines changed: 131 additions & 0 deletions

File tree

build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ buildscript {
2525

2626
plugins {
2727
id 'application'
28+
id 'java'
29+
id 'org.docstr.gwt' version '2.1.7'
2830
}
2931

3032
apply plugin: 'io.github.fvarrui.javapackager.plugin'
@@ -154,6 +156,13 @@ dependencies {
154156
'xml-apis:xml-apis:1.4.01',
155157
'xml-apis:xml-apis-ext:1.3.04',
156158
'commons-cli:commons-cli:1.4'
159+
compileOnly group: 'org.gwtproject', name: 'gwt-dev', version: '2.12.2' // has vulnerabilities even in the latest version
160+
compileOnly group: 'org.gwtproject', name: 'gwt-user', version: '2.12.2'
161+
}
162+
163+
// relevant for later insert the main file for GWT here later
164+
gwt {
165+
modules = ["webapp.JGEXWebApp"]
157166
}
158167

159168
application {
@@ -232,4 +241,10 @@ task runGproverMain2(type: JavaExec) {
232241
File runningDir = new File('src/docs')
233242
workingDir = runningDir
234243
mainClass = 'gprover.Main2'
244+
}
245+
246+
// this copies files from the webapp folder to the war folder to be usable by GWT
247+
tasks.register("prepareWebApp", Copy) {
248+
from("src/main/webapp")
249+
into("build/gwt/war")
235250
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<module rename-to="jgexwebapp">
2+
<inherits name="com.google.gwt.user.User"/>
3+
<entry-point class="webapp.JGEXWebApp"/>
4+
<source path=""/>
5+
<source path=""/>
6+
<add-linker name="xsiframe"/>
7+
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
8+
<!-- enable source maps -->
9+
<set-property name="compiler.useSourceMaps" value="true" />
10+
</module>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
package webapp;
2+
3+
import com.google.gwt.core.client.EntryPoint;
4+
import com.google.gwt.dom.client.Style;
5+
import com.google.gwt.event.dom.client.ClickEvent;
6+
import com.google.gwt.event.dom.client.ClickHandler;
7+
import com.google.gwt.user.client.Command;
8+
import com.google.gwt.user.client.DOM;
9+
import com.google.gwt.user.client.Window;
10+
import com.google.gwt.user.client.ui.*;
11+
12+
public class JGEXWebApp implements EntryPoint {
13+
private int count = 0;
14+
15+
@Override
16+
public void onModuleLoad() {
17+
// Main Layout Panel
18+
DockLayoutPanel rootPanel = new DockLayoutPanel(Style.Unit.PX);
19+
rootPanel.setSize("100%", "100%");
20+
21+
// Menu Bar
22+
MenuBar menuBar = new MenuBar();
23+
MenuBar fileMenu = new MenuBar(true); // "true" makes it a drop-down menu
24+
fileMenu.addStyleName("dropdown-menu"); // Add CSS class for styling
25+
fileMenu.addItem("Neew", (Command) () -> Window.alert("New File Clicked"));
26+
fileMenu.addItem("Open", (Command) () -> Window.alert("Open File Clicked"));
27+
fileMenu.addItem("Save", (Command) () -> Window.alert("Save File Clicked"));
28+
fileMenu.addItem("Exit", (Command) () -> Window.alert("Exit Clicked"));
29+
30+
// Add the "File" menu with the sub-menu
31+
menuBar.addItem("File", fileMenu);
32+
33+
menuBar.addItem("Examples", (Command) () -> Window.alert("Examples Clicked"));
34+
menuBar.addItem("Construct", (Command) () -> Window.alert("Construct Clicked"));
35+
menuBar.addItem("Constraint", (Command) () -> Window.alert("Constraint Clicked"));
36+
menuBar.addItem("Action", (Command) () -> Window.alert("Action Clicked"));
37+
menuBar.addItem("Prove", (Command) () -> Window.alert("Prove Clicked"));
38+
menuBar.addItem("Lemmas", (Command) () -> Window.alert("Lemmas Clicked"));
39+
menuBar.addItem("Options", (Command) () -> Window.alert("Options Clicked"));
40+
menuBar.addItem("Help", (Command) () -> Window.alert("Help Clicked"));
41+
42+
// Wrap menu in a container
43+
SimplePanel menuContainer = new SimplePanel();
44+
menuContainer.setWidget(menuBar);
45+
menuContainer.setStyleName("menu-bar-border"); // Optional: Add custom styling
46+
47+
rootPanel.addNorth(menuContainer, 30);
48+
49+
// Central Content Panel
50+
VerticalPanel contentPanel = new VerticalPanel();
51+
contentPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
52+
contentPanel.setSpacing(10);
53+
54+
Label label = new Label("Count: 0");
55+
Button button = new Button("Click me!");
56+
Button resetButton = new Button("Reset count");
57+
58+
resetButton.addClickHandler(new ClickHandler() {
59+
@Override
60+
public void onClick(ClickEvent event) {
61+
count = 0;
62+
label.setText("Count: " + count);
63+
}
64+
});
65+
66+
button.addClickHandler(new ClickHandler() {
67+
@Override
68+
public void onClick(ClickEvent event) {
69+
count++;
70+
label.setText("Count: " + count);
71+
}
72+
});
73+
74+
contentPanel.add(button);
75+
contentPanel.add(label);
76+
contentPanel.add(resetButton);
77+
78+
rootPanel.add(contentPanel);
79+
80+
RootLayoutPanel.get().clear();
81+
RootLayoutPanel.get().add(rootPanel);
82+
}
83+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package webapp;

src/main/webapp/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset=UTF-8>
5+
<script type=text/javascript src=./jgexwebapp/jgexwebapp.nocache.js></script>
6+
<title>JGEX WebApp</title>
7+
<link rel="stylesheet" type="text/css" href="layout.css">
8+
</head>
9+
<body>
10+
<div id=gwtContainer></div>
11+
</body>
12+
</html>

src/main/webapp/layout.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.menu-bar-border {
2+
border: 1px solid #000000;
3+
padding: 4px;
4+
}
5+
6+
.dropdown-menu {
7+
background-color: #a5a5a5;
8+
border: 1px solid #2b2b2b;
9+
padding: 10px;
10+
}

0 commit comments

Comments
 (0)