Skip to content

Commit 9506f37

Browse files
committed
init
1 parent 3231141 commit 9506f37

40 files changed

+1477
-0
lines changed

.gitignore

+194
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
_data/webdrivers/*
2+
node/*
3+
node_modules/*
4+
5+
6+
node
7+
node_modules
8+
9+
package.json
10+
package-lock.json
11+
webpack.config.js
12+
webpack.generated.js
13+
14+
*/package.json
15+
*/package-lock.json
16+
*/webpack.config.js
17+
*/webpack.generated.js
18+
19+
target/*
20+
21+
*.iml
22+
.idea/*
23+
24+
# Created by .ignore support plugin (hsz.mobi)
25+
### JetBrains template
26+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
27+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
28+
29+
# User-specific stuff
30+
.idea/**/workspace.xml
31+
.idea/**/tasks.xml
32+
.idea/**/dictionaries
33+
.idea/**/shelf
34+
35+
# Sensitive or high-churn files
36+
.idea/**/dataSources/
37+
.idea/**/dataSources.ids
38+
.idea/**/dataSources.local.xml
39+
.idea/**/sqlDataSources.xml
40+
.idea/**/dynamic.xml
41+
.idea/**/uiDesigner.xml
42+
43+
# Gradle
44+
.idea/**/gradle.xml
45+
.idea/**/libraries
46+
47+
# CMake
48+
cmake-build-debug/
49+
cmake-build-release/
50+
51+
# Mongo Explorer plugin
52+
.idea/**/mongoSettings.xml
53+
54+
# File-based project format
55+
*.iws
56+
57+
# IntelliJ
58+
out/
59+
60+
# mpeltonen/sbt-idea plugin
61+
.idea_modules/
62+
63+
# JIRA plugin
64+
atlassian-ide-plugin.xml
65+
66+
# Cursive Clojure plugin
67+
.idea/replstate.xml
68+
69+
# Crashlytics plugin (for Android Studio and IntelliJ)
70+
com_crashlytics_export_strings.xml
71+
crashlytics.properties
72+
crashlytics-build.properties
73+
fabric.properties
74+
75+
# Editor-based Rest Client
76+
.idea/httpRequests
77+
### Maven template
78+
target/
79+
pom.xml.tag
80+
pom.xml.releaseBackup
81+
pom.xml.versionsBackup
82+
pom.xml.next
83+
release.properties
84+
dependency-reduced-pom.xml
85+
buildNumber.properties
86+
.mvn/timing.properties
87+
88+
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
89+
!/.mvn/wrapper/maven-wrapper.jar
90+
### Java template
91+
# Compiled class file
92+
*.class
93+
94+
# Log file
95+
*.log
96+
97+
# BlueJ files
98+
*.ctxt
99+
100+
# Mobile Tools for Java (J2ME)
101+
.mtj.tmp/
102+
103+
# Package Files #
104+
*.jar
105+
*.war
106+
*.nar
107+
*.ear
108+
*.zip
109+
*.tar.gz
110+
*.rar
111+
112+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
113+
hs_err_pid*
114+
### Kotlin template
115+
# Compiled class file
116+
117+
# Log file
118+
119+
# BlueJ files
120+
121+
# Mobile Tools for Java (J2ME)
122+
123+
# Package Files #
124+
125+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
126+
### NetBeans template
127+
nbproject/private/
128+
build/
129+
nbbuild/
130+
dist/
131+
nbdist/
132+
.nb-gradle/
133+
134+
### Eclipse stuff
135+
136+
.classpath
137+
.project
138+
.metadata
139+
bin/
140+
tmp/
141+
*.tmp
142+
*.bak
143+
*.swp
144+
*~.nib
145+
local.properties
146+
.settings/
147+
.loadpath
148+
.recommenders
149+
150+
# External tool builders
151+
.externalToolBuilders/
152+
153+
# Locally stored "Eclipse launch configurations"
154+
*.launch
155+
156+
# PyDev specific (Python IDE for Eclipse)
157+
*.pydevproject
158+
159+
# CDT-specific (C/C++ Development Tooling)
160+
.cproject
161+
162+
# CDT- autotools
163+
.autotools
164+
165+
# Java annotation processor (APT)
166+
.factorypath
167+
168+
# PDT-specific (PHP Development Tools)
169+
.buildpath
170+
171+
# sbteclipse plugin
172+
.target
173+
174+
# Tern plugin
175+
.tern-project
176+
177+
# TeXlipse plugin
178+
.texlipse
179+
180+
# STS (Spring Tool Suite)
181+
.springBeans
182+
183+
# Code Recommenders
184+
.recommenders/
185+
186+
# Annotation Processing
187+
.apt_generated/
188+
.apt_generated_test/
189+
190+
# Scala IDE specific (Scala & Java development for Eclipse)
191+
.cache-main
192+
.scala_dependencies
193+
.worksheet
194+

.mvn/jvm.config

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-Xmx128m -Xms64m -Djava.awt.headless=true

.mvn/maven.config

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-Dmaven.test.failure.ignore=false -Pvaadin-install-nodejs -P_java-and-kotlin

01_impl/pom.xml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Copyright © 2018 Sven Ruppert ([email protected])
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
-->
19+
<project xmlns="http://maven.apache.org/POM/4.0.0"
20+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22+
<parent>
23+
<artifactId>component-project-template-for-flow-parent</artifactId>
24+
<groupId>org.rapidpm.vaadin</groupId>
25+
<version>00.00.01-RPM-SNAPSHOT</version>
26+
</parent>
27+
<modelVersion>4.0.0</modelVersion>
28+
29+
<artifactId>component-project-template-for-flow</artifactId>
30+
31+
32+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/**
2+
* Copyright © 2018 Sven Ruppert ([email protected])
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.rapidpm.vaadin.i18n.provider;
17+
18+
import com.vaadin.flow.i18n.I18NProvider;
19+
import org.rapidpm.dependencies.core.logger.HasLogger;
20+
21+
import java.util.List;
22+
import java.util.Locale;
23+
import java.util.ResourceBundle;
24+
25+
import static java.util.Locale.ROOT;
26+
import static java.util.Objects.isNull;
27+
import static org.rapidpm.frp.matcher.Case.match;
28+
import static org.rapidpm.frp.matcher.Case.matchCase;
29+
import static org.rapidpm.frp.model.Result.failure;
30+
import static org.rapidpm.frp.model.Result.success;
31+
32+
public class I18NPropertiesProvider
33+
implements I18NProvider, HasLogger {
34+
35+
public static final String NULL_KEY = "###-NULL-KEY-###";
36+
public static final String EMPTY_KEY = "###-EMPTY-KEY-###";
37+
38+
private final ResourceBundleService resourceBundleService = new ResourceBundleService();
39+
40+
public I18NPropertiesProvider() {
41+
logger().info("I18NPropertiesProvider was found..");
42+
}
43+
44+
@Override
45+
public List<Locale> getProvidedLocales() {
46+
logger().info("getProvidedLocales.. ");
47+
return resourceBundleService.providedLocalesAsList();
48+
}
49+
50+
@Override
51+
//TODO add custom translations
52+
public String getTranslation(String key, Locale locale, Object... params) {
53+
final Locale localeInput = locale != null
54+
? locale
55+
: ROOT;
56+
final ResourceBundle resourceBundle = resourceBundleService.resourceBundleToUse()
57+
.apply(localeInput);
58+
59+
return match(matchCase(() -> failure("###-" + key + "-###-" + locale)),
60+
matchCase(() -> isNull(key), () -> failure(NULL_KEY)),
61+
matchCase(key::isEmpty, () -> failure(EMPTY_KEY)),
62+
matchCase(() -> resourceBundle.containsKey(key),
63+
() -> success(resourceBundle.getString(key))))
64+
.ifFailed(msg -> logger().warning(msg))
65+
.getOrElse(() -> "###-KEY_NOT_FOUND-" + key + " - " + locale + "-###");
66+
}
67+
}

0 commit comments

Comments
 (0)