From f9376f647396f5ad1d0c1a3a4f9150439f6786c2 Mon Sep 17 00:00:00 2001 From: Javier Godoy <11554739+javier-godoy@users.noreply.github.com> Date: Fri, 29 Dec 2023 13:45:56 -0300 Subject: [PATCH] refactor: rename component as DayOfWeekSelector --- ...eekSelector.java => DayOfWeekSelector.java} | 10 +++++----- ...o.java => DayOfWeekSelectorBinderDemo.java} | 10 +++++----- ...torDemo.java => DayOfWeekSelectorDemo.java} | 18 +++++++++--------- ...iew.java => DayOfWeekSelectorDemoView.java} | 12 ++++++------ ...emo.java => DayOfWeekSelectorI18NDemo.java} | 8 ++++---- .../addons/dayofweekselector/DemoView.java | 2 +- .../test/SerializationTest.java | 4 ++-- 7 files changed, 32 insertions(+), 32 deletions(-) rename src/main/java/com/flowingcode/vaadin/addons/dayofweekselector/{DaysOfWeekSelector.java => DayOfWeekSelector.java} (94%) rename src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/{DaysOfWeekSelectorBinderDemo.java => DayOfWeekSelectorBinderDemo.java} (82%) rename src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/{DaysOfWeekSelectorDemo.java => DayOfWeekSelectorDemo.java} (50%) rename src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/{DaysOfWeekSelectorDemoView.java => DayOfWeekSelectorDemoView.java} (79%) rename src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/{DaysOfWeekSelectorI18NDemo.java => DayOfWeekSelectorI18NDemo.java} (67%) diff --git a/src/main/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelector.java b/src/main/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelector.java similarity index 94% rename from src/main/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelector.java rename to src/main/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelector.java index b0ffbfa..169c229 100644 --- a/src/main/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelector.java +++ b/src/main/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelector.java @@ -18,7 +18,7 @@ @SuppressWarnings("serial") @CssImport("./styles/fc-days-of-week-selector-styles.css") -public class DaysOfWeekSelector extends CustomField> { +public class DayOfWeekSelector extends CustomField> { private static class DayOfWeekButton extends Button { private static final String CLASS_NAME = "fc-days-of-week-selector-button"; @@ -54,7 +54,7 @@ private void setState(boolean state) { private HorizontalLayout buttonsLayout; - public DaysOfWeekSelector() { + public DayOfWeekSelector() { getStyle().set("padding", "var(--lumo-space-m)"); buttonsLayout = new HorizontalLayout(); @@ -71,19 +71,19 @@ public DaysOfWeekSelector() { clear(); } - public DaysOfWeekSelector(DayOfWeek... value) { + public DayOfWeekSelector(DayOfWeek... value) { this(); if (value.length > 0) { setValue(value[0], value); } } - public DaysOfWeekSelector(String label) { + public DayOfWeekSelector(String label) { this(); setLabel(label); } - public DaysOfWeekSelector(String label, DayOfWeek... value) { + public DayOfWeekSelector(String label, DayOfWeek... value) { this(value); setLabel(label); } diff --git a/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelectorBinderDemo.java b/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelectorBinderDemo.java similarity index 82% rename from src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelectorBinderDemo.java rename to src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelectorBinderDemo.java index 63971fd..926a049 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelectorBinderDemo.java +++ b/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelectorBinderDemo.java @@ -14,15 +14,15 @@ @DemoSource @PageTitle("Binder") @SuppressWarnings("serial") -@Route(value = "day-of-week-selector/binder", layout = DaysOfWeekSelectorDemoView.class) -public class DaysOfWeekSelectorBinderDemo extends Div { +@Route(value = "day-of-week-selector/binder", layout = DayOfWeekSelectorDemoView.class) +public class DayOfWeekSelectorBinderDemo extends Div { - public DaysOfWeekSelectorBinderDemo() { + public DayOfWeekSelectorBinderDemo() { // begin-block selector1 Span span1 = new Span(); Binder binder1 = new Binder<>(); - DaysOfWeekSelector selector1 = new DaysOfWeekSelector("Bound field"); + DayOfWeekSelector selector1 = new DayOfWeekSelector("Bound field"); binder1.forField(selector1).bind(Bean::getDays, Bean::setDays); add(selector1, span1); @@ -36,7 +36,7 @@ public DaysOfWeekSelectorBinderDemo() { // begin-block selector2 Span span2 = new Span(); Binder binder2 = new Binder<>(); - DaysOfWeekSelector selector2 = new DaysOfWeekSelector("Bound field, required"); + DayOfWeekSelector selector2 = new DayOfWeekSelector("Bound field, required"); binder2.forField(selector2).asRequired().bind(Bean::getDays, Bean::setDays); add(selector2, span2); diff --git a/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelectorDemo.java b/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelectorDemo.java similarity index 50% rename from src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelectorDemo.java rename to src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelectorDemo.java index 27e40ca..5e30030 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelectorDemo.java +++ b/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelectorDemo.java @@ -9,21 +9,21 @@ @DemoSource @PageTitle("Demo") @SuppressWarnings("serial") -@Route(value = "day-of-week-selector/demo", layout = DaysOfWeekSelectorDemoView.class) -public class DaysOfWeekSelectorDemo extends Div { +@Route(value = "day-of-week-selector/demo", layout = DayOfWeekSelectorDemoView.class) +public class DayOfWeekSelectorDemo extends Div { - public DaysOfWeekSelectorDemo() { - DaysOfWeekSelector selector1 = - new DaysOfWeekSelector("Enabled", DayOfWeek.MONDAY, DayOfWeek.WEDNESDAY); + public DayOfWeekSelectorDemo() { + DayOfWeekSelector selector1 = + new DayOfWeekSelector("Enabled", DayOfWeek.MONDAY, DayOfWeek.WEDNESDAY); add(selector1); - DaysOfWeekSelector selector2 = - new DaysOfWeekSelector("Read-only", DayOfWeek.MONDAY, DayOfWeek.WEDNESDAY); + DayOfWeekSelector selector2 = + new DayOfWeekSelector("Read-only", DayOfWeek.MONDAY, DayOfWeek.WEDNESDAY); selector2.setReadOnly(true); add(selector2); - DaysOfWeekSelector selector3 = - new DaysOfWeekSelector("Disabled", DayOfWeek.MONDAY, DayOfWeek.WEDNESDAY); + DayOfWeekSelector selector3 = + new DayOfWeekSelector("Disabled", DayOfWeek.MONDAY, DayOfWeek.WEDNESDAY); selector3.setEnabled(false); add(selector3); } diff --git a/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelectorDemoView.java b/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelectorDemoView.java similarity index 79% rename from src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelectorDemoView.java rename to src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelectorDemoView.java index b17108f..734ac13 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelectorDemoView.java +++ b/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelectorDemoView.java @@ -27,14 +27,14 @@ @SuppressWarnings("serial") @ParentLayout(DemoLayout.class) -@Route("days-of-week-selector") +@Route("day-of-week-selector") @GithubLink("https://github.com/FlowingCode/AddonStarter24") -public class DaysOfWeekSelectorDemoView extends TabbedDemo { +public class DayOfWeekSelectorDemoView extends TabbedDemo { - public DaysOfWeekSelectorDemoView() { - addDemo(DaysOfWeekSelectorDemo.class); - addDemo(DaysOfWeekSelectorBinderDemo.class); - addDemo(DaysOfWeekSelectorI18NDemo.class); + public DayOfWeekSelectorDemoView() { + addDemo(DayOfWeekSelectorDemo.class); + addDemo(DayOfWeekSelectorBinderDemo.class); + addDemo(DayOfWeekSelectorI18NDemo.class); setSizeFull(); } } diff --git a/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelectorI18NDemo.java b/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelectorI18NDemo.java similarity index 67% rename from src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelectorI18NDemo.java rename to src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelectorI18NDemo.java index c6ca4e9..617f232 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DaysOfWeekSelectorI18NDemo.java +++ b/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DayOfWeekSelectorI18NDemo.java @@ -10,11 +10,11 @@ @DemoSource @PageTitle("I18N") @SuppressWarnings("serial") -@Route(value = "day-of-week-selector/i18n", layout = DaysOfWeekSelectorDemoView.class) -public class DaysOfWeekSelectorI18NDemo extends Div { +@Route(value = "day-of-week-selector/i18n", layout = DayOfWeekSelectorDemoView.class) +public class DayOfWeekSelectorI18NDemo extends Div { - public DaysOfWeekSelectorI18NDemo() { - DaysOfWeekSelector selector = new DaysOfWeekSelector(); + public DayOfWeekSelectorI18NDemo() { + DayOfWeekSelector selector = new DayOfWeekSelector(); selector.setWeekDaysShort(List.of("D", "L", "M", "X", "J", "V", "S")); selector.setFirstDayOfWeek(DayOfWeek.MONDAY); add(selector); diff --git a/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DemoView.java b/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DemoView.java index 73cb3f2..a929ee6 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DemoView.java +++ b/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/DemoView.java @@ -31,6 +31,6 @@ public class DemoView extends VerticalLayout implements BeforeEnterObserver { @Override public void beforeEnter(BeforeEnterEvent event) { - event.forwardTo(DaysOfWeekSelectorDemoView.class); + event.forwardTo(DayOfWeekSelectorDemoView.class); } } diff --git a/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/test/SerializationTest.java b/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/test/SerializationTest.java index af7ddd8..095e8db 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/test/SerializationTest.java +++ b/src/test/java/com/flowingcode/vaadin/addons/dayofweekselector/test/SerializationTest.java @@ -19,7 +19,7 @@ */ package com.flowingcode.vaadin.addons.dayofweekselector.test; -import com.flowingcode.vaadin.addons.dayofweekselector.DaysOfWeekSelector; +import com.flowingcode.vaadin.addons.dayofweekselector.DayOfWeekSelector; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -44,7 +44,7 @@ private void testSerializationOf(Object obj) throws IOException, ClassNotFoundEx @Test public void testSerialization() throws ClassNotFoundException, IOException { try { - testSerializationOf(new DaysOfWeekSelector()); + testSerializationOf(new DayOfWeekSelector()); } catch (Exception e) { Assert.fail("Problem while testing serialization: " + e.getMessage()); }