mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-09-18 17:55:14 +00:00
Vaadin init
This commit is contained in:
parent
1b991f7cc4
commit
e0b3a9165b
20
.gitignore
vendored
Normal file
20
.gitignore
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/target/
|
||||||
|
.idea/
|
||||||
|
.settings
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
|
||||||
|
*.iml
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# The following files are generated/updated by vaadin-maven-plugin
|
||||||
|
node_modules/
|
||||||
|
frontend/generated/
|
||||||
|
pnpmfile.js
|
||||||
|
types.d.ts
|
||||||
|
|
||||||
|
# Browser drivers for local integration tests
|
||||||
|
drivers/
|
||||||
|
# Error screenshots generated by TestBench for failed integration tests
|
||||||
|
error-screenshots/
|
||||||
|
webpack.generated.js
|
8
.vscode/extensions.json
vendored
Normal file
8
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"runem.lit-plugin",
|
||||||
|
"vscjava.vscode-java-pack",
|
||||||
|
"pivotal.vscode-spring-boot",
|
||||||
|
],
|
||||||
|
"unwantedRecommendations": []
|
||||||
|
}
|
31
Dockerfile
Normal file
31
Dockerfile
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Stage that builds the application, a prerequisite for the running stage
|
||||||
|
FROM maven:3-jdk-11 as build
|
||||||
|
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
|
||||||
|
RUN apt-get update -qq && apt-get install -qq --no-install-recommends nodejs
|
||||||
|
|
||||||
|
# Stop running as root at this point
|
||||||
|
RUN useradd -m myuser
|
||||||
|
WORKDIR /usr/src/app/
|
||||||
|
RUN chown myuser:myuser /usr/src/app/
|
||||||
|
USER myuser
|
||||||
|
|
||||||
|
# Copy pom.xml and prefetch dependencies so a repeated build can continue from the next step with existing dependencies
|
||||||
|
COPY --chown=myuser pom.xml ./
|
||||||
|
RUN mvn dependency:go-offline -Pproduction
|
||||||
|
|
||||||
|
# Copy all needed project files to a folder
|
||||||
|
COPY --chown=myuser:myuser src src
|
||||||
|
COPY --chown=myuser:myuser frontend frontend
|
||||||
|
COPY --chown=myuser:myuser package.json pnpm-lock.yaml webpack.config.js ./
|
||||||
|
|
||||||
|
|
||||||
|
# Build the production package, assuming that we validated the version before so no need for running tests again
|
||||||
|
RUN mvn clean package -DskipTests -Pproduction
|
||||||
|
|
||||||
|
# Running stage: the part that is used for running the application
|
||||||
|
FROM openjdk:11
|
||||||
|
COPY --from=build /usr/src/app/target/*.jar /usr/app/app.jar
|
||||||
|
RUN useradd -m myuser
|
||||||
|
USER myuser
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD java -jar /usr/app/app.jar
|
24
LICENSE.md
Normal file
24
LICENSE.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <http://unlicense.org>
|
59
README.md
59
README.md
@ -1,4 +1,57 @@
|
|||||||
Typicalc
|
# Typicalc
|
||||||
========
|
|
||||||
|
|
||||||
Vaadin docs: https://vaadin.com/docs-beta/latest/flow/overview/
|
This is an example project that can be used as a starting point to create your own Vaadin application with Spring Boot.
|
||||||
|
It contains all the necessary configuration and some placeholder files to get you started.
|
||||||
|
|
||||||
|
The project is a standard Maven project, so you can import it to your IDE of choice. [Read more how to set up a development environment](https://vaadin.com/docs/v14/flow/installing/installing-overview.html) for Vaadin projects (Windows, Linux, macOS).
|
||||||
|
|
||||||
|
This project was created from https://start.vaadin.com.
|
||||||
|
|
||||||
|
## Running and debugging the applcation
|
||||||
|
|
||||||
|
### Running the application from the command line.
|
||||||
|
To run from the command line, use `mvn` and open http://localhost:8080 in your browser.
|
||||||
|
|
||||||
|
### Running and debugging the application in Intellij IDEA
|
||||||
|
- Locate the Application.java class in the Project view. It is in the src folder, under the main package's root.
|
||||||
|
- Right click on the Application class
|
||||||
|
- Select "Debug 'Application.main()'" from the list
|
||||||
|
|
||||||
|
After the application has started, you can view your it at http://localhost:8080/ in your browser.
|
||||||
|
You can now also attach break points in code for debugging purposes, by clicking next to a line number in any source file.
|
||||||
|
|
||||||
|
### Running and debugging the application in Eclipse
|
||||||
|
- Locate the Application.java class in the Package explorer. It is in `src/main/java`, under the main package.
|
||||||
|
- Right click on the file and select `Debug As` --> `Java Application`.
|
||||||
|
|
||||||
|
Do not worry if the debugger breaks at a `SilentExitException`. This is a Spring Boot feature and happens on every startup.
|
||||||
|
|
||||||
|
After the application has started, you can view your it at http://localhost:8080/ in your browser.
|
||||||
|
You can now also attach break points in code for debugging purposes, by clicking next to a line number in any source file.
|
||||||
|
## Project structure
|
||||||
|
|
||||||
|
- `MainView.java` in `src/main/java` contains the navigation setup. It uses [App Layout](https://vaadin.com/components/vaadin-app-layout).
|
||||||
|
- `views` package in `src/main/java` contains the server-side Java views of your application.
|
||||||
|
- `views` folder in `frontend/src/` contains the client-side JavaScript views of your application.
|
||||||
|
|
||||||
|
## What next?
|
||||||
|
|
||||||
|
[vaadin.com](https://vaadin.com) has lots of material to help you get you started:
|
||||||
|
|
||||||
|
- Follow the tutorials in [vaadin.com/tutorials](https://vaadin.com/tutorials). Especially [vaadin.com/tutorials/getting-started-with-flow](https://vaadin.com/tutorials/getting-started-with-flow) is good for getting a grasp of the basic Vaadin concepts.
|
||||||
|
- Read the documentation in [vaadin.com/docs](https://vaadin.com/docs).
|
||||||
|
- For a bigger Vaadin application example, check out the Full Stack App starter from [vaadin.com/start](https://vaadin.com/start).
|
||||||
|
|
||||||
|
## Deploying using Docker
|
||||||
|
|
||||||
|
To build the Dockerized version of the project, run
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build . -t myapp:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Once the Docker image is correctly built, you can test it locally using
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -p 8080:8080 myapp:latest
|
||||||
|
```
|
||||||
|
16
frontend/styles/shared-styles.js
Normal file
16
frontend/styles/shared-styles.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// eagerly import theme styles so as we can override them
|
||||||
|
import '@vaadin/vaadin-lumo-styles/all-imports';
|
||||||
|
|
||||||
|
const $_documentContainer = document.createElement('template');
|
||||||
|
|
||||||
|
$_documentContainer.innerHTML = `
|
||||||
|
<custom-style>
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</custom-style>
|
||||||
|
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
||||||
|
document.head.appendChild($_documentContainer.content);
|
44
frontend/styles/views/main/main-view.css
Normal file
44
frontend/styles/views/main/main-view.css
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#header {
|
||||||
|
height: var(--lumo-size-xl);
|
||||||
|
}
|
||||||
|
#header vaadin-avatar {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: var(--lumo-space-m);
|
||||||
|
}
|
||||||
|
vaadin-app-layout[dir='rtl'] #header vaadin-avatar {
|
||||||
|
margin-left: var(--lumo-space-m);
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
#header h1 {
|
||||||
|
font-size: var(--lumo-font-size-l);
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
#logo {
|
||||||
|
box-sizing: border-box;
|
||||||
|
box-shadow: inset 0 -1px var(--lumo-contrast-10pct);
|
||||||
|
padding: var(--lumo-space-s) var(--lumo-space-m);
|
||||||
|
}
|
||||||
|
#logo img {
|
||||||
|
height: calc(var(--lumo-size-l) * 1.5);
|
||||||
|
}
|
||||||
|
#logo h1 {
|
||||||
|
font-size: var(--lumo-font-size-xl);
|
||||||
|
font-weight: 600;
|
||||||
|
margin: 0 var(--lumo-space-s);
|
||||||
|
}
|
||||||
|
|
||||||
|
vaadin-tab {
|
||||||
|
font-size: var(--lumo-font-size-s);
|
||||||
|
height: var(--lumo-size-l);
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--lumo-body-text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
vaadin-tab:hover {
|
||||||
|
background-color: var(--lumo-contrast-5pct);
|
||||||
|
}
|
||||||
|
|
||||||
|
vaadin-tab[selected] {
|
||||||
|
background-color: var(--lumo-primary-color-10pct);
|
||||||
|
color: var(--lumo-primary-text-color);
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
type-inference-view-view,
|
||||||
|
#type-inference-view-view {
|
||||||
|
display: block;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
154
package.json
Normal file
154
package.json
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
{
|
||||||
|
"name": "no-name",
|
||||||
|
"license": "UNLICENSED",
|
||||||
|
"dependencies": {
|
||||||
|
"@polymer/iron-icon": "3.0.1",
|
||||||
|
"@polymer/iron-list": "3.1.0",
|
||||||
|
"@polymer/polymer": "3.2.0",
|
||||||
|
"@vaadin/flow-frontend": "./target/flow-frontend",
|
||||||
|
"@vaadin/router": "1.7.2",
|
||||||
|
"@vaadin/vaadin-accordion": "1.2.0",
|
||||||
|
"@vaadin/vaadin-app-layout": "2.2.0",
|
||||||
|
"@vaadin/vaadin-board": "2.2.0",
|
||||||
|
"@vaadin/vaadin-button": "2.4.0",
|
||||||
|
"@vaadin/vaadin-charts": "7.0.0",
|
||||||
|
"@vaadin/vaadin-checkbox": "2.5.0",
|
||||||
|
"@vaadin/vaadin-combo-box": "5.4.7",
|
||||||
|
"@vaadin/vaadin-confirm-dialog": "1.3.0",
|
||||||
|
"@vaadin/vaadin-context-menu": "4.5.0",
|
||||||
|
"@vaadin/vaadin-cookie-consent": "1.2.0",
|
||||||
|
"@vaadin/vaadin-core-shrinkwrap": "18.0.5",
|
||||||
|
"@vaadin/vaadin-crud": "1.3.0",
|
||||||
|
"@vaadin/vaadin-custom-field": "1.3.0",
|
||||||
|
"@vaadin/vaadin-date-picker": "4.4.1",
|
||||||
|
"@vaadin/vaadin-details": "1.2.0",
|
||||||
|
"@vaadin/vaadin-dialog": "2.5.2",
|
||||||
|
"@vaadin/vaadin-form-layout": "2.3.0",
|
||||||
|
"@vaadin/vaadin-grid": "5.7.7",
|
||||||
|
"@vaadin/vaadin-grid-pro": "2.2.2",
|
||||||
|
"@vaadin/vaadin-icons": "4.3.2",
|
||||||
|
"@vaadin/vaadin-item": "2.3.0",
|
||||||
|
"@vaadin/vaadin-list-box": "1.4.0",
|
||||||
|
"@vaadin/vaadin-login": "1.2.0",
|
||||||
|
"@vaadin/vaadin-lumo-styles": "1.6.0",
|
||||||
|
"@vaadin/vaadin-material-styles": "1.3.2",
|
||||||
|
"@vaadin/vaadin-menu-bar": "1.2.1",
|
||||||
|
"@vaadin/vaadin-notification": "1.6.0",
|
||||||
|
"@vaadin/vaadin-ordered-layout": "1.4.0",
|
||||||
|
"@vaadin/vaadin-progress-bar": "1.3.0",
|
||||||
|
"@vaadin/vaadin-radio-button": "1.5.1",
|
||||||
|
"@vaadin/vaadin-rich-text-editor": "1.3.0",
|
||||||
|
"@vaadin/vaadin-select": "2.4.0",
|
||||||
|
"@vaadin/vaadin-shrinkwrap": "18.0.5",
|
||||||
|
"@vaadin/vaadin-split-layout": "4.3.0",
|
||||||
|
"@vaadin/vaadin-tabs": "3.2.0",
|
||||||
|
"@vaadin/vaadin-text-field": "2.8.2",
|
||||||
|
"@vaadin/vaadin-time-picker": "2.4.0",
|
||||||
|
"@vaadin/vaadin-upload": "4.4.1",
|
||||||
|
"lit-element": "2.3.1",
|
||||||
|
"@vaadin/vaadin-date-time-picker": "1.4.0",
|
||||||
|
"@vaadin/form": "./target/flow-frontend/form",
|
||||||
|
"@vaadin/vaadin-avatar": "1.0.3",
|
||||||
|
"open": "^7.2.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"webpack": "4.42.0",
|
||||||
|
"webpack-cli": "3.3.11",
|
||||||
|
"webpack-dev-server": "3.11.0",
|
||||||
|
"webpack-babel-multi-target-plugin": "2.3.3",
|
||||||
|
"copy-webpack-plugin": "5.1.2",
|
||||||
|
"webpack-merge": "4.2.2",
|
||||||
|
"raw-loader": "4.0.0",
|
||||||
|
"compression-webpack-plugin": "4.0.1",
|
||||||
|
"html-webpack-plugin": "3.2.0",
|
||||||
|
"script-ext-html-webpack-plugin": "2.1.4",
|
||||||
|
"awesome-typescript-loader": "5.2.1",
|
||||||
|
"typescript": "4.0.3",
|
||||||
|
"terser": "4.6.7",
|
||||||
|
"progress-webpack-plugin": "0.0.24",
|
||||||
|
"lit-element": "2.3.1",
|
||||||
|
"chokidar": "^3.4.0",
|
||||||
|
"validator": "13.1.17",
|
||||||
|
"lit-html": "1.2.1",
|
||||||
|
"@types/validator": "13.1.0",
|
||||||
|
"css-loader": "4.2.1",
|
||||||
|
"lit-css-loader": "0.0.4",
|
||||||
|
"extract-loader": "5.1.0"
|
||||||
|
},
|
||||||
|
"vaadin": {
|
||||||
|
"dependencies": {
|
||||||
|
"@vaadin/router": "1.7.2",
|
||||||
|
"@polymer/polymer": "3.2.0",
|
||||||
|
"@webcomponents/webcomponentsjs": "^2.2.10",
|
||||||
|
"@vaadin/vaadin-crud": "1.3.0",
|
||||||
|
"@vaadin/vaadin-grid": "5.7.7",
|
||||||
|
"@vaadin/vaadin-icons": "4.3.2",
|
||||||
|
"@vaadin/vaadin-split-layout": "4.3.0",
|
||||||
|
"@vaadin/vaadin-combo-box": "5.4.7",
|
||||||
|
"@vaadin/vaadin-cookie-consent": "1.2.0",
|
||||||
|
"@vaadin/vaadin-core-shrinkwrap": "18.0.5",
|
||||||
|
"@vaadin/vaadin-upload": "4.4.1",
|
||||||
|
"@vaadin/vaadin-dialog": "2.5.2",
|
||||||
|
"@vaadin/vaadin-select": "2.4.0",
|
||||||
|
"@vaadin/vaadin-app-layout": "2.2.0",
|
||||||
|
"@vaadin/vaadin-item": "2.3.0",
|
||||||
|
"@vaadin/vaadin-board": "2.2.0",
|
||||||
|
"@vaadin/vaadin-notification": "1.6.0",
|
||||||
|
"@vaadin/vaadin-charts": "7.0.0",
|
||||||
|
"@vaadin/vaadin-grid-pro": "2.2.2",
|
||||||
|
"@vaadin/vaadin-progress-bar": "1.3.0",
|
||||||
|
"@vaadin/vaadin-shrinkwrap": "18.0.5",
|
||||||
|
"@vaadin/vaadin-ordered-layout": "1.4.0",
|
||||||
|
"@vaadin/vaadin-login": "1.2.0",
|
||||||
|
"@vaadin/vaadin-button": "2.4.0",
|
||||||
|
"@vaadin/vaadin-date-picker": "4.4.1",
|
||||||
|
"@vaadin/vaadin-text-field": "2.8.2",
|
||||||
|
"@vaadin/vaadin-menu-bar": "1.2.1",
|
||||||
|
"@vaadin/vaadin-form-layout": "2.3.0",
|
||||||
|
"@vaadin/vaadin-accordion": "1.2.0",
|
||||||
|
"@polymer/iron-list": "3.1.0",
|
||||||
|
"@vaadin/vaadin-confirm-dialog": "1.3.0",
|
||||||
|
"@vaadin/vaadin-list-box": "1.4.0",
|
||||||
|
"@vaadin/vaadin-checkbox": "2.5.0",
|
||||||
|
"@vaadin/vaadin-details": "1.2.0",
|
||||||
|
"@polymer/iron-icon": "3.0.1",
|
||||||
|
"@vaadin/vaadin-time-picker": "2.4.0",
|
||||||
|
"@vaadin/vaadin-context-menu": "4.5.0",
|
||||||
|
"@vaadin/vaadin-tabs": "3.2.0",
|
||||||
|
"@vaadin/vaadin-radio-button": "1.5.1",
|
||||||
|
"@vaadin/vaadin-lumo-styles": "1.6.0",
|
||||||
|
"@vaadin/vaadin-material-styles": "1.3.2",
|
||||||
|
"@vaadin/vaadin-rich-text-editor": "1.3.0",
|
||||||
|
"@vaadin/vaadin-custom-field": "1.3.0",
|
||||||
|
"@vaadin/vaadin-date-time-picker": "1.4.0",
|
||||||
|
"lit-element": "2.3.1",
|
||||||
|
"@vaadin/vaadin-avatar": "1.0.3",
|
||||||
|
"open": "^7.2.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"webpack-babel-multi-target-plugin": "2.3.3",
|
||||||
|
"copy-webpack-plugin": "5.1.2",
|
||||||
|
"compression-webpack-plugin": "4.0.1",
|
||||||
|
"raw-loader": "4.0.0",
|
||||||
|
"webpack-cli": "3.3.11",
|
||||||
|
"webpack": "4.42.0",
|
||||||
|
"html-webpack-plugin": "3.2.0",
|
||||||
|
"script-ext-html-webpack-plugin": "2.1.4",
|
||||||
|
"awesome-typescript-loader": "5.2.1",
|
||||||
|
"typescript": "4.0.3",
|
||||||
|
"webpack-merge": "4.2.2",
|
||||||
|
"webpack-dev-server": "3.11.0",
|
||||||
|
"terser": "4.6.7",
|
||||||
|
"progress-webpack-plugin": "0.0.24",
|
||||||
|
"lit-element": "2.3.1",
|
||||||
|
"chokidar": "^3.4.0",
|
||||||
|
"validator": "13.1.17",
|
||||||
|
"lit-html": "1.2.1",
|
||||||
|
"@types/validator": "13.1.0",
|
||||||
|
"css-loader": "4.2.1",
|
||||||
|
"lit-css-loader": "0.0.4",
|
||||||
|
"extract-loader": "5.1.0"
|
||||||
|
},
|
||||||
|
"hash": "b905e6c0ab4b1f42dcee18553457275cfa5c59c2404c0d9d2acc51cdb43de40b"
|
||||||
|
}
|
||||||
|
}
|
7583
pnpm-lock.yaml
Normal file
7583
pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load Diff
223
pom.xml
Normal file
223
pom.xml
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>edu.kit.typicalc</groupId>
|
||||||
|
<artifactId>typicalc</artifactId>
|
||||||
|
<name>Typicalc</name>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
|
||||||
|
<vaadin.version>18.0.5</vaadin.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.4.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->
|
||||||
|
|
||||||
|
<!-- Main Maven repository -->
|
||||||
|
<repository>
|
||||||
|
<id>central</id>
|
||||||
|
<url>https://repo.maven.apache.org/maven2</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
<!-- Repository used by Vaadin add-ons -->
|
||||||
|
<repository>
|
||||||
|
<id>Vaadin Directory</id>
|
||||||
|
<url>https://maven.vaadin.com/vaadin-addons</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<pluginRepositories>
|
||||||
|
<!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->
|
||||||
|
<pluginRepository>
|
||||||
|
<id>central</id>
|
||||||
|
<url>https://repo.maven.apache.org/maven2</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>vaadin-bom</artifactId>
|
||||||
|
<version>${vaadin.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<!-- Replace artifactId with vaadin-core to use only free components -->
|
||||||
|
<artifactId>vaadin</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>vaadin-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.vaadin.artur</groupId>
|
||||||
|
<artifactId>a-vaadin-helper</artifactId>
|
||||||
|
<version>1.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>vaadin-testbench</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.bonigarcia</groupId>
|
||||||
|
<artifactId>webdrivermanager</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<defaultGoal>spring-boot:run</defaultGoal>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<!-- Clean build and startup time for Vaadin apps sometimes may exceed
|
||||||
|
the default Spring Boot's 30sec timeout. -->
|
||||||
|
<configuration>
|
||||||
|
<wait>500</wait>
|
||||||
|
<maxAttempts>240</maxAttempts>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Take care of synchronizing java dependencies and imports in
|
||||||
|
package.json and main.js files.
|
||||||
|
It also creates webpack.config.js if not exists yet.
|
||||||
|
-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>vaadin-maven-plugin</artifactId>
|
||||||
|
<version>${vaadin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>prepare-frontend</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<!-- Production mode is activated using -Pproduction -->
|
||||||
|
<id>production</id>
|
||||||
|
<properties>
|
||||||
|
<vaadin.productionMode>true</vaadin.productionMode>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>flow-server-production-mode</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<jvmArguments>-Dvaadin.productionMode</jvmArguments>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>vaadin-maven-plugin</artifactId>
|
||||||
|
<version>${vaadin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>build-frontend</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>compile</phase>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>it</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>start-spring-boot</id>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>start</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>stop-spring-boot</id>
|
||||||
|
<phase>post-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>stop</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- Runs the integration tests (*IT) after the server is started -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<trimStackTrace>false</trimStackTrace>
|
||||||
|
<enableAssertions>true</enableAssertions>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
</profiles>
|
||||||
|
</project>
|
25
src/main/java/edu/kit/typicalc/Application.java
Normal file
25
src/main/java/edu/kit/typicalc/Application.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package edu.kit.typicalc;
|
||||||
|
|
||||||
|
import com.vaadin.flow.component.page.AppShellConfigurator;
|
||||||
|
import com.vaadin.flow.server.PWA;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
import org.vaadin.artur.helpers.LaunchUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entry point of the Spring Boot application.
|
||||||
|
*
|
||||||
|
* Use the * and some desktop browsers.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@SpringBootApplication
|
||||||
|
@PWA(name = "Typicalc", shortName = "Typicalc", offlineResources = {"images/logo.png"})
|
||||||
|
public class Application extends SpringBootServletInitializer implements AppShellConfigurator {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
LaunchUtil.launchBrowserInDevelopmentMode(SpringApplication.run(Application.class, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
109
src/main/java/edu/kit/typicalc/views/main/MainView.java
Normal file
109
src/main/java/edu/kit/typicalc/views/main/MainView.java
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
package edu.kit.typicalc.views.main;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.vaadin.flow.component.Component;
|
||||||
|
import com.vaadin.flow.component.ComponentUtil;
|
||||||
|
import com.vaadin.flow.component.applayout.AppLayout;
|
||||||
|
import com.vaadin.flow.component.applayout.DrawerToggle;
|
||||||
|
import com.vaadin.flow.component.avatar.Avatar;
|
||||||
|
import com.vaadin.flow.component.dependency.CssImport;
|
||||||
|
import com.vaadin.flow.component.dependency.JsModule;
|
||||||
|
import com.vaadin.flow.component.html.Image;
|
||||||
|
import com.vaadin.flow.component.html.H1;
|
||||||
|
import com.vaadin.flow.component.orderedlayout.FlexComponent;
|
||||||
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
|
import com.vaadin.flow.component.tabs.Tab;
|
||||||
|
import com.vaadin.flow.component.tabs.Tabs;
|
||||||
|
import com.vaadin.flow.component.tabs.TabsVariant;
|
||||||
|
import com.vaadin.flow.router.PageTitle;
|
||||||
|
import com.vaadin.flow.router.RouterLink;
|
||||||
|
import com.vaadin.flow.server.PWA;
|
||||||
|
import com.vaadin.flow.theme.Theme;
|
||||||
|
import edu.kit.typicalc.views.main.MainView;
|
||||||
|
import edu.kit.typicalc.views.typeinferenceview.TypeInferenceViewView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main view is a top-level placeholder for other views.
|
||||||
|
*/
|
||||||
|
@CssImport("./styles/views/main/main-view.css")
|
||||||
|
@JsModule("./styles/shared-styles.js")
|
||||||
|
public class MainView extends AppLayout {
|
||||||
|
|
||||||
|
private final Tabs menu;
|
||||||
|
private H1 viewTitle;
|
||||||
|
|
||||||
|
public MainView() {
|
||||||
|
setPrimarySection(Section.DRAWER);
|
||||||
|
addToNavbar(true, createHeaderContent());
|
||||||
|
menu = createMenu();
|
||||||
|
addToDrawer(createDrawerContent(menu));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Component createHeaderContent() {
|
||||||
|
HorizontalLayout layout = new HorizontalLayout();
|
||||||
|
layout.setId("header");
|
||||||
|
layout.getThemeList().set("dark", true);
|
||||||
|
layout.setWidthFull();
|
||||||
|
layout.setSpacing(false);
|
||||||
|
layout.setAlignItems(FlexComponent.Alignment.CENTER);
|
||||||
|
layout.add(new DrawerToggle());
|
||||||
|
viewTitle = new H1();
|
||||||
|
layout.add(viewTitle);
|
||||||
|
layout.add(new Avatar());
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Component createDrawerContent(Tabs menu) {
|
||||||
|
VerticalLayout layout = new VerticalLayout();
|
||||||
|
layout.setSizeFull();
|
||||||
|
layout.setPadding(false);
|
||||||
|
layout.setSpacing(false);
|
||||||
|
layout.getThemeList().set("spacing-s", true);
|
||||||
|
layout.setAlignItems(FlexComponent.Alignment.STRETCH);
|
||||||
|
HorizontalLayout logoLayout = new HorizontalLayout();
|
||||||
|
logoLayout.setId("logo");
|
||||||
|
logoLayout.setAlignItems(FlexComponent.Alignment.CENTER);
|
||||||
|
logoLayout.add(new Image("images/logo.png", "Typicalc logo"));
|
||||||
|
logoLayout.add(new H1("Typicalc"));
|
||||||
|
layout.add(logoLayout, menu);
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tabs createMenu() {
|
||||||
|
final Tabs tabs = new Tabs();
|
||||||
|
tabs.setOrientation(Tabs.Orientation.VERTICAL);
|
||||||
|
tabs.addThemeVariants(TabsVariant.LUMO_MINIMAL);
|
||||||
|
tabs.setId("tabs");
|
||||||
|
tabs.add(createMenuItems());
|
||||||
|
return tabs;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Component[] createMenuItems() {
|
||||||
|
return new Tab[]{createTab("TypeInferenceView", TypeInferenceViewView.class)};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Tab createTab(String text, Class<? extends Component> navigationTarget) {
|
||||||
|
final Tab tab = new Tab();
|
||||||
|
tab.add(new RouterLink(text, navigationTarget));
|
||||||
|
ComponentUtil.setData(tab, Class.class, navigationTarget);
|
||||||
|
return tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void afterNavigation() {
|
||||||
|
super.afterNavigation();
|
||||||
|
getTabForComponent(getContent()).ifPresent(menu::setSelectedTab);
|
||||||
|
viewTitle.setText(getCurrentPageTitle());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Optional<Tab> getTabForComponent(Component component) {
|
||||||
|
return menu.getChildren().filter(tab -> ComponentUtil.getData(tab, Class.class).equals(component.getClass()))
|
||||||
|
.findFirst().map(Tab.class::cast);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCurrentPageTitle() {
|
||||||
|
return getContent().getClass().getAnnotation(PageTitle.class).value();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package edu.kit.typicalc.views.typeinferenceview;
|
||||||
|
|
||||||
|
import com.vaadin.flow.component.button.Button;
|
||||||
|
import com.vaadin.flow.component.dependency.CssImport;
|
||||||
|
import com.vaadin.flow.component.notification.Notification;
|
||||||
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
|
import com.vaadin.flow.component.textfield.TextField;
|
||||||
|
import com.vaadin.flow.router.PageTitle;
|
||||||
|
import com.vaadin.flow.router.Route;
|
||||||
|
import edu.kit.typicalc.views.main.MainView;
|
||||||
|
import com.vaadin.flow.router.RouteAlias;
|
||||||
|
|
||||||
|
@Route(value = "visualize", layout = MainView.class)
|
||||||
|
@PageTitle("TypeInferenceView")
|
||||||
|
@CssImport("./styles/views/typeinferenceview/type-inference-view-view.css")
|
||||||
|
@RouteAlias(value = "", layout = MainView.class)
|
||||||
|
public class TypeInferenceViewView extends HorizontalLayout {
|
||||||
|
|
||||||
|
private TextField name;
|
||||||
|
private Button sayHello;
|
||||||
|
|
||||||
|
public TypeInferenceViewView() {
|
||||||
|
setId("type-inference-view-view");
|
||||||
|
name = new TextField("Your name");
|
||||||
|
sayHello = new Button("Say hello");
|
||||||
|
add(name, sayHello);
|
||||||
|
setVerticalComponentAlignment(Alignment.END, name, sayHello);
|
||||||
|
sayHello.addClickListener(e -> {
|
||||||
|
Notification.show("Hello " + name.getValue());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
BIN
src/main/resources/META-INF/resources/icons/icon.png
Normal file
BIN
src/main/resources/META-INF/resources/icons/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
src/main/resources/META-INF/resources/images/logo.png
Normal file
BIN
src/main/resources/META-INF/resources/images/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
7
src/main/resources/application.properties
Normal file
7
src/main/resources/application.properties
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
server.port=${PORT:8080}
|
||||||
|
logging.level.org.atmosphere = warn
|
||||||
|
spring.mustache.check-template-location = false
|
||||||
|
|
||||||
|
# To improve the performance during development.
|
||||||
|
# For more information https://vaadin.com/docs/flow/spring/tutorial-spring-configuration.html#special-configuration-parameters
|
||||||
|
# vaadin.whitelisted-packages= org/vaadin/example
|
6
src/main/resources/banner.txt
Normal file
6
src/main/resources/banner.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
_____ _ _
|
||||||
|
|_ _| _ _ _ __ (_) ___ __ _ | | ___
|
||||||
|
| | | | | || '_ \ | | / __| / _` || | / __|
|
||||||
|
| | | |_| || |_) || || (__ | (_| || || (__
|
||||||
|
|_| \__, || .__/ |_| \___| \__,_||_| \___|
|
||||||
|
|___/ |_|
|
23
tsconfig.json
Normal file
23
tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"sourceMap": true,
|
||||||
|
"inlineSources": true,
|
||||||
|
"module": "esNext",
|
||||||
|
"target": "es2017",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"strict": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"experimentalDecorators": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"frontend/**/*.ts",
|
||||||
|
"frontend/index.js",
|
||||||
|
"types.d.ts"
|
||||||
|
],
|
||||||
|
"exclude": []
|
||||||
|
}
|
31
webpack.config.js
Normal file
31
webpack.config.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* This file has been autogenerated as it didn't exist or was made for an older
|
||||||
|
* incompatible version.
|
||||||
|
*
|
||||||
|
* This file can be used for manual configuration. It will not be modified
|
||||||
|
* if the flowDefaults constant exists.
|
||||||
|
*/
|
||||||
|
const merge = require('webpack-merge');
|
||||||
|
const flowDefaults = require('./webpack.generated.js');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To change the webpack config, add a new configuration object in
|
||||||
|
* the merge arguments below:
|
||||||
|
*/
|
||||||
|
module.exports = merge(flowDefaults,
|
||||||
|
// Override default configuration
|
||||||
|
// {
|
||||||
|
// mode: 'development',
|
||||||
|
// devtool: 'inline-source-map',
|
||||||
|
// },
|
||||||
|
|
||||||
|
// Add a custom plugin
|
||||||
|
// (install the plugin with `npm install --save-dev webpack-bundle-analyzer`)
|
||||||
|
// {
|
||||||
|
// plugins: [
|
||||||
|
// new require('webpack-bundle-analyzer').BundleAnalyzerPlugin({
|
||||||
|
// analyzerMode: 'static'
|
||||||
|
// })
|
||||||
|
// ]
|
||||||
|
// },
|
||||||
|
);
|
Loading…
Reference in New Issue
Block a user