Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<fileSets>
<fileSet>
<directory>..</directory>
<directory>.</directory>
<includes>
<include>LICENSE</include>
<include>README.md</include>
Expand All @@ -28,7 +28,7 @@
<include>*.pdf</include>
</includes>
<excludes>
<exclude>*-tests.jar</exclude>
<exclude>*-demo.jar</exclude>
</excludes>
</fileSet>
</fileSets>
Expand Down
19 changes: 9 additions & 10 deletions src/main/java/com/flowingcode/vaadin/addons/carousel/Carousel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -92,35 +91,35 @@ 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() {
return this.getElement().getProperty(POSITION, 0);
}

public void setStartPosition(int startPosition) {
this.getElement().setAttribute(POSITION, "" + startPosition);
this.getElement().setAttribute(POSITION, "" + startPosition);
}

public boolean isDisableSwipe() {
return this.getElement().getProperty(DISABLE_SWIPE, false);
}

public void setDisableSwipe(boolean disableSwipe) {
this.getElement().setAttribute(DISABLE_SWIPE, disableSwipe);
this.getElement().setAttribute(DISABLE_SWIPE, disableSwipe);
}

public boolean isHideNavigation() {
return this.getElement().getProperty(HIDE_NAV, false);
}

public void setHideNavigation(boolean hideNavigation) {
this.getElement().setAttribute(HIDE_NAV, hideNavigation);
this.getElement().setAttribute(HIDE_NAV, hideNavigation);
}

// FLUENT API
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand All @@ -49,5 +62,4 @@ public AutoProgressDemo() {

add(c);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -35,16 +33,31 @@
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();
c.addChangeListener(e -> Notification.show("Slide Changed!", 1000, Position.BOTTOM_START));

add(c);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand All @@ -61,5 +74,4 @@ public SlideButtonsDemo() {
btns.setWidthFull();
add(cf, btns);
}

}