#3 -- add base page

This commit is contained in:
Anton Romanov 2020-11-02 11:43:55 +04:00
parent 78bb2ac508
commit 9602e40873
9 changed files with 169 additions and 3 deletions

View File

@ -9,7 +9,11 @@ jar {
}
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://repository.primefaces.org/"
}
}
sourceCompatibility = 11
@ -23,11 +27,15 @@ dependencies {
versionSwagger = '2.5.0'
}
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-jetty'
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

View 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");
}
}

View 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);
}
}

View 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>

View File

@ -0,0 +1,7 @@
.ui-picklist-list-wrapper {
width: 50% !important;
}
.ui-picklist-list {
width: 100% !important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View 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>

View File

@ -1,5 +1,6 @@
spring.main.banner-mode=off
logging.level.tech.athene=DEBUG
server.port=8080
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
joinfaces.primefaces.theme=afterwork
joinfaces.primefaces.font-awesome=true