Skip to content

Commit

Permalink
style: apply code formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
javier-godoy authored and paodb committed Mar 8, 2024
1 parent 0de4e81 commit 738b8b1
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions src/main/java/com/flowingcode/vaadin/addons/carousel/Carousel.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,23 @@ public class Carousel extends Component implements HasSize {
private Slide[] slides;

public Carousel(Slide... paperSlides) {
this.setSlides(paperSlides);
setSlides(paperSlides);
updateSlides(paperSlides);
initProperties();
}

private void updateSlides(Slide... paperSlides) {
for (Slide slide : paperSlides) {
this.getElement().appendChild(slide.getElement());
getElement().appendChild(slide.getElement());
}
}

private void initProperties() {
this.setAutoProgress(false);
this.setSlideDuration(DEFAULT_SLIDE_DURATION);
this.setStartPosition(0);
this.setDisableSwipe(false);
this.setHideNavigation(false);
setAutoProgress(false);
setSlideDuration(DEFAULT_SLIDE_DURATION);
setStartPosition(0);
setDisableSwipe(false);
setHideNavigation(false);
}

// PROPERTIES
Expand All @@ -83,68 +83,68 @@ public void setSlides(Slide[] slides) {
}

public boolean isAutoProgress() {
return this.getElement().getProperty(AUTO_PROGRESS, false);
return getElement().getProperty(AUTO_PROGRESS, false);
}

public void setAutoProgress(boolean autoProgress) {
this.getElement().setAttribute(AUTO_PROGRESS, autoProgress);
getElement().setAttribute(AUTO_PROGRESS, autoProgress);
}

public int getSlideDuration() {
return this.getElement().getProperty(SLIDE_DURATION, 0);
return getElement().getProperty(SLIDE_DURATION, 0);
}

public void setSlideDuration(int slideDuration) {
this.getElement().setProperty(SLIDE_DURATION, slideDuration);
getElement().setProperty(SLIDE_DURATION, slideDuration);
}

public int getStartPosition() {
return this.getElement().getProperty(POSITION, 0);
return getElement().getProperty(POSITION, 0);
}

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

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

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

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

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

// FLUENT API
public Carousel withAutoProgress() {
this.setAutoProgress(true);
setAutoProgress(true);
return this;
}

public Carousel withoutSwipe() {
this.setDisableSwipe(true);
setDisableSwipe(true);
return this;
}

public Carousel withoutNavigation() {
this.setHideNavigation(true);
setHideNavigation(true);
return this;
}

public Carousel withSlideDuration(int slideDuration) {
this.setSlideDuration(slideDuration);
setSlideDuration(slideDuration);
return this;
}

public Carousel withStartPosition(int startPosition) {
this.setStartPosition(startPosition);
setStartPosition(startPosition);
return this;
}

Expand All @@ -163,12 +163,12 @@ public String getHeight() {
// METHODS
/** Move to the next slide */
public void moveNext() {
this.getElement().callJsFunction("moveNext");
getElement().callJsFunction("moveNext");
}

/** Move to the previous slide */
public void movePrev() {
this.getElement().callJsFunction("movePrev");
getElement().callJsFunction("movePrev");
}

/**
Expand All @@ -177,7 +177,7 @@ public void movePrev() {
* @param slide
*/
public void movePos(int slide) {
this.getElement().callJsFunction("movePos", "" + slide);
getElement().callJsFunction("movePos", "" + slide);
}

// EVENTS
Expand Down

0 comments on commit 738b8b1

Please sign in to comment.