Skip to content

Commit

Permalink
Merge branch 'develop' into update-from-template-merged
Browse files Browse the repository at this point in the history
  • Loading branch information
xdev-gh-bot committed Dec 16, 2024
2 parents fbacead + 9c07b16 commit bea71f2
Show file tree
Hide file tree
Showing 31 changed files with 521 additions and 35 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ body:
attributes:
label: "Checklist"
options:
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)"
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/vaadin-breadcrumbs/releases/latest)"
required: true
- 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."
- 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."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/enhancement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body:
attributes:
label: "Checklist"
options:
- 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."
- 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."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body:
attributes:
label: "Checklist"
options:
- 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."
- 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."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
required: true
Expand Down
2 changes: 1 addition & 1 deletion .run/Run Demo.run.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Demo" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="software.xdev.vaadin.Application" />
<module name="template-placeholder-demo" />
<module name="vaadin-breadcrumbs-demo" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<extension name="coverage">
<pattern>
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 1.1.0
* Do not depend on Vaadin's I18N / Allow custom path to text translation #1
* Updated dependencies

# 1.0.0
_Initial release_
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ Bigger changes may require a complete restart.
* [Vaadin automatically reloads the UI on each restart](https://vaadin.com/docs/latest/configuration/live-reload/spring-boot).<br/>
You can control this behavior with the ``vaadin.devmode.liveReload.enabled`` property (default: ``true``).

## 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)
## 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)

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

If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes
Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0?logo=vaadin)](https://vaadin.com/directory/component/template-placeholder)
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/template-placeholder?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/template-placeholder)
[![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)
[![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)
[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0?logo=vaadin)](https://vaadin.com/directory/component/vaadin-breadcrumbs)
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/vaadin-breadcrumbs?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/vaadin-breadcrumbs)
[![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)
[![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)
![Vaadin 24+](https://img.shields.io/badge/Vaadin%20Platform/Flow-24+-00b4f0)

# template-placeholder
A Vaadin Template Repo
# vaadin-breadcrumbs

A Breadcrumbs component for Vaadin Flow.

![demo](assets/demo.png)

_What is a "Breadcrumb"?_ <br/>
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.

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

## Run the Demo
* Checkout the repo
* Run ``mvn install && mvn -f template-placeholder-demo spring-boot:run``
* Run ``mvn install && mvn -f vaadin-breadcrumbs-demo spring-boot:run``
* Open http://localhost:8080

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

## Dependencies and Licenses
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/template-placeholder/dependencies)
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/vaadin-breadcrumbs/dependencies)

_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)_
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## Reporting a Vulnerability

Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new).
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/vaadin-breadcrumbs/security/advisories/new).
4 changes: 4 additions & 0 deletions assets/ATU_Logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/demo.avif
Binary file not shown.
Binary file modified assets/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<modelVersion>4.0.0</modelVersion>

<groupId>software.xdev</groupId>
<artifactId>template-placeholder-root</artifactId>
<version>1.0.0-SNAPSHOT</version>
<artifactId>vaadin-breadcrumbs-root</artifactId>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>

<organization>
Expand All @@ -15,8 +15,8 @@
</organization>

<modules>
<module>template-placeholder</module>
<module>template-placeholder-demo</module>
<module>vaadin-breadcrumbs</module>
<module>vaadin-breadcrumbs-demo</module>
</modules>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"packageRules": [
{
"description": "Ignore project internal dependencies",
"packagePattern": "^software.xdev:template-placeholder",
"packagePattern": "^software.xdev:vaadin-breadcrumbs",
"datasources": [
"maven"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

<parent>
<groupId>software.xdev</groupId>
<artifactId>template-placeholder-root</artifactId>
<version>1.0.0-SNAPSHOT</version>
<artifactId>vaadin-breadcrumbs-root</artifactId>
<version>1.1.1-SNAPSHOT</version>
</parent>

<artifactId>template-placeholder-demo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<artifactId>vaadin-breadcrumbs-demo</artifactId>
<version>1.1.1-SNAPSHOT</version>
<packaging>jar</packaging>

<organization>
Expand Down Expand Up @@ -70,7 +70,7 @@
</dependency>
<dependency>
<groupId>software.xdev</groupId>
<artifactId>template-placeholder</artifactId>
<artifactId>vaadin-breadcrumbs</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package software.xdev.vaadin.ui;

import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.dom.Element;
import com.vaadin.flow.router.Route;


@Route("")
public class HomeView extends VerticalLayout
{
public HomeView()
{
this.add(new Button("Toggle theme", ev -> {
final Element uiElement = UI.getCurrent().getElement();
uiElement.setAttribute("theme", "dark".equals(uiElement.getAttribute("theme")) ? "" : "dark");
}));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package software.xdev.vaadin.ui;

import java.util.Objects;

import com.vaadin.flow.component.HasElement;
import com.vaadin.flow.component.applayout.AppLayout;
import com.vaadin.flow.component.applayout.DrawerToggle;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.sidenav.SideNav;
import com.vaadin.flow.component.sidenav.SideNavItem;
import com.vaadin.flow.router.Layout;
import com.vaadin.flow.router.PageTitle;

import software.xdev.vaadin.breadcrumbs.Breadcrumbs;
import software.xdev.vaadin.ui.cars.CarsView;
import software.xdev.vaadin.ui.cars.brand.ElectricView;
import software.xdev.vaadin.ui.cars.brand.GasolineView;
import software.xdev.vaadin.ui.cars.brand.HybridView;


@Layout
@PageTitle("Breadcrumb Demo")
public class MainLayout extends AppLayout
{
private final Breadcrumbs breadcrumbs = new Breadcrumbs()
.withHomeBreadcrumbName(this.getTranslation(TranslationKeys.HOME))
.withBreadcrumbNameResolver((full, part) -> this.getTranslation(part));

public MainLayout()
{
final SideNav sideNav = new SideNav();
sideNav.addItem(new SideNavItem(
this.getTranslation(TranslationKeys.HOME),
"",
VaadinIcon.HOME_O.create()));

final SideNavItem carsItem = new SideNavItem(
this.getTranslation(TranslationKeys.CARS),
CarsView.class,
VaadinIcon.CAR.create());
carsItem.addItem(new SideNavItem(
this.getTranslation(TranslationKeys.GASOLINE),
GasolineView.class,
VaadinIcon.FIRE.create()));
carsItem.addItem(new SideNavItem(
this.getTranslation(TranslationKeys.HYBRID),
HybridView.class,
VaadinIcon.GLOBE.create()));
carsItem.addItem(new SideNavItem(
this.getTranslation(TranslationKeys.ELECTRIC),
ElectricView.class,
VaadinIcon.BOLT.create()));

sideNav.addItem(Objects.requireNonNull(carsItem));

this.setPrimarySection(Section.DRAWER);

final VerticalLayout navWrapper = new VerticalLayout(sideNav);
sideNav.setWidthFull();
navWrapper.setSpacing(true);
this.addToDrawer(navWrapper);

final HorizontalLayout vlHeader = new HorizontalLayout(new DrawerToggle(), this.breadcrumbs);
vlHeader.setSpacing(false);
this.addToNavbar(vlHeader);
}

@Override
public void showRouterLayoutContent(final HasElement content)
{
super.showRouterLayoutContent(content);
this.breadcrumbs.updateFromCurrentPath();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package software.xdev.vaadin.ui;

public final class TranslationKeys
{
public static final String HOME = "home";

public static final String CARS = "cars";
public static final String ELECTRIC = "electric";
public static final String HYBRID = "hybrid";
public static final String GASOLINE = "gasoline";
public static final String PLUTONIUM = "plutonium";

public static final String FUEL = "fuel";
public static final String MODEL = "model";
public static final String HP = "hp";

private TranslationKeys()
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package software.xdev.vaadin.ui.cars;

import static software.xdev.vaadin.ui.TranslationKeys.ELECTRIC;
import static software.xdev.vaadin.ui.TranslationKeys.GASOLINE;
import static software.xdev.vaadin.ui.TranslationKeys.HYBRID;
import static software.xdev.vaadin.ui.TranslationKeys.PLUTONIUM;

import java.util.List;

import com.vaadin.flow.component.orderedlayout.VerticalLayout;


public abstract class AbstractCarView extends VerticalLayout
{
protected AbstractCarView()
{
final CarGrid carGrid = new CarGrid(this.getCars());
carGrid.setAllRowsVisible(true);
this.add(carGrid);
}

protected abstract List<Car> getCars();

protected static List<Car> getCarsByFuel(final String fuel)
{
return getAllCars().stream()
.filter(c -> fuel.equals(c.fuelI18N()))
.toList();
}

@SuppressWarnings("checkstyle:MagicNumber")
protected static List<Car> getAllCars()
{
return List.of(
new Car(GASOLINE, "Opel Astra K", 110),
new Car(GASOLINE, "Skoda Octavia 4", 150),
new Car(GASOLINE, "VW Golf 7 GTI", 220),
new Car(GASOLINE, "Porsche GT3 RS", 525),
new Car(HYBRID, "Mercedes A250", 160),
new Car(HYBRID, "VW Golf 8 eTSI", 150),
new Car(ELECTRIC, "Tesla Model 3", 460),
new Car(ELECTRIC, "BMW i4", 540),
new Car(PLUTONIUM, "DeLorean DMC-12", 1_620_000)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package software.xdev.vaadin.ui.cars;

public record Car(String fuelI18N, String model, int hp)
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package software.xdev.vaadin.ui.cars;

import java.util.List;

import com.vaadin.flow.component.grid.Grid;

import software.xdev.vaadin.ui.TranslationKeys;


public class CarGrid extends Grid<Car>
{

public CarGrid(final List<Car> cars)
{
this.setItems(cars);
this.addColumn(car -> this.getTranslation(car.fuelI18N()))
.setHeader(this.getTranslation(TranslationKeys.FUEL));
this.addColumn(Car::model).setHeader(this.getTranslation(TranslationKeys.MODEL));
this.addColumn(Car::hp).setHeader(this.getTranslation(TranslationKeys.HP));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package software.xdev.vaadin.ui.cars;

import java.util.List;

import com.vaadin.flow.router.Route;


@Route("cars")
public class CarsView extends AbstractCarView
{
@Override
protected List<Car> getCars()
{
return getAllCars();
}
}
Loading

0 comments on commit bea71f2

Please sign in to comment.