Skip to content

Commit 5a98016

Browse files
committed
Code quality fixes
1 parent b8c2cbb commit 5a98016

File tree

1 file changed

+8
-6
lines changed
  • src/main/java/com/flowingcode/vaadin/addons/carousel

1 file changed

+8
-6
lines changed

src/main/java/com/flowingcode/vaadin/addons/carousel/Carousel.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@
3737
@JsModule("@xpertsea/paper-slider/l2t-paper-slider.js")
3838
public class Carousel extends Component implements HasSize {
3939

40+
private static final int DEFAULT_SLIDE_DURATION = 2;
41+
4042
private Slide[] slides;
4143
private boolean autoProgress;
42-
private int slideDuration = 2;
44+
private int slideDuration = DEFAULT_SLIDE_DURATION;
4345
private int startPosition;
4446
private boolean disableSwipe;
4547
private boolean hideNavigation;
@@ -65,7 +67,7 @@ private void updateProperties() {
6567
this.getElement().setAttribute("hide-nav", "true");
6668
this.getElement().setAttribute("slide-duration", "" + this.slideDuration);
6769
this.getElement().setAttribute("position", "" + this.startPosition);
68-
};
70+
}
6971

7072
// PROPERTIES
7173
public Slide[] getSlides() {
@@ -165,27 +167,27 @@ public String getHeight() {
165167
* Move to the next slide
166168
*/
167169
public void moveNext() {
168-
this.getElement().callFunction("moveNext");
170+
this.getElement().callJsFunction("moveNext");
169171
}
170172

171173
/**
172174
* Move to the previous slide
173175
*/
174176
public void movePrev() {
175-
this.getElement().callFunction("movePrev");
177+
this.getElement().callJsFunction("movePrev");
176178
}
177179

178180
/**
179181
* Move to a specific slide
180182
* @param slide
181183
*/
182184
public void movePos(int slide) {
183-
this.getElement().callFunction("movePos", ""+slide);
185+
this.getElement().callJsFunction("movePos", ""+slide);
184186
}
185187

186188
// EVENTS
187189
@DomEvent("position-changed")
188-
static public class SlideChangeEvent extends ComponentEvent<Carousel> {
190+
public static class SlideChangeEvent extends ComponentEvent<Carousel> {
189191
public SlideChangeEvent(Carousel source, boolean fromClient) {
190192
super(source, true);
191193
}

0 commit comments

Comments
 (0)