#3 -- add base page
This commit is contained in:
parent
78bb2ac508
commit
9602e40873
10
build.gradle
10
build.gradle
@ -9,7 +9,11 @@ jar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
url "https://repository.primefaces.org/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 11
|
sourceCompatibility = 11
|
||||||
@ -23,11 +27,15 @@ dependencies {
|
|||||||
versionSwagger = '2.5.0'
|
versionSwagger = '2.5.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
|
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
|
||||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security'
|
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security'
|
||||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jetty'
|
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jetty'
|
||||||
implementation group: 'org.slf4j', name: 'slf4j-api', version: versionSLF4J
|
implementation group: 'org.slf4j', name: 'slf4j-api', version: versionSLF4J
|
||||||
|
implementation group: 'org.primefaces', name: 'primefaces', version: '7.0'
|
||||||
|
implementation group: 'net.bootsfaces', name: 'bootsfaces', version: '1.4.2'
|
||||||
|
implementation group: 'org.joinfaces', name: 'jsf-spring-boot-starter', version: '4.0.8'
|
||||||
|
implementation group: 'org.javassist', name: 'javassist', version: '3.25.0-GA'
|
||||||
|
implementation group: 'org.primefaces.themes', name: 'all-themes', version: '1.0.10'
|
||||||
|
|
||||||
implementation group: 'org.eclipse.jetty', name: 'jetty-servlet', version: versionJetty
|
implementation group: 'org.eclipse.jetty', name: 'jetty-servlet', version: versionJetty
|
||||||
|
|
||||||
|
14
src/main/java/ru/ulstu/configurations/MvcConfiguration.java
Normal file
14
src/main/java/ru/ulstu/configurations/MvcConfiguration.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package ru.ulstu.configuration;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class MvcConfiguration implements WebMvcConfigurer {
|
||||||
|
@Override
|
||||||
|
public void addViewControllers(ViewControllerRegistry registry) {
|
||||||
|
registry.addRedirectViewController("/", "/index.xhtml");
|
||||||
|
registry.addRedirectViewController("/default", "/index.xhtml");
|
||||||
|
}
|
||||||
|
}
|
73
src/main/java/ru/ulstu/pages/IndexView.java
Normal file
73
src/main/java/ru/ulstu/pages/IndexView.java
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
package ru.ulstu.pages;
|
||||||
|
|
||||||
|
import org.primefaces.model.chart.Axis;
|
||||||
|
import org.primefaces.model.chart.AxisType;
|
||||||
|
import org.primefaces.model.chart.LineChartModel;
|
||||||
|
import org.primefaces.model.chart.LineChartSeries;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class IndexView implements Serializable {
|
||||||
|
private LineChartModel lineModel1;
|
||||||
|
|
||||||
|
public LineChartModel getLineModel1() {
|
||||||
|
return lineModel1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
createChart();
|
||||||
|
}
|
||||||
|
|
||||||
|
private LineChartModel initLinearModel() {
|
||||||
|
LineChartModel model = new LineChartModel();
|
||||||
|
|
||||||
|
LineChartSeries series1 = new LineChartSeries();
|
||||||
|
series1.setLabel("Временной ряд");
|
||||||
|
|
||||||
|
series1.set(1, 2);
|
||||||
|
series1.set(2, 1);
|
||||||
|
series1.set(3, 3);
|
||||||
|
series1.set(4, 6);
|
||||||
|
series1.set(5, 8);
|
||||||
|
|
||||||
|
LineChartSeries series2 = new LineChartSeries();
|
||||||
|
series2.setLabel("Сглаженный ряд");
|
||||||
|
|
||||||
|
series2.set(1, 6);
|
||||||
|
series2.set(2, 3);
|
||||||
|
series2.set(3, 2);
|
||||||
|
series2.set(4, 7);
|
||||||
|
series2.set(5, 9);
|
||||||
|
|
||||||
|
LineChartSeries series3 = new LineChartSeries();
|
||||||
|
series3.setLabel("Прогноз");
|
||||||
|
|
||||||
|
series3.set(1, 6);
|
||||||
|
series3.set(2, 3);
|
||||||
|
series3.set(3, 2);
|
||||||
|
series3.set(4, 7);
|
||||||
|
series3.set(6, 9);
|
||||||
|
series3.set(7, 9);
|
||||||
|
|
||||||
|
model.addSeries(series1);
|
||||||
|
model.addSeries(series2);
|
||||||
|
model.addSeries(series3);
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createChart() {
|
||||||
|
lineModel1 = initLinearModel();
|
||||||
|
lineModel1.setTitle("Сглаживание временного ряда");
|
||||||
|
lineModel1.setLegendPosition("e");
|
||||||
|
Axis yAxis = lineModel1.getAxis(AxisType.Y);
|
||||||
|
yAxis.setMin(0);
|
||||||
|
yAxis.setMax(10);
|
||||||
|
}
|
||||||
|
}
|
44
src/main/resources/META-INF/resources/basicTemplate.xhtml
Normal file
44
src/main/resources/META-INF/resources/basicTemplate.xhtml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
||||||
|
|
||||||
|
<h:head>
|
||||||
|
<title>Time series smoothing</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
|
<h:outputStylesheet name="css/style.css"/>
|
||||||
|
</h:head>
|
||||||
|
|
||||||
|
<h:body>
|
||||||
|
<div class="ui-g">
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<p:outputPanel>
|
||||||
|
<p:growl id="msgs" showDetail="true"/>
|
||||||
|
<a href="/index.xhtml">
|
||||||
|
<img src="/img/logo.png" alt="" width="100"/>
|
||||||
|
</a>
|
||||||
|
</p:outputPanel>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g">
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<ui:insert name="content">Content</ui:insert>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g">
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<p:outputPanel>
|
||||||
|
<div class="ui-g">
|
||||||
|
<div class="ui-g-12 ui-md-12 ui-lg-4">Ulyanovsk State Technical University</div>
|
||||||
|
<div class="ui-g-6 ui-md-6 ui-lg-4"><h:outputLink
|
||||||
|
value="http://ulstu.ru">ulstu.ru</h:outputLink></div>
|
||||||
|
<div class="ui-g-6 ui-md-6 ui-lg-4">2020</div>
|
||||||
|
</div>
|
||||||
|
</p:outputPanel>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
7
src/main/resources/META-INF/resources/css/style.css
Normal file
7
src/main/resources/META-INF/resources/css/style.css
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
.ui-picklist-list-wrapper {
|
||||||
|
width: 50% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-picklist-list {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
BIN
src/main/resources/META-INF/resources/img/logo.jpg
Normal file
BIN
src/main/resources/META-INF/resources/img/logo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
BIN
src/main/resources/META-INF/resources/img/logo.png
Normal file
BIN
src/main/resources/META-INF/resources/img/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
19
src/main/resources/META-INF/resources/index.xhtml
Normal file
19
src/main/resources/META-INF/resources/index.xhtml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
<ui:composition template="/basicTemplate.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<div class="ui-g">
|
||||||
|
<div class="ui-g-12 ui-md-12 ui-lg-6">
|
||||||
|
<p:inputTextarea style="height:200px; width:100%;" placeholder="Paste time series here"
|
||||||
|
autoResize="false"/>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12 ui-md-12 ui-lg-6">
|
||||||
|
<p:chart type="line" model="#{indexView.lineModel1}" style="height:200px;"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
@ -1,5 +1,6 @@
|
|||||||
spring.main.banner-mode=off
|
spring.main.banner-mode=off
|
||||||
logging.level.tech.athene=DEBUG
|
logging.level.tech.athene=DEBUG
|
||||||
server.port=8080
|
server.port=8080
|
||||||
|
|
||||||
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
|
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
|
||||||
|
joinfaces.primefaces.theme=afterwork
|
||||||
|
joinfaces.primefaces.font-awesome=true
|
Loading…
Reference in New Issue
Block a user