ID Generator for Flow

Dependencies for the Java/Kotlin projects

License

License

Categories

Categories

Vaadin User Interface Web Frameworks
GroupId

GroupId

org.rapidpm.vaadin
ArtifactId

ArtifactId

id-generator-for-flow
Last Version

Last Version

00.09.04-RPM
Release Date

Release Date

Type

Type

jar
Description

Description

ID Generator for Flow
Dependencies for the Java/Kotlin projects
Project URL

Project URL

https://github.com/vaadin-developer/id-generator-for-flow.git
Project Organization

Project Organization

Sven Ruppert
Source Code Management

Source Code Management

https://github.com/vaadin-developer/id-generator-for-flow.git

Download id-generator-for-flow

How to add to project

<!-- https://jarcasting.com/artifacts/org.rapidpm.vaadin/id-generator-for-flow/ -->
<dependency>
    <groupId>org.rapidpm.vaadin</groupId>
    <artifactId>id-generator-for-flow</artifactId>
    <version>00.09.04-RPM</version>
</dependency>
// https://jarcasting.com/artifacts/org.rapidpm.vaadin/id-generator-for-flow/
implementation 'org.rapidpm.vaadin:id-generator-for-flow:00.09.04-RPM'
// https://jarcasting.com/artifacts/org.rapidpm.vaadin/id-generator-for-flow/
implementation ("org.rapidpm.vaadin:id-generator-for-flow:00.09.04-RPM")
'org.rapidpm.vaadin:id-generator-for-flow:jar:00.09.04-RPM'
<dependency org="org.rapidpm.vaadin" name="id-generator-for-flow" rev="00.09.04-RPM">
  <artifact name="id-generator-for-flow" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.rapidpm.vaadin', module='id-generator-for-flow', version='00.09.04-RPM')
)
libraryDependencies += "org.rapidpm.vaadin" % "id-generator-for-flow" % "00.09.04-RPM"
[org.rapidpm.vaadin/id-generator-for-flow "00.09.04-RPM"]

Dependencies

compile (10)

Group / Artifact Type Version
org.rapidpm : rapidpm-vaadin-flow-commons jar 04.05.02-RPM
com.vaadin : flow-server jar
com.vaadin : flow-push jar
com.vaadin : flow-client jar
com.vaadin : flow-html-components jar
com.vaadin : flow-data jar
org.rapidpm : rapidpm-functional-reactive jar 01.00.04-RPM
org.rapidpm : rapidpm-logger-adapter jar 01.00.06-RPM
net.jcip : jcip-annotations jar 1.0
com.google.code.findbugs : jsr305 jar 3.0.2

provided (27)

Group / Artifact Type Version
com.vaadin : vaadin-accordion-flow jar
com.vaadin : vaadin-button-flow jar
com.vaadin : vaadin-checkbox-flow jar
com.vaadin : vaadin-combo-box-flow jar
com.vaadin : vaadin-custom-field-flow jar
com.vaadin : vaadin-date-picker-flow jar
com.vaadin : vaadin-details-flow jar
com.vaadin : vaadin-time-picker-flow jar
com.vaadin : vaadin-select-flow jar
com.vaadin : vaadin-dialog-flow jar
com.vaadin : vaadin-form-layout-flow jar
com.vaadin : vaadin-grid-flow jar
com.vaadin : vaadin-icons-flow jar
com.vaadin : vaadin-iron-list-flow jar
com.vaadin : vaadin-list-box-flow jar
com.vaadin : vaadin-login-flow jar
com.vaadin : vaadin-ordered-layout-flow jar
com.vaadin : vaadin-progress-bar-flow jar
com.vaadin : vaadin-radio-button-flow jar
com.vaadin : vaadin-split-layout-flow jar
com.vaadin : vaadin-tabs-flow jar
com.vaadin : vaadin-text-field-flow jar
com.vaadin : vaadin-upload-flow jar
com.vaadin : vaadin-notification-flow jar
com.vaadin : vaadin-app-layout-flow jar
com.vaadin : vaadin-context-menu-flow jar
com.vaadin : vaadin-menu-bar-flow jar

test (13)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-api jar 5.5.2
org.junit.jupiter : junit-jupiter-params jar 5.5.2
org.junit.platform : junit-platform-launcher jar 1.5.2
org.junit.jupiter : junit-jupiter-engine jar 5.5.2
org.junit.platform : junit-platform-testkit jar 1.5.2
com.google.truth : truth jar 1.0
org.openjdk.jmh : jmh-core jar 1.22
org.openjdk.jmh : jmh-core-benchmarks jar 1.22
org.openjdk.jmh : jmh-generator-annprocess jar 1.22
org.openjdk.jmh : jmh-generator-reflection jar 1.22
com.github.javafaker : javafaker jar 1.0.1
org.slf4j : slf4j-api jar 1.7.28
org.slf4j : slf4j-simple jar 1.7.28

Project Modules

There are no modules declared in this project.

IDGenerator for Flow

No Vaadin Directory anymore

This AddOn is no longer available in the Vaadin Directory The deployment process is way to manually. So I decided to use maven central only.

Why this IDGenerator?

If IDs for components needed in a project, it makes sense to use an ID generator. With this, you get in a project ID's that always built according to the same scheme. Relevant here is that these numbers 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.

  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.

  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.

  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.

  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
org.rapidpm.vaadin

Vaadin Developer

Jumpstarts and HowTos for Vaadin based projects

Versions

Version
00.09.04-RPM
00.09.03-RPM
00.09.02-RPM
00.09.01-RPM
00.09.00-RPM