From: gyeongmin.ju Date: Mon, 28 Apr 2014 13:10:12 +0000 (+0900) Subject: UIB : When copy & paste, animator fix the problem X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6677c29fd621d9387887417419b92e927329326;p=sdk%2Fide%2Fweb-ui-builder-eplugin.git UIB : When copy & paste, animator fix the problem Signed-off-by: gyeongmin.ju Change-Id: I504d4be23b5e31065d2a92ada7b98df7b691ade7 --- diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/viewer/AnimatorBrowserViewer.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/viewer/AnimatorBrowserViewer.java index 75b00da..3db3f43 100644 --- a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/viewer/AnimatorBrowserViewer.java +++ b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/viewer/AnimatorBrowserViewer.java @@ -81,10 +81,12 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer { public AnimatorBrowserViewer(AppManager appManager, ScreenSize screen, IEditorInput editorInput) { super(appManager, screen, editorInput); -// AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager); -// AnimatorPagePart pagePart = (AnimatorPagePart) manager.getPagePart(); - - AnimatorPagePart pagePart = (AnimatorPagePart)appManager.getPageData(appManager.getPageIndex(pageData)).getPagePart(); + // AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager); + // AnimatorPagePart pagePart = (AnimatorPagePart) manager.getPagePart(); + + AnimatorPagePart pagePart = + (AnimatorPagePart) appManager.getPageData(appManager.getPageIndex(pageData)) + .getPagePart(); List animations = pagePart.getAnimations(); if (!animations.isEmpty()) { this.currentAnimationGroupId = animations.get(0).getId(); @@ -119,10 +121,13 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer { protected void handleDispose(DisposeEvent e) { super.handleDispose(e); -// AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager); -// ((AnimatorPart)manager.getRootPart()).removeAnimatorModelListener(animatorModelEventAdapter); - - ((AnimatorPart)appManager.getPageDataSet().getBaseRootPart()).removeAnimatorModelListener(animatorModelEventAdapter); + // AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager); + // ((AnimatorPart)manager.getRootPart()).removeAnimatorModelListener(animatorModelEventAdapter); + + AnimatorPart rootPart = (AnimatorPart) appManager.getPageDataSet().getBaseRootPart(); + if (rootPart != null) { + rootPart.removeAnimatorModelListener(animatorModelEventAdapter); + } } /** @@ -156,11 +161,11 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer { * @param rootPart */ public void setAnimatorModelListener(Part rootPart) { - if(rootPart == null){ + if (rootPart == null) { return; } - - ((AnimatorPart)rootPart).addAnimatorModelListener(animatorModelEventAdapter); + + ((AnimatorPart) rootPart).addAnimatorModelListener(animatorModelEventAdapter); } /** @@ -194,7 +199,9 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer { */ public void showAnimationAtMoment(String animationGroupId, double pointTime) { this.pointTime = pointTime; - getGoingBridge().aniBridge_setCurrentTime(animationGroupId, (int) (pointTime * 1000)); + if (getGoingBridge() != null) { + getGoingBridge().aniBridge_setCurrentTime(animationGroupId, (int) (pointTime * 1000)); + } } /** @@ -219,13 +226,13 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer { * play animation using javascript framework API. */ public void playCurrentAnimation() { -// AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager); -// AnimatorPagePart pagePart = (AnimatorPagePart) manager.getPagePart(); -// -// String pageId = pagePart.getPropertyValue("id"); - - getGoingBridge().aniBridge_play(appManager.getPageData(appManager.getPageIndex(pageData)).getName(), - currentAnimationGroupId); + // AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager); + // AnimatorPagePart pagePart = (AnimatorPagePart) manager.getPagePart(); + // + // String pageId = pagePart.getPropertyValue("id"); + + getGoingBridge().aniBridge_play(appManager.getPageData(appManager.getPageIndex(pageData)) + .getName(), currentAnimationGroupId); } /** @@ -246,11 +253,12 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer { */ public void pauseAnimation(double pointTime) { this.pointTime = pointTime; -// AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager); -// AnimatorPagePart pagePart = (AnimatorPagePart) manager.getPagePart(); -// -// String pageId = pagePart.getPropertyValue("id"); - getGoingBridge().aniBridge_pause(appManager.getPageData(appManager.getPageIndex(pageData)).getName()); + // AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager); + // AnimatorPagePart pagePart = (AnimatorPagePart) manager.getPagePart(); + // + // String pageId = pagePart.getPropertyValue("id"); + getGoingBridge().aniBridge_pause(appManager.getPageData(appManager.getPageIndex(pageData)) + .getName()); } /** @@ -259,11 +267,19 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer { public void initAnimationFW() { getGoingBridge() .aniBridge_initFW(AnimatorFileWriter - .getOneAnimationGroupModelString(appManager.getPageData(appManager.getPageIndex(pageData)).getName(), + .getOneAnimationGroupModelString(appManager + .getPageData(appManager + .getPageIndex(pageData)) + .getName(), currentAnimationGroupId, - appManager, appManager.getPageDataSet().getBaseRootPart()), - AnimatorFileWriter.getOnePageAnimatorKeyFrameString(appManager.getPageDataSet().getBaseRootPart(), - appManager.getPageData(appManager.getPageIndex(pageData)).getPagePart())); + appManager, + appManager + .getPageDataSet() + .getBaseRootPart()), + AnimatorFileWriter.getOnePageAnimatorKeyFrameString(appManager + .getPageDataSet().getBaseRootPart(), appManager + .getPageData(appManager.getPageIndex(pageData)) + .getPagePart())); } /** @@ -323,24 +339,36 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer { * framework API. */ private void updateAnimationModel() { - + getGoingBridge() - .aniBridge_setAnimationCss(AnimatorFileWriter.getOnePageAnimatorKeyFrameString(appManager.getPageDataSet().getBaseRootPart(), - appManager.getPageData(appManager.getPageIndex(pageData)).getPagePart())); + .aniBridge_setAnimationCss(AnimatorFileWriter + .getOnePageAnimatorKeyFrameString(appManager + .getPageDataSet() + .getBaseRootPart(), + appManager + .getPageData(appManager + .getPageIndex(pageData)) + .getPagePart())); getGoingBridge() - .aniBridge_setAnimationJs(AnimatorFileWriter - .getOneAnimationGroupModelString(appManager.getPageData(appManager.getPageIndex(pageData)).getName(), - currentAnimationGroupId, - appManager, - appManager.getPageDataSet().getBaseRootPart())); + .aniBridge_setAnimationJs(AnimatorFileWriter.getOneAnimationGroupModelString(appManager + .getPageData(appManager + .getPageIndex(pageData)) + .getName(), + currentAnimationGroupId, + appManager, + appManager + .getPageDataSet() + .getBaseRootPart())); } /** * Apply status(lock and invisible) to widget from animation model. */ public void checkLockInvisibleWidget() { - AnimatorPagePart pagePart = (AnimatorPagePart)appManager.getPageData(appManager.getPageIndex(pageData)).getPagePart(); - AnimatorAnimation animation = pagePart.getAnimation(currentAnimationGroupId); + AnimatorPagePart pagePart = + (AnimatorPagePart) appManager.getPageData(appManager.getPageIndex(pageData)) + .getPagePart(); + AnimatorAnimation animation = pagePart.getAnimation(currentAnimationGroupId); if (animation == null) { return; } @@ -395,11 +423,11 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer { 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); + // } } } @@ -416,23 +444,23 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer { * */ private class AnimatorModelEventAdapter extends AnimatorModelListenerAdapter { - - /* + + /* * (non-Javadoc) * * @see - * org.tizen.webuibuilder.animator.model.AnimatorModelListenerAdapter#selectorRefresh(org.tizen - * .webuibuilder.animator.model.AnimatorModelEvent) + * org.tizen.webuibuilder.animator.model.AnimatorModelListenerAdapter#selectorRefresh(org + * .tizen .webuibuilder.animator.model.AnimatorModelEvent) */ - @Override - public void selectorRefresh(AnimatorModelEvent e) { - updateAnimationModel(); + @Override + public void selectorRefresh(AnimatorModelEvent e) { + updateAnimationModel(); AnimatorSelector selector = (AnimatorSelector) e.getModel(); updateAnimationFWAndDetect(selector, currentAnimationGroupId, pointTime); - } + } - /* + /* * (non-Javadoc) * * @see @@ -448,24 +476,25 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer { /* * Add the first keyframe in Selector */ - if (Double.compare(keyFrame.getDelay(),selector.getDelay()) == 0) { + if (Double.compare(keyFrame.getDelay(), selector.getDelay()) == 0) { updateAnimationFWAndDetect(selector, currentAnimationGroupId, pointTime); } else { - updateAnimationFW(selector, currentAnimationGroupId, pointTime); + updateAnimationFW(selector, currentAnimationGroupId, pointTime); } /* * Add the last keyframe in Selector */ - /*else if (Double.compare(keyFrame.getDelay() + keyFrame.getDuration(), selector.getDelay() - + selector.getDuration()) == 0) { - updateAnimationFW(selector, currentAnimationGroupId, pointTime); - }*/ + /* + * else if (Double.compare(keyFrame.getDelay() + keyFrame.getDuration(), + * selector.getDelay() + selector.getDuration()) == 0) { updateAnimationFW(selector, + * currentAnimationGroupId, pointTime); } + */ /* * Add the middle keyframe in Selector */ - /*else { - updateAnimationFW(selector, currentAnimationGroupId, pointTime); - }*/ + /* + * else { updateAnimationFW(selector, currentAnimationGroupId, pointTime); } + */ } /* @@ -505,22 +534,23 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer { if (keyFrame.getDelay() < selector.getDelay()) { updateAnimationFWAndDetect(selector, currentAnimationGroupId, pointTime); } else { - updateAnimationFW(selector, currentAnimationGroupId, pointTime); + 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() - + selector.getDuration()) { - updateAnimationFW(selector, currentAnimationGroupId, pointTime); - }*/ + /* + * else if (keyFrame.getDelay() + keyFrame.getDuration() > selector.getDelay() + + * selector.getDuration()) { updateAnimationFW(selector, currentAnimationGroupId, + * pointTime); } + */ /* * Remove the middle keyframe in Selector */ - /*else { - updateAnimationFW(selector, currentAnimationGroupId, pointTime); - }*/ + /* + * else { updateAnimationFW(selector, currentAnimationGroupId, pointTime); } + */ } /* @@ -544,16 +574,17 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer { if (0.0 <= pointTime && pointTime < delay) { updateAnimationFWAndDetect(selector, currentAnimationGroupId, pointTime); } else { - updateAnimationFW(selector, currentAnimationGroupId, pointTime); + updateAnimationFW(selector, currentAnimationGroupId, pointTime); } // Add to middle - /*else if (delay < pointTime && pointTime < duration) { - updateAnimationFW(selector, currentAnimationGroupId, pointTime); - }*/ + /* + * else if (delay < pointTime && pointTime < duration) { updateAnimationFW(selector, + * currentAnimationGroupId, pointTime); } + */ // Add to end - /*else { - updateAnimationFW(selector, currentAnimationGroupId, pointTime); - }*/ + /* + * else { updateAnimationFW(selector, currentAnimationGroupId, pointTime); } + */ } /* diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/part/AnimatorPartFactory.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/part/AnimatorPartFactory.java index bf8bee0..a284183 100644 --- a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/part/AnimatorPartFactory.java +++ b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/part/AnimatorPartFactory.java @@ -43,17 +43,9 @@ public class AnimatorPartFactory extends PartFactory { super(descriptorManager); } - //public AnimatorPart createPart(String key) { - // AnimatorPart part = null; - public Part createPart(String key) { + protected Part createPart(PartDescriptor descriptor) { Part part = null; - if (getDescriptorManager() == null) { - return null; - } - - PartDescriptor descriptor = getDescriptorManager().getPartDescriptor(key); - if (descriptor == null) { Logger logger = LoggerFactory.getLogger(AnimatorPartFactory.class); logger.error(BuilderConstants.LOG_DESC_CANNOT_BE_FOUND_ERROR); @@ -76,7 +68,7 @@ public class AnimatorPartFactory extends PartFactory { part.setPartId(part.getUniquePartId()); part.setPartClass(PartClass.DOCUMENT_PART); } else { - part = super.createPart(descriptor); + part = super.createPart(descriptor); } return part;