-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c758425
commit e61bd2a
Showing
8 changed files
with
698 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
_data/webdrivers/* | ||
|
||
|
||
|
||
|
||
.DS_Store | ||
.classpath | ||
.project | ||
.settings | ||
.idea | ||
*.iml | ||
*/target/ | ||
vaadin-testbench-standalone/dependency-reduced-pom.xml | ||
vaadin-testbench-recorder/selenium-extensions/core/user-extensions.js | ||
vaadin-testbench-recorder/chrome/content/selenium/scripts/selenium-api.js | ||
vaadin-testbench-recorder/chrome/content/selenium/scripts/selenium-browserbot.js | ||
vaadin-testbench-recorder/chrome/testbench-recorder.jar | ||
vaadin-testbench-recorder/extension/ | ||
vaadin-testbench-recorder/install.rdf | ||
vaadin-testbench-playground | ||
vaadin-testbench-integration-tests/error-screenshots/ | ||
vaadin-testbench-integration-tests/config/testbench.properties | ||
chromedriver.log | ||
phantomjsdriver.log | ||
|
||
test/temp/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,100 @@ | ||
# id-generator-for-flow | ||
IDGenerator for Flow | ||
# IDGenerator for Flow | ||
If IDs for components are needed in a project, it makes sense to use an ID generator. | ||
With this, you get in a project ID's that are always built according to the same scheme. | ||
Relevant here is that these numbers are kept in human-readable form. | ||
This strategy facilitates the assignment of log messages to the particular source code point later during operation. | ||
|
||
Another requirement is the uniqueness of identification numbers. | ||
With this, it is the only way to guarantee that the tests based on it work flawlessly. | ||
|
||
To use this ID generator now, you can use the static methods in the interface named **VaadinIDGenerator**. | ||
The method **genericID** returns a generic and neutral ID generator. | ||
This result is a function with three input parameters. | ||
Based on these parameters, the ID will be generated. | ||
|
||
```java | ||
static TriFunction<Class, Class, String, String> genericID() { | ||
return (uiClass , componentClass , label) | ||
-> (uiClass.getSimpleName() | ||
+ "-" + componentClass.getSimpleName() | ||
+ "-" + label.replace(" " , "-")) | ||
.toLowerCase(Locale.US); | ||
} | ||
``` | ||
|
||
To take the next step, you can specialise the ID generators on the particular component types. | ||
This refers to the components contained in Vaadin Flow, such as the button. | ||
|
||
```java | ||
static Function<Class, BiFunction<Class, String, String>> typedComponentIDGenerator() { | ||
return (clazz) -> (uiClass , label) -> genericID().apply(uiClass , clazz , label); | ||
} | ||
|
||
static BiFunction<Class, String, String> buttonID() { | ||
return typedComponentIDGenerator().apply(Button.class); | ||
} | ||
``` | ||
|
||
To use this ID generator, only the class which should hold the | ||
particular element and a logical identifier which then leads to the | ||
domain-specific name of the individual components is needed at the place of use. | ||
|
||
```java | ||
public static final String BTN_CLICK_ME_ID = buttonID().apply(ClickCounterWorkspace.class, "btn-click-me"); | ||
public static final String LB_CLICK_COUNT_ID = spanID().apply(ClickCounterWorkspace.class, "lb-click-count"); | ||
``` | ||
|
||
But not only identification numbers benefit from this ID generator. | ||
You can just as well use this method to generate unique keys for the I18n mechanism. | ||
Here only a slightly modified structure is used. | ||
|
||
```java | ||
static Function<String, String> caption() { | ||
return (id) -> id + "." + "caption"; | ||
} | ||
|
||
static Function<String, String> placeholder() { | ||
return (id) -> id + "." + "placeholder"; | ||
} | ||
``` | ||
|
||
## Available / typed IDGenerators | ||
* Vaadin Grid | ||
* Vaadin Button | ||
* Vaadin Combo Box | ||
* Vaadin Date Picker | ||
* Vaadin Label | ||
* Vaadin Span | ||
* Vaadin Text Field - Text / Password | ||
* Vaadin Checkbox | ||
* Vaadin Ordered Layout - Horizontal / Vertical | ||
* Vaadin Context Menu | ||
* Vaadin Time Picker | ||
* Vaadin Details | ||
* Vaadin Dialog | ||
* Vaadin Select | ||
* Vaadin Form Layout | ||
* Vaadin Icons | ||
* Vaadin List Box | ||
* Vaadin Progress Bar | ||
* Vaadin Radio Button | ||
* Vaadin Split Layout | ||
* Vaadin Tabs | ||
* Vaadin Upload | ||
* Vaadin Custom Field | ||
|
||
* Vaadin Charts | ||
* Vaadin Grid Pro | ||
* Vaadin Rich Text Editor | ||
* Vaadin Crud | ||
* Vaadin Cookie Consent | ||
* Vaadin Confirm Dialog | ||
|
||
|
||
## Backlog | ||
* Vaadin Accordion | ||
* Vaadin Item | ||
* Vaadin Notification | ||
* Vaadin App Layout | ||
* Vaadin Login | ||
* Vaadin Board |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Manifest-Version: 1.0 | ||
Vaadin-Package-Version: 1 | ||
Vaadin-Addon: ${project.build.finalName}.${project.packaging} | ||
Implementation-Vendor: Sven Ruppert | ||
Implementation-Title: ID Generator for Flow | ||
Implementation-Version: ${project.version} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright © 2018 Sven Ruppert ([email protected]) | ||
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. | ||
--> | ||
<assembly | ||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> | ||
<id>paper-slider</id> | ||
|
||
<formats> | ||
<format>zip</format> | ||
</formats> | ||
|
||
<!-- Do not use because we must put META-INF/MANIFEST.MF there. --> | ||
<includeBaseDirectory>false</includeBaseDirectory> | ||
|
||
<fileSets> | ||
<fileSet> | ||
<directory>../</directory> | ||
<includes> | ||
<include>LICENSE</include> | ||
<include>README.md</include> | ||
</includes> | ||
</fileSet> | ||
<fileSet> | ||
<directory>target</directory> | ||
<outputDirectory></outputDirectory> | ||
<includes> | ||
<include>*.jar</include> | ||
<include>*.pdf</include> | ||
</includes> | ||
</fileSet> | ||
</fileSets> | ||
|
||
<files> | ||
<!-- This is vaadin.com/directory related manifest needed in the | ||
zip package --> | ||
<file> | ||
<source>assembly/MANIFEST.MF</source> | ||
<outputDirectory>META-INF</outputDirectory> | ||
<filtered>true</filtered> | ||
</file> | ||
</files> | ||
</assembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright © 2018 Sven Ruppert ([email protected]) | ||
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. | ||
--> | ||
<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"> | ||
<parent> | ||
<artifactId>id-generator-for-flow</artifactId> | ||
<groupId>org.rapidpm.vaadin</groupId> | ||
<version>00.08.00-RPM</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>id-generator-for-flow-impl</artifactId> | ||
<properties> | ||
<!--Properties for Vaadin Directory--> | ||
<Vaadin-Package-Version>1</Vaadin-Package-Version> | ||
<Vaadin-Addon>${project.build.finalName}.${project.packaging}</Vaadin-Addon> | ||
</properties> | ||
|
||
<build> | ||
<finalName>id-generator-for-flow</finalName> | ||
<plugins> | ||
<!--For Vaadin Directory deployment--> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<index>true</index> | ||
<manifest> | ||
<addClasspath>false</addClasspath> | ||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries> | ||
</manifest> | ||
<manifestEntries> | ||
<Vaadin-Package-Version>${Vaadin-Package-Version}</Vaadin-Package-Version> | ||
</manifestEntries> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<configuration> | ||
<appendAssemblyId>false</appendAssemblyId> | ||
<descriptors> | ||
<descriptor>assembly/assembly.xml</descriptor> | ||
</descriptors> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
<phase>install</phase> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
Oops, something went wrong.