diff --git a/.gitignore b/.gitignore index 2ecbc7d..8a30ffa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,20 @@ -/target -/.classpath -/.project -/.settings -/node_modules -/webpack.generated.js -/package.json -/package-lock.json -/webpack.config.js +node_modules +target +.vscode +.settings +.project +.classpath +webpack.generated.js +package-lock.json +package.json +webpack.config.js +/error-screenshots +drivers tsconfig.json +.idea types.d.ts +/frontend/generated +/frontend/index.html +vite.generated.ts +vite.config.ts +/src/main/dev-bundle \ No newline at end of file diff --git a/assembly/assembly.xml b/assembly/assembly.xml index e2d07fc..14a5a9a 100644 --- a/assembly/assembly.xml +++ b/assembly/assembly.xml @@ -14,7 +14,7 @@ - .. + . LICENSE README.md @@ -28,7 +28,7 @@ *.pdf - *-tests.jar + *-demo.jar diff --git a/src/main/java/com/flowingcode/vaadin/addons/carousel/Carousel.java b/src/main/java/com/flowingcode/vaadin/addons/carousel/Carousel.java index f82c0c4..8253b75 100644 --- a/src/main/java/com/flowingcode/vaadin/addons/carousel/Carousel.java +++ b/src/main/java/com/flowingcode/vaadin/addons/carousel/Carousel.java @@ -32,10 +32,9 @@ import com.vaadin.flow.shared.Registration; /** - * A component that displays a slideshow of slides. - * By default the slides will be displayed with navigation buttons, autoplay and swipe enabled. - * You can configure the slideshow by adding custom parameters, such as duration of transition, - * start position, maximum height and disabling swipe. + * A component that displays a slideshow of slides. By default the slides will be displayed with + * navigation buttons, autoplay and swipe enabled. You can configure the slideshow by adding custom + * parameters, such as duration of transition, start position, maximum height and disabling swipe. */ @SuppressWarnings("serial") @Tag("l2t-paper-slider") @@ -92,11 +91,11 @@ public void setAutoProgress(boolean autoProgress) { } public int getSlideDuration() { - return this.getElement().getProperty(SLIDE_DURATION, 0); + return this.getElement().getProperty(SLIDE_DURATION, 0); } public void setSlideDuration(int slideDuration) { - this.getElement().setProperty(SLIDE_DURATION, slideDuration); + this.getElement().setProperty(SLIDE_DURATION, slideDuration); } public int getStartPosition() { @@ -104,7 +103,7 @@ public int getStartPosition() { } public void setStartPosition(int startPosition) { - this.getElement().setAttribute(POSITION, "" + startPosition); + this.getElement().setAttribute(POSITION, "" + startPosition); } public boolean isDisableSwipe() { @@ -112,7 +111,7 @@ public boolean isDisableSwipe() { } public void setDisableSwipe(boolean disableSwipe) { - this.getElement().setAttribute(DISABLE_SWIPE, disableSwipe); + this.getElement().setAttribute(DISABLE_SWIPE, disableSwipe); } public boolean isHideNavigation() { @@ -120,7 +119,7 @@ public boolean isHideNavigation() { } public void setHideNavigation(boolean hideNavigation) { - this.getElement().setAttribute(HIDE_NAV, hideNavigation); + this.getElement().setAttribute(HIDE_NAV, hideNavigation); } // FLUENT API @@ -152,7 +151,7 @@ public Carousel withStartPosition(int startPosition) { // SIZING @Override public void setHeight(String height) { - HasSize.super.setHeight(height); + HasSize.super.setHeight(height); getElement().getStyle().set("--paper-slide-height", height); } diff --git a/src/test/java/com/flowingcode/vaadin/addons/carousel/AutoProgressDemo.java b/src/test/java/com/flowingcode/vaadin/addons/carousel/AutoProgressDemo.java index b516173..5e2bf75 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/carousel/AutoProgressDemo.java +++ b/src/test/java/com/flowingcode/vaadin/addons/carousel/AutoProgressDemo.java @@ -20,8 +20,6 @@ package com.flowingcode.vaadin.addons.carousel; import com.flowingcode.vaadin.addons.demo.DemoSource; -import com.vaadin.flow.component.Component; -import com.vaadin.flow.component.html.H1; import com.vaadin.flow.component.orderedlayout.VerticalLayout; import com.vaadin.flow.router.PageTitle; import com.vaadin.flow.router.Route; @@ -33,11 +31,26 @@ public class AutoProgressDemo extends VerticalLayout { public AutoProgressDemo() { - Slide s1 = new Slide(CarouselDemoView.createSlideContent("Slide 1", "https://www.flowingcode.com/wp-content/uploads/2018/04/birthday-3021071_640.jpg")); - Slide s2 = new Slide(CarouselDemoView.createSlideContent("Slide 2", "https://2.bp.blogspot.com/-nvtIfgN8duc/XKUQh9VEyFI/AAAAAAAABT8/mE7P45E2uqwWlkKimAmes7fT2rdW9UDWwCEwYBhgL/s320/anniversary_1.jpg")); - Slide s3 = new Slide(CarouselDemoView.createSlideContent("Slide 3", "https://www.flowingcode.com/wp-content/uploads/2020/04/photo4blog-300x300.jpg")); - Slide s4 = new Slide(CarouselDemoView.createSlideContent("Slide 4", "https://www.flowingcode.com/wp-content/uploads/2021/03/happy_birthday_2.jpg")); - + Slide s1 = + new Slide( + CarouselDemoView.createSlideContent( + "Slide 1", + "https://www.flowingcode.com/wp-content/uploads/2018/04/birthday-3021071_640.jpg")); + Slide s2 = + new Slide( + CarouselDemoView.createSlideContent( + "Slide 2", + "https://2.bp.blogspot.com/-nvtIfgN8duc/XKUQh9VEyFI/AAAAAAAABT8/mE7P45E2uqwWlkKimAmes7fT2rdW9UDWwCEwYBhgL/s320/anniversary_1.jpg")); + Slide s3 = + new Slide( + CarouselDemoView.createSlideContent( + "Slide 3", + "https://www.flowingcode.com/wp-content/uploads/2020/04/photo4blog-300x300.jpg")); + Slide s4 = + new Slide( + CarouselDemoView.createSlideContent( + "Slide 4", + "https://www.flowingcode.com/wp-content/uploads/2021/03/happy_birthday_2.jpg")); Carousel c = new Carousel(s1, s2, s3, s4) @@ -49,5 +62,4 @@ public AutoProgressDemo() { add(c); } - } diff --git a/src/test/java/com/flowingcode/vaadin/addons/carousel/CarouselDemoView.java b/src/test/java/com/flowingcode/vaadin/addons/carousel/CarouselDemoView.java index a61235f..2680205 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/carousel/CarouselDemoView.java +++ b/src/test/java/com/flowingcode/vaadin/addons/carousel/CarouselDemoView.java @@ -39,15 +39,15 @@ public CarouselDemoView() { addDemo(SlideButtonsDemo.class); setSizeFull(); } - + public static Component createSlideContent(String string, String image) { - Div result = new Div(); - result.getStyle().set("width", "auto"); - result.getStyle().set("height", "100%"); - result.getStyle().set("background-image", "url('" + image + "')"); - result.getStyle().set("background-size", "cover"); - result.getStyle().set("background-repeat", "no-repeat"); - result.getStyle().set("background-position", "50% 50%"); + Div result = new Div(); + result.getStyle().set("width", "auto"); + result.getStyle().set("height", "100%"); + result.getStyle().set("background-image", "url('" + image + "')"); + result.getStyle().set("background-size", "cover"); + result.getStyle().set("background-repeat", "no-repeat"); + result.getStyle().set("background-position", "50% 50%"); return result; } } diff --git a/src/test/java/com/flowingcode/vaadin/addons/carousel/ListenerDemo.java b/src/test/java/com/flowingcode/vaadin/addons/carousel/ListenerDemo.java index b7db41c..6c7c911 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/carousel/ListenerDemo.java +++ b/src/test/java/com/flowingcode/vaadin/addons/carousel/ListenerDemo.java @@ -20,8 +20,6 @@ package com.flowingcode.vaadin.addons.carousel; import com.flowingcode.vaadin.addons.demo.DemoSource; -import com.vaadin.flow.component.Component; -import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.notification.Notification; import com.vaadin.flow.component.notification.Notification.Position; import com.vaadin.flow.component.orderedlayout.VerticalLayout; @@ -35,10 +33,26 @@ public class ListenerDemo extends VerticalLayout { public ListenerDemo() { - Slide s1 = new Slide(CarouselDemoView.createSlideContent("Slide 1", "https://www.flowingcode.com/wp-content/uploads/2018/04/birthday-3021071_640.jpg")); - Slide s2 = new Slide(CarouselDemoView.createSlideContent("Slide 2", "https://2.bp.blogspot.com/-nvtIfgN8duc/XKUQh9VEyFI/AAAAAAAABT8/mE7P45E2uqwWlkKimAmes7fT2rdW9UDWwCEwYBhgL/s320/anniversary_1.jpg")); - Slide s3 = new Slide(CarouselDemoView.createSlideContent("Slide 3", "https://www.flowingcode.com/wp-content/uploads/2020/04/photo4blog-300x300.jpg")); - Slide s4 = new Slide(CarouselDemoView.createSlideContent("Slide 4", "https://www.flowingcode.com/wp-content/uploads/2021/03/happy_birthday_2.jpg")); + Slide s1 = + new Slide( + CarouselDemoView.createSlideContent( + "Slide 1", + "https://www.flowingcode.com/wp-content/uploads/2018/04/birthday-3021071_640.jpg")); + Slide s2 = + new Slide( + CarouselDemoView.createSlideContent( + "Slide 2", + "https://2.bp.blogspot.com/-nvtIfgN8duc/XKUQh9VEyFI/AAAAAAAABT8/mE7P45E2uqwWlkKimAmes7fT2rdW9UDWwCEwYBhgL/s320/anniversary_1.jpg")); + Slide s3 = + new Slide( + CarouselDemoView.createSlideContent( + "Slide 3", + "https://www.flowingcode.com/wp-content/uploads/2020/04/photo4blog-300x300.jpg")); + Slide s4 = + new Slide( + CarouselDemoView.createSlideContent( + "Slide 4", + "https://www.flowingcode.com/wp-content/uploads/2021/03/happy_birthday_2.jpg")); Carousel c = new Carousel(s1, s2, s3, s4); c.setSizeFull(); @@ -46,5 +60,4 @@ public ListenerDemo() { add(c); } - } diff --git a/src/test/java/com/flowingcode/vaadin/addons/carousel/SlideButtonsDemo.java b/src/test/java/com/flowingcode/vaadin/addons/carousel/SlideButtonsDemo.java index db1de0b..c38e4a1 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/carousel/SlideButtonsDemo.java +++ b/src/test/java/com/flowingcode/vaadin/addons/carousel/SlideButtonsDemo.java @@ -20,9 +20,7 @@ package com.flowingcode.vaadin.addons.carousel; import com.flowingcode.vaadin.addons.demo.DemoSource; -import com.vaadin.flow.component.Component; import com.vaadin.flow.component.button.Button; -import com.vaadin.flow.component.html.H1; import com.vaadin.flow.component.notification.Notification; import com.vaadin.flow.component.notification.Notification.Position; import com.vaadin.flow.component.orderedlayout.HorizontalLayout; @@ -37,11 +35,26 @@ public class SlideButtonsDemo extends VerticalLayout { public SlideButtonsDemo() { - Slide s1 = new Slide(CarouselDemoView.createSlideContent("Slide 1", "https://www.flowingcode.com/wp-content/uploads/2018/04/birthday-3021071_640.jpg")); - Slide s2 = new Slide(CarouselDemoView.createSlideContent("Slide 2", "https://2.bp.blogspot.com/-nvtIfgN8duc/XKUQh9VEyFI/AAAAAAAABT8/mE7P45E2uqwWlkKimAmes7fT2rdW9UDWwCEwYBhgL/s320/anniversary_1.jpg")); - Slide s3 = new Slide(CarouselDemoView.createSlideContent("Slide 3", "https://www.flowingcode.com/wp-content/uploads/2020/04/photo4blog-300x300.jpg")); - Slide s4 = new Slide(CarouselDemoView.createSlideContent("Slide 4", "https://www.flowingcode.com/wp-content/uploads/2021/03/happy_birthday_2.jpg")); - + Slide s1 = + new Slide( + CarouselDemoView.createSlideContent( + "Slide 1", + "https://www.flowingcode.com/wp-content/uploads/2018/04/birthday-3021071_640.jpg")); + Slide s2 = + new Slide( + CarouselDemoView.createSlideContent( + "Slide 2", + "https://2.bp.blogspot.com/-nvtIfgN8duc/XKUQh9VEyFI/AAAAAAAABT8/mE7P45E2uqwWlkKimAmes7fT2rdW9UDWwCEwYBhgL/s320/anniversary_1.jpg")); + Slide s3 = + new Slide( + CarouselDemoView.createSlideContent( + "Slide 3", + "https://www.flowingcode.com/wp-content/uploads/2020/04/photo4blog-300x300.jpg")); + Slide s4 = + new Slide( + CarouselDemoView.createSlideContent( + "Slide 4", + "https://www.flowingcode.com/wp-content/uploads/2021/03/happy_birthday_2.jpg")); final Carousel cf = new Carousel(s1, s2, s3, s4).withoutNavigation(); cf.setSizeFull(); @@ -61,5 +74,4 @@ public SlideButtonsDemo() { btns.setWidthFull(); add(cf, btns); } - }