From f7307a8c2319641706074d9ff45ba810dcd3966c Mon Sep 17 00:00:00 2001 From: ace Date: Tue, 14 Jan 2025 03:59:26 +0100 Subject: [PATCH] init --- .gitignore | 113 ++++++++++++++ pom.xml | 141 ++++++++++++++++++ src/main/java/de/own/skill/AppShell.java | 10 ++ src/main/java/de/own/skill/MyData.java | 13 ++ .../java/de/own/skill/PresentationView.java | 127 ++++++++++++++++ src/main/java/de/own/skill/Row.java | 11 ++ .../java/de/own/skill/SkillApplication.java | 13 ++ src/main/resources/application.properties | 2 + .../de/own/skill/SkillApplicationTests.java | 13 ++ 9 files changed, 443 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/main/java/de/own/skill/AppShell.java create mode 100644 src/main/java/de/own/skill/MyData.java create mode 100644 src/main/java/de/own/skill/PresentationView.java create mode 100644 src/main/java/de/own/skill/Row.java create mode 100644 src/main/java/de/own/skill/SkillApplication.java create mode 100644 src/main/resources/application.properties create mode 100644 src/test/java/de/own/skill/SkillApplicationTests.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc74fbb --- /dev/null +++ b/.gitignore @@ -0,0 +1,113 @@ +node_modules +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ +/.mvn/wrapper/maven-wrapper.properties +/src/main/bundles/dev.bundle +/src/main/bundles/README.md +/src/main/frontend/generated/flow/Flow.tsx +/src/main/frontend/generated/flow/generated-flow-imports.d.ts +/src/main/frontend/generated/flow/generated-flow-imports.js +/src/main/frontend/generated/flow/generated-flow-webcomponent-imports.js +/src/main/frontend/generated/flow/ReactAdapter.tsx +/src/main/frontend/generated/jar-resources/com/github/appreciated/apexcharts/apexcharts-wrapper.ts +/src/main/frontend/generated/jar-resources/com/github/appreciated/apexcharts/apexcharts-wrapper-styles.css +/src/main/frontend/generated/jar-resources/com/github/appreciated/apexcharts/declarations.d.ts +/src/main/frontend/generated/jar-resources/copilot/base-panel-CtbJwWq1.js +/src/main/frontend/generated/jar-resources/copilot/copilot-Cj-G4kPi.js +/src/main/frontend/generated/jar-resources/copilot/copilot-features-plugin-Sf57yYee.js +/src/main/frontend/generated/jar-resources/copilot/copilot-feedback-plugin-aYzbzFyU.js +/src/main/frontend/generated/jar-resources/copilot/copilot-global-vars-later-Cmafk9dE.js +/src/main/frontend/generated/jar-resources/copilot/copilot-info-plugin-DAX7GxFL.js +/src/main/frontend/generated/jar-resources/copilot/copilot-init-step2-DpKGNrcj.js +/src/main/frontend/generated/jar-resources/copilot/copilot-log-plugin-BPSkPKUL.js +/src/main/frontend/generated/jar-resources/copilot/copilot-shortcuts-plugin-BhZyJbe8.js +/src/main/frontend/generated/jar-resources/copilot/icons-18Y63hfX.js +/src/main/frontend/generated/jar-resources/copilot/overlay-monkeypatch-Ux66pzCq.js +/src/main/frontend/generated/jar-resources/copilot/state-CX50xuH-.js +/src/main/frontend/generated/jar-resources/vaadin-dev-tools/connection.d.ts +/src/main/frontend/generated/jar-resources/vaadin-dev-tools/License.d.ts +/src/main/frontend/generated/jar-resources/vaadin-dev-tools/live-reload-connection.d.ts +/src/main/frontend/generated/jar-resources/vaadin-dev-tools/vaadin-dev-tools.d.ts +/src/main/frontend/generated/jar-resources/vaadin-dev-tools/vaadin-dev-tools.js +/src/main/frontend/generated/jar-resources/vaadin-dev-tools/websocket-connection.d.ts +/src/main/frontend/generated/jar-resources/vaadin-popover/popover.ts +/src/main/frontend/generated/jar-resources/vaadin-time-picker/helpers.js +/src/main/frontend/generated/jar-resources/vaadin-time-picker/timepickerConnector.js +/src/main/frontend/generated/jar-resources/comboBoxConnector.js +/src/main/frontend/generated/jar-resources/contextMenuConnector.js +/src/main/frontend/generated/jar-resources/contextMenuTargetConnector.js +/src/main/frontend/generated/jar-resources/copilot.js +/src/main/frontend/generated/jar-resources/datepickerConnector.js +/src/main/frontend/generated/jar-resources/disableOnClickFunctions.js +/src/main/frontend/generated/jar-resources/dndConnector.js +/src/main/frontend/generated/jar-resources/Flow.d.ts +/src/main/frontend/generated/jar-resources/Flow.js +/src/main/frontend/generated/jar-resources/Flow.js.map +/src/main/frontend/generated/jar-resources/flow-component-directive.js +/src/main/frontend/generated/jar-resources/flow-component-renderer.js +/src/main/frontend/generated/jar-resources/FlowBootstrap.d.ts +/src/main/frontend/generated/jar-resources/FlowBootstrap.js +/src/main/frontend/generated/jar-resources/FlowClient.d.ts +/src/main/frontend/generated/jar-resources/FlowClient.js +/src/main/frontend/generated/jar-resources/gridConnector.ts +/src/main/frontend/generated/jar-resources/index.d.ts +/src/main/frontend/generated/jar-resources/index.js +/src/main/frontend/generated/jar-resources/index.js.map +/src/main/frontend/generated/jar-resources/lit-renderer.ts +/src/main/frontend/generated/jar-resources/menubarConnector.js +/src/main/frontend/generated/jar-resources/messageListConnector.js +/src/main/frontend/generated/jar-resources/ReactRouterOutletElement.tsx +/src/main/frontend/generated/jar-resources/selectConnector.js +/src/main/frontend/generated/jar-resources/theme-util.js +/src/main/frontend/generated/jar-resources/tooltip.ts +/src/main/frontend/generated/jar-resources/vaadin-big-decimal-field.js +/src/main/frontend/generated/jar-resources/vaadin-grid-flow-selection-column.js +/src/main/frontend/generated/jar-resources/virtualListConnector.js +/src/main/frontend/generated/index.tsx +/src/main/frontend/generated/layouts.json +/src/main/frontend/generated/routes.tsx +/src/main/frontend/generated/vaadin.ts +/src/main/frontend/generated/vaadin-featureflags.js +/src/main/frontend/generated/vaadin-react.tsx +/src/main/frontend/generated/vite-devmode.ts +/src/main/frontend/index.html +/.gitattributes +/mvnw +/mvnw.cmd +/package.json +/package-lock.json +/tsconfig.json +/types.d.ts +/vite.config.ts +/vite.generated.ts diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..c747cd7 --- /dev/null +++ b/pom.xml @@ -0,0 +1,141 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.4.1 + + + de.own + skill + 0.0.1-SNAPSHOT + skill + skill + + + + + + + + + + + + + + + 21 + 24.6.1 + + + + com.vaadin + vaadin-spring-boot-starter + + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + + com.github.appreciated + apexcharts + 24.0.1 + + + + + + com.vaadin + vaadin-bom + ${vaadin.version} + pom + import + + + + + + Vaadin Directory + https://maven.vaadin.com/vaadin-addons + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.projectlombok + lombok + 1.18.36 + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + + + production + + + com.vaadin + vaadin-core + + + com.vaadin + vaadin-dev + + + + + + + + + com.vaadin + vaadin-maven-plugin + ${vaadin.version} + + + frontend + compile + + prepare-frontend + build-frontend + + + + + + + + + + diff --git a/src/main/java/de/own/skill/AppShell.java b/src/main/java/de/own/skill/AppShell.java new file mode 100644 index 0000000..aa5b2b1 --- /dev/null +++ b/src/main/java/de/own/skill/AppShell.java @@ -0,0 +1,10 @@ +package de.own.skill; + +import com.vaadin.flow.component.page.AppShellConfigurator; +import com.vaadin.flow.theme.Theme; +import com.vaadin.flow.theme.lumo.Lumo; + +@Theme(variant = Lumo.DARK) +public class AppShell implements AppShellConfigurator { + // Your AppShell configuration +} diff --git a/src/main/java/de/own/skill/MyData.java b/src/main/java/de/own/skill/MyData.java new file mode 100644 index 0000000..a68b2ce --- /dev/null +++ b/src/main/java/de/own/skill/MyData.java @@ -0,0 +1,13 @@ +package de.own.skill; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + + +@Data +public class MyData { + private String presentationName; + List data = new ArrayList<>(); +} diff --git a/src/main/java/de/own/skill/PresentationView.java b/src/main/java/de/own/skill/PresentationView.java new file mode 100644 index 0000000..6a011d5 --- /dev/null +++ b/src/main/java/de/own/skill/PresentationView.java @@ -0,0 +1,127 @@ +package de.own.skill; + +import com.github.appreciated.apexcharts.ApexCharts; +import com.github.appreciated.apexcharts.ApexChartsBuilder; +import com.github.appreciated.apexcharts.config.builder.*; +import com.github.appreciated.apexcharts.config.chart.Type; +import com.github.appreciated.apexcharts.config.subtitle.Style; +import com.github.appreciated.apexcharts.config.theme.Mode; +import com.github.appreciated.apexcharts.helper.Series; +import com.vaadin.flow.component.UI; +import com.vaadin.flow.component.Unit; +import com.vaadin.flow.component.grid.Grid; +import com.vaadin.flow.component.orderedlayout.HorizontalLayout; +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.Route; + +import java.util.List; + +@Route("") +public class PresentationView extends VerticalLayout { + private final HorizontalLayout backendLayout = new HorizontalLayout(); + private final HorizontalLayout frontendLayout = new HorizontalLayout(); + private final Grid backendGrid = new Grid<>(Row.class); + private final Grid frontendGrid = new Grid<>(Row.class); + public PresentationView() { + setSizeFull(); + MyData backendData = initBackendData(); + MyData frontendData = initFrontendData(); + + + backendGrid.setItems(backendData.getData()); + backendGrid.setMinWidth(500, Unit.PIXELS); + backendGrid.setMaxWidth(500, Unit.PIXELS); + backendGrid.setHeightFull(); + + frontendGrid.setItems(frontendData.getData()); + frontendGrid.setMinWidth(500, Unit.PIXELS); + frontendGrid.setMaxWidth(500, Unit.PIXELS); + frontendGrid.setHeightFull(); + + backendLayout.setWidth(500, Unit.PIXELS); + backendLayout.setHeight(500, Unit.PIXELS); + backendLayout.add(backendGrid); + ApexCharts backendChart = initChartByType(backendData, Type.RADAR, "Backend skills"); + backendLayout.add(backendChart); + + + frontendLayout.setHeightFull(); + frontendLayout.setMaxWidth(500, Unit.PIXELS); + frontendLayout.add(frontendGrid); + ApexCharts frontendChart = initChartByType(frontendData, Type.BAR, "Frontend skills"); + frontendLayout.add(frontendChart); + + UI.getCurrent().getPage().retrieveExtendedClientDetails(details -> { + if (details.getBodyClientWidth() < 500) { + add(new VerticalLayout(backendChart, backendGrid, frontendChart, frontendGrid)); + backendGrid.setHeight(500, Unit.PIXELS); + frontendGrid.setHeight(500, Unit.PIXELS); + } else { + add(backendLayout,frontendLayout); + } + }); + + UI.getCurrent().getPage().addStyleSheet("data:text/css," + + ".apexcharts-menu-icon { display: none !important; }"); + } + + private ApexCharts initChartByType(MyData data, Type type, String title) { + String[] names = data.getData().stream().map(Row::getName).toArray(String[]::new); + Double[] scores = data.getData().stream().map(Row::getScore).toArray(Double[]::new); + Style style =new Style(); + style.setColor("red"); + ApexCharts chart = new ApexChartsBuilder() + .withTheme(ThemeBuilder.get().withMode(Mode.LIGHT).build()) + .withChart(ChartBuilder.get().withType(type).build()) + .withTitle(TitleSubtitleBuilder.get().withText(title).withStyle(style).build()) + .withYaxis(YAxisBuilder.get() + .withMin(0d) + .withMax(9d) + .build()) + .withTooltip(TooltipBuilder.get().withTheme("dark").withFillSeriesColor(true).build()) +// .withColors("#142a4d", "#142a4d", "#142a4d") +// .withColors("red") + + .withLabels(names) + .withSeries(new Series<>("Scores", scores)) + .build(); + chart.setWidth(500, Unit.PIXELS); + chart.setHeight(500, Unit.PIXELS); + return chart; + } + + private MyData initBackendData() { + MyData myData = new MyData(); + myData.setData(List.of( + Row.builder().name("Apache Poi").score(7d).build(), + Row.builder().name("Flowable").score(5d).build(), + Row.builder().name("Flyway").score(6d).build(), + Row.builder().name("Git").score(8d).build(), + Row.builder().name("Hibernate").score(8d).build(), + Row.builder().name("Jasper Report").score(6d).build(), + Row.builder().name("Jenkins").score(3d).build(), + Row.builder().name("Junit").score(5d).build(), + Row.builder().name("Liquibase").score(7d).build(), + Row.builder().name("Mapstruct").score(7d).build(), + Row.builder().name("Open CSV").score(5d).build(), + Row.builder().name("QueryDSL").score(6d).build(), + Row.builder().name("SonarQ").score(3d).build(), + Row.builder().name("Spring").score(8d).build(), + Row.builder().name("Spring Data JPA").score(8d).build() + ) + ); + return myData; + } + + private MyData initFrontendData() { + MyData myData = new MyData(); + myData.setData(List.of( + Row.builder().name("Primeface").score(7d).build(), + Row.builder().name("Swing").score(6d).build(), + Row.builder().name("Vaadin").score(7d).build(), + Row.builder().name("Vuejs").score(6d).build() + ) + ); + return myData; + } +} diff --git a/src/main/java/de/own/skill/Row.java b/src/main/java/de/own/skill/Row.java new file mode 100644 index 0000000..9e71c5b --- /dev/null +++ b/src/main/java/de/own/skill/Row.java @@ -0,0 +1,11 @@ +package de.own.skill; + +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class Row { + private String name; + private Double score; +} diff --git a/src/main/java/de/own/skill/SkillApplication.java b/src/main/java/de/own/skill/SkillApplication.java new file mode 100644 index 0000000..150e533 --- /dev/null +++ b/src/main/java/de/own/skill/SkillApplication.java @@ -0,0 +1,13 @@ +package de.own.skill; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SkillApplication { + + public static void main(String[] args) { + SpringApplication.run(SkillApplication.class, args); + } + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..0e6b990 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,2 @@ +vaadin.launch-browser=true +spring.application.name=skill diff --git a/src/test/java/de/own/skill/SkillApplicationTests.java b/src/test/java/de/own/skill/SkillApplicationTests.java new file mode 100644 index 0000000..bba05ed --- /dev/null +++ b/src/test/java/de/own/skill/SkillApplicationTests.java @@ -0,0 +1,13 @@ +package de.own.skill; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class SkillApplicationTests { + + @Test + void contextLoads() { + } + +}