import org.tizen.webuibuilder.animator.gef.command.AnimationCreateAndChangeFrameCommand;
import org.tizen.webuibuilder.animator.gef.editparts.AnimatorEditPart;
import org.tizen.webuibuilder.animator.model.AnimatorModelEvent;
-import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
import org.tizen.webuibuilder.animator.model.AnimatorSelector;
+import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
import org.tizen.webuibuilder.animator.model.part.AnimatorPart;
+import org.tizen.webuibuilder.animator.model.part.AnimatorWidgetPart;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
import org.tizen.webuibuilder.model.Part;
} else if (part.getPositionMode() == Part.PositionMode.RELATIVE_POSITION) {
left = part.getAniPosition().x + delta.x - originalRect.x;
top = part.getAniPosition().y + delta.y - originalRect.y;
- }
-
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ }
+
+ AnimatorPagePart pagePart = (AnimatorPagePart)part.getOwnerPage();
+
String animationGroupId =
AnimatorUtils.getActiveAnimatorBrowserViewer().getCurrentAnimationGroupId();
-
- AnimatorSelector selector =
- animatorModelManager.findAnimatorSelector(animationGroupId, part,
- part.getUiSelector());
+
+ AnimatorSelector selector =
+ pagePart.findAnimatorSelector(animationGroupId, part.getUiSelector());
double currentTime = AnimatorUtils.getActiveAnimatorBrowserViewer().getPointTime();
import org.tizen.webuibuilder.animator.model.AnimatorModelEvent;
import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
import org.tizen.webuibuilder.animator.model.AnimatorWidget;
+import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
import org.tizen.webuibuilder.gef.editparts.DesignerEditPart;
import org.tizen.webuibuilder.model.Part;
@Override
protected boolean calculateEnabled() {
List<Object> selectedList = getSelectedObjects();
- AnimatorModelManager animatorModelManager = AnimatorModelManager
- .getInstance(AnimatorUtils.getAppManager());
if (AnimatorUtils.getActiveAnimatorBrowserViewer() == null) {
return true;
if (model instanceof Part) {
Part part = (Part) model;
if (!part.isDocumentPart()) {
- AnimatorWidget animatorWidget = animatorModelManager
- .findAnimatorWidget(AnimatorUtils
+
+ AnimatorPagePart pagePart = (AnimatorPagePart)part.getOwnerPage();
+ AnimatorWidget animatorWidget = pagePart.
+ findAnimatorWidget(AnimatorUtils
.getActiveAnimatorBrowserViewer()
.getCurrentAnimationGroupId(),
((Part) ((DesignerEditPart) editPart)
@Override
public void run() {
List<Object> selectedList = getSelectedObjects();
- AnimatorModelManager animatorModelManager = AnimatorModelManager
- .getInstance(AnimatorUtils.getAppManager());
CompoundCommand compoundCommand = new CompoundCommand();
for (int i = 0; i < selectedList.size(); i++) {
DesignerEditPart editPart = (DesignerEditPart) selectedList.get(i);
- AnimatorWidget animatorWidget = animatorModelManager
+ Part part = (Part)editPart.getModel();
+ AnimatorPagePart pagePart = (AnimatorPagePart)part.getOwnerPage();
+
+ AnimatorWidget animatorWidget = pagePart
.findAnimatorWidget(AnimatorUtils
.getActiveAnimatorBrowserViewer()
- .getCurrentAnimationGroupId(), ((Part) editPart
- .getModel()).getIdPropertyValue());
+ .getCurrentAnimationGroupId(), part.getIdPropertyValue());
Command lockCommand = null;
if (getText().equals(AnimatorConstants.ANIMATOR_MENU_LOCK)) {
import org.tizen.webuibuilder.animator.AnimatorConstants;
import org.tizen.webuibuilder.animator.gef.command.AnimationMakeInvisibleCommand;
import org.tizen.webuibuilder.animator.model.AnimatorModelEvent;
-import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
import org.tizen.webuibuilder.animator.model.AnimatorWidget;
+import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
import org.tizen.webuibuilder.gef.editparts.DesignerEditPart;
import org.tizen.webuibuilder.model.Part;
@Override
public void run() {
List<Object> selectedList = getSelectedObjects();
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
CompoundCommand compoundCommand = new CompoundCommand();
for (int i = 0; i < selectedList.size(); i++) {
DesignerEditPart editPart = (DesignerEditPart) selectedList.get(i);
+ Part part = (Part)editPart.getModel();
+ AnimatorPagePart pagePart = (AnimatorPagePart)part.getOwnerPage();
AnimatorWidget animatorWidget =
- animatorModelManager
+ pagePart
.findAnimatorWidget(AnimatorUtils.getActiveAnimatorBrowserViewer()
- .getCurrentAnimationGroupId(), ((Part) editPart.getModel())
+ .getCurrentAnimationGroupId(), part
.getIdPropertyValue());
Command visibleCommand = null;
*/
@Override
public void execute() {
- AnimatorModelManager animatorModelManager = AnimatorModelManager.getInstance(appManager);
- AnimatorTrigger trigger = animatorModelManager.getAnimatorTrigger(eventName, selelectModel);
+ AnimatorTrigger trigger = selelectModel.getAnimatorTrigger(eventName);
actionAnimation = (AnimatorActionAnimation) trigger.removeChild(selectBarIndex);
if (trigger.getChildrenSize() == 0)
*/
@Override
public void undo() {
- AnimatorModelManager animatorModelManager = AnimatorModelManager.getInstance(appManager);
- AnimatorTrigger trigger = animatorModelManager.getAnimatorTrigger(eventName, selelectModel);
+ AnimatorTrigger trigger = selelectModel.getAnimatorTrigger(eventName);
trigger.addChild(selectBarIndex, actionAnimation);
}
}
\ No newline at end of file
import org.tizen.webuibuilder.animator.model.AnimatorActionAnimation;
import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
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;
@Override
public void execute() {
- AnimatorModelManager animatorModelManager = AnimatorModelManager.getInstance(appManager);
- AnimatorTrigger trigger = animatorModelManager.getAnimatorTrigger(eventName, selelectModel);
+ AnimatorTrigger trigger = selelectModel.getAnimatorTrigger(eventName);
+ AnimatorPagePart pagePart = (AnimatorPagePart)selelectModel.getOwnerPage();
beforeActionAnimation = (AnimatorActionAnimation) trigger.getChild(selectBarIndex);
if (afterActionAnimation == null) {
afterActionAnimation =
- animatorModelManager
+ pagePart
.createAnimatorActionAnimation(groupId,
convertActionAnimationGroupTypes(type),
time, trigger);
*/
@Override
public void undo() {
-
- AnimatorModelManager animatorModelManager = AnimatorModelManager.getInstance(appManager);
- AnimatorTrigger trigger = animatorModelManager.getAnimatorTrigger(eventName, selelectModel);
+ AnimatorTrigger trigger = selelectModel.getAnimatorTrigger(eventName);
trigger.removeChild(afterActionAnimation);
trigger.addChild(selectBarIndex, beforeActionAnimation);
import org.tizen.webuibuilder.animator.model.AnimatorActionAnimation;
import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
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;
*/
@Override
public void execute() {
- AnimatorModelManager animatorModelManager = AnimatorModelManager.getInstance(appManager);
- AnimatorTrigger trigger = animatorModelManager.getAnimatorTrigger(eventName, selelectModel);
+ AnimatorTrigger trigger = selelectModel.getAnimatorTrigger(eventName);
+ AnimatorPagePart pagePart = (AnimatorPagePart)selelectModel.getOwnerPage();
if (actionAnimation == null) {
actionAnimation =
- animatorModelManager
+ pagePart
.createAnimatorActionAnimation(groupId,
convertActionAnimationGroupTypes(type),
time, trigger);
*/
@Override
public void undo() {
- AnimatorModelManager animatorModelManager = AnimatorModelManager.getInstance(appManager);
- AnimatorTrigger trigger = animatorModelManager.getAnimatorTrigger(eventName, selelectModel);
+ AnimatorTrigger trigger = selelectModel.getAnimatorTrigger(eventName);
trigger.removeChild(actionAnimation);
}
import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
import org.tizen.webuibuilder.animator.model.AnimatorSelector;
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;
if (originObject instanceof PageDesigner) {
AnimatorModelManager animatorModelManager =
AnimatorModelManager.getInstance(appManager);
- AnimatorSelector animatorSelector =
- animatorModelManager.findAnimatorSelector(animationGroupId, target.getPropertyValue("id"), selector);
+ AnimatorPagePart pagePart = (AnimatorPagePart)target.getOwnerPage();
+ AnimatorSelector animatorSelector = pagePart.
+ findAnimatorSelector(animationGroupId, target.getPropertyValue("id"), selector);
if (animatorSelector != null) {
if(names == null) {
animatorModelManager.removeAnimatorFrames(frames, preDefinedAnimationDescriptor
.getDisplayName(), origin);
+ AnimatorPagePart pagePart = (AnimatorPagePart)target.getOwnerPage();
AnimatorSelector animatorSelector =
- animatorModelManager.findAnimatorSelector(animationGroupId, target.getPropertyValue("id"), selector);
+ pagePart.findAnimatorSelector(animationGroupId, target.getPropertyValue("id"), selector);
+
if(animatorSelector != null) {
animatorSelector.setKeyframeNames(names);
}
import org.tizen.webuibuilder.animator.model.AnimatorModelListenerAdapter;
import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
import org.tizen.webuibuilder.animator.model.AnimatorSelector;
+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.gef.editparts.HoverViewerEditPart;
if (editpart != null) {
Part part = (Part) getModel();
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorPagePart pagePart = (AnimatorPagePart)part.getOwnerPage();
AnimatorSelector selector =
- animatorModelManager
- .findAnimatorSelector(AnimatorUtils.getActiveAnimatorBrowserViewer()
- .getCurrentAnimationGroupId(), part, part.getUiSelector());
+ pagePart.findAnimatorSelector(AnimatorUtils.getActiveAnimatorBrowserViewer()
+ .getCurrentAnimationGroupId(), part.getUiSelector());
AnimationPathModel test = new AnimationPathModel(selector);
editpart.setModel(test);
public void refreshModel() {
if (editpart != null) {
Part part = (Part) getModel();
-
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorPagePart pagePart = (AnimatorPagePart)part.getOwnerPage();
AnimatorSelector selector =
- animatorModelManager
- .findAnimatorSelector(AnimatorUtils.getActiveAnimatorBrowserViewer()
- .getCurrentAnimationGroupId(), part, part.getUiSelector());
-
+ pagePart.findAnimatorSelector(AnimatorUtils.getActiveAnimatorBrowserViewer()
+ .getCurrentAnimationGroupId(), part.getUiSelector());
+
AnimationPathModel test = new AnimationPathModel(selector);
editpart.setModel(test);
editpart.refresh();
import org.tizen.webuibuilder.animator.model.AnimatorModelEvent;
import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
import org.tizen.webuibuilder.animator.model.AnimatorSelector;
+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.gef.figure.PolygonBorder;
top = layout.y - originalRect.y;
}
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
String animationGroupId =
AnimatorUtils.getActiveAnimatorBrowserViewer().getCurrentAnimationGroupId();
-
+
+ AnimatorPagePart pagePart = (AnimatorPagePart)part.getOwnerPage();
AnimatorSelector selector =
- animatorModelManager.findAnimatorSelector(animationGroupId, part,
- part.getUiSelector());
+ pagePart.findAnimatorSelector(animationGroupId, part.getUiSelector());
double currentTime = AnimatorUtils.getActiveAnimatorBrowserViewer().getPointTime();
AnimatorPart part = (AnimatorPart) (getHost().getModel());
Rectangle rect = new Rectangle(part.getAniPosition());
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
String animationGroupId =
AnimatorUtils.getActiveAnimatorBrowserViewer().getCurrentAnimationGroupId();
-
+
+ AnimatorPagePart pagePart = (AnimatorPagePart)part.getOwnerPage();
AnimatorSelector selector =
- animatorModelManager.findAnimatorSelector(animationGroupId, part,
- part.getUiSelector());
+ pagePart.findAnimatorSelector(animationGroupId, part.getUiSelector());
+
double currentTime = AnimatorUtils.getActiveAnimatorBrowserViewer().getPointTime();
Map<String, String> properties = new HashMap<String, String>();
package org.tizen.webuibuilder.animator.model;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
return animatorWidgets;
}
+
+ public List<AnimatorModel> createAnimatorWidgetsForWidget(Part child) {
+
+ List<AnimatorModel> widgetList = new ArrayList<AnimatorModel>();
+ AnimatorWidget animatorWidget = createAnimatorWidget(child);
+ widgetList.add(animatorWidget);
+
+ for (Part part : child.getChildren()) {
+ widgetList.addAll(createAnimatorWidgetsForWidget(part));
+ }
+
+ return widgetList;
+ }
}
\ No newline at end of file
import java.util.ArrayList;
import java.util.Iterator;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
}
/******************************************************************************************************************
- * Interface for command(about Animation)
- ******************************************************************************************************************/
- /**
- * Create Default animation group Create AnimatorWidget by current widget state
- *
- * @param rootPart
- * @return
- */
- public List<AnimatorModel> createDefaultAnimations(Part rootPart) {
- List<AnimatorModel> animations = new ArrayList<AnimatorModel>();
- for (Part part : rootPart.getChildren()) {
- animations.add(createAnimation(part, null, true, 1, false));
- }
- return animations;
- }
-
- /**
- * Create animation group
- *
- * @param part
- * @param name
- * @param autoPlay
- * @param iteration
- * @param isRepeated
- * @return
- */
- public AnimatorModel createAnimation(Part part, String name, boolean autoPlay, int iteration,
- boolean isRepeated) {
- AnimatorAnimation addedAnimation = (AnimatorAnimation) makeDefaultAnimatorModel(part);
- if (name == null || name.trim().equals("")) {
- addedAnimation.setName(addedAnimation.getId());
- } else {
- addedAnimation.setName(name);
- }
-
- addedAnimation.setJustPlay(autoPlay);
- addedAnimation.setIteration(iteration);
- addedAnimation.setRepeated(isRepeated);
-
- return addedAnimation;
- }
-
- /**
- * Add animation to pagePart
- *
- * @param animation
- * @param origin
- */
- public void addAnimation(AnimatorAnimation animation, Origin origin) {
- AnimatorPagePart pagePart = (AnimatorPagePart) animation.getPartLink();
- pagePart.addAnimation(animation);
-
- eventSource.fireEvent(EventType.ANIMATION_ADD, origin, animation);
- }
-
- /**
- * Remove animation from pagePart
- *
- * @param animation
- * @param origin
- */
- public void removeAnimatoin(AnimatorAnimation animation, Origin origin) {
- AnimatorPagePart pagePart = (AnimatorPagePart) getPagePart();
- pagePart.removeAnimation(animation);
-
- eventSource.fireEvent(EventType.ANIMATION_REMOVE, origin, animation);
- }
-
- /**
- * Edit animation Can be changed autoplay, iteration, repeated
- *
- * @param editAnimation
- * @param name
- * @param autoPlay
- * @param iteration
- * @param repeated
- * @param origin
- */
- public void editAnimation(AnimatorAnimation editAnimation, String name, boolean autoPlay,
- int iteration, boolean repeated, Origin origin) {
-
- if (name == null || name.trim().equals("")) {
- editAnimation.setName(editAnimation.getId());
- } else {
- editAnimation.setName(name);
- }
-
- editAnimation.setJustPlay(autoPlay);
- editAnimation.setIteration(iteration);
- editAnimation.setRepeated(repeated);
-
- eventSource.fireEvent(EventType.ANIMATION_EDIT, origin, editAnimation);
- }
-
- /******************************************************************************************************************
* Interface for command(about Widget)
******************************************************************************************************************/
- /**
- * Create AnimatorWidgets for all animation group
- *
- * @param child
- * @return
- */
- public List<AnimatorModel> createAnimatorWidgetsForAllAnimations(Part child) {
- List<AnimatorModel> widgetList = new ArrayList<AnimatorModel>();
- AnimatorPagePart pagePart = (AnimatorPagePart) getPagePart();
- for (AnimatorAnimation animation : pagePart.getAnimations())
- widgetList.addAll(createAnimatorWidgetsForWidget(child, animation));
-
- return widgetList;
- }
-
- /**
- * Create AnimatorWidgets for all animation group
- *
- * @param clonedParts
- * @return
- */
- public List<AnimatorModel> createAnimatorWidgetsForAllAnimations(List<Part> clonedParts) {
- List<AnimatorModel> widgetList = new ArrayList<AnimatorModel>();
- AnimatorPagePart pagePart = (AnimatorPagePart) getPagePart();
- for (AnimatorAnimation animation : pagePart.getAnimations()) {
-
- for (Part part : clonedParts)
- widgetList.addAll(createAnimatorWidgetsForWidget(part, animation));
- }
-
- return widgetList;
- }
-
- /**
- * Add AnimatorWidgtes to animation group
- *
- * @param animatorWidgets
- * @param origin
- */
- public void addAnimatorWidgets(List<AnimatorModel> animatorWidgets, Origin origin) {
- List<AnimatorModel> currentAnimationWidget = new ArrayList<AnimatorModel>();
- AnimatorAnimation currentAnimation = getCurrentAnimation();
- for (AnimatorModel model : animatorWidgets) {
- AnimatorWidget widget = (AnimatorWidget) model;
- AnimatorAnimation animation = (AnimatorAnimation) widget.getParent();
- animation.addChild(widget);
-
- if (currentAnimation != null) {
- if (animation.equals(currentAnimation))
- currentAnimationWidget.add(widget);
- }
- }
- eventSource.fireEvent(currentAnimation, EventType.WIDGET_ADD, origin, null,
- currentAnimationWidget);
- eventSource.fireEvent(EventType.WIDGET_ADD, origin, null);
- }
/**
* Add AnimatorWidgtes to animation group
eventSource.fireEvent(EventType.WIDGET_ADD, origin, null);
}
- /**
- * Remove AnimatorWidgtes from animation group
- *
- * @param animatorWidgets
- * @param origin
- */
- public void removeAnimatorWidgets(List<AnimatorModel> animatorWidgets, Origin origin) {
- AnimatorModel currentAnimationWidget = null;
- AnimatorAnimation currentAnimation = getCurrentAnimation();
-
- for (AnimatorModel model : animatorWidgets) {
- AnimatorWidget widget = (AnimatorWidget) model;
- AnimatorAnimation animation = (AnimatorAnimation) widget.getParent();
- animation.removeChild(widget);
-
- if (animation.equals(currentAnimation))
- currentAnimationWidget = widget;
- }
-
- eventSource.fireEvent(true, getCurrentAnimation(), EventType.WIDGET_REMOVE, origin,
- currentAnimationWidget);
- }
-
- /**
- * Remove AnimatorWidgtes from animation group
- *
- * @param child
- * @param origin
- * @return
- */
- public Map<AnimatorModel, Integer> removeAnimatorWidgets(Part child, Origin origin) {
- AnimatorAnimation currentAnimation = getCurrentAnimation();
- Map<AnimatorModel, Integer> animatorWidgets = collectWillRemoveAnimatorWidget(child);
- List<AnimatorModel> widgets = deleteAnimatorWidget(animatorWidgets, currentAnimation);
-
- eventSource.fireEvent(currentAnimation, EventType.WIDGET_REMOVE, origin, null, widgets);
- eventSource.fireEvent(EventType.WIDGET_REMOVE, origin, null);
-
- return animatorWidgets;
- }
/******************************************************************************************************************
* Interface for command(about Frame)
return animation;
}
- /**
- * Search animatorWidget by animation id and widget id and return AnimatorWidget
- *
- * @param animationId
- * @param widgetId
- * @return
- */
- public AnimatorWidget findAnimatorWidget(String animationId, String widgetId) {
- AnimatorWidget animatorWidget = null;
-
- AnimatorPagePart pagePart = (AnimatorPagePart) getPagePart();
- AnimatorAnimation animation = pagePart.getAnimation(animationId);
- if (animation != null) {
- animatorWidget = (AnimatorWidget) animation.getChild(widgetId);
- }
-
- return animatorWidget;
- }
-
- /**
- * Search AnimatorSelector by animation id, widget id and selector and return AnimatorSelector
- *
- * @param animationId
- * @param part
- * @param selector
- * @return
- */
- public AnimatorSelector findAnimatorSelector(String animationId, Part part, String selector) {
- return findAnimatorSelector(animationId, part.getPropertyValue("id"), selector);
- }
-
- /**
- * Search AnimatorSelector by animation id, widget id and selector and return AnimatorSelector
- *
- * @param animationId
- * @param partId
- * @param selector
- * @return
- */
- public AnimatorSelector findAnimatorSelector(String animationId, String partId, String selector) {
- AnimatorSelector animatorSelector = null;
-
- AnimatorPagePart pagePart = (AnimatorPagePart) getPagePart();
-
- AnimatorAnimation animation = pagePart.getAnimation(animationId);
- if (animation != null) {
- AnimatorWidget animatorWidget = (AnimatorWidget) animation.getChild(partId);
- if (animatorWidget != null) {
- animatorSelector = animatorWidget.getAnimatorSelector(selector);
- }
- }
-
- return animatorSelector;
- }
-
- /******************************************************************************************************************
- * Model Control - Start
- ******************************************************************************************************************/
- private AnimatorModel makeDefaultAnimatorModel(Part part) {
- AnimatorPagePart pagePart = (AnimatorPagePart) part;
- pagePart.setTransition("none");
-
- // Create AnimatorAnimation
- AnimatorAnimation animationGroup =
- pagePart.createAnimatorAnimation(getModelFactory(), idGenerator(AnimatorModelType.ANIMATION));
-
- List<AnimatorModel> makeAnimatorWidget =
- animationGroup.composeAnimatorWidget(pagePart.getChildren());
- animationGroup.setChildren(makeAnimatorWidget);
-
- return animationGroup;
- }
-
- /******************************************************************************************************************
- * Model Control - AnimatorWidget
- ******************************************************************************************************************/
- private List<AnimatorModel> createAnimatorWidgetsForWidget(Part child,
- AnimatorAnimation animation) {
- List<AnimatorModel> widgetList = new ArrayList<AnimatorModel>();
- AnimatorWidget animatorWidget = animation.createAnimatorWidget(child);
- widgetList.add(animatorWidget);
-
- for (Part part : child.getChildren())
- widgetList.addAll(createAnimatorWidgetsForWidget(part, animation));
-
- return widgetList;
- }
-
- private Map<AnimatorModel, Integer> collectWillRemoveAnimatorWidget(Part child) {
- Map<AnimatorModel, Integer> animatorWidgets = new LinkedHashMap<AnimatorModel, Integer>();
- AnimatorPagePart pagePart = (AnimatorPagePart) getPagePart();
-
- for (AnimatorModel model : pagePart.getAnimations()) {
- AnimatorAnimation animation = (AnimatorAnimation) model;
- AnimatorWidget animatorWidget =
- findAnimatorWidget(animation.getId(), child.getIdPropertyValue());
- animatorWidgets.put(animatorWidget, animation.getChildIndex(animatorWidget));
- }
-
- // if part has a children
- for (Part partChild : child.getChildren())
- animatorWidgets.putAll(collectWillRemoveAnimatorWidget(partChild));
-
- return animatorWidgets;
- }
-
- private List<AnimatorModel> deleteAnimatorWidget(Map<AnimatorModel, Integer> animatorWidgets,
- AnimatorAnimation currentAnimation) {
- List<AnimatorModel> widgets = new ArrayList<AnimatorModel>();
- Iterator<Entry<AnimatorModel, Integer>> iter = animatorWidgets.entrySet().iterator();
- while (iter.hasNext()) {
- Entry<AnimatorModel, Integer> next = iter.next();
- AnimatorWidget animatorWidget = (AnimatorWidget) next.getKey();
- if (animatorWidget != null) {
- AnimatorAnimation animation = (AnimatorAnimation) animatorWidget.getParent();
- animation.removeChild(animatorWidget);
-
- if (animation.equals(currentAnimation))
- widgets.add(animatorWidget);
- }
- }
-
- return widgets;
- }
-
- /******************************************************************************************************************
- * Model Control - AnimatorTrigger
- ******************************************************************************************************************/
- private AnimatorTrigger createAnimatorTrigger(String eventName, AnimatorPart part) {
- AnimatorTrigger trigger = (AnimatorTrigger)getModelFactory().createAnimatorModel(AnimatorModelType.TRIGGER);
-
- trigger.setEventName(eventName);
- trigger.setPartLink(part);
- part.addTrigger(trigger);
-
- return trigger;
- }
-
- /**
- * Return created AnimatorTrigger when there is no AnimatorTrigger by event name
- *
- * @param eventName
- * @param part
- * @return
- */
- public AnimatorTrigger getAnimatorTrigger(String eventName, AnimatorPart part) {
- AnimatorTrigger trigger = part.getTriggerByEventName(eventName);
- if (trigger == null)
- trigger = createAnimatorTrigger(eventName, part);
-
- return trigger;
- }
-
- /******************************************************************************************************************
- * Model Control - AnimatorActionAnimation
- ******************************************************************************************************************/
- /**
- * Create actionAnimation
- *
- * @param animationGroup
- * @param actionType
- * @param time
- * @param trigger
- * @return
- */
- public AnimatorActionAnimation createAnimatorActionAnimation(String animationGroup,
- String actionType, double time,
- AnimatorTrigger trigger) {
- AnimatorActionAnimation actionAnimation = null;
- AnimatorAnimation animation = findAnimation(animationGroup);
-
- if (animation != null)
- actionAnimation = trigger.createAnimatorActionAnimation(animation, actionType, time);
-
- return actionAnimation;
- }
-
/******************************************************************************************************************
* Listener(Customer)
for (Part newPart : newRootPart.getChildren()) {
AnimatorPagePart newPagePart = (AnimatorPagePart) newPart;
- if (newPagePart.getAnimations().size() == 0)
- newPagePart.addAnimation((AnimatorAnimation) createAnimation(newPagePart, null,
- true, 1, false));
+ if (newPagePart.getAnimations().size() == 0) {
+ newPagePart.addAnimation(newPagePart.createAnimation(null, true, 1, false));
+ }
}
}
}
* @param part
*/
public void widgetPropertyEdit(Part part) {
- AnimatorAnimation animation = getCurrentAnimation();
+ AnimatorPagePart pagePart = (AnimatorPagePart)part.getOwnerPage();
+ AnimatorAnimation animation = pagePart.getCurrentAnimation();
if (animation != null) {
AnimatorWidget widget = (AnimatorWidget) animation.findAnimatorModelByPartLink(part);
/*
* Animation Model
*/
- addedPagePart.addAnimation((AnimatorAnimation) createAnimation(addedPagePart, null, true,
+ addedPagePart.addAnimation(addedPagePart.createAnimation(null, true,
1, false));
}
public AnimatorWidget() {
// TODO Auto-generated constructor stub
}
+
+
+
+ @Override
+ public void removeChild(AnimatorModel child) {
+ for(AnimatorModel model : getChildren()) {
+ AnimatorSelector selector = (AnimatorSelector)model;
+ if(selector.getSelector().equals(((AnimatorSelector)child).getSelector())) {
+ super.removeChild(selector);
+ break;
+ }
+ }
+ }
+
+
/**
* Check visibility
package org.tizen.webuibuilder.animator.model.part;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.tizen.webuibuilder.animator.model.AnimatorActionAnimation;
import org.tizen.webuibuilder.animator.model.AnimatorAnimation;
import org.tizen.webuibuilder.animator.model.AnimatorModel;
import org.tizen.webuibuilder.animator.model.AnimatorModelFactory;
+import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
import org.tizen.webuibuilder.animator.model.AnimatorModelType;
+import org.tizen.webuibuilder.animator.model.AnimatorSelector;
+import org.tizen.webuibuilder.animator.model.AnimatorTrigger;
+import org.tizen.webuibuilder.animator.model.AnimatorWidget;
+import org.tizen.webuibuilder.animator.model.AnimatorModelEvent.EventType;
+import org.tizen.webuibuilder.animator.model.AnimatorModelEvent.Origin;
+import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
import org.tizen.webuibuilder.model.Part;
import org.tizen.webuibuilder.model.descriptors.PartDescriptor;
public AnimatorAnimation getAnimation(String animationId) {
AnimatorAnimation animation = null;
- for (AnimatorAnimation currentAnimation : animations) {
+ for (AnimatorAnimation currentAnimation : getAnimations()) {
String currentAnimationId = currentAnimation.getId();
if (currentAnimationId.equals(animationId)) {
animation = currentAnimation;
addAnimation(animation);
}
}
+
+
+
+ /**
+ * Create animation group
+ *
+ * @param part
+ * @param name
+ * @param autoPlay
+ * @param iteration
+ * @param isRepeated
+ * @return
+ */
+ public AnimatorAnimation createAnimation(String name, boolean autoPlay, int iteration,
+ boolean isRepeated) {
+ AnimatorAnimation addedAnimation = (AnimatorAnimation) makeDefaultAnimatorModel();
+ if (name == null || name.trim().equals("")) {
+ addedAnimation.setName(addedAnimation.getId());
+ } else {
+ addedAnimation.setName(name);
+ }
+
+ addedAnimation.setJustPlay(autoPlay);
+ addedAnimation.setIteration(iteration);
+ addedAnimation.setRepeated(isRepeated);
+
+ return addedAnimation;
+ }
+
+ private AnimatorModel makeDefaultAnimatorModel() {
+ setTransition("none");
+ AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+
+ // Create AnimatorAnimation
+ AnimatorAnimation animationGroup =
+ createAnimatorAnimation(modelManager.getModelFactory(), modelManager.idGenerator(AnimatorModelType.ANIMATION));
+
+ List<AnimatorModel> makeAnimatorWidget =
+ animationGroup.composeAnimatorWidget(getChildren());
+ animationGroup.setChildren(makeAnimatorWidget);
+
+ return animationGroup;
+ }
+
+ /**
+ * Add animation to pagePart
+ *
+ * @param animation
+ * @param origin
+ */
+ public void addAnimation(AnimatorAnimation animation, Origin origin) {
+ addAnimation(animation);
+
+ AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ modelManager.fireEvent(EventType.ANIMATION_ADD, origin, animation);
+ }
+
+ /**
+ * Remove animation from pagePart
+ *
+ * @param animation
+ * @param origin
+ */
+ public void removeAnimatoin(AnimatorAnimation animation, Origin origin) {
+ removeAnimation(animation);
+
+ AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ modelManager.fireEvent(EventType.ANIMATION_ADD, origin, animation);
+ }
+
+ /**
+ * Edit animation Can be changed autoplay, iteration, repeated
+ *
+ * @param editAnimation
+ * @param name
+ * @param autoPlay
+ * @param iteration
+ * @param repeated
+ * @param origin
+ */
+ public void editAnimation(AnimatorAnimation editAnimation, String name, boolean autoPlay,
+ int iteration, boolean repeated, Origin origin) {
+
+ if (name == null || name.trim().equals("")) {
+ editAnimation.setName(editAnimation.getId());
+ } else {
+ editAnimation.setName(name);
+ }
+
+ editAnimation.setJustPlay(autoPlay);
+ editAnimation.setIteration(iteration);
+ editAnimation.setRepeated(repeated);
+
+ AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ modelManager.fireEvent(EventType.ANIMATION_EDIT, origin, editAnimation);
+ }
+
+ /**
+ * Create AnimatorWidgets for all animation group
+ *
+ * @param child
+ * @return
+ */
+ public List<AnimatorModel> createAnimatorWidgetsForAllAnimations(Part child) {
+ List<AnimatorModel> widgetList = new ArrayList<AnimatorModel>();
+ for (AnimatorAnimation animation : getAnimations())
+ widgetList.addAll(animation.createAnimatorWidgetsForWidget(child));
+
+ return widgetList;
+ }
+
+ /**
+ * Create AnimatorWidgets for all animation group
+ *
+ * @param clonedParts
+ * @return
+ */
+ public List<AnimatorModel> createAnimatorWidgetsForAllAnimations(List<Part> clonedParts) {
+ List<AnimatorModel> widgetList = new ArrayList<AnimatorModel>();
+ for (AnimatorAnimation animation : getAnimations()) {
+ for (Part part : clonedParts) {
+ widgetList.addAll(animation.createAnimatorWidgetsForWidget(part));
+ }
+ }
+
+ return widgetList;
+ }
+
+ /**
+ * Add AnimatorWidgtes to animation group
+ *
+ * @param animatorWidgets
+ * @param origin
+ */
+ public void addAnimatorWidgets(List<AnimatorModel> animatorWidgets, Origin origin) {
+ List<AnimatorModel> currentAnimationWidget = new ArrayList<AnimatorModel>();
+ AnimatorAnimation currentAnimation = getCurrentAnimation();
+ for (AnimatorModel model : animatorWidgets) {
+ AnimatorWidget widget = (AnimatorWidget) model;
+ AnimatorAnimation animation = (AnimatorAnimation) widget.getParent();
+ animation.addChild(widget);
+
+ if (currentAnimation != null) {
+ if (animation.equals(currentAnimation))
+ currentAnimationWidget.add(widget);
+ }
+ }
+
+ AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ modelManager.fireEvent(currentAnimation, EventType.WIDGET_ADD, origin, null,
+ currentAnimationWidget);
+ modelManager.fireEvent(EventType.WIDGET_ADD, origin, null);
+ }
+
+ /**
+ * Remove AnimatorWidgtes from animation group
+ *
+ * @param animatorWidgets
+ * @param origin
+ */
+ public void removeAnimatorWidgets(List<AnimatorModel> animatorWidgets, Origin origin) {
+ AnimatorModel currentAnimationWidget = null;
+ AnimatorAnimation currentAnimation = getCurrentAnimation();
+
+ for (AnimatorModel model : animatorWidgets) {
+ AnimatorWidget widget = (AnimatorWidget) model;
+ AnimatorAnimation animation = (AnimatorAnimation) widget.getParent();
+ animation.removeChild(widget);
+
+ if (animation.equals(currentAnimation))
+ currentAnimationWidget = widget;
+ }
+
+ AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ modelManager.fireEvent(true, getCurrentAnimation(), EventType.WIDGET_REMOVE, origin,
+ currentAnimationWidget);
+ }
+
+
+ public AnimatorAnimation getCurrentAnimation() {
+ if (AnimatorUtils.getActiveAnimatorBrowserViewer() != null)
+ return getAnimation(AnimatorUtils.getActiveAnimatorBrowserViewer()
+ .getCurrentAnimationGroupId());
+ return null;
+ }
+
+ /**
+ * Search animatorWidget by animation id and widget id and return AnimatorWidget
+ *
+ * @param animationId
+ * @param widgetId
+ * @return
+ */
+ public AnimatorWidget findAnimatorWidget(String animationId, String widgetId) {
+ AnimatorWidget animatorWidget = null;
+
+ AnimatorAnimation animation = getAnimation(animationId);
+ if (animation != null) {
+ animatorWidget = (AnimatorWidget) animation.getChild(widgetId);
+ }
+
+ return animatorWidget;
+ }
+
+ /**
+ * Add AnimatorWidgtes to animation group
+ *
+ * @param animatorWidgetGroup
+ * @param origin
+ */
+ public void addAnimatorWidgets(Part part, AnimatorModel model, int index, Origin origin) {
+ AnimatorAnimation currentAnimation = getCurrentAnimation();
+ List<AnimatorModel> animatorWidgets = new ArrayList<AnimatorModel>();
+ AnimatorWidget animatorWidget = (AnimatorWidget)model;
+ AnimatorAnimation animation = (AnimatorAnimation) animatorWidget.getParent();
+ animation.addChild(index, animatorWidget);
+
+ if (currentAnimation != null) {
+ if (currentAnimation.equals(animation))
+ animatorWidgets.add(animatorWidget);
+ }
+
+ AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ modelManager
+ .fireEvent(currentAnimation, EventType.WIDGET_ADD, origin, null, animatorWidgets);
+ modelManager.fireEvent(EventType.WIDGET_ADD, origin, null);
+ }
+
+ /**
+ * Search AnimatorSelector by animation id, widget id and selector and return AnimatorSelector
+ *
+ * @param animationId
+ * @param part
+ * @param selector
+ * @return
+ */
+ public AnimatorSelector findAnimatorSelector(String animationId, String selector) {
+ return findAnimatorSelector(animationId, getPropertyValue("id"), selector);
+ }
+
+ /**
+ * Search AnimatorSelector by animation id, widget id and selector and return AnimatorSelector
+ *
+ * @param animationId
+ * @param partId
+ * @param selector
+ * @return
+ */
+ public AnimatorSelector findAnimatorSelector(String animationId, String partId, String selector) {
+ AnimatorSelector animatorSelector = null;
+
+ AnimatorAnimation animation = getAnimation(animationId);
+ if (animation != null) {
+ AnimatorWidget animatorWidget = (AnimatorWidget) animation.getChild(partId);
+ if (animatorWidget != null) {
+ animatorSelector = animatorWidget.getAnimatorSelector(selector);
+ }
+ }
+
+ return animatorSelector;
+ }
+
+ /**
+ * Create actionAnimation
+ *
+ * @param animationGroup
+ * @param actionType
+ * @param time
+ * @param trigger
+ * @return
+ */
+ public AnimatorActionAnimation createAnimatorActionAnimation(String animationGroup,
+ String actionType, double time,
+ AnimatorTrigger trigger) {
+ AnimatorActionAnimation actionAnimation = null;
+ AnimatorAnimation animation = getAnimation(animationGroup);
+
+ if (animation != null) {
+ actionAnimation = trigger.createAnimatorActionAnimation(animation, actionType, time);
+ }
+
+ return actionAnimation;
+ }
}
import org.tizen.webuibuilder.animator.model.AnimatorAnimation;
import org.tizen.webuibuilder.animator.model.AnimatorModel;
import org.tizen.webuibuilder.animator.model.AnimatorModelEvent;
+import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
+import org.tizen.webuibuilder.animator.model.AnimatorModelType;
import org.tizen.webuibuilder.animator.model.AnimatorSelector;
import org.tizen.webuibuilder.animator.model.AnimatorTrigger;
import org.tizen.webuibuilder.animator.model.IAnimatorModelListener;
+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;
}
/**
+ * Return created AnimatorTrigger when there is no AnimatorTrigger by event name
+ *
+ * @param eventName
+ * @param part
+ * @return
+ */
+ public AnimatorTrigger getAnimatorTrigger(String eventName) {
+ AnimatorTrigger trigger = getTriggerByEventName(eventName);
+ if (trigger == null)
+ trigger = createAnimatorTrigger(eventName);
+
+ return trigger;
+ }
+
+ /**
* Check whether current page has animation or not
*
* @param
return false;
}
+
+
+ /**
+ * Create Default animation group Create AnimatorWidget by current widget state
+ *
+ * @return
+ */
+ public List<AnimatorAnimation> createDefaultAnimations() {
+
+ List<AnimatorAnimation> animations = new ArrayList<AnimatorAnimation>();
+ for (Part part : getChildren()) {
+ animations.add(((AnimatorPagePart)part).createAnimation(null, true, 1, false));
+ }
+ return animations;
+ }
+
public void fireEvent(AnimatorModelEvent event) {
if (event == null) {
}
}
}
+
+
+ private AnimatorTrigger createAnimatorTrigger(String eventName) {
+ AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+
+ AnimatorTrigger trigger = (AnimatorTrigger)modelManager.getModelFactory().createAnimatorModel(AnimatorModelType.TRIGGER);
+
+ trigger.setEventName(eventName);
+ trigger.setPartLink(this);
+ addTrigger(trigger);
+
+ return trigger;
+ }
}
package org.tizen.webuibuilder.animator.model.part;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.tizen.webuibuilder.animator.model.AnimatorAnimation;
+import org.tizen.webuibuilder.animator.model.AnimatorModel;
+import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
+import org.tizen.webuibuilder.animator.model.AnimatorSelector;
+import org.tizen.webuibuilder.animator.model.AnimatorWidget;
+import org.tizen.webuibuilder.animator.model.AnimatorModelEvent.EventType;
+import org.tizen.webuibuilder.animator.model.AnimatorModelEvent.Origin;
+import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
+import org.tizen.webuibuilder.model.Part;
import org.tizen.webuibuilder.model.descriptors.WidgetPartDescriptor;
public AnimatorWidgetPart(Object ownerRef, WidgetPartDescriptor descriptor) {
super(ownerRef, descriptor);
}
+
+
+ /**
+ * Remove AnimatorWidgtes from animation group
+ *
+ * @param child
+ * @param origin
+ * @return
+ */
+ public Map<AnimatorModel, Integer> removeAnimatorWidgets(Origin origin) {
+ AnimatorAnimation currentAnimation = ((AnimatorPagePart)getOwnerPage()).getCurrentAnimation();
+ Map<AnimatorModel, Integer> animatorWidgets = collectWillRemoveAnimatorWidget(this);
+ List<AnimatorModel> widgets = deleteAnimatorWidget(animatorWidgets, currentAnimation);
+
+ AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ modelManager.fireEvent(currentAnimation, EventType.WIDGET_REMOVE, origin, null, widgets);
+ modelManager.fireEvent(EventType.WIDGET_REMOVE, origin, null);
+
+ return animatorWidgets;
+ }
+
+ private Map<AnimatorModel, Integer> collectWillRemoveAnimatorWidget(Part child) {
+ Map<AnimatorModel, Integer> animatorWidgets = new LinkedHashMap<AnimatorModel, Integer>();
+ AnimatorPagePart pagePart = (AnimatorPagePart) getOwnerPage();
+
+ for (AnimatorModel model : pagePart.getAnimations()) {
+ AnimatorAnimation animation = (AnimatorAnimation) model;
+ AnimatorWidget animatorWidget =
+ pagePart.findAnimatorWidget(animation.getId(), child.getIdPropertyValue());
+ animatorWidgets.put(animatorWidget, animation.getChildIndex(animatorWidget));
+ }
+
+ // if part has a children
+ for (Part partChild : child.getChildren()) {
+ animatorWidgets.putAll(collectWillRemoveAnimatorWidget(partChild));
+ }
+
+ return animatorWidgets;
+ }
+
+ private List<AnimatorModel> deleteAnimatorWidget(Map<AnimatorModel, Integer> animatorWidgets,
+ AnimatorAnimation currentAnimation) {
+ List<AnimatorModel> widgets = new ArrayList<AnimatorModel>();
+ Iterator<Entry<AnimatorModel, Integer>> iter = animatorWidgets.entrySet().iterator();
+ while (iter.hasNext()) {
+ Entry<AnimatorModel, Integer> next = iter.next();
+ AnimatorWidget animatorWidget = (AnimatorWidget) next.getKey();
+ if (animatorWidget != null) {
+ AnimatorAnimation animation = (AnimatorAnimation) animatorWidget.getParent();
+ animation.removeChild(animatorWidget);
+
+ if (animation.equals(currentAnimation))
+ widgets.add(animatorWidget);
+ }
+ }
+
+ return widgets;
+ }
}
import org.tizen.webuibuilder.animator.model.AnimatorModelEvent.Origin;
import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
import org.tizen.webuibuilder.animator.model.AnimatorModelType;
+import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
import org.tizen.webuibuilder.animator.ui.views.timeline.header.AnimationGroupDialogResult;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
* This class is Command. This command is for create animation Group.
*/
public class TimelineAnimationGroupCreateCommand extends Command {
+ private AnimatorPagePart pagePart = null;
private AnimatorAnimation animation = null;
private AnimationGroupDialogResult result = null;
private String currentAnimationGroupId = null;
* @param result
* {@link AnimationGroupDialogResult}
*/
- public TimelineAnimationGroupCreateCommand(AnimationGroupDialogResult result) {
+ public TimelineAnimationGroupCreateCommand(AnimatorPagePart pagePart, AnimationGroupDialogResult result) {
+ this.pagePart = pagePart;
this.result = result;
this.currentAnimationGroupId =
AnimatorUtils.getActiveAnimatorBrowserViewer().getCurrentAnimationGroupId();
*/
@Override
public void execute() {
- AnimatorModelManager manager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
if (animation == null) {
- animation =
- (AnimatorAnimation) manager.createAnimation(manager.getPagePart(),
- result.getName(),
- result.isAutoPlay(),
- result.getIteration(),
- result.isRepeated());
+ animation = pagePart.createAnimation(result.getName(),
+ result.isAutoPlay(),
+ result.getIteration(),
+ result.isRepeated());
}
- manager.addAnimation(animation, Origin.TIMELINE);
+ pagePart.addAnimation(animation, Origin.TIMELINE);
String animationId = animation.getId();
AnimatorUtils.getActiveAnimatorBrowserViewer()
AnimatorUtils.getActiveAnimatorBrowserViewer()
.setCurrentAnimationGroupId(currentAnimationGroupId, true);
manager.decreaseId(AnimatorModelType.ANIMATION);
- manager.removeAnimatoin(animation, Origin.TIMELINE);
+ pagePart.removeAnimatoin(animation, Origin.TIMELINE);
}
}
outlineHeader.getViewer().setContents(animationGroup);
}
- AnimatorModelManager manager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
-
// String pageId = pagePart.getPropertyValue("id");
// Integer animationIndex = manager.getAnimationIds().get(pageId);
//
// manager.decreaseId(AnimatorModelType.ANIMATION, pageId);
// }
- manager.removeAnimatoin(removeAnimation, AnimatorModelEvent.Origin.TIMELINE);
+ pagePart.removeAnimatoin(removeAnimation, AnimatorModelEvent.Origin.TIMELINE);
}
/*
String animationGroupId = removeAnimation.getId();
AnimatorModelManager manager =
AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
- manager.addAnimation(removeAnimation, AnimatorModelEvent.Origin.TIMELINE);
+
+ AnimatorPagePart pagePart = (AnimatorPagePart)manager.getPagePart();
+ pagePart.addAnimation(removeAnimation, AnimatorModelEvent.Origin.TIMELINE);
outlineHeader.getAnimationGroupLabel().setText(removeAnimation.getName());
outlineHeader.getAnimationGroupLabel().setData("id", removeAnimation.getId());
import org.tizen.webuibuilder.animator.model.AnimatorAnimation;
import org.tizen.webuibuilder.animator.model.AnimatorModelEvent;
import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
+import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
import org.tizen.webuibuilder.animator.ui.views.timeline.header.AnimationGroupDialogResult;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
* This class is Command. This command is for edit animation Group.
*/
public class TimelineAnimationGroupEditCommand extends Command {
-
+ private AnimatorPagePart pagePart = null;
private AnimatorAnimation editAnimation = null;
private AnimationGroupDialogResult result = null;
private AnimationGroupDialogResult backupOldValue = null;
* @param result
* {@link AnimationGroupDialogResult}
*/
- public TimelineAnimationGroupEditCommand(AnimatorAnimation editAnimation,
+ public TimelineAnimationGroupEditCommand(AnimatorPagePart pagePart, AnimatorAnimation editAnimation,
AnimationGroupDialogResult result) {
this.editAnimation = editAnimation;
this.result = result;
editAnimation.isRepeated(),
editAnimation.isJustPlay(), editAnimation.getName());
- AnimatorModelManager manager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
- manager.editAnimation(editAnimation, result.getName(), result.isAutoPlay(),
+ pagePart.editAnimation(editAnimation, result.getName(), result.isAutoPlay(),
result.getIteration(), result.isRepeated(),
AnimatorModelEvent.Origin.TIMELINE);
}
@Override
public void undo() {
if (backupOldValue != null) {
-
- AnimatorModelManager manager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
- manager.editAnimation(editAnimation, backupOldValue.getName(),
+ pagePart.editAnimation(editAnimation, backupOldValue.getName(),
backupOldValue.isAutoPlay(), backupOldValue.getIteration(),
backupOldValue.isRepeated(), AnimatorModelEvent.Origin.TIMELINE);
}
AnimationGroupDialogResult result = (AnimationGroupDialogResult) createDialog.open();
if (result != null) {
- Command createAnimationGroup = new TimelineAnimationGroupCreateCommand(result);
+ Command createAnimationGroup = new TimelineAnimationGroupCreateCommand(pagePart, result);
viewer.getEditDomain().getCommandStack().execute(createAnimationGroup);
}
}
public void addDefaultAnimationGroup() {
AnimationGroupDialogResult result = new AnimationGroupDialogResult(1, false, true, null);
if (result != null) {
- Command createAnimationGroup = new TimelineAnimationGroupCreateCommand(result);
+ Command createAnimationGroup = new TimelineAnimationGroupCreateCommand(pagePart, result);
viewer.getEditDomain().getCommandStack().execute(createAnimationGroup);
}
}
AnimationGroupDialogResult result =
new AnimationGroupDialogResult(1, false, true, animationAnimatorId);
- Command createAnimationGroup = new TimelineAnimationGroupCreateCommand(result);
+ Command createAnimationGroup = new TimelineAnimationGroupCreateCommand(pagePart, result);
removeAnimationGroup = removeAnimationGroup.chain(createAnimationGroup);
AnimationGroupDialogResult result = (AnimationGroupDialogResult) editDialog.open();
if (result != null) {
Command editAnimationGroup =
- new TimelineAnimationGroupEditCommand(editAnimation, result);
+ new TimelineAnimationGroupEditCommand(pagePart, editAnimation, result);
viewer.getEditDomain().getCommandStack().execute(editAnimationGroup);
}
}
import org.tizen.webuibuilder.animator.model.AnimatorProperty;
import org.tizen.webuibuilder.animator.model.AnimatorSelector;
import org.tizen.webuibuilder.animator.model.AnimatorWidget;
+import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
import org.tizen.webuibuilder.animator.model.part.AnimatorPart;
import org.tizen.webuibuilder.animator.model.part.AnimatorWidgetPart;
import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineViewer;
import org.tizen.webuibuilder.animator.ui.views.timeline.common.ColorResource;
import org.tizen.webuibuilder.animator.ui.views.timeline.editpart.TimelineEditPart;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
+import org.tizen.webuibuilder.model.Part;
import org.tizen.webuibuilder.model.descriptors.PartDescriptor;
import org.tizen.webuibuilder.utility.ResourceManager;
if (data instanceof TimelineEditPart) {
Object model = ((TimelineEditPart) data).getModel();
if (model instanceof AnimatorModel) {
- AnimatorModelManager manager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+
+ Part part = ((AnimatorModel) model).getPartLink();
+ AnimatorPagePart pagePart = (AnimatorPagePart)part.getOwnerPage();
AnimatorWidget animatorWidget =
- manager.findAnimatorWidget(AnimatorUtils
+ pagePart.findAnimatorWidget(AnimatorUtils
.getActiveAnimatorBrowserViewer()
- .getCurrentAnimationGroupId(), ((AnimatorModel) model)
- .getPartLink().getIdPropertyValue());
+ .getCurrentAnimationGroupId(), part.getIdPropertyValue());
AnimationLockCommand lockCommand =
new AnimationLockCommand(!isLockable, animatorWidget,
if (data instanceof TimelineEditPart) {
Object model = ((TimelineEditPart) data).getModel();
if (model instanceof AnimatorModel) {
-
- AnimatorModelManager manager =
- AnimatorModelManager.getInstance(AnimatorUtils
- .getAppManager());
+
+ Part part = ((AnimatorModel) model).getPartLink();
+ AnimatorPagePart pagePart = (AnimatorPagePart)part.getOwnerPage();
AnimatorWidget animatorWidget =
- manager.findAnimatorWidget(AnimatorUtils
+ pagePart.findAnimatorWidget(AnimatorUtils
.getActiveAnimatorBrowserViewer()
.getCurrentAnimationGroupId(),
- ((AnimatorModel) model)
- .getPartLink()
- .getIdPropertyValue());
+ part.getIdPropertyValue());
AnimationMakeInvisibleCommand visibleCommand =
new AnimationMakeInvisibleCommand(
import org.tizen.webuibuilder.animator.model.AnimatorModel;
import org.tizen.webuibuilder.animator.model.AnimatorModelEvent.Origin;
import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
+import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
import org.tizen.webuibuilder.model.Part;
import org.tizen.webuibuilder.model.descriptors.PartDescriptor;
default:
break;
}
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
-
+
if (animatorWidgetList.size() == 0) {
animatorWidgetList =
- animatorModelManager.createAnimatorWidgetsForAllAnimations(child);
+ ((AnimatorPagePart)child.getOwnerPage()).createAnimatorWidgetsForAllAnimations(child);
}
- animatorModelManager.addAnimatorWidgets(animatorWidgetList, Origin.EDITOR);
+ ((AnimatorPagePart)child.getOwnerPage()).addAnimatorWidgets(animatorWidgetList, Origin.EDITOR);
}
this.chain(this);
}
*/
@Override
public void undo() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
- animatorModelManager.removeAnimatorWidgets(animatorWidgetList, Origin.EDITOR);
+ ((AnimatorPagePart)child.getOwnerPage()).removeAnimatorWidgets(animatorWidgetList, Origin.EDITOR);
if (relation.getRelation() == WidgetRelation.Relation.CHILD) {
refChild.removeChild(child, true);
package org.tizen.webuibuilder.gef.commands;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.gef.commands.Command;
import org.tizen.webuibuilder.animator.model.AnimatorModel;
+import org.tizen.webuibuilder.animator.model.AnimatorWidget;
import org.tizen.webuibuilder.animator.model.AnimatorModelEvent.Origin;
import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
+import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
+import org.tizen.webuibuilder.animator.model.part.AnimatorWidgetPart;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
import org.tizen.webuibuilder.model.Part;
import org.tizen.webuibuilder.model.PartEvent;
*/
@Override
public void redo() {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
-
for (int i = 0; i < deletedGroup.size(); i++) {
// Removes parts.
DeletedPartGroup group = deletedGroup.get(i);
for (int j = 0; j < size; j++) {
Part child = parts.get(j);
- animatorWidgetGroup =
- animatorModelManager.removeAnimatorWidgets(child, Origin.EDITOR);
-
+
+ if(child instanceof AnimatorWidgetPart) {
+ animatorWidgetGroup.putAll(((AnimatorWidgetPart)child).removeAnimatorWidgets(Origin.EDITOR));
+ }
group.getParent().removeChild(child, false);
}
group.getParent().fireEvent(PartEvent.EventType.CHILD_REMOVED, parts);
}
}
}
+
animatorModelManager.addAnimatorWidgets(animatorWidgetGroup, Origin.EDITOR);
}
import org.tizen.webuibuilder.BuilderConstants;
import org.tizen.webuibuilder.animator.model.AnimatorModel;
import org.tizen.webuibuilder.animator.model.AnimatorModelEvent.Origin;
-import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
+import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
import org.tizen.webuibuilder.model.Part;
import org.tizen.webuibuilder.model.css.CssSelector;
}
clonedParts = paste(parentPart, clipboardParts);
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
if (animatorWidgetGroup.size() == 0)
animatorWidgetGroup =
- animatorModelManager.createAnimatorWidgetsForAllAnimations(clonedParts);
+ ((AnimatorPagePart)parentPart.getOwnerPage()).createAnimatorWidgetsForAllAnimations(clonedParts);
- animatorModelManager.addAnimatorWidgets(animatorWidgetGroup, Origin.EDITOR);
+ ((AnimatorPagePart)parentPart.getOwnerPage()).addAnimatorWidgets(animatorWidgetGroup, Origin.EDITOR);
}
/**
}
}
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
- animatorModelManager.addAnimatorWidgets(animatorWidgetGroup, Origin.EDITOR);
+ ((AnimatorPagePart)parentPart.getOwnerPage()).addAnimatorWidgets(animatorWidgetGroup, Origin.EDITOR);
}
import org.tizen.webuibuilder.animator.model.AnimatorWidget;
import org.tizen.webuibuilder.animator.model.io.AnimatorFileReader;
import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
+import org.tizen.webuibuilder.animator.model.part.AnimatorPart;
import org.tizen.webuibuilder.animator.ui.views.timeline.TimelinePage;
import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineViewer;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
return (EditPart) viewer.getEditPartRegistry()
.get(((Part) part.getModel()).getPartId());
} else {
- AnimatorModelManager animatorModelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ AnimatorPagePart animatorPagePart = (AnimatorPagePart)((Part) part.getModel()).
+ getOwnerPage();
AnimatorWidget animatorWidget =
- animatorModelManager.findAnimatorWidget(animator
+ animatorPagePart.findAnimatorWidget(animator
.getCurrentAnimationGroupId(), ((Part) part.getModel())
.getIdPropertyValue());
if (animatorWidget != null && animatorWidget.isLock() == true) {
if (isExist) {
AnimatorFileReader.makeModelbyFile(rootPart, animatorModelJsFile, animatorModelCssFile);
} else {
-
- List<AnimatorModel> animations = animatorModelManager.createDefaultAnimations(rootPart);
- for (AnimatorModel model : animations) {
- animatorModelManager.addAnimation((AnimatorAnimation) model, Origin.EDITOR);
+ List<AnimatorAnimation> animations = ((AnimatorPart)rootPart).createDefaultAnimations();
+ for (Part part : rootPart.getChildren()) {
+ for (AnimatorAnimation animation : animations) {
+ if(part.equals(animation.getPartLink())) {
+ ((AnimatorPagePart)part).addAnimation(animation, Origin.EDITOR);
+ }
+ }
}
}
}
import org.tizen.webuibuilder.animator.model.AnimatorModel;
import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
import org.tizen.webuibuilder.animator.model.AnimatorSelector;
+import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
import org.tizen.webuibuilder.animator.ui.views.timeline.command.TimelineFrameCreateCommand;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
import org.tizen.webuibuilder.model.Part;
import org.tizen.webuibuilder.model.page.IPageDataListener;
import org.tizen.webuibuilder.model.page.PageDataEvent;
import org.tizen.webuibuilder.ui.views.properties.CategoryComposite;
+import org.tizen.webuibuilder.ui.views.properties.PropertiesConstant;
import org.tizen.webuibuilder.ui.views.properties.PropertiesPage.PropertiesMode;
import org.tizen.webuibuilder.ui.views.properties.PropertiesPage.TabIndex;
-import org.tizen.webuibuilder.ui.views.properties.PropertiesConstant;
import org.tizen.webuibuilder.ui.views.properties.PropertiesTabItem;
import org.tizen.webuibuilder.ui.views.properties.method.ClipMethod;
import org.tizen.webuibuilder.ui.views.properties.method.CustomCSSMethod;
String widgetId = tempPart.getPropertyValue("id");
String selectorId = tempPart.getUiSelector();
+ AnimatorPagePart pagePart = (AnimatorPagePart)tempPart.getOwnerPage();
/* 1. check already been frame */
AnimatorSelector animatorSelector =
- animatorModelManager.findAnimatorSelector(AnimatorUtils
- .getActiveAnimatorBrowserViewer()
- .getCurrentAnimationGroupId(),
+ pagePart.findAnimatorSelector(AnimatorUtils.getActiveAnimatorBrowserViewer()
+ .getCurrentAnimationGroupId(),
widgetId,
selectorId);