AnimatorTrigger trigger = animatorModelManager.getAnimatorTrigger(eventName, selelectModel);
beforeActionAnimation = (AnimatorActionAnimation) trigger.getChild(selectBarIndex);
- if (afterActionAnimation == null)
+ if (afterActionAnimation == null) {
afterActionAnimation =
animatorModelManager
.createAnimatorActionAnimation(groupId,
convertActionAnimationGroupTypes(type),
time, trigger);
+ }
- trigger.removeChild(beforeActionAnimation);
- trigger.addChild(selectBarIndex, afterActionAnimation);
+ if(afterActionAnimation != null) {
+ trigger.removeChild(beforeActionAnimation);
+ trigger.addChild(selectBarIndex, afterActionAnimation);
+ }
}
/*
public void execute() {
AnimatorModelManager animatorModelManager = AnimatorModelManager.getInstance(appManager);
AnimatorTrigger trigger = animatorModelManager.getAnimatorTrigger(eventName, selelectModel);
- if (actionAnimation == null)
+ if (actionAnimation == null) {
actionAnimation =
animatorModelManager
.createAnimatorActionAnimation(groupId,
convertActionAnimationGroupTypes(type),
time, trigger);
+ }
- trigger.addChild(actionAnimation);
+ if(actionAnimation != null) {
+ trigger.addChild(actionAnimation);
+ }
}
/*
package org.tizen.webuibuilder.animator.gef.command;
+import org.tizen.webuibuilder.animator.model.AnimationPathCurve;
import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
public class AnimationPathCurveCreateCommand extends AnimationPathCommand {
public void execute() {
- AnimatorModelManager animatorModelManager =
+ AnimatorModelManager animatorModelManager =
AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
- getModel().insertCurveToModel(animatorModelManager.getModelFactory(), getIndex(), getCurveIndex(),
- getModel().getCurve(getIndex(), getCurveIndex()));
- super.execute();
+ AnimationPathCurve curve = getModel().getCurve(getIndex(), getCurveIndex());
+ if(curve != null) {
+ getModel().insertCurveToModel(animatorModelManager.getModelFactory(), getIndex(), getCurveIndex(),
+ curve);
+ }
+ super.execute();
}
public void undo() {
getModel().setKeyFrameToModel(getIndex(), p.x, p.y);
} else {
setOldCurve(getModel().getCurveFromModel(getIndex(), getCurveIndex()));
- getModel().setCurveToModel(getIndex(), getCurveIndex(),
- getModel().getCurve(getIndex(), getCurveIndex()));
+ AnimationPathCurve curve = getModel().getCurve(getIndex(), getCurveIndex());
+ if(curve != null) {
+ getModel().setCurveToModel(getIndex(), getCurveIndex(), curve);
+ }
}
super.execute();
}
if (part.getPartId() != null && !part.getPartId().isEmpty()) {
WidgetPosition pos = widgetPositions.get(part.getPartId());
if (pos != null) {
- if (isFireEvent) {
- ((AnimatorPart)part).setAnimationVisualPosition(pos);
- } else {
- ((AnimatorPart)part).setAnimationVisualPosition(pos);
- }
+// if (isFireEvent) {
+ ((AnimatorPart)part).setAnimationVisualPosition(pos);
+// } else {
+// ((AnimatorPart)part).setAnimationVisualPosition(pos);
+// }
}
}
/*
* Add the first keyframe in Selector
*/
- if (keyFrame.getDelay() == selector.getDelay()) {
+ if (Double.compare(keyFrame.getDelay(),selector.getDelay()) == 0) {
updateAnimationFWAndDetect(selector, currentAnimationGroupId, pointTime);
+ } else {
+ updateAnimationFW(selector, currentAnimationGroupId, pointTime);
}
/*
* Add the last keyframe in Selector
*/
- else if (keyFrame.getDelay() + keyFrame.getDuration() == selector.getDelay()
- + selector.getDuration()) {
+ /*else if (Double.compare(keyFrame.getDelay() + keyFrame.getDuration(), selector.getDelay()
+ + selector.getDuration()) == 0) {
updateAnimationFW(selector, currentAnimationGroupId, pointTime);
- }
+ }*/
/*
* Add the middle keyframe in Selector
*/
- else {
+ /*else {
updateAnimationFW(selector, currentAnimationGroupId, pointTime);
- }
+ }*/
}
/*
*/
if (keyFrame.getDelay() < selector.getDelay()) {
updateAnimationFWAndDetect(selector, currentAnimationGroupId, pointTime);
+ } else {
+ updateAnimationFW(selector, currentAnimationGroupId, pointTime);
}
/*
* Remove the last keyframe in Selector (KeyFrame's delay + duration) > (Selector's
* delay + duration)
*/
- else if (keyFrame.getDelay() + keyFrame.getDuration() > selector.getDelay()
+ /*else if (keyFrame.getDelay() + keyFrame.getDuration() > selector.getDelay()
+ selector.getDuration()) {
updateAnimationFW(selector, currentAnimationGroupId, pointTime);
- }
+ }*/
/*
* Remove the middle keyframe in Selector
*/
- else {
+ /*else {
updateAnimationFW(selector, currentAnimationGroupId, pointTime);
- }
+ }*/
}
/*
// Add to front
if (0.0 <= pointTime && pointTime < delay) {
updateAnimationFWAndDetect(selector, currentAnimationGroupId, pointTime);
+ } else {
+ updateAnimationFW(selector, currentAnimationGroupId, pointTime);
}
// Add to middle
- else if (delay < pointTime && pointTime < duration) {
+ /*else if (delay < pointTime && pointTime < duration) {
updateAnimationFW(selector, currentAnimationGroupId, pointTime);
- }
+ }*/
// Add to end
- else {
+ /*else {
updateAnimationFW(selector, currentAnimationGroupId, pointTime);
- }
+ }*/
}
/*
if ((frame.getCurveFrameSize() > 0) && (i + 1 < mergedFrames.size())) {
AnimatorFrame nextFrame = getNextFrame(mergedFrames, i);
+ if(nextFrame != null) {
+ left = getPixelProperty(frame, Constants.translateX, translateInDesigner.width);
+ top = getPixelProperty(frame, Constants.translateY, translateInDesigner.height);
- left = getPixelProperty(frame, Constants.translateX, translateInDesigner.width);
- top = getPixelProperty(frame, Constants.translateY, translateInDesigner.height);
+ Point location = new Point(left, top);
- Point location = new Point(left, top);
+ PointList pointList =
+ getCurveFramePoints(frame, nextFrame, translateInDesigner.width,
+ translateInDesigner.height);
- PointList pointList =
- getCurveFramePoints(frame, nextFrame, translateInDesigner.width,
- translateInDesigner.height);
+ if(pointList != null) {
+ List<AnimatorFrame> curves = getCurveFrames(modelFactory, pointList, location, frame, nextFrame);
- List<AnimatorFrame> curves = getCurveFrames(modelFactory, pointList, location, frame, nextFrame);
-
- curves.remove(curves.size() - 1);
-
- interpolateTransformProperties(curves, propertiesUsed, frame, nextFrame);
- frames.addAll(curves);
+ curves.remove(curves.size() - 1);
+ interpolateTransformProperties(curves, propertiesUsed, frame, nextFrame);
+ frames.addAll(curves);
+ }
+ }
}
i++;
return p.getTranslated(-pos.x, -pos.y);
}
- private class CssValueForLocation {
+ private static class CssValueForLocation {
int left = 0;
int top = 0;
int width = 0;
NodeList heads = editDoc.getElementsByTagName("head");
if (heads == null) {
Element newElmHead = editDoc.createElement("head");
- editDoc.insertBefore(newElmHead, editDoc.getFirstChild());
+ if(newElmHead != null) {
+ editDoc.insertBefore(newElmHead, editDoc.getFirstChild());
+ }
}
Element elm = (Element) heads.item(0);
builder.append(rotateZ);
builder.append(") ");
}
- if (rotateY != null) {
+ if (rotateX != null) {
builder.append("rotateX(");
builder.append(rotateX);
builder.append(") ");
if (jsFile.exists()) {
jsFile.delete();
}
-
return;
}
+ FileWriter fw = null;
try {
- FileWriter fw = new FileWriter(modelJsFilePath);
+ fw = new FileWriter(modelJsFilePath);
fw.write(fileModel);
- fw.close();
-
} catch (IOException e) {
e.printStackTrace();
+ } finally {
+ try {
+ if (fw != null) {
+ fw.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
}
}
* @param rootPart
*/
public static void writeCssFileModel(AppManager appManager, Part rootPart) {
+ FileWriter fw = null;
try {
String animationCssString = getAnimatorKeyFrameString(rootPart);
return;
}
- FileWriter fw = new FileWriter(modelCssFilePath);
+ fw = new FileWriter(modelCssFilePath);
fw.write(animationCssString.toString());
- fw.close();
-
} catch (IOException e) {
e.printStackTrace();
+ } finally {
+ try {
+ if (fw != null) {
+ fw.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
}
}