Skip to content

Commit 9c07b16

Browse files
committed
Merge branch 'develop' into update-from-template-merged
2 parents c861a0d + 6987a8e commit 9c07b16

31 files changed

+521
-35
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ body:
1414
attributes:
1515
label: "Checklist"
1616
options:
17-
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)"
17+
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/vaadin-breadcrumbs/releases/latest)"
1818
required: true
19-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
19+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/vaadin-breadcrumbs/issues) or [closed](https://github.com/xdev-software/vaadin-breadcrumbs/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
2020
required: true
2121
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
2222
required: true

.github/ISSUE_TEMPLATE/enhancement.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ body:
1212
attributes:
1313
label: "Checklist"
1414
options:
15-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
15+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/vaadin-breadcrumbs/issues) or [closed](https://github.com/xdev-software/vaadin-breadcrumbs/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1616
required: true
1717
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
1818
required: true

.github/ISSUE_TEMPLATE/question.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ body:
1212
attributes:
1313
label: "Checklist"
1414
options:
15-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
15+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/vaadin-breadcrumbs/issues) or [closed](https://github.com/xdev-software/vaadin-breadcrumbs/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1616
required: true
1717
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
1818
required: true

.run/Run Demo.run.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="Run Demo" type="Application" factoryName="Application">
33
<option name="MAIN_CLASS_NAME" value="software.xdev.vaadin.Application" />
4-
<module name="template-placeholder-demo" />
4+
<module name="vaadin-breadcrumbs-demo" />
55
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
66
<extension name="coverage">
77
<pattern>

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# 1.1.0
2+
* Do not depend on Vaadin's I18N / Allow custom path to text translation #1
3+
* Updated dependencies
4+
5+
# 1.0.0
6+
_Initial release_

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ Bigger changes may require a complete restart.
4747
* [Vaadin automatically reloads the UI on each restart](https://vaadin.com/docs/latest/configuration/live-reload/spring-boot).<br/>
4848
You can control this behavior with the ``vaadin.devmode.liveReload.enabled`` property (default: ``true``).
4949

50-
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/release.yml?branch=master)](https://github.com/xdev-software/template-placeholder/actions/workflows/release.yml)
50+
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/vaadin-breadcrumbs/release.yml?branch=master)](https://github.com/xdev-software/vaadin-breadcrumbs/actions/workflows/release.yml)
5151

5252
Before releasing:
53-
* Consider doing a [test-deployment](https://github.com/xdev-software/template-placeholder/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
53+
* Consider doing a [test-deployment](https://github.com/xdev-software/vaadin-breadcrumbs/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
5454
* Check the [changelog](CHANGELOG.md)
5555

5656
If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes

README.md

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0?logo=vaadin)](https://vaadin.com/directory/component/template-placeholder)
2-
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/template-placeholder?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/template-placeholder)
3-
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/check-build.yml?branch=develop)](https://github.com/xdev-software/template-placeholder/actions/workflows/check-build.yml?query=branch%3Adevelop)
4-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_template-placeholder&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_template-placeholder)
1+
[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0?logo=vaadin)](https://vaadin.com/directory/component/vaadin-breadcrumbs)
2+
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/vaadin-breadcrumbs?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/vaadin-breadcrumbs)
3+
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/vaadin-breadcrumbs/check-build.yml?branch=develop)](https://github.com/xdev-software/vaadin-breadcrumbs/actions/workflows/check-build.yml?query=branch%3Adevelop)
4+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_vaadin-breadcrumbs&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_vaadin-breadcrumbs)
55
![Vaadin 24+](https://img.shields.io/badge/Vaadin%20Platform/Flow-24+-00b4f0)
66

7-
# template-placeholder
8-
A Vaadin Template Repo
7+
# vaadin-breadcrumbs
8+
9+
A Breadcrumbs component for Vaadin Flow.
910

1011
![demo](assets/demo.png)
1112

13+
_What is a "Breadcrumb"?_ <br/>
14+
A component with a list of links that helps visualizing a page's location within a site's hierarchical structure, it allows navigation up to any of the ancestors.
1215

1316
## Installation
14-
[Installation guide for the latest release](https://github.com/xdev-software/template-placeholder/releases/latest#Installation)
17+
[Installation guide for the latest release](https://github.com/xdev-software/vaadin-breadcrumbs/releases/latest#Installation)
1518

1619
## Run the Demo
1720
* Checkout the repo
18-
* Run ``mvn install && mvn -f template-placeholder-demo spring-boot:run``
21+
* Run ``mvn install && mvn -f vaadin-breadcrumbs-demo spring-boot:run``
1922
* Open http://localhost:8080
2023

2124
<details>
@@ -31,4 +34,6 @@ If you need support as soon as possible and you can't wait for any pull request,
3134
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.
3235

3336
## Dependencies and Licenses
34-
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/template-placeholder/dependencies)
37+
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/vaadin-breadcrumbs/dependencies)
38+
39+
_This component [was sponsored](https://xdev.software/en/news/detail/collaboration-between-atu-and-xdev-leads-to-open-source-breadcrumb-component-for-vaadin) by [<img src="./assets/ATU_Logo.svg" alt="ATU" height=20 />](https://atu.de)_

SECURITY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new).
5+
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/vaadin-breadcrumbs/security/advisories/new).

assets/ATU_Logo.svg

+4
Loading

assets/demo.avif

61.8 KB
Binary file not shown.

assets/demo.png

-3.21 KB
Loading

pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>software.xdev</groupId>
8-
<artifactId>template-placeholder-root</artifactId>
9-
<version>1.0.0-SNAPSHOT</version>
8+
<artifactId>vaadin-breadcrumbs-root</artifactId>
9+
<version>1.1.1-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

1212
<organization>
@@ -15,8 +15,8 @@
1515
</organization>
1616

1717
<modules>
18-
<module>template-placeholder</module>
19-
<module>template-placeholder-demo</module>
18+
<module>vaadin-breadcrumbs</module>
19+
<module>vaadin-breadcrumbs-demo</module>
2020
</modules>
2121

2222
<properties>

renovate.json5

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"packageRules": [
55
{
66
"description": "Ignore project internal dependencies",
7-
"packagePattern": "^software.xdev:template-placeholder",
7+
"packagePattern": "^software.xdev:vaadin-breadcrumbs",
88
"datasources": [
99
"maven"
1010
],

template-placeholder-demo/pom.xml renamed to vaadin-breadcrumbs-demo/pom.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
<parent>
88
<groupId>software.xdev</groupId>
9-
<artifactId>template-placeholder-root</artifactId>
10-
<version>1.0.0-SNAPSHOT</version>
9+
<artifactId>vaadin-breadcrumbs-root</artifactId>
10+
<version>1.1.1-SNAPSHOT</version>
1111
</parent>
1212

13-
<artifactId>template-placeholder-demo</artifactId>
14-
<version>1.0.0-SNAPSHOT</version>
13+
<artifactId>vaadin-breadcrumbs-demo</artifactId>
14+
<version>1.1.1-SNAPSHOT</version>
1515
<packaging>jar</packaging>
1616

1717
<organization>
@@ -70,7 +70,7 @@
7070
</dependency>
7171
<dependency>
7272
<groupId>software.xdev</groupId>
73-
<artifactId>template-placeholder</artifactId>
73+
<artifactId>vaadin-breadcrumbs</artifactId>
7474
<version>${project.version}</version>
7575
</dependency>
7676

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package software.xdev.vaadin.ui;
2+
3+
import com.vaadin.flow.component.UI;
4+
import com.vaadin.flow.component.button.Button;
5+
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
6+
import com.vaadin.flow.dom.Element;
7+
import com.vaadin.flow.router.Route;
8+
9+
10+
@Route("")
11+
public class HomeView extends VerticalLayout
12+
{
13+
public HomeView()
14+
{
15+
this.add(new Button("Toggle theme", ev -> {
16+
final Element uiElement = UI.getCurrent().getElement();
17+
uiElement.setAttribute("theme", "dark".equals(uiElement.getAttribute("theme")) ? "" : "dark");
18+
}));
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package software.xdev.vaadin.ui;
2+
3+
import java.util.Objects;
4+
5+
import com.vaadin.flow.component.HasElement;
6+
import com.vaadin.flow.component.applayout.AppLayout;
7+
import com.vaadin.flow.component.applayout.DrawerToggle;
8+
import com.vaadin.flow.component.icon.VaadinIcon;
9+
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
10+
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
11+
import com.vaadin.flow.component.sidenav.SideNav;
12+
import com.vaadin.flow.component.sidenav.SideNavItem;
13+
import com.vaadin.flow.router.Layout;
14+
import com.vaadin.flow.router.PageTitle;
15+
16+
import software.xdev.vaadin.breadcrumbs.Breadcrumbs;
17+
import software.xdev.vaadin.ui.cars.CarsView;
18+
import software.xdev.vaadin.ui.cars.brand.ElectricView;
19+
import software.xdev.vaadin.ui.cars.brand.GasolineView;
20+
import software.xdev.vaadin.ui.cars.brand.HybridView;
21+
22+
23+
@Layout
24+
@PageTitle("Breadcrumb Demo")
25+
public class MainLayout extends AppLayout
26+
{
27+
private final Breadcrumbs breadcrumbs = new Breadcrumbs()
28+
.withHomeBreadcrumbName(this.getTranslation(TranslationKeys.HOME))
29+
.withBreadcrumbNameResolver((full, part) -> this.getTranslation(part));
30+
31+
public MainLayout()
32+
{
33+
final SideNav sideNav = new SideNav();
34+
sideNav.addItem(new SideNavItem(
35+
this.getTranslation(TranslationKeys.HOME),
36+
"",
37+
VaadinIcon.HOME_O.create()));
38+
39+
final SideNavItem carsItem = new SideNavItem(
40+
this.getTranslation(TranslationKeys.CARS),
41+
CarsView.class,
42+
VaadinIcon.CAR.create());
43+
carsItem.addItem(new SideNavItem(
44+
this.getTranslation(TranslationKeys.GASOLINE),
45+
GasolineView.class,
46+
VaadinIcon.FIRE.create()));
47+
carsItem.addItem(new SideNavItem(
48+
this.getTranslation(TranslationKeys.HYBRID),
49+
HybridView.class,
50+
VaadinIcon.GLOBE.create()));
51+
carsItem.addItem(new SideNavItem(
52+
this.getTranslation(TranslationKeys.ELECTRIC),
53+
ElectricView.class,
54+
VaadinIcon.BOLT.create()));
55+
56+
sideNav.addItem(Objects.requireNonNull(carsItem));
57+
58+
this.setPrimarySection(Section.DRAWER);
59+
60+
final VerticalLayout navWrapper = new VerticalLayout(sideNav);
61+
sideNav.setWidthFull();
62+
navWrapper.setSpacing(true);
63+
this.addToDrawer(navWrapper);
64+
65+
final HorizontalLayout vlHeader = new HorizontalLayout(new DrawerToggle(), this.breadcrumbs);
66+
vlHeader.setSpacing(false);
67+
this.addToNavbar(vlHeader);
68+
}
69+
70+
@Override
71+
public void showRouterLayoutContent(final HasElement content)
72+
{
73+
super.showRouterLayoutContent(content);
74+
this.breadcrumbs.updateFromCurrentPath();
75+
}
76+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package software.xdev.vaadin.ui;
2+
3+
public final class TranslationKeys
4+
{
5+
public static final String HOME = "home";
6+
7+
public static final String CARS = "cars";
8+
public static final String ELECTRIC = "electric";
9+
public static final String HYBRID = "hybrid";
10+
public static final String GASOLINE = "gasoline";
11+
public static final String PLUTONIUM = "plutonium";
12+
13+
public static final String FUEL = "fuel";
14+
public static final String MODEL = "model";
15+
public static final String HP = "hp";
16+
17+
private TranslationKeys()
18+
{
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package software.xdev.vaadin.ui.cars;
2+
3+
import static software.xdev.vaadin.ui.TranslationKeys.ELECTRIC;
4+
import static software.xdev.vaadin.ui.TranslationKeys.GASOLINE;
5+
import static software.xdev.vaadin.ui.TranslationKeys.HYBRID;
6+
import static software.xdev.vaadin.ui.TranslationKeys.PLUTONIUM;
7+
8+
import java.util.List;
9+
10+
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
11+
12+
13+
public abstract class AbstractCarView extends VerticalLayout
14+
{
15+
protected AbstractCarView()
16+
{
17+
final CarGrid carGrid = new CarGrid(this.getCars());
18+
carGrid.setAllRowsVisible(true);
19+
this.add(carGrid);
20+
}
21+
22+
protected abstract List<Car> getCars();
23+
24+
protected static List<Car> getCarsByFuel(final String fuel)
25+
{
26+
return getAllCars().stream()
27+
.filter(c -> fuel.equals(c.fuelI18N()))
28+
.toList();
29+
}
30+
31+
@SuppressWarnings("checkstyle:MagicNumber")
32+
protected static List<Car> getAllCars()
33+
{
34+
return List.of(
35+
new Car(GASOLINE, "Opel Astra K", 110),
36+
new Car(GASOLINE, "Skoda Octavia 4", 150),
37+
new Car(GASOLINE, "VW Golf 7 GTI", 220),
38+
new Car(GASOLINE, "Porsche GT3 RS", 525),
39+
new Car(HYBRID, "Mercedes A250", 160),
40+
new Car(HYBRID, "VW Golf 8 eTSI", 150),
41+
new Car(ELECTRIC, "Tesla Model 3", 460),
42+
new Car(ELECTRIC, "BMW i4", 540),
43+
new Car(PLUTONIUM, "DeLorean DMC-12", 1_620_000)
44+
);
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package software.xdev.vaadin.ui.cars;
2+
3+
public record Car(String fuelI18N, String model, int hp)
4+
{
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package software.xdev.vaadin.ui.cars;
2+
3+
import java.util.List;
4+
5+
import com.vaadin.flow.component.grid.Grid;
6+
7+
import software.xdev.vaadin.ui.TranslationKeys;
8+
9+
10+
public class CarGrid extends Grid<Car>
11+
{
12+
13+
public CarGrid(final List<Car> cars)
14+
{
15+
this.setItems(cars);
16+
this.addColumn(car -> this.getTranslation(car.fuelI18N()))
17+
.setHeader(this.getTranslation(TranslationKeys.FUEL));
18+
this.addColumn(Car::model).setHeader(this.getTranslation(TranslationKeys.MODEL));
19+
this.addColumn(Car::hp).setHeader(this.getTranslation(TranslationKeys.HP));
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package software.xdev.vaadin.ui.cars;
2+
3+
import java.util.List;
4+
5+
import com.vaadin.flow.router.Route;
6+
7+
8+
@Route("cars")
9+
public class CarsView extends AbstractCarView
10+
{
11+
@Override
12+
protected List<Car> getCars()
13+
{
14+
return getAllCars();
15+
}
16+
}

0 commit comments

Comments
 (0)