Change AnimatorModelManager to dynamic instance from static and referenced by AppManager
Change-Id: I478305372567059ac3ce8369acdf9b92deeea176
Signed-off-by: seongwon.shim <seongwon.shim@samsung.com>
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;
/**
*/
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;
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;
*/
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;
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;
*/
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;
}
}
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
if (preparedTrigger == null) {
preparedTrigger = (AnimatorTrigger)animatorModelManager.getModelFactory().createAnimatorModel(AnimatorModelType.TRIGGER);
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);
*/
@Override
public void execute() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
if(oldSelector == null || newSelector == null) {
oldSelector = currentSelector.cloneAnimatorSelector();
@Override
public void undo() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
currentSelector.replaceAll(oldSelector);
animatorModelManager.fireEvent(true, currentSelector,
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;
/**
@Override
public void execute() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(appManager);
+ AnimatorModelManager animatorModelManager = appManager.getAnimatorModelManager();
if(newSelector == null || oldSelector == null) {
oldSelector = currentSelector.cloneAnimatorSelector();
*/
@Override
public void undo() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(appManager);
+ AnimatorModelManager animatorModelManager = appManager.getAnimatorModelManager();
currentSelector.replaceAll(oldSelector);
animatorModelManager.fireEvent(true, currentSelector,
*/
@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,
*/
@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,
*/
@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,
*/
@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,
public void execute() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
currentSelector = getModel().getSelector();
if(currentSelector != null) {
public void undo() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
currentSelector.replaceAll(oldSelector);
animatorModelManager.fireEvent(true, currentSelector,
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();
public void undo() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
currentSelector.replaceAll(oldSelector);
animatorModelManager.fireEvent(true, currentSelector,
@Override
public void execute() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
if(newSelector == null || oldSelector == null) {
oldSelector = currentSelector.cloneAnimatorSelector();
@Override
public void undo() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
currentSelector.replaceAll(oldSelector);
animatorModelManager.fireEvent(true, currentSelector,
appManager
.getPageDataSet()
.getBaseRootPart()),
- AnimatorFileWriter.getOnePageAnimatorKeyFrameString(appManager
- .getPageDataSet().getBaseRootPart(), appManager
+ AnimatorFileWriter.getOnePageAnimatorKeyFrameString(appManager.getAnimatorModelManager(),
+ appManager.getPageDataSet().getBaseRootPart(), appManager
.getPageData(appManager.getPageIndex(pageData))
.getPagePart()));
}
getGoingBridge()
.aniBridge_setAnimationCss(AnimatorFileWriter
- .getOnePageAnimatorKeyFrameString(appManager
+ .getOnePageAnimatorKeyFrameString(appManager.getAnimatorModelManager(),
+ appManager
.getPageDataSet()
.getBaseRootPart(),
appManager
}
private void fireModelChangeEvent(AnimatorFrame frame, boolean isEditCurve) {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
frame.setPartLink(selector.getPartLink());
*
* @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()) {
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;
*/
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);
+
}
}
/**
- * 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
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) {
* @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()) {
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));
}
}
}
*/
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");
*/
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;
AppManager appManager = pageDesigner.getAppManager();
if (appManager != this.appManager) {
this.appManager = appManager;
- this.rootPart = pageDesigner.getRootPart();
- // clearIds();
- initMaxIds(this.rootPart);
}
}
}
/*
* Animation Model
*/
- addedPagePart.addAnimation(addedPagePart.createAnimation(null, true,
+ addedPagePart.addAnimation(addedPagePart.createAnimation(this, null, true,
1, false));
}
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;
public void removeChild(AnimatorModel child) {
super.removeChild(child);
- AnimatorModelManager modelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
modelManager.removeAnimatorRelatedResources();
}
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
* @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));
}
/**
*/
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));
}
/**
* @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 =
}
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()) {
* @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()) {
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);
* @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 {
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());
* @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);
}
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);
}
editAnimation.setIteration(iteration);
editAnimation.setRepeated(repeated);
- AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
modelManager.fireEvent(EventType.ANIMATION_EDIT, origin, editAnimation);
}
}
}
- 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);
currentAnimationWidget = widget;
}
- AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
modelManager.fireEvent(true, getCurrentAnimation(), EventType.WIDGET_REMOVE, origin,
currentAnimationWidget);
}
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);
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;
*
* @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;
}
private AnimatorTrigger createAnimatorTrigger(String eventName) {
- AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager modelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
AnimatorTrigger trigger = (AnimatorTrigger)modelManager.getModelFactory().createAnimatorModel(AnimatorModelType.TRIGGER);
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);
// 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);
}
}
// update timeline page when chnage page
AppManager appManager = AnimatorUtils.getAppManager();
- AnimatorModelManager modelManager =
- AnimatorModelManager.getInstance(appManager);
+ AnimatorModelManager modelManager = appManager.getAnimatorModelManager();
AnimatorPagePart newPagePart =
(AnimatorPagePart) modelManager.getPagePart();
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()
*/
@Override
public void undo() {
- AnimatorModelManager manager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
AnimatorUtils.getActiveAnimatorBrowserViewer()
.setCurrentAnimationGroupId(currentAnimationGroupId, true);
manager.decreaseId(AnimatorModelType.ANIMATION);
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());
@Override
public void execute() {
- AnimatorModelManager manager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
if(oldSelectors == null || newSelectors == null) {
*/
@Override
public void undo() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
for(AnimatorModel model : currentSelectors) {
AnimatorSelector currentSelector = (AnimatorSelector)model;
*/
@Override
public void execute() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
if(oldSelector == null || oldSelector == null) {
oldSelector = currentSelector.cloneAnimatorSelector();
@Override
public void undo() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
currentSelector.replaceAll(oldSelector);
animatorModelManager.fireEvent(true, currentSelector,
*/
@Override
public void execute() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
if(oldSelector == null || oldSelector == null) {
oldSelector = currentSelector.cloneAnimatorSelector();
*/
@Override
public void undo() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
currentSelector.replaceAll(oldSelector);
animatorModelManager.fireEvent(true, currentSelector,
@Override
public void execute() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
if(newSelector == null || oldSelector == null) {
oldSelector = currentSelector.cloneAnimatorSelector();
@Override
public void undo() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
currentSelector.replaceAll(oldSelector);
animatorModelManager.fireEvent(true, currentSelector,
*/
@Override
public void execute() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
if(newSelector == null || oldSelector == null) {
oldSelector = currentSelector.cloneAnimatorSelector();
@Override
public void undo() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
currentSelector.replaceAll(oldSelector);
animatorModelManager.fireEvent(true, currentSelector,
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);
/**********************************
* Change selection
*********************************/
- AnimatorModelManager manager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
manager.fireEvent(AnimatorModelEvent.EventType.SELECTION_CHANGE,
AnimatorModelEvent.Origin.TIMELINE, model);
*/
@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.
// 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);
}
if (type == TimelinePage.class) {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(appManager);
- animatorModelManager.initialize(rootPart);
if (timelinePage == null) {
timelinePage =
new TimelinePage(editDomain, rootPart, pageData.getPagePart(),
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;
}
}
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);
}
}
}
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;
((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) {
private void setPageInfoToComboItem(Combo combo) {
if (manager == null) {
- manager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
}
Part pagePart = (Part) manager.getPagePart();
*/
public AnimatorSelector getAnimatorSelector() {
if (animatorModelManager == null) {
- animatorModelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ animatorModelManager = AnimatorUtils.getAppManager().getAnimatorModelManager();
}
Part tempPart = getModel();