Skip to content

Commit 228de22

Browse files
committed
Add getters/setters to MaterialAnimation.
1 parent 94d39d8 commit 228de22

File tree

1 file changed

+56
-39
lines changed

1 file changed

+56
-39
lines changed

gwt-material/src/main/java/gwt/material/design/client/ui/animate/MaterialAnimation.java

Lines changed: 56 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -123,46 +123,46 @@ public void animate(Widget widget, Functions.Func callback) {
123123
@Override
124124
public void run() {
125125
switch (transition) {
126-
case SHOW_STAGGERED_LIST:
127-
JsMaterialElement.showStaggeredList(element);
128-
break;
129-
case FADE_IN_IMAGE:
130-
JsMaterialElement.fadeInImage(element);
131-
break;
132-
case SHOW_GRID:
133-
widget.addStyleName(CssName.DISPLAY_ANIMATION);
134-
JsMaterialElement.closeGrid(element);
135-
break;
136-
case CLOSE_GRID:
137-
widget.addStyleName(CssName.DISPLAY_ANIMATION);
138-
JsMaterialElement.closeGrid(element);
139-
break;
140-
default:
141-
// For core animation components
142-
if (infinite) {
143-
widget.addStyleName(CssName.INFINITE);
144-
}
145-
widget.addStyleName("animated " + transition.getCssName());
146-
147-
// Only start the end timer if its not already active.
148-
if(endTimer == null) {
149-
endTimer = new Timer() {
150-
@Override
151-
public void run() {
152-
if (callback != null) {
153-
callback.call();
154-
}
155-
if (!infinite) {
156-
$(element).removeClass("animated " + transition.getCssName());
157-
}
158-
159-
endTimer = null;
160-
startTimer = null;
126+
case SHOW_STAGGERED_LIST:
127+
JsMaterialElement.showStaggeredList(element);
128+
break;
129+
case FADE_IN_IMAGE:
130+
JsMaterialElement.fadeInImage(element);
131+
break;
132+
case SHOW_GRID:
133+
widget.addStyleName(CssName.DISPLAY_ANIMATION);
134+
JsMaterialElement.closeGrid(element);
135+
break;
136+
case CLOSE_GRID:
137+
widget.addStyleName(CssName.DISPLAY_ANIMATION);
138+
JsMaterialElement.closeGrid(element);
139+
break;
140+
default:
141+
// For core animation components
142+
if (infinite) {
143+
widget.addStyleName(CssName.INFINITE);
144+
}
145+
widget.addStyleName("animated " + transition.getCssName());
146+
147+
// Only start the end timer if its not already active.
148+
if(endTimer == null) {
149+
endTimer = new Timer() {
150+
@Override
151+
public void run() {
152+
if (callback != null) {
153+
callback.call();
161154
}
162-
};
163-
endTimer.schedule(durationMillis);
164-
}
165-
break;
155+
if (!infinite) {
156+
$(element).removeClass("animated " + transition.getCssName());
157+
}
158+
159+
endTimer = null;
160+
startTimer = null;
161+
}
162+
};
163+
endTimer.schedule(durationMillis);
164+
}
165+
break;
166166
}
167167
}
168168
};
@@ -190,15 +190,32 @@ public Transition getTransition() {
190190
return transition;
191191
}
192192

193+
public void setTransition(Transition transition) {
194+
this.transition = transition;
195+
}
196+
193197
public int getDelayMillis() {
194198
return delayMillis;
195199
}
196200

201+
public void setDelayMillis(int delayMillis) {
202+
this.delayMillis = delayMillis;
203+
}
204+
197205
public int getDurationMillis() {
198206
return durationMillis;
199207
}
200208

209+
public void setDurationMillis(int durationMillis) {
210+
this.durationMillis = durationMillis;
211+
}
212+
201213
public boolean isInfinite() {
202214
return infinite;
203215
}
216+
217+
public void setInfinite(boolean infinite) {
218+
this.infinite = infinite;
219+
stopAnimation();
220+
}
204221
}

0 commit comments

Comments
 (0)