ANIMATOR : Change AnimatorModelManager lifecycle 42/20442/1
authorseongwon.shim <seongwon.shim@samsung.com>
Wed, 7 May 2014 09:24:59 +0000 (18:24 +0900)
committerseongwon.shim <seongwon.shim@samsung.com>
Wed, 7 May 2014 09:31:30 +0000 (18:31 +0900)
Change AnimatorModelManager to dynamic instance from static and referenced by AppManager

Change-Id: I478305372567059ac3ce8369acdf9b92deeea176
Signed-off-by: seongwon.shim <seongwon.shim@samsung.com>
37 files changed:
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/command/ActionAnimationGroupRemoveCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/command/ActoinAnimationGroupChangeCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/command/ActoinAnimationGroupCreateCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/command/ActoinCreateCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/command/AnimationCreateAndChangeFrameCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/command/AnimationCreateCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/command/AnimationLockCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/command/AnimationMakeInvisibleCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/command/AnimationPathCurveCreateCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/command/AnimationPathMoveCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/command/AnimationPropertyChangeCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/viewer/AnimatorBrowserViewer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/AnimationPathModel.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/AnimatorAnimation.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/AnimatorModelManager.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/AnimatorSelector.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/EventManager.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/io/AnimatorFileReader.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/io/AnimatorFileWriter.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/part/AnimatorPagePart.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/part/AnimatorPart.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/part/AnimatorWidgetPart.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/TimelineViewer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/command/TimelineAnimationGroupCreateCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/command/TimelineAnimationGroupDeleteCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/command/TimelineFrameCreateCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/command/TimelineFrameDeleteCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/command/TimelineFrameEditCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/command/TimelineKeyframeDeleteCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/command/TimelineKeyframeEditCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/editpart/TimelineEditPart.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/DeletePartCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/app/AppManagerForHTML.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/editor/PageDesigner.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/editor/PageDesignerForHTML.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/action/ActionAnimationGroupComposite.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/style/CssStyleTab.java

index fa17621..981dea6 100644 (file)
@@ -27,8 +27,6 @@ import org.eclipse.gef.commands.Command;
 import org.tizen.webuibuilder.animator.model.AnimatorActionAnimation;
 import org.tizen.webuibuilder.animator.model.AnimatorTrigger;
 import org.tizen.webuibuilder.animator.model.part.AnimatorPart;
-import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
-import org.tizen.webuibuilder.model.app.AppManager;
 
 
 /**
@@ -36,8 +34,6 @@ import org.tizen.webuibuilder.model.app.AppManager;
  */
 public class ActionAnimationGroupRemoveCommand extends Command {
 
-    // private IProject project = AnimatorUtils.getProject();
-    private AppManager appManager = AnimatorUtils.getAppManager();
     private AnimatorPart selelectModel = null;
     private String eventName = null;
     private int selectBarIndex;
index 790dd5c..bda757d 100644 (file)
@@ -28,8 +28,6 @@ import org.tizen.webuibuilder.animator.model.AnimatorActionAnimation;
 import org.tizen.webuibuilder.animator.model.AnimatorTrigger;
 import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
 import org.tizen.webuibuilder.animator.model.part.AnimatorPart;
-import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
-import org.tizen.webuibuilder.model.app.AppManager;
 import org.tizen.webuibuilder.ui.views.properties.action.ActionAnimationGroupComposite.ActionAnimationGroupTypes;
 
 
@@ -38,8 +36,6 @@ import org.tizen.webuibuilder.ui.views.properties.action.ActionAnimationGroupCom
  */
 public class ActoinAnimationGroupChangeCommand extends Command {
 
-    // private IProject project = AnimatorUtils.getProject();
-    private AppManager appManager = AnimatorUtils.getAppManager();
     private AnimatorPart selelectModel = null;
     private ActionAnimationGroupTypes type;
     private String groupId = null;
index 703d885..4644bcd 100644 (file)
@@ -28,8 +28,6 @@ import org.tizen.webuibuilder.animator.model.AnimatorActionAnimation;
 import org.tizen.webuibuilder.animator.model.AnimatorTrigger;
 import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
 import org.tizen.webuibuilder.animator.model.part.AnimatorPart;
-import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
-import org.tizen.webuibuilder.model.app.AppManager;
 import org.tizen.webuibuilder.ui.views.properties.action.ActionAnimationGroupComposite.ActionAnimationGroupTypes;
 
 
@@ -38,9 +36,7 @@ import org.tizen.webuibuilder.ui.views.properties.action.ActionAnimationGroupCom
  */
 public class ActoinAnimationGroupCreateCommand extends Command {
 
-    // private IProject project = AnimatorUtils.getProject();
-    private AppManager appManager = AnimatorUtils.getAppManager();
-    private AnimatorPart selelectModel = null;
+       private AnimatorPart selelectModel = null;
     private ActionAnimationGroupTypes type;
     private String groupId = null;
     private String eventName = null;
index 5887995..c56ca7a 100644 (file)
@@ -98,8 +98,7 @@ public class ActoinCreateCommand extends Command {
             }
         }
 
-        AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
 
         if (preparedTrigger == null) {
             preparedTrigger = (AnimatorTrigger)animatorModelManager.getModelFactory().createAnimatorModel(AnimatorModelType.TRIGGER);
@@ -122,9 +121,6 @@ public class ActoinCreateCommand extends Command {
             actionAnimation.setParent(preparedTrigger);
             actionAnimation.setAnimation(animation);
             actionAnimation.setActionType(method);
-            String actionAnimationId =
-                    animatorModelManager.idGenerator(AnimatorModelType.ACTION_ANIMATION);
-            actionAnimation.setId(actionAnimationId);
             actionAnimation.setActionType("start");
             // preparedTrigger.addAction(actionAnimation);
             preparedTrigger.addChild(actionAnimation);
index a555bc8..9b85aa7 100644 (file)
@@ -71,8 +71,7 @@ public class AnimationCreateAndChangeFrameCommand extends Command {
      */
     @Override
     public void execute() {
-       AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
        
        if(oldSelector == null || newSelector == null) {
                oldSelector = currentSelector.cloneAnimatorSelector();
@@ -128,8 +127,7 @@ public class AnimationCreateAndChangeFrameCommand extends Command {
     @Override
     public void undo() {
        
-       AnimatorModelManager animatorModelManager =
-                       AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         currentSelector.replaceAll(oldSelector);
          
        animatorModelManager.fireEvent(true, currentSelector,
index 017ab18..18a11ca 100644 (file)
@@ -35,7 +35,6 @@ import org.tizen.webuibuilder.animator.model.descriptor.CssAnimationDescriptor;
 import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
 import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.model.app.AppManager;
-import org.tizen.webuibuilder.ui.editor.PageDesigner;
 
 
 /**
@@ -82,8 +81,7 @@ public class AnimationCreateCommand extends Command {
     @Override
     public void execute() {
 
-        AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(appManager);
+        AnimatorModelManager animatorModelManager = appManager.getAnimatorModelManager();
         
        if(newSelector == null || oldSelector == null) {
                oldSelector = currentSelector.cloneAnimatorSelector();
@@ -130,8 +128,7 @@ public class AnimationCreateCommand extends Command {
      */
     @Override
     public void undo() {
-            AnimatorModelManager animatorModelManager =
-                    AnimatorModelManager.getInstance(appManager);
+            AnimatorModelManager animatorModelManager = appManager.getAnimatorModelManager();
            
             currentSelector.replaceAll(oldSelector);
             animatorModelManager.fireEvent(true, currentSelector,
index 28194d2..9ab2f55 100644 (file)
@@ -70,8 +70,7 @@ public class AnimationLockCommand extends Command {
      */
     @Override
     public void redo() {
-        AnimatorModelManager manager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         animatorWidget.setLock(isLock);
         AnimatorProperty animatorProperty = new AnimatorProperty("LOCK", isLock);
         manager.fireEvent(AnimatorModelEvent.EventType.PROPERTY_CHANGE, origin, animatorWidget,
@@ -85,8 +84,7 @@ public class AnimationLockCommand extends Command {
      */
     @Override
     public void undo() {
-        AnimatorModelManager manager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         animatorWidget.setLock(!isLock);
         AnimatorProperty animatorProperty = new AnimatorProperty("LOCK", !isLock);
         manager.fireEvent(AnimatorModelEvent.EventType.PROPERTY_CHANGE, origin, animatorWidget,
index 7008151..2d7b5d8 100644 (file)
@@ -70,8 +70,7 @@ public class AnimationMakeInvisibleCommand extends Command {
      */
     @Override
     public void redo() {
-        AnimatorModelManager manager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         animatorWidget.setVisibility(visibility);
         AnimatorProperty animatorProperty = new AnimatorProperty("VISIBLE", visibility);
         manager.fireEvent(AnimatorModelEvent.EventType.PROPERTY_CHANGE, origin, animatorWidget,
@@ -85,8 +84,8 @@ public class AnimationMakeInvisibleCommand extends Command {
      */
     @Override
     public void undo() {
-        AnimatorModelManager manager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
+
         animatorWidget.setVisibility(!visibility);
         AnimatorProperty animatorProperty = new AnimatorProperty("VISIBLE", !visibility);
         manager.fireEvent(AnimatorModelEvent.EventType.PROPERTY_CHANGE, origin, animatorWidget,
index 23ed0e7..f3ca5bf 100644 (file)
@@ -42,8 +42,7 @@ public class AnimationPathCurveCreateCommand extends AnimationPathCommand {
        
 
        public void execute() {
-       AnimatorModelManager animatorModelManager =
-                 AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
        
        currentSelector = getModel().getSelector();
        if(currentSelector != null) {
@@ -82,8 +81,7 @@ public class AnimationPathCurveCreateCommand extends AnimationPathCommand {
 
     public void undo() {
        
-       AnimatorModelManager animatorModelManager =
-                       AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         currentSelector.replaceAll(oldSelector);
          
        animatorModelManager.fireEvent(true, currentSelector,
index e61b5a2..c0745a3 100644 (file)
@@ -43,14 +43,13 @@ public class AnimationPathMoveCommand extends AnimationPathCommand {
     private AnimationPathCurve oldCurve = null;
 
     public void execute() {
-       AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager(); 
        currentSelector = getModel().getSelector();
        if(currentSelector != null) {
                if(newSelector == null || oldSelector == null) {
                        oldSelector = currentSelector.cloneAnimatorSelector();
                        currentSelector.replaceAll(currentSelector.cloneAnimatorSelector());
-                       getModel().updateAnimationPathKeyframe();
+//                     getModel().updateAnimationPathKeyframe();
                        
                        if (getCurveIndex() == null) {
                     Point p = getLocation();
@@ -107,8 +106,7 @@ public class AnimationPathMoveCommand extends AnimationPathCommand {
 
     public void undo() {
        
-       AnimatorModelManager animatorModelManager =
-                       AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         currentSelector.replaceAll(oldSelector);
          
        animatorModelManager.fireEvent(true, currentSelector,
index 36aafab..ad13034 100644 (file)
@@ -88,8 +88,7 @@ public class AnimationPropertyChangeCommand extends Command {
     @Override
     public void execute() {
        
-       AnimatorModelManager animatorModelManager =
-                 AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
        
        if(newSelector == null || oldSelector == null) {
                oldSelector = currentSelector.cloneAnimatorSelector();
@@ -135,8 +134,7 @@ public class AnimationPropertyChangeCommand extends Command {
     @Override
     public void undo() {
        
-       AnimatorModelManager animatorModelManager =
-                       AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         currentSelector.replaceAll(oldSelector);
          
        animatorModelManager.fireEvent(true, currentSelector,
index 3db3f43..d46326e 100644 (file)
@@ -276,8 +276,8 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer {
                                                                            appManager
                                                                                    .getPageDataSet()
                                                                                    .getBaseRootPart()),
-                                  AnimatorFileWriter.getOnePageAnimatorKeyFrameString(appManager
-                                          .getPageDataSet().getBaseRootPart(), appManager
+                                  AnimatorFileWriter.getOnePageAnimatorKeyFrameString(appManager.getAnimatorModelManager(),
+                                                 appManager.getPageDataSet().getBaseRootPart(), appManager
                                           .getPageData(appManager.getPageIndex(pageData))
                                           .getPagePart()));
     }
@@ -342,7 +342,8 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer {
 
         getGoingBridge()
                 .aniBridge_setAnimationCss(AnimatorFileWriter
-                                                   .getOnePageAnimatorKeyFrameString(appManager
+                                                   .getOnePageAnimatorKeyFrameString(appManager.getAnimatorModelManager(),
+                                                                                                                        appManager
                                                                                              .getPageDataSet()
                                                                                              .getBaseRootPart(),
                                                                                      appManager
index e3d454d..052f0bd 100644 (file)
@@ -560,8 +560,7 @@ public class AnimationPathModel implements IPropertySource {
     }
 
     private void fireModelChangeEvent(AnimatorFrame frame, boolean isEditCurve) {
-        AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
 
         frame.setPartLink(selector.getPartLink());
 
index f0a852c..56491bf 100644 (file)
@@ -194,9 +194,8 @@ public class AnimatorAnimation extends AnimatorModel {
      * 
      * @param part
      */
-    public void updateAnimatorWidget(Part part) {
-        AnimatorModelManager manager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+    public void updateAnimatorWidget(Part part) {      
+        AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         // Update current exist animatorWidget's PartLink
         Iterator<AnimatorModel> iter = getChildren().iterator();
         while (iter.hasNext()) {
index 2b619be..6d4bd5c 100644 (file)
@@ -27,13 +27,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
 import org.tizen.webuibuilder.animator.AnimatorConstants;
 import org.tizen.webuibuilder.animator.gef.viewer.AnimatorBrowserViewer;
 import org.tizen.webuibuilder.animator.model.AnimatorModelEvent.EventType;
@@ -58,114 +53,30 @@ import org.w3c.dom.NodeList;
  */
 public class AnimatorModelManager implements ISelectionListener, IPageDataSetListener {
 
-    private static AnimatorModelManager modelManager = null;
     private AnimatorDescriptorManager descriptorManager = null;
     private AppManager appManager = null;
-    private Part rootPart = null;
     private AnimatorPagePart pagePart = null;
 
-    private static AnimatorModelEditorChecker editorChecker = null;
-    private static final int TIMER_INTERVAL = 1000;
-
     private EventFireDelegate eventSource;
     private IDGenerator idGenerator = null;
     
     private AnimatorPredefinedAnimationFactory predefinedAnimationFactory = null;
     private AnimatorModelFactory modelFactory = null;
 
-    private class AnimatorModelEditorChecker implements Runnable {
-        /*
-         * (non-Javadoc)
-         * 
-         * @see java.lang.Runnable#run()
-         */
-        @Override
-        public void run() {
-            IWorkbenchWindow activeWorkbenchWindow =
-                    PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-            if (activeWorkbenchWindow != null) {
-                IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
-                if (activePage != null) {
-                    IEditorPart activeEditor = activePage.getActiveEditor();
-                    if (activeEditor != null && activeEditor instanceof PageDesigner) {
-                        activePage.addSelectionListener(modelManager);
-                        AnimatorModelManager.this.rootPart =
-                                ((PageDesigner) activeEditor).getRootPart();
-
-                        Display.getDefault().timerExec(-1, this);
-
-                        return;
-                    }
-                }
-            }
-
-            Display.getDefault().timerExec(TIMER_INTERVAL, this);
-        }
-    }
-
-    private AnimatorModelManager(AppManager appManager) {
+   
+    public AnimatorModelManager(AppManager appManager) {
         this.appManager = appManager;
         this.descriptorManager = AnimatorDescriptorManager.createNewManager(appManager);
         this.idGenerator = new IDGenerator();
         this.modelFactory = new AnimatorModelFactory(idGenerator);
-        this.predefinedAnimationFactory = new AnimatorPredefinedAnimationFactory(modelFactory); 
+        this.predefinedAnimationFactory = new AnimatorPredefinedAnimationFactory(modelFactory);
+        this.eventSource = new EventManager(appManager);
 
         appManager.getPageDataSet().addPageListener(this);
-
-        editorChecker = new AnimatorModelEditorChecker();
-        Display.getDefault().timerExec(TIMER_INTERVAL, editorChecker);
-    }
-
-    /**
-     * Get AnimatorModelManager instance
-     * 
-     * @param appManager
-     * @return
-     */
-    public static AnimatorModelManager getInstance(AppManager appManager) {
-        if (modelManager == null) {
-            synchronized (AnimatorModelManager.class) {
-                if (modelManager == null) {
-                    modelManager = new AnimatorModelManager(appManager);
-                    appManager.setAnimatorModelManager(modelManager);
-                }
-            }
-        } else if (appManager != null) {
-            if (appManager.getAnimatorModelManager() == null) {
-                appManager.setAnimatorModelManager(modelManager);
-            }
-        }
-        return modelManager;
-    }
-
-    /**
-     * Initialize AnimatorModelManager
-     * 
-     * @param rootPart
-     */
-    public void initialize(Part rootPart) {
-        this.rootPart = rootPart;
-        if(rootPart != null && rootPart instanceof AnimatorPart){
-               eventSource = new EventManager((AnimatorPart)rootPart);
-               initMaxIds(rootPart);
-        }
-    }
-
-    /**
-     * Initialize AnimatorModelManager
-     * 
-     * @param appManager
-     * @param rootPart
-     */
-    public void initialize(AppManager appManager, Part rootPart) {
-        this.rootPart = rootPart;
-        this.pagePart = (AnimatorPagePart)rootPart.getChildren().get(0);
-        eventSource = new EventManager((AnimatorPart)rootPart);
-        if (this.appManager != appManager) {
-            this.appManager = appManager;
-        }
-
-        initMaxIds(rootPart);
+        
+        //FIXME
+        this.pagePart = (AnimatorPagePart)appManager.getPageDataSet().getBaseRootPart().getChildren().get(0);
+        
     }
     
 
@@ -191,35 +102,6 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
     }
 
     /**
-     * Get rootPart
-     * 
-     * @return
-     */
-    public Part getRootPart() {
-        return rootPart;
-    }
-
-    /**
-     * Set rootPart
-     * 
-     * @param rootPart
-     */
-    public void setRootPart(Part rootPart) {
-        this.rootPart = rootPart;
-        setPagePart((AnimatorPagePart)rootPart.getChildren().get(0));
-    }
-
-    /**
-     * Get page id
-     * 
-     * @return
-     */
-    public String getPageId() {
-        AnimatorPagePart pagePart = (AnimatorPagePart) rootPart.getChildren().get(0);
-        return pagePart.getPropertyValue("id");
-    }
-
-    /**
      * Get page part
      * 
      * @return
@@ -254,7 +136,17 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
                return modelFactory;
        }
 
-    /******************************************************************************************************************
+    public AppManager getAppManager() {
+               return appManager;
+       }
+
+
+       public void setAppManager(AppManager appManager) {
+               this.appManager = appManager;
+       }
+
+
+       /******************************************************************************************************************
      * Animator Model ID Control - Start
      ******************************************************************************************************************/
     private void initMaxIds(Part rootPart) {
@@ -407,7 +299,7 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
      * @param newRootPart
      */
     public void updateAnimatorModel(Part newRootPart) {
-        Part oldRootPart = getRootPart();
+        Part oldRootPart = getAppManager().getPageDataSet().getBaseRootPart();
         if (!oldRootPart.equals(newRootPart)) {
             for (Part oldPart : oldRootPart.getChildren()) {
                 for (Part newPart : newRootPart.getChildren()) {
@@ -424,7 +316,7 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
                 AnimatorPagePart newPagePart = (AnimatorPagePart) newPart;
 
                 if (newPagePart.getAnimations().size() == 0) {
-                       newPagePart.addAnimation(newPagePart.createAnimation(null, true, 1, false));
+                       newPagePart.addAnimation(newPagePart.createAnimation(this, null, true, 1, false));
                 }
             }
         }
@@ -435,7 +327,7 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
      */
     public void addAnimatorRelatedResources() {
         if (appManager instanceof AppManagerForHTML) {
-            if (!((AnimatorPart)rootPart).hasAnimation()) {
+            if (!((AnimatorPart)getAppManager().getPageDataSet().getBaseRootPart()).hasAnimation()) {
                 Document editDoc = ((AppManagerForHTML) appManager).getDocument();
 
                 NodeList heads = editDoc.getElementsByTagName("head");
@@ -480,7 +372,7 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
      */
     public void removeAnimatorRelatedResources() {
         if (appManager instanceof AppManagerForHTML) {
-            if (!((AnimatorPart) rootPart).hasAnimation()) {
+            if (!((AnimatorPart) getAppManager().getPageDataSet().getBaseRootPart()).hasAnimation()) {
                 Document editDoc = ((AppManagerForHTML) appManager).getDocument();
                 NodeList heads = editDoc.getElementsByTagName("head");
                 Element head = null;
@@ -549,9 +441,6 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
             AppManager appManager = pageDesigner.getAppManager();
             if (appManager != this.appManager) {
                 this.appManager = appManager;
-                this.rootPart = pageDesigner.getRootPart();
-                // clearIds();
-                initMaxIds(this.rootPart);
             }
         }
     }
@@ -612,7 +501,7 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
         /*
          * Animation Model
          */
-        addedPagePart.addAnimation(addedPagePart.createAnimation(null, true,
+        addedPagePart.addAnimation(addedPagePart.createAnimation(this, null, true,
                                                                        1, false));
     }
 
index ecabcb3..39b162c 100644 (file)
@@ -244,9 +244,8 @@ public class AnimatorSelector extends AnimatorModel {
     public void addChild(AnimatorModel child) {
         int index = 0;
 
-        AnimatorModelManager modelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
-        modelManager.addAnimatorRelatedResources();
+//        AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
+//        modelManager.addAnimatorRelatedResources();
 
         for (AnimatorModel model : getChildren()) {
             AnimatorKeyframe keyframe = (AnimatorKeyframe) model;
@@ -269,8 +268,7 @@ public class AnimatorSelector extends AnimatorModel {
     public void removeChild(AnimatorModel child) {
         super.removeChild(child);
 
-        AnimatorModelManager modelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         modelManager.removeAnimatorRelatedResources();
     }
 
index ea0bcb0..e47aec9 100644 (file)
@@ -28,21 +28,22 @@ import java.util.List;
 import org.tizen.webuibuilder.animator.model.AnimatorModelEvent.EventType;
 import org.tizen.webuibuilder.animator.model.AnimatorModelEvent.Origin;
 import org.tizen.webuibuilder.animator.model.part.AnimatorPart;
+import org.tizen.webuibuilder.model.app.AppManager;
 
 
 /**
  * A EventManager class
  */
 public class EventManager implements EventFireDelegate {
-       AnimatorPart rootPart;
+       AppManager appManager;
 
     /**
      * Constructor
      * 
      * @param rootPart
      */
-    public EventManager(AnimatorPart rootPart) {
-        this.rootPart = rootPart;
+    public EventManager(AppManager appManager) {
+        this.appManager = appManager;
     }
     /**
      * Fire event from rootPart
@@ -52,7 +53,7 @@ public class EventManager implements EventFireDelegate {
      * @param model
      */
     public void fireEvent(EventType event, Origin origin, AnimatorModel model) {
-        rootPart.fireEvent(new AnimatorModelEvent(event, origin, model));
+        ((AnimatorPart)appManager.getPageDataSet().getBaseRootPart()).fireEvent(new AnimatorModelEvent(event, origin, model));
     }
 
     /**
@@ -65,7 +66,7 @@ public class EventManager implements EventFireDelegate {
      */
     public void fireEvent(EventType event, Origin origin, AnimatorModel model,
                           AnimatorProperty animatorProperty) {
-        rootPart.fireEvent(new AnimatorModelEvent(event, origin, model, animatorProperty));
+       ((AnimatorPart)appManager.getPageDataSet().getBaseRootPart()).fireEvent(new AnimatorModelEvent(event, origin, model, animatorProperty));
     }
 
     /**
index 3b5ea49..1cc5038 100644 (file)
@@ -95,11 +95,8 @@ public class AnimatorFileReader {
      * @param cssPath
      *            css file path
      */
-    public static void makeModelbyFile(Part rootPart, String jsPath, String cssPath) {
+    public static void makeModelbyFile(AnimatorModelManager manager, Part rootPart, String jsPath, String cssPath) {
         GsonBuilder gsonBuilder = new GsonBuilder();
-
-        AnimatorModelManager manager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
         
         AnimatorWidgetPartDeserializer widgetPartDeserializer = new AnimatorWidgetPartDeserializer();
         AnimatorAnimationDeserializer animatorAnimationDeserializer =
index 722c491..d3631ce 100644 (file)
@@ -289,8 +289,7 @@ public class AnimatorFileWriter {
         }
         
         try {
-               AnimatorModelManager manager =
-                    AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+               AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
             StringBuffer animationCssString = new StringBuffer(new String("".getBytes(), "utf-8"));// ask
                                                                                                    // why?
             for (Part part : rootPart.getChildren()) {
@@ -318,14 +317,12 @@ public class AnimatorFileWriter {
      * @param rootPart
      * @return
      */
-    public static String getOnePageAnimatorKeyFrameString(Part rootPart, Part pagePart) {
+    public static String getOnePageAnimatorKeyFrameString(AnimatorModelManager manager, Part rootPart, Part pagePart) {
         if(rootPart == null || pagePart == null){
             return null;
         }
         
         try {
-            AnimatorModelManager manager =
-                    AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
             StringBuffer animationCssString = new StringBuffer(new String("".getBytes(), "utf-8"));// ask
                                                                                                    // why?
             for (Part part : rootPart.getChildren()) {
index 770e57a..bdc09ca 100644 (file)
@@ -78,10 +78,9 @@ public class AnimatorPagePart extends AnimatorPart {
                return animation;
        }
 
-       public AnimatorAnimation createAnimatorAnimation(AnimatorModelFactory modelFactory, String animationId) {
+       public AnimatorAnimation createAnimatorAnimation(AnimatorModelFactory modelFactory) {
                AnimatorAnimation animationGroup = (AnimatorAnimation)modelFactory.createAnimatorModel(AnimatorModelType.ANIMATION);
-               animationGroup.setId(animationId);
-               animationGroup.setName(animationId);
+               animationGroup.setName(animationGroup.getId());
                animationGroup.setDuration("0s");
                animationGroup.setIteration(1);
                animationGroup.setRepeated(false);
@@ -114,9 +113,9 @@ public class AnimatorPagePart extends AnimatorPart {
      * @param isRepeated
      * @return
      */
-    public AnimatorAnimation createAnimation(String name, boolean autoPlay, int iteration,
+    public AnimatorAnimation createAnimation(AnimatorModelManager modelManager, String name, boolean autoPlay, int iteration,
                                          boolean isRepeated) {
-        AnimatorAnimation addedAnimation = (AnimatorAnimation) makeDefaultAnimatorModel();
+        AnimatorAnimation addedAnimation = (AnimatorAnimation) makeDefaultAnimatorModel(modelManager);
         if (name == null || name.trim().equals("")) {
             addedAnimation.setName(addedAnimation.getId());
         } else {
@@ -130,13 +129,11 @@ public class AnimatorPagePart extends AnimatorPart {
         return addedAnimation;
     }
     
-    private AnimatorModel makeDefaultAnimatorModel() {
+    private AnimatorModel makeDefaultAnimatorModel(AnimatorModelManager modelManager) {
         setTransition("none");
-        AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
-
         // Create AnimatorAnimation
         AnimatorAnimation animationGroup =
-                createAnimatorAnimation(modelManager.getModelFactory(), modelManager.idGenerator(AnimatorModelType.ANIMATION));
+                createAnimatorAnimation(modelManager.getModelFactory());
 
         List<AnimatorModel> makeAnimatorWidget =
                 animationGroup.composeAnimatorWidget(getChildren());
@@ -151,10 +148,8 @@ public class AnimatorPagePart extends AnimatorPart {
      * @param animation
      * @param origin
      */
-    public void addAnimation(AnimatorAnimation animation, Origin origin) {
+    public void addAnimation(AnimatorModelManager modelManager, AnimatorAnimation animation, Origin origin) {
         addAnimation(animation);
-
-        AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
         modelManager.fireEvent(EventType.ANIMATION_ADD, origin, animation);
     }
     
@@ -167,7 +162,7 @@ public class AnimatorPagePart extends AnimatorPart {
     public void removeAnimatoin(AnimatorAnimation animation, Origin origin) {
         removeAnimation(animation);
 
-        AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         modelManager.fireEvent(EventType.ANIMATION_REMOVE, origin, animation);
     }
     
@@ -194,7 +189,7 @@ public class AnimatorPagePart extends AnimatorPart {
         editAnimation.setIteration(iteration);
         editAnimation.setRepeated(repeated);
 
-        AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         modelManager.fireEvent(EventType.ANIMATION_EDIT, origin, editAnimation);
     }
     
@@ -249,7 +244,7 @@ public class AnimatorPagePart extends AnimatorPart {
             }
         }
 
-        AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         modelManager.fireEvent(currentAnimation, EventType.WIDGET_ADD, origin, null,
                               currentAnimationWidget);
         modelManager.fireEvent(EventType.WIDGET_ADD, origin, null);
@@ -274,7 +269,7 @@ public class AnimatorPagePart extends AnimatorPart {
                 currentAnimationWidget = widget;
         }
 
-        AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         modelManager.fireEvent(true, getCurrentAnimation(), EventType.WIDGET_REMOVE, origin,
                               currentAnimationWidget);
     }
@@ -323,7 +318,7 @@ public class AnimatorPagePart extends AnimatorPart {
                 animatorWidgets.add(animatorWidget);
         }
 
-        AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         modelManager
                 .fireEvent(currentAnimation, EventType.WIDGET_ADD, origin, null, animatorWidgets);
         modelManager.fireEvent(EventType.WIDGET_ADD, origin, null);
index 3ce6d77..2e09783 100644 (file)
@@ -42,6 +42,7 @@ import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
 import org.tizen.webuibuilder.bridge.DesignerGoingBridge.WidgetPosition;
 import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.model.PartEvent;
+import org.tizen.webuibuilder.model.app.AppManager;
 import org.tizen.webuibuilder.model.descriptors.PartDescriptor;
 
 import com.google.gson.annotations.Expose;
@@ -219,11 +220,11 @@ public class AnimatorPart extends Part {
      *
      * @return
      */
-       public List<AnimatorAnimation> createDefaultAnimations() {
+       public List<AnimatorAnimation> createDefaultAnimations(AnimatorModelManager animatorModelManager) {
                           
                List<AnimatorAnimation> animations = new ArrayList<AnimatorAnimation>();
                for (Part part : getChildren()) {
-                       animations.add(((AnimatorPagePart)part).createAnimation(null, true, 1, false));
+                       animations.add(((AnimatorPagePart)part).createAnimation(animatorModelManager, null, true, 1, false));
                }
                return animations;
        }
@@ -294,7 +295,7 @@ public class AnimatorPart extends Part {
     
     
     private AnimatorTrigger createAnimatorTrigger(String eventName) {
-       AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         
         AnimatorTrigger trigger = (AnimatorTrigger)modelManager.getModelFactory().createAnimatorModel(AnimatorModelType.TRIGGER);
 
index c72ed35..22c9a6f 100644 (file)
@@ -71,7 +71,7 @@ public class AnimatorWidgetPart extends AnimatorPart {
         Map<AnimatorModel, Integer> animatorWidgets = collectWillRemoveAnimatorWidget(this);
         List<AnimatorModel> widgets = deleteAnimatorWidget(animatorWidgets, currentAnimation);
 
-        AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         modelManager.fireEvent(currentAnimation, EventType.WIDGET_REMOVE, origin, null, widgets);
         modelManager.fireEvent(EventType.WIDGET_REMOVE, origin, null);
 
@@ -93,7 +93,7 @@ public class AnimatorWidgetPart extends AnimatorPart {
                 // temporary is not always need...
                 widget.setId(getPropertyValue("id"));
                 /*******************************/
-                AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+                AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
                 modelManager.fireEvent(widget, EventType.WIDGET_EDIT, Origin.PROPERTY, null);
             }
         }
index b108a0a..7993703 100644 (file)
@@ -233,8 +233,7 @@ public class TimelineViewer extends TreeViewer implements ISelectionChangedListe
 
                 // update timeline page when chnage page
                     AppManager appManager = AnimatorUtils.getAppManager();
-                    AnimatorModelManager modelManager =
-                            AnimatorModelManager.getInstance(appManager);
+                    AnimatorModelManager modelManager = appManager.getAnimatorModelManager();
                     AnimatorPagePart newPagePart =
                             (AnimatorPagePart) modelManager.getPagePart();
 
index 25fb877..1457a56 100644 (file)
@@ -64,13 +64,14 @@ public class TimelineAnimationGroupCreateCommand extends Command {
     public void execute() {
 
         if (animation == null) {
-            animation = pagePart.createAnimation(result.getName(),
+            animation = pagePart.createAnimation(AnimatorUtils.getAppManager().getAnimatorModelManager(), 
+                                                                                       result.getName(),
                                                                                        result.isAutoPlay(),
                                                                                        result.getIteration(),
                                                                                        result.isRepeated());
         }
 
-        pagePart.addAnimation(animation, Origin.TIMELINE);
+        pagePart.addAnimation(AnimatorUtils.getAppManager().getAnimatorModelManager(), animation, Origin.TIMELINE);
 
         String animationId = animation.getId();
         AnimatorUtils.getActiveAnimatorBrowserViewer()
@@ -95,8 +96,7 @@ public class TimelineAnimationGroupCreateCommand extends Command {
      */
     @Override
     public void undo() {
-        AnimatorModelManager manager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         AnimatorUtils.getActiveAnimatorBrowserViewer()
                 .setCurrentAnimationGroupId(currentAnimationGroupId, true);
         manager.decreaseId(AnimatorModelType.ANIMATION);
index b2f10a5..bab15f4 100644 (file)
@@ -153,7 +153,7 @@ public class TimelineAnimationGroupDeleteCommand extends Command {
     public void undo() {
         String animationGroupId = removeAnimation.getId();
 
-        pagePart.addAnimation(removeAnimation, AnimatorModelEvent.Origin.TIMELINE);
+        pagePart.addAnimation(AnimatorUtils.getAppManager().getAnimatorModelManager(), removeAnimation, AnimatorModelEvent.Origin.TIMELINE);
 
         outlineHeader.getAnimationGroupLabel().setText(removeAnimation.getName());
         outlineHeader.getAnimationGroupLabel().setData("id", removeAnimation.getId());
index f426836..1c6d40c 100644 (file)
@@ -66,8 +66,7 @@ public class TimelineFrameCreateCommand extends Command {
     @Override
     public void execute() {
        
-       AnimatorModelManager manager =
-              AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
        
        if(oldSelectors == null  || newSelectors == null) {
                
@@ -131,8 +130,7 @@ public class TimelineFrameCreateCommand extends Command {
      */
     @Override
     public void undo() {
-        AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         
         for(AnimatorModel model : currentSelectors) {
                AnimatorSelector currentSelector = (AnimatorSelector)model;
index 121a83c..bd7ae9b 100644 (file)
@@ -82,8 +82,7 @@ public class TimelineFrameDeleteCommand extends Command {
      */
     @Override
     public void execute() {
-        AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
        
        if(oldSelector == null  || oldSelector == null) {
                oldSelector = currentSelector.cloneAnimatorSelector();
@@ -150,8 +149,7 @@ public class TimelineFrameDeleteCommand extends Command {
     @Override
     public void undo() {
        
-       AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         currentSelector.replaceAll(oldSelector);
         
        animatorModelManager.fireEvent(true, currentSelector,
index 718b692..ec8e730 100644 (file)
@@ -65,8 +65,7 @@ public class TimelineFrameEditCommand extends Command {
      */
     @Override
     public void execute() {
-       AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
        
        if(oldSelector == null  || oldSelector == null) {
                oldSelector = currentSelector.cloneAnimatorSelector();
@@ -118,8 +117,7 @@ public class TimelineFrameEditCommand extends Command {
      */
     @Override
     public void undo() {
-       AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         currentSelector.replaceAll(oldSelector);
         
        animatorModelManager.fireEvent(true, currentSelector,
index ecd512f..37f25d2 100644 (file)
@@ -59,8 +59,7 @@ public class TimelineKeyframeDeleteCommand extends Command {
     @Override
     public void execute() {
        
-       AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
        
        if(newSelector == null || oldSelector == null) {
                oldSelector = currentSelector.cloneAnimatorSelector();
@@ -105,8 +104,7 @@ public class TimelineKeyframeDeleteCommand extends Command {
     @Override
     public void undo() {
        
-       AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+       AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         currentSelector.replaceAll(oldSelector);
         
        animatorModelManager.fireEvent(true, currentSelector,
index 88afc54..2ce31a9 100644 (file)
@@ -72,8 +72,7 @@ public class TimelineKeyframeEditCommand extends Command {
      */
     @Override
     public void execute() {
-        AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         
         if(newSelector == null || oldSelector == null) {
                oldSelector = currentSelector.cloneAnimatorSelector();
@@ -123,8 +122,7 @@ public class TimelineKeyframeEditCommand extends Command {
     @Override
     public void undo() {
 
-        AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         currentSelector.replaceAll(oldSelector);
         
        animatorModelManager.fireEvent(true, currentSelector,
index 09dfc82..fa74073 100644 (file)
@@ -689,8 +689,7 @@ public class TimelineEditPart extends AbstractTreeEditPart {
 
                     viewer.select(TimelineEditPart.this);
 
-                    AnimatorModelManager manager =
-                            AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+                    AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
                     manager.fireEvent(AnimatorModelEvent.EventType.SELECTION_CHANGE,
                                       AnimatorModelEvent.Origin.TIMELINE, model);
 
@@ -1000,8 +999,7 @@ public class TimelineEditPart extends AbstractTreeEditPart {
                 /**********************************
                  * Change selection
                  *********************************/
-                AnimatorModelManager manager =
-                        AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+                AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
                 manager.fireEvent(AnimatorModelEvent.EventType.SELECTION_CHANGE,
                                   AnimatorModelEvent.Origin.TIMELINE, model);
 
index 0a4cffa..63ca28a 100644 (file)
@@ -193,8 +193,7 @@ public class DeletePartCommand extends Command {
      */
     @Override
     public void undo() {
-        AnimatorModelManager animatorModelManager =
-                AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+        AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
 
         for (int i = deletedGroup.size() - 1; i > -1; i--) {
             // Adds parts.
index baf67a7..d5f2a24 100644 (file)
@@ -546,7 +546,7 @@ public class AppManagerForHTML extends AppManager {
 //        AnimatorModelManager modelManager = this.getAnimatorModelManager();
 //        Part aniRootPart = modelManager.getRootPart();
         Part aniRootPart = getPageDataSet().getBaseRootPart();
-        String animatorCss = AnimatorFileWriter.getOnePageAnimatorKeyFrameString(aniRootPart, getPageData(index).getPagePart());
+        String animatorCss = AnimatorFileWriter.getOnePageAnimatorKeyFrameString(getAnimatorModelManager(), aniRootPart, getPageData(index).getPagePart());
         String animatorJs =
                        AnimatorFileWriter.getOneAnimationGroupModelString(getPageData(index).getName(),
                                                               animationGroupId, this, aniRootPart);
index c5fb357..ded1ae5 100644 (file)
@@ -1010,9 +1010,6 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
         }
 
         if (type == TimelinePage.class) {
-            AnimatorModelManager animatorModelManager =
-                    AnimatorModelManager.getInstance(appManager);
-            animatorModelManager.initialize(rootPart);
             if (timelinePage == null) {
                 timelinePage =
                         new TimelinePage(editDomain, rootPart, pageData.getPagePart(),
@@ -1092,15 +1089,13 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
 
                         Part model = (Part) part.getModel();
                         if (model.isPagePart()) {
-                            AnimatorModelManager modelManager =
-                                    AnimatorModelManager.getInstance(appManager);
+                            AnimatorModelManager modelManager = appManager.getAnimatorModelManager();
                             modelManager.setPagePart((AnimatorPagePart) model);
                         } else {
                             Part parentPart = model.getParent();
                             while (parentPart != null) {
                                 if (parentPart.isPagePart()) {
-                                    AnimatorModelManager modelManager =
-                                            AnimatorModelManager.getInstance(appManager);
+                                    AnimatorModelManager modelManager = appManager.getAnimatorModelManager();
                                     modelManager.setPagePart((AnimatorPagePart) parentPart);
                                     break;
                                 }
@@ -1355,24 +1350,23 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
     }
 
     public void bindingAnimatorModel(Part rootPart) {
-        AnimatorModelManager animatorModelManager = AnimatorModelManager.getInstance(appManager);
+        AnimatorModelManager animatorModelManager = new AnimatorModelManager(appManager);
+        appManager.setAnimatorModelManager(animatorModelManager);
 
         String animatorModelJsFile = AnimatorUtils.getFilePath(project, AnimatorConstants.JS_FILE);
         String animatorModelCssFile =
                 AnimatorUtils.getFilePath(project, AnimatorConstants.CSS_FILE);
 
-        animatorModelManager.initialize(appManager, rootPart);
-
         boolean isExist = AnimatorFileReader.isExistModelFile(animatorModelJsFile);
         if (isExist) {
-            AnimatorFileReader.makeModelbyFile(rootPart, animatorModelJsFile, animatorModelCssFile);
+            AnimatorFileReader.makeModelbyFile(animatorModelManager, rootPart, animatorModelJsFile, animatorModelCssFile);
         } else {
             List<AnimatorAnimation> animations =
-                    ((AnimatorPart) rootPart).createDefaultAnimations();
+                    ((AnimatorPart) rootPart).createDefaultAnimations(animatorModelManager);
             for (Part part : rootPart.getChildren()) {
                 for (AnimatorAnimation animation : animations) {
                     if (part.equals(animation.getPartLink())) {
-                        ((AnimatorPagePart) part).addAnimation(animation, Origin.EDITOR);
+                        ((AnimatorPagePart) part).addAnimation(animatorModelManager, animation, Origin.EDITOR);
                     }
                 }
             }
index 088c561..06573ed 100644 (file)
@@ -43,6 +43,7 @@ import org.tizen.webuibuilder.BuilderConstants;
 import org.tizen.webuibuilder.animator.gef.viewer.AnimatorBrowserViewer;
 import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
 import org.tizen.webuibuilder.animator.model.io.AnimatorFileWriter;
+import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
 import org.tizen.webuibuilder.animator.model.part.AnimatorPartFactory;
 import org.tizen.webuibuilder.gef.viewer.HoverBrowserViewer;
 import org.tizen.webuibuilder.model.app.AppManagerForHTML;
@@ -250,9 +251,9 @@ public class PageDesignerForHTML extends PageDesigner implements ITextEditorList
         ((HoverBrowserViewer) viewer).updateStyle();
         ((HoverBrowserViewer) viewer).getRootEditPart().refresh();
 
-        AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager);
+        AnimatorModelManager manager = appManager.getAnimatorModelManager();
         manager.updateAnimatorModel(getRootPart());
-        manager.setRootPart(getRootPart());
+        manager.setPagePart((AnimatorPagePart)getRootPart().getChildren().get(0));
 
         AnimatorBrowserViewer animatorViewer = getAnimatorViewer();
         if (animatorViewer != null) {
index 2e027f1..3891ab9 100644 (file)
@@ -402,7 +402,7 @@ public class ActionAnimationGroupComposite extends Composite implements IActionA
     private void setPageInfoToComboItem(Combo combo) {
 
         if (manager == null) {
-            manager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+            manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         }
 
         Part pagePart = (Part) manager.getPagePart();
index 781c946..7393067 100644 (file)
@@ -1437,7 +1437,7 @@ public class CssStyleTab extends PropertiesTabItem implements IPageDataListener
      */
     public AnimatorSelector getAnimatorSelector() {
         if (animatorModelManager == null) {
-            animatorModelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+            animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
         }
 
         Part tempPart = getModel();