Initial commit

This commit is contained in:
2020-10-07 16:36:04 +02:00
commit 5b52d0c5fa
26 changed files with 10947 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
/target/
.idea/
.settings
.project
.classpath
/src/main/webapp/frontend-es*/
*.iml
.DS_Store
# The following files are generated/updated by vaadin-maven-plugin
node_modules/
# Browser drivers for local integration tests
drivers.xml
drivers/
# Error screenshots generated by TestBench for failed integration tests
error-screenshots/
webpack.generated.js
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+24
View 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>
+5
View File
@@ -0,0 +1,5 @@
How to get MySQL database connected to Vaadin start.vaadin.com project
=================================================================
This tutorial mainly concentrates on how to wire your Vaadin web application to `MySQL` database so you can Create, Read, Update and Delete (CRUD) information in database via `Vaadin` web application. Idea is to show you how to connect a template downloaded from https://start.vaadin.com to a database so you can replicate it to your own needs. This is not about the best practices (for `Vaadin`, `Spring` or `MySQL`) but to get you started fast.
+1
View File
@@ -0,0 +1 @@
Place your Vaadin Designer or hand written templates in this folder.
+3
View File
@@ -0,0 +1,3 @@
Place your optional style modules in this folder.
See https://vaadin.com/docs/flow/theme/theming-overview.html for getting started on theming Vaadin Flow applications.
+73
View File
@@ -0,0 +1,73 @@
import "@vaadin/vaadin-charts/theme/vaadin-chart-default-theme";
const $_documentContainer = document.createElement('template');
$_documentContainer.innerHTML = `
<custom-style>
<style>
html {
}
</style>
</custom-style>
<custom-style>
<style>
vaadin-app-layout vaadin-tab a:hover {
text-decoration: none;
}
</style>
</custom-style>
<dom-module id="app-layout-theme" theme-for="vaadin-app-layout">
<template>
<style>
[part="navbar"] {
align-items: center;
justify-content: center;
}
</style>
</template>
</dom-module>
<dom-module id="chart" theme-for="vaadin-chart">
<template>
<style include="vaadin-chart-default-theme">
:host {
--vaadin-charts-color-0: var(--lumo-primary-color);
--vaadin-charts-color-1: var(--lumo-error-color);
--vaadin-charts-color-2: var(--lumo-success-color);
--vaadin-charts-color-3: var(--lumo-contrast);
}
.highcharts-container {
font-family: var(--lumo-font-family);
}
.highcharts-background {
fill: var(--lumo-base-color);
}
.highcharts-title {
fill: var(--lumo-header-text-color);
font-size: var(--lumo-font-size-xl);
font-weight: 600;
line-height: var(--lumo-line-height-xs);
}
.highcharts-legend-item text {
fill: var(--lumo-body-text-color);
}
.highcharts-axis-title,
.highcharts-axis-labels {
fill: var(--lumo-secondary-text-color);
}
.highcharts-axis-line,
.highcharts-grid-line,
.highcharts-tick {
stroke: var(--lumo-contrast-10pct);
}
.highcharts-column-series rect.highcharts-point {
stroke: var(--lumo-base-color);
}
</style>
</template>
</dom-module>`;
document.head.appendChild($_documentContainer.content);
+44
View File
@@ -0,0 +1,44 @@
#header {
height: var(--lumo-size-xl);
}
#header img {
border-radius: 50%;
height: var(--lumo-size-s);
margin-left: auto;
margin-right: var(--lumo-space-m);
overflow: hidden;
background-color: var(--lumo-contrast);
}
#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,39 @@
#movies-view {
display: block;
height: 100%;
flex-direction: column;
}
:host {
display: flex;
height: 100%;
flex-direction: column;
}
.grid-wrapper {
flex-grow: 1;
width: 100%;
}
.full-size {
width: 100%;
height: 100%;
}
#editor-layout {
width: 400px;
display: flex;
flex-direction: column;
}
#editor {
padding: var(--lumo-space-l);
flex-grow: 1;
}
#button-layout {
width: 100%;
flex-wrap: wrap;
background-color: var(--lumo-contrast-5pct);
padding: var(--lumo-space-s) var(--lumo-space-l);
}
@@ -0,0 +1,39 @@
#series-view {
display: block;
height: 100%;
flex-direction: column;
}
:host {
display: flex;
height: 100%;
flex-direction: column;
}
.grid-wrapper {
flex-grow: 1;
width: 100%;
}
.full-size {
width: 100%;
height: 100%;
}
#editor-layout {
width: 400px;
display: flex;
flex-direction: column;
}
#editor {
padding: var(--lumo-space-l);
flex-grow: 1;
}
#button-layout {
width: 100%;
flex-wrap: wrap;
background-color: var(--lumo-contrast-5pct);
padding: var(--lumo-space-s) var(--lumo-space-l);
}
BIN
View File
Binary file not shown.
+9477
View File
File diff suppressed because it is too large Load Diff
+18
View File
@@ -0,0 +1,18 @@
{
"name": "no-name",
"license": "UNLICENSED",
"dependencies": {
"@polymer/polymer": "3.2.0",
"@webcomponents/webcomponentsjs": "^2.2.10",
"@vaadin/flow-deps": "./target/frontend"
},
"devDependencies": {
"webpack": "4.30.0",
"webpack-cli": "3.3.0",
"webpack-dev-server": "3.3.0",
"webpack-babel-multi-target-plugin": "2.1.0",
"copy-webpack-plugin": "5.0.3",
"webpack-merge": "4.2.1",
"raw-loader": "3.0.0"
}
}
+271
View File
@@ -0,0 +1,271 @@
<?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>at.windesign.application</groupId>
<artifactId>multimedia</artifactId>
<name>multimedia</name>
<version>2.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<vaadin.version>14.0.4</vaadin.version>
<drivers.dir>${project.basedir}/drivers</drivers.dir>
<drivers.downloader.phase>pre-integration-test</drivers.downloader.phase>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
</parent>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
<snapshots><enabled>false</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<!-- Repository used by many Vaadin add-ons -->
<repository>
<id>Vaadin Directory</id>
<url>https://maven.vaadin.com/vaadin-addons</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
<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>
<exclusions>
<!-- Webjars are only needed when running in Vaadin 13 compatibility mode -->
<exclusion>
<groupId>com.vaadin.webjar</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.insites</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.polymer</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.polymerelements</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.vaadin</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.webcomponents</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
<exclusions>
<!-- Excluding so that webjars are not included. -->
<exclusion><groupId>com.vaadin</groupId>
<artifactId>vaadin-core</artifactId></exclusion>
</exclusions>
</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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>spring-boot:run</defaultGoal>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</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>
<executions>
<execution>
<goals>
<goal>build-frontend</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration-tests</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>
<systemPropertyVariables>
<!-- Pass location of downloaded webdrivers to the tests -->
<webdriver.chrome.driver>${webdriver.chrome.driver}</webdriver.chrome.driver>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
<version>1.0.17</version>
<configuration>
<onlyGetDriversForHostOperatingSystem>true
</onlyGetDriversForHostOperatingSystem>
<rootStandaloneServerDirectory>
${project.basedir}/drivers/driver
</rootStandaloneServerDirectory>
<downloadedZipFileDirectory>
${project.basedir}/drivers/driver_zips
</downloadedZipFileDirectory>
<customRepositoryMap>
${project.basedir}/drivers.xml
</customRepositoryMap>
</configuration>
<executions>
<execution>
<!-- use phase "none" to skip download step -->
<phase>${drivers.downloader.phase}</phase>
<goals>
<goal>selenium</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
@@ -0,0 +1,17 @@
package at.windesign.application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* The entry point of the Spring Boot application.
*/
@SpringBootApplication
public class Application extends SpringBootServletInitializer
{
public static void main(String[] args)
{
SpringApplication.run(Application.class, args);
}
}
@@ -0,0 +1,105 @@
package at.windesign.application.data.entity;
public class Movie
{
private int movieID;
private String movieTitle;
private String originalTitle;
private String releaseDate;
private String overview;
private String state;
private String resolution;
public Movie(int movieID, String movieTitle, String originalTitle, String releaseDate, String overview, String state, String resolution)
{
super();
this.movieID = movieID;
this.movieTitle = movieTitle;
this.originalTitle = originalTitle;
this.releaseDate = releaseDate;
this.overview = overview;
this.state = state;
this.resolution = resolution;
}
public Movie()
{
}
public int getMovieID()
{
return movieID;
}
public void setMovieID(int movieID)
{
this.movieID = movieID;
}
public String getMovieTitle()
{
return movieTitle;
}
public void setMovieTitle(String movieTitle)
{
this.movieTitle = movieTitle;
}
public String getOriginalTitle()
{
return originalTitle;
}
public void setOriginalTitle(String originalTitle)
{
this.originalTitle = originalTitle;
}
public String getReleaseDate()
{
return releaseDate;
}
public void setReleaseDate(String releaseDate)
{
this.releaseDate = releaseDate;
}
public String getOverview()
{
return overview;
}
public void setOverview(String overview)
{
this.overview = overview;
}
public String getState()
{
return state;
}
public void setState(String state)
{
this.state = state;
}
public String getResolution()
{
return resolution;
}
public void setResolution(String resolution)
{
this.resolution = resolution;
}
@Override
public String toString()
{
return String.valueOf(movieID);
}
}
@@ -0,0 +1,162 @@
package at.windesign.application.data.entity;
/*
$sql = " SELECT serie.seriesID seriesID," .
" serie.seriesName seriesName," .
" YEAR(serie.firstAired) seriesFirstAired," .
" serie.resolution seriesResolution," .
" serie.cliffhanger seriesCliffhanger," .
" serie.status seriesStatus," .
" serie.download seriesDownload," .
" season.seasonNumber seasonNumber," .
" episode.episodeNumber episodeNumber," .
" episode.state episodeState" .
" FROM serie" .
" LEFT JOIN season ON serie.seriesID = season.seriesID" .
" LEFT JOIN episode ON serie.seriesID = episode.seriesID AND season.seasonNumber = episode.seasonNumber" .
" WHERE season.seasonNumber != 0 OR" .
" serie.seriesID >= 1000000 " .
" ORDER BY serie.seriesName," .
" serie.firstAired," .
" season.seasonNumber," .
" episode.episodeNumber;";
*/
public class Series
{
private int seriesID;
private String seriesName;
private int seriesFirstAired;
private String seriesResolution;
private boolean seriesCliffhanger;
private String seriesStatus;
private String seriesDownload;
private int seasonNumber;
private int episodeNumber;
private String episodeState;
public Series(int seriesID, String seriesName, int seriesFirstAired, String seriesResolution, boolean seriesCliffhanger, String seriesStatus, String seriesDownload, int seasonNumber, int episodeNumber, String episodeState)
{
super();
this.seriesID = seriesID;
this.seriesName = seriesName;
this.seriesFirstAired = seriesFirstAired;
this.seriesResolution = seriesResolution;
this.seriesCliffhanger = seriesCliffhanger;
this.seriesStatus = seriesStatus;
this.seriesDownload = seriesDownload;
this.seasonNumber = seasonNumber;
this.episodeNumber = episodeNumber;
this.episodeState = episodeState;
}
public Series()
{
}
public int getSeriesID()
{
return seriesID;
}
public void setSeriesID(int seriesID)
{
this.seriesID = seriesID;
}
public String getSeriesName()
{
return seriesName;
}
public void setSeriesName(String seriesName)
{
this.seriesName = seriesName;
}
public int getSeriesFirstAired()
{
return seriesFirstAired;
}
public void setSeriesFirstAired(int seriesFirstAired)
{
this.seriesFirstAired = seriesFirstAired;
}
public String getSeriesResolution()
{
return seriesResolution;
}
public void setSeriesResolution(String seriesResolution)
{
this.seriesResolution = seriesResolution;
}
public boolean getSeriesCliffhanger()
{
return seriesCliffhanger;
}
public void setSeriesCliffhanger(boolean seriesCliffhanger)
{
this.seriesCliffhanger = seriesCliffhanger;
}
public String getSeriesStatus()
{
return seriesStatus;
}
public void setSeriesStatus(String seriesStatus)
{
this.seriesStatus = seriesStatus;
}
public String getSeriesDownload()
{
return seriesDownload;
}
public void setSeriesDownload(String seriesDownload)
{
this.seriesDownload = seriesDownload;
}
public int getSeasonNumber()
{
return seasonNumber;
}
public void setSeasonNumber(int seasonNumber)
{
this.seasonNumber = seasonNumber;
}
public int getEpisodeNumber()
{
return episodeNumber;
}
public void setEpisodeNumber(int episodeNumber)
{
this.episodeNumber = episodeNumber;
}
public String getEpisodeState()
{
return episodeState;
}
public void setEpisodeState(String episodeState)
{
this.episodeState = episodeState;
}
@Override
public String toString()
{
return String.valueOf(seriesID);
}
}
@@ -0,0 +1,48 @@
package at.windesign.application.data.service;
import at.windesign.application.data.entity.Movie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class MovieService
{
@Autowired
private JdbcTemplate jdbcTemplate;
public List<Movie> findAll()
{
try
{
return jdbcTemplate.query("SELECT movieID, movieTitle, originalTitle, releaseDate, overview, state, resolution FROM movie ORDER BY movieTitle",
(rs, rowNum) -> new Movie(rs.getInt("movieID"), rs.getString("movieTitle"), rs.getString("originalTitle"), rs.getString("releaseDate"), rs.getString("overview"), rs.getString("state"), rs.getString("resolution")));
} catch(Exception e)
{
return new ArrayList<Movie>();
}
}
public int saveMovie(Movie movie)
{
return 0;
}
private int updateMovie(Movie movie)
{
return 0;
}
private int insertMovie(Movie movie)
{
return 0;
}
public int deleteMovie(Movie movie)
{
return 0;
}
}
@@ -0,0 +1,67 @@
package at.windesign.application.data.service;
import at.windesign.application.data.entity.Series;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class SerieService
{
@Autowired
private JdbcTemplate jdbcTemplate;
public List<Series> findAll()
{
try
{
return jdbcTemplate.query("SELECT serie.seriesID seriesID," +
" serie.seriesName seriesName," +
" YEAR(serie.firstAired) seriesFirstAired," +
" serie.resolution seriesResolution," +
" serie.cliffhanger seriesCliffhanger," +
" serie.status seriesStatus," +
" serie.download seriesDownload," +
" season.seasonNumber seasonNumber," +
" episode.episodeNumber episodeNumber," +
" episode.state episodeState" +
" FROM serie" +
" LEFT JOIN season ON serie.seriesID = season.seriesID" +
" LEFT JOIN episode ON serie.seriesID = episode.seriesID AND season.seasonNumber = episode.seasonNumber" +
" WHERE season.seasonNumber != 0 OR" +
" serie.seriesID >= 1000000 " +
" ORDER BY serie.seriesName," +
" serie.firstAired," +
" season.seasonNumber," +
" episode.episodeNumber;",
(rs, rowNum) -> new Series(rs.getInt("seriesID"), rs.getString("seriesName"), rs.getInt("seriesFirstAired"), rs.getString("seriesResolution"), rs.getBoolean("seriesCliffhanger"), rs.getString("seriesStatus"), rs.getString("seriesDownload"), rs.getInt("seasonNumber"), rs.getInt("episodeNumber"), rs.getString("episodeState")));
} catch(Exception e)
{
return new ArrayList<Series>();
}
}
public int saveSerie(Series Series)
{
return 0;
}
private int updateSerie(Series Series)
{
return 0;
}
private int insertSerie(Series Series)
{
return 0;
}
public int deleteSerie(Series Series)
{
return 0;
}
}
@@ -0,0 +1,84 @@
package at.windesign.application.views.Series;
import at.windesign.application.data.entity.Series;
import at.windesign.application.data.service.SerieService;
import at.windesign.application.views.main.MainView;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.GridVariant;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.router.AfterNavigationEvent;
import com.vaadin.flow.router.AfterNavigationObserver;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
@Route(value = "series", layout = MainView.class)
@PageTitle("TV Shows")
@CssImport("styles/views/series/series-view.css")
public class SeriesView extends Div implements AfterNavigationObserver
{
@Autowired
private SerieService serieService;
private Grid<Series> series;
private TextField seriesName = new TextField();
private TextField seriesFirstAired = new TextField();
public SeriesView()
{
setId("series-view");
series = new Grid<>();
series.addThemeVariants(GridVariant.LUMO_NO_BORDER);
series.setHeightFull();
series.addColumn(Series::getSeriesName).setHeader("Series Name");
series.addColumn(Series::getSeriesFirstAired).setHeader("First Aired");
series.addColumn(Series::getSeriesResolution).setHeader("Resolution");
series.addColumn(Series::getSeriesCliffhanger).setHeader("Cliffhanger");
//when a row is selected or deselected, populate form
series.asSingleSelect().addValueChangeListener(event -> populateForm(event.getValue()));
series.addItemDoubleClickListener(
event ->
{
Notification.show("Clicked Item: " + event.getItem());
});
add(series);
}
@Override
public void afterNavigation(AfterNavigationEvent event)
{
List<Series> seriesList = serieService.findAll();
List<Series> seriesList1 = new ArrayList<Series>();
int oldID = -1;
for(Series s : seriesList)
{
if(s.getSeriesID() != oldID)
{
oldID = s.getSeriesID();
seriesList1.add(s);
}
};
series.setItems(seriesList1);
}
private void populateForm(Series value)
{
if(value == null)
{
value = new Series();
}
}
}
@@ -0,0 +1,123 @@
package at.windesign.application.views.main;
import java.util.Optional;
import at.windesign.application.views.Series.SeriesView;
import at.windesign.application.views.movies.MoviesView;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.ComponentUtil;
import com.vaadin.flow.component.applayout.DrawerToggle;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.applayout.AppLayout;
import com.vaadin.flow.component.html.H1;
import com.vaadin.flow.component.html.Image;
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;
/**
* The main view is a top-level placeholder for other views.
*/
@JsModule("./styles/shared-styles.js")
@CssImport("./styles/views/main/main-view.css")
@PWA(name = "multimedia", shortName = "multimedia", enableInstallPrompt = false)
//@Theme(value = Lumo.class, variant = Lumo.LIGHT)
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 Image("images/user.svg", "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", "multimedia logo"));
logoLayout.add(new H1("multimedia"));
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("TVShows", SeriesView.class),
createTab("Movies", MoviesView.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,68 @@
package at.windesign.application.views.movies;
import at.windesign.application.data.entity.Movie;
import at.windesign.application.data.service.MovieService;
import at.windesign.application.views.main.MainView;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.GridVariant;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.router.AfterNavigationEvent;
import com.vaadin.flow.router.AfterNavigationObserver;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;
import org.springframework.beans.factory.annotation.Autowired;
@Route(value = "movies", layout = MainView.class)
@PageTitle("Movies")
@CssImport("styles/views/movies/movies-view.css")
public class MoviesView extends Div implements AfterNavigationObserver
{
@Autowired
private MovieService movieService;
private Grid<Movie> movies;
private TextField movieTitle = new TextField();
private TextField originalTitle = new TextField();
public MoviesView()
{
setId("movies-view");
movies = new Grid<>();
movies.addThemeVariants(GridVariant.LUMO_NO_BORDER);
movies.setHeightFull();
movies.addColumn(Movie::getMovieTitle).setHeader("Movie Title");
movies.addColumn(Movie::getOriginalTitle).setHeader("Original Title");
movies.addColumn(Movie::getReleaseDate).setHeader("Release Date");
movies.addColumn(Movie::getResolution).setHeader("Resolution");
//when a row is selected or deselected, populate form
movies.asSingleSelect().addValueChangeListener(event -> populateForm(event.getValue()));
movies.addItemDoubleClickListener(
event ->
{
Notification.show("Clicked Item: " + event.getItem());
});
add(movies);
}
@Override
public void afterNavigation(AfterNavigationEvent event)
{
movies.setItems(movieService.findAll());
}
private void populateForm(Movie value)
{
if(value == null)
{
value = new Movie();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+15
View File
@@ -0,0 +1,15 @@
server.port=8080
# Ensure application is run in Vaadin 14/npm mode
vaadin.compatibilityMode = false
# Workaround for https://github.com/vaadin/flow/issues/5947
spring.devtools.restart.additional-exclude=META-INF/VAADIN/config/**
logging.level.org.atmosphere = warn
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
spring.datasource.url = jdbc:mysql://localhost:3306/multimedia
spring.datasource.username = multimedia
spring.datasource.password = WeissIchNicht8
##spring.datasource.url = jdbc:mysql://localhost:3306/dummydata
##spring.datasource.username = dummydata
##spring.datasource.password = dummydata
+6
View File
@@ -0,0 +1,6 @@
_ _ _ _ _
__| | __ _ | |_ __ _ | |__ __ _ ___ ___ _ __ ___ _ _ ___ __ _ | | ___ __ __ __ _ _ __ ___ _ __ | | ___
/ _` | / _` || __| / _` || '_ \ / _` |/ __| / _ \ _____ | '_ ` _ \ | | | |/ __| / _` || | _____ / _ \\ \/ / / _` || '_ ` _ \ | '_ \ | | / _ \
| (_| || (_| || |_ | (_| || |_) || (_| |\__ \| __/|_____|| | | | | || |_| |\__ \| (_| || ||_____|| __/ > < | (_| || | | | | || |_) || || __/
\__,_| \__,_| \__| \__,_||_.__/ \__,_||___/ \___| |_| |_| |_| \__, ||___/ \__, ||_| \___|/_/\_\ \__,_||_| |_| |_|| .__/ |_| \___|
|___/ |_| |_|
+37
View File
@@ -0,0 +1,37 @@
/**
* 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 will not be modified if the flowDefaults constant exists.
*/
const merge = require('webpack-merge');
const flowDefaults = require('./webpack.generated.js');
module.exports = merge(flowDefaults, {
});
/**
* This file can be used to configure the flow plugin defaults.
* <code>
* // Add a custom plugin
* flowDefaults.plugins.push(new MyPlugin());
*
* // Update the rules to also transpile `.mjs` files
* if (!flowDefaults.module.rules[0].test) {
* throw "Unexpected structure in generated webpack config";
* }
* flowDefaults.module.rules[0].test = /\.m?js$/
*
* // Include a custom JS in the entry point in addition to generated-flow-imports.js
* if (typeof flowDefaults.entry.index != "string") {
* throw "Unexpected structure in generated webpack config";
* }
* flowDefaults.entry.index = [flowDefaults.entry.index, "myCustomFile.js"];
* </code>
* or add new configuration in the merge block.
* <code>
* module.exports = merge(flowDefaults, {
* mode: 'development',
* devtool: 'inline-source-map'
* });
* </code>
*/