frame.addOrEditProperties(properties);
frame.setPredefined(false);
-
+ currentSelector.updateSelectorTime();
newSelector = currentSelector.cloneAnimatorSelector();
}
} else {
currentSelector.updateSelectorTime();
currentSelector.mergeOrSplitKeyframe();
+ currentSelector.updateSelectorTime();
newSelector = currentSelector.cloneAnimatorSelector();
}
} else {
}
}
super.execute();
+ currentSelector.updateSelectorTime();
newSelector = currentSelector.cloneAnimatorSelector();
} else {
currentSelector.replaceAll(newSelector);
import org.tizen.webuibuilder.animator.model.AnimationPathModel;
import org.tizen.webuibuilder.animator.model.AnimatorModelEvent;
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;
@Override
public void addNotify() {
super.addNotify();
- AnimatorModelManager animatorModelManager = AnimatorModelManager.getInstance(appManager);
- AnimatorPart part = (AnimatorPart)animatorModelManager.getRootPart();
+// AnimatorModelManager animatorModelManager = AnimatorModelManager.getInstance(appManager);
+// AnimatorPart part = (AnimatorPart)animatorModelManager.getRootPart();
+ AnimatorPart part = (AnimatorPart)appManager.getPageDataSet().getBaseRootPart();
part.addAnimatorModelListener(animatorModelEventAdapter);
}
*/
@Override
public void removeNotify() {
- AnimatorModelManager animatorModelManager = AnimatorModelManager.getInstance(appManager);
- AnimatorPart part = (AnimatorPart)animatorModelManager.getRootPart();
+// AnimatorModelManager animatorModelManager = AnimatorModelManager.getInstance(appManager);
+// AnimatorPart part = (AnimatorPart)animatorModelManager.getRootPart();
+ AnimatorPart part = (AnimatorPart)appManager.getPageDataSet().getBaseRootPart();
part.removeAnimatorModelListener(animatorModelEventAdapter);
super.removeNotify();
}
import org.tizen.webuibuilder.animator.model.AnimatorModel;
import org.tizen.webuibuilder.animator.model.AnimatorModelEvent;
import org.tizen.webuibuilder.animator.model.AnimatorModelListenerAdapter;
-import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
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.io.AnimatorFileWriter;
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.bridge.DesignerGoingBridge.WidgetPosition;
import org.tizen.webuibuilder.gef.viewer.HoverBrowserViewer;
import org.tizen.webuibuilder.model.Part;
public AnimatorBrowserViewer(AppManager appManager, ScreenSize screen, IEditorInput editorInput) {
super(appManager, screen, editorInput);
- AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager);
- AnimatorPagePart pagePart = (AnimatorPagePart) manager.getPagePart();
-
+// AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager);
+// AnimatorPagePart pagePart = (AnimatorPagePart) manager.getPagePart();
+
+ AnimatorPagePart pagePart = (AnimatorPagePart)appManager.getPageData(appManager.getPageIndex(pageData)).getPagePart();
List<AnimatorAnimation> animations = pagePart.getAnimations();
if (!animations.isEmpty()) {
this.currentAnimationGroupId = animations.get(0).getId();
}
- setAnimatorModelListener(manager.getRootPart());
+ setAnimatorModelListener(appManager.getPageDataSet().getBaseRootPart());
}
/**
protected void handleDispose(DisposeEvent e) {
super.handleDispose(e);
- AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager);
- ((AnimatorPart)manager.getRootPart()).removeAnimatorModelListener(animatorModelEventAdapter);
+// AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager);
+// ((AnimatorPart)manager.getRootPart()).removeAnimatorModelListener(animatorModelEventAdapter);
+
+ ((AnimatorPart)appManager.getPageDataSet().getBaseRootPart()).removeAnimatorModelListener(animatorModelEventAdapter);
}
/**
*/
@Override
protected String generateCssCode() {
- AnimatorModelManager manager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
- return CodeGenerator.generateCssCode(manager.getRootPart());
+ return CodeGenerator.generateCssCode(appManager.getPageDataSet().getBaseRootPart());
}
/**
* play animation using javascript framework API.
*/
public void playCurrentAnimation() {
- AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager);
- AnimatorPagePart pagePart = (AnimatorPagePart) manager.getPagePart();
-
- String pageId = pagePart.getPropertyValue("id");
- getGoingBridge().aniBridge_play(pageId, currentAnimationGroupId);
+// AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager);
+// AnimatorPagePart pagePart = (AnimatorPagePart) manager.getPagePart();
+//
+// String pageId = pagePart.getPropertyValue("id");
+
+ getGoingBridge().aniBridge_play(appManager.getPageData(appManager.getPageIndex(pageData)).getName(),
+ currentAnimationGroupId);
}
/**
*/
public void pauseAnimation(double pointTime) {
this.pointTime = pointTime;
- AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager);
- AnimatorPagePart pagePart = (AnimatorPagePart) manager.getPagePart();
-
- String pageId = pagePart.getPropertyValue("id");
- getGoingBridge().aniBridge_pause(pageId);
+// AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager);
+// AnimatorPagePart pagePart = (AnimatorPagePart) manager.getPagePart();
+//
+// String pageId = pagePart.getPropertyValue("id");
+ getGoingBridge().aniBridge_pause(appManager.getPageData(appManager.getPageIndex(pageData)).getName());
}
/**
* initialize javascript animation framework.
*/
public void initAnimationFW() {
- AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager);
getGoingBridge()
.aniBridge_initFW(AnimatorFileWriter
- .getOneAnimationGroupModelString(manager.getPagePart()
- .getIdPropertyValue(),
+ .getOneAnimationGroupModelString(appManager.getPageData(appManager.getPageIndex(pageData)).getName(),
currentAnimationGroupId,
- appManager, manager
- .getRootPart()),
- AnimatorFileWriter.getOnePageAnimatorKeyFrameString(manager
- .getRootPart()));
+ appManager, appManager.getPageDataSet().getBaseRootPart()),
+ AnimatorFileWriter.getOnePageAnimatorKeyFrameString(appManager.getPageDataSet().getBaseRootPart(),
+ appManager.getPageData(appManager.getPageIndex(pageData)).getPagePart()));
}
/**
* framework API.
*/
private void updateAnimationModel() {
- AnimatorModelManager manager = AnimatorModelManager.getInstance(appManager);
+
getGoingBridge()
- .aniBridge_setAnimationCss(AnimatorFileWriter.getOnePageAnimatorKeyFrameString(manager
- .getRootPart()));
+ .aniBridge_setAnimationCss(AnimatorFileWriter.getOnePageAnimatorKeyFrameString(appManager.getPageDataSet().getBaseRootPart(),
+ appManager.getPageData(appManager.getPageIndex(pageData)).getPagePart()));
getGoingBridge()
.aniBridge_setAnimationJs(AnimatorFileWriter
- .getOneAnimationGroupModelString(manager.getPagePart()
- .getIdPropertyValue(),
+ .getOneAnimationGroupModelString(appManager.getPageData(appManager.getPageIndex(pageData)).getName(),
currentAnimationGroupId,
appManager,
- manager.getRootPart()));
+ appManager.getPageDataSet().getBaseRootPart()));
}
/**
* Apply status(lock and invisible) to widget from animation model.
*/
public void checkLockInvisibleWidget() {
- AnimatorModelManager manager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
- AnimatorAnimation animation = manager.findAnimation(currentAnimationGroupId);
+ AnimatorPagePart pagePart = (AnimatorPagePart)appManager.getPageData(appManager.getPageIndex(pageData)).getPagePart();
+ AnimatorAnimation animation = pagePart.getAnimation(currentAnimationGroupId);
if (animation == null) {
return;
}
package org.tizen.webuibuilder.animator.model;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Iterator;
import java.util.List;
package org.tizen.webuibuilder.animator.model;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.widgets.Display;
eventSource.fireEvent(fireRootPart, fireModel, eventType, origin, model);
}
- /******************************************************************************************************************
- * Interface for command(about Widget)
- ******************************************************************************************************************/
-
-
+
/**
- * Add AnimatorWidgtes to animation group
+ * Update AnimatorModel by current rootPart After two-way editing new rootPart is generated so,
+ * animatorModel need to change PartLink, and parent link
*
- * @param animatorWidgetGroup
- * @param origin
+ * @param newRootPart
*/
- public void addAnimatorWidgets(Map<AnimatorModel, Integer> animatorWidgetGroup, Origin origin) {
- AnimatorAnimation currentAnimation = getCurrentAnimation();
- List<AnimatorModel> animatorWidgets = new ArrayList<AnimatorModel>();
- Iterator<Entry<AnimatorModel, Integer>> iter = animatorWidgetGroup.entrySet().iterator();
- while (iter.hasNext()) {
- Entry<AnimatorModel, Integer> next = iter.next();
- AnimatorWidget animatorWidget = (AnimatorWidget) next.getKey();
- AnimatorAnimation animation = (AnimatorAnimation) animatorWidget.getParent();
- animation.addChild(next.getValue(), animatorWidget);
-
- if (currentAnimation != null) {
- if (currentAnimation.equals(animation))
- animatorWidgets.add(animatorWidget);
+ public void updateAnimatorModel(Part newRootPart) {
+ Part oldRootPart = getRootPart();
+ if (!oldRootPart.equals(newRootPart)) {
+ for (Part oldPart : oldRootPart.getChildren()) {
+ for (Part newPart : newRootPart.getChildren()) {
+ AnimatorPart part = (AnimatorPart)newPart;
+ if (part.getPropertyValue("id").equals(oldPart.getPropertyValue("id"))) {
+ part.updateAnimatorTrigger((AnimatorPart)oldPart);
+ ((AnimatorPagePart) newPart).updateAnimatorAnimation((AnimatorPagePart) oldPart);
+ break;
+ }
+ }
}
- }
-
- eventSource
- .fireEvent(currentAnimation, EventType.WIDGET_ADD, origin, null, animatorWidgets);
- eventSource.fireEvent(EventType.WIDGET_ADD, origin, null);
- }
+ for (Part newPart : newRootPart.getChildren()) {
+ AnimatorPagePart newPagePart = (AnimatorPagePart) newPart;
- /******************************************************************************************************************
- * Interface for command(about Frame)
- ******************************************************************************************************************/
- /**
- * Add AnimatorFrames to selectors return list of frames(at most a frame per selector if
- * selector has no frame at that time)
- *
- * @param selectors
- * @param currentTime
- * @return
- */
- public List<AnimatorFrame> createOrGetAnimatorFrames(AnimatorModelFactory modelFactory,
- List<AnimatorModel> selectors,
- double currentTime) {
- List<AnimatorFrame> frames = new ArrayList<AnimatorFrame>();
- for (AnimatorModel model : selectors) {
- AnimatorSelector selector = (AnimatorSelector) model;
- AnimatorFrame frame = selector.createOrGetAnimatorFrame(currentTime);
- if (frame != null)
- frames.add(frame);
- }
- return frames;
- }
-
- /**
- * find selector for the frame and add the frame to the found selector;
- *
- * @param frames
- * @param currentTime
- * @param origin
- */
- public void addAnimatorFrames(List<AnimatorFrame> frames, double currentTime, Origin origin) {
- for (AnimatorFrame model : frames) {
- addAnimatorFrame(model, currentTime, origin);
+ if (newPagePart.getAnimations().size() == 0) {
+ newPagePart.addAnimation(newPagePart.createAnimation(null, true, 1, false));
+ }
+ }
}
}
-
+
/**
- * Add frame with no property specified there are 2 cases 1. A AnimatorKeyframe with one frame
- * is created with no specific property 2. A frame is created inside existing AnimatorKyeframe
- * and animated properties are specified
- *
- * @precondition frame was already created
- * @param model
- * @param currentTime
- * @param origin
+ * Add animator related resources to index.html
*/
- public void addAnimatorFrame(AnimatorFrame frame, double currentTime, Origin origin) {
- AnimatorKeyframe keyframe = (AnimatorKeyframe) frame.getParent();
- AnimatorSelector selector = (AnimatorSelector) keyframe.getParent();
-
- keyframe.addChild(frame, true);
-
- if (!selector.isExistKeyframe(keyframe)) {// case 1
- selector.addChild(keyframe);
-// copyPropertiesInLeftOrRightFrame(frame, keyframe);
- } else {// case 2
- frame.findAnimatedPropertyAndSetInFrame((AnimatorFrame) keyframe.getPrevChild(frame),
- (AnimatorFrame) keyframe.getNextChild(frame));
-// findAnimatedPropertyAndSetInFrame(frame, keyframe);
- }
+ public void addAnimatorRelatedResources() {
+ if (appManager instanceof AppManagerForHTML) {
+ if (!((AnimatorPart)rootPart).hasAnimation()) {
+ Document editDoc = ((AppManagerForHTML) appManager).getDocument();
- eventSource.fireEvent(AnimatorModelEvent.EventType.FRAME_ADD, origin, frame);
- }
+ NodeList heads = editDoc.getElementsByTagName("head");
+ Element head = (Element) heads.item(0);
+ NodeList scripts = head.getElementsByTagName("script");
+ if (scripts != null) {
+ int len = scripts.getLength();
+ for (int i = 0; i < len; i++) {
+ Element script = (Element) scripts.item(i);
+ String src = script.getAttribute("src");
+ int fileidx = src.lastIndexOf("/");
+ String filename = src.substring(fileidx + 1);
+ if (filename.equals(AnimatorConstants.ANIMATOR_FRAMEWORK_JSPATH)) {
+ return;
+ }
+ }
+ }
- /**
- * Remove AnimatorFrames
- *
- * @param frames
- * @param name
- * @param origin
- */
- public void removeAnimatorFrames(List<AnimatorFrame> frames, String name, Origin origin) {
- for (AnimatorModel model : frames) {
- removeAnimatorFrame(model, name, origin);
- }
- }
+ Element animatorJs = editDoc.createElement("script");
+ animatorJs.setAttribute("src", "./" + AnimatorConstants.ANIMATOR_MODEL_JS_FILE);
- /**
- * Remove AnimatorFrame
- *
- * @param model
- * @param name
- * @param origin
- */
- public void removeAnimatorFrame(AnimatorModel model, String name, Origin origin) {
- AnimatorFrame frame = (AnimatorFrame) model;
- AnimatorKeyframe keyframe = (AnimatorKeyframe) frame.getParent();
+ Element framework = editDoc.createElement("script");
+ framework.setAttribute("src", "./"
+ + AnimatorConstants.ANIMATOR_TIZEN_UI_BUILDER_FRAMEWORK
+ + AnimatorConstants.SLASH + AnimatorConstants.ANIMATOR_FRAMEWORK_JSPATH);
- keyframe.removeChild(frame, true);
- eventSource.fireEvent(AnimatorModelEvent.EventType.FRAME_REMOVE, origin, frame);
- }
+ Element animatorCss = editDoc.createElement("link");
+ animatorCss.setAttribute("type", "text/css");
+ animatorCss.setAttribute("rel", "stylesheet");
+ animatorCss.setAttribute("href", "./" + AnimatorConstants.ANIMATOR_MODEL_CSS_FILE);
- /******************************************************************************************************************
- * Interface for utility
- ******************************************************************************************************************/
- private AnimatorAnimation getCurrentAnimation() {
- if (AnimatorUtils.getActiveAnimatorBrowserViewer() != null)
- return findAnimation(AnimatorUtils.getActiveAnimatorBrowserViewer()
- .getCurrentAnimationGroupId());
- return null;
+ head.insertBefore(framework, head.getLastChild());
+ head.insertBefore(animatorJs, framework);
+ head.insertBefore(animatorCss, animatorJs);
+ }
+ }
}
/**
- * Search animation by id and return animation
- *
- * @param animationId
- * @return
+ * Remove animator related resources from index.html
*/
- public AnimatorAnimation findAnimation(String animationId) {
- AnimatorAnimation animation = null;
-
- AnimatorPagePart pagePart = (AnimatorPagePart) getPagePart();
- animation = pagePart.getAnimation(animationId);
-
- return animation;
+ public void removeAnimatorRelatedResources() {
+ if (appManager instanceof AppManagerForHTML) {
+ if (!((AnimatorPart) rootPart).hasAnimation()) {
+ Document editDoc = ((AppManagerForHTML) appManager).getDocument();
+ NodeList heads = editDoc.getElementsByTagName("head");
+ Element head = null;
+ if (heads != null) {
+ head = (Element) heads.item(0);
+ } else {
+ head = editDoc.createElement("head");
+ if (head != null) {
+ editDoc.insertBefore(head, editDoc.getFirstChild());
+ }
+ }
+ if (head != null) {
+ NodeList scripts = head.getElementsByTagName("script");
+ if (scripts != null) {
+ int len = scripts.getLength();
+ for (int i = 0; i < len; i++) {
+ Element script = (Element) scripts.item(i);
+ String src = script.getAttribute("src");
+ int fileidx = src.lastIndexOf("/");
+ String filename = src.substring(fileidx + 1);
+ if (filename.equals(AnimatorConstants.ANIMATOR_MODEL_JS_FILE)
+ || filename.equals(AnimatorConstants.ANIMATOR_FRAMEWORK_JSPATH)) {
+ // elm.removeChild(script);
+ script.removeAttribute("src");
+ script.setTextContent("");
+ }
+ }
+ }
+ NodeList links = head.getElementsByTagName("link");
+ if (links != null) {
+ int len = links.getLength();
+ for (int i = 0; i < len; i++) {
+ Element link = (Element) links.item(i);
+ String src = link.getAttribute("href");
+ int fileidx = src.lastIndexOf("/");
+ String filename = src.substring(fileidx + 1);
+ if (filename.equals(AnimatorConstants.ANIMATOR_MODEL_CSS_FILE)) {
+ // elm.removeChild(script);
+ link.removeAttribute("href");
+ link.removeAttribute("rel");
+ link.removeAttribute("type");
+ link.setTextContent("");
+ }
+ }
+ }
+ }
+ }
+ }
}
}
}
- /**
- * Update AnimatorModel by current rootPart After two-way editing new rootPart is generated so,
- * animatorModel need to change PartLink, and parent link
- *
- * @param newRootPart
- */
- public void updateAnimatorModel(Part newRootPart) {
- Part oldRootPart = getRootPart();
- if (!oldRootPart.equals(newRootPart)) {
- for (Part oldPart : oldRootPart.getChildren()) {
- for (Part newPart : newRootPart.getChildren()) {
- AnimatorPart part = (AnimatorPart)newPart;
- if (part.getPropertyValue("id").equals(oldPart.getPropertyValue("id"))) {
- part.updateAnimatorTrigger((AnimatorPart)oldPart);
- ((AnimatorPagePart) newPart).updateAnimatorAnimation((AnimatorPagePart) oldPart);
- break;
- }
- }
- }
- for (Part newPart : newRootPart.getChildren()) {
- AnimatorPagePart newPagePart = (AnimatorPagePart) newPart;
-
- if (newPagePart.getAnimations().size() == 0) {
- newPagePart.addAnimation(newPagePart.createAnimation(null, true, 1, false));
- }
- }
- }
- }
-
- /**
- * Edit widget Property
- *
- * @param part
- */
- public void widgetPropertyEdit(Part part) {
- AnimatorPagePart pagePart = (AnimatorPagePart)part.getOwnerPage();
- AnimatorAnimation animation = pagePart.getCurrentAnimation();
- if (animation != null) {
- AnimatorWidget widget = (AnimatorWidget) animation.findAnimatorModelByPartLink(part);
-
- if (widget != null) {
- // temporary is not always need...
- widget.setId(part.getPropertyValue("id"));
- /*******************************/
- eventSource.fireEvent(widget, EventType.WIDGET_EDIT, Origin.PROPERTY, null);
- }
- }
- }
/*
* (non-Javadoc)
// TODO Auto-generated method stub
}
-
- /**
- * Add animator related resources to index.html
- */
- public void addAnimatorRelatedResources() {
- if (appManager instanceof AppManagerForHTML) {
- if (!((AnimatorPart)rootPart).hasAnimation()) {
- Document editDoc = ((AppManagerForHTML) appManager).getDocument();
-
- NodeList heads = editDoc.getElementsByTagName("head");
- Element head = (Element) heads.item(0);
-
- NodeList scripts = head.getElementsByTagName("script");
- if (scripts != null) {
- int len = scripts.getLength();
- for (int i = 0; i < len; i++) {
- Element script = (Element) scripts.item(i);
- String src = script.getAttribute("src");
- int fileidx = src.lastIndexOf("/");
- String filename = src.substring(fileidx + 1);
- if (filename.equals(AnimatorConstants.ANIMATOR_FRAMEWORK_JSPATH)) {
- return;
- }
- }
- }
-
- Element animatorJs = editDoc.createElement("script");
- animatorJs.setAttribute("src", "./" + AnimatorConstants.ANIMATOR_MODEL_JS_FILE);
-
- Element framework = editDoc.createElement("script");
- framework.setAttribute("src", "./"
- + AnimatorConstants.ANIMATOR_TIZEN_UI_BUILDER_FRAMEWORK
- + AnimatorConstants.SLASH + AnimatorConstants.ANIMATOR_FRAMEWORK_JSPATH);
-
- Element animatorCss = editDoc.createElement("link");
- animatorCss.setAttribute("type", "text/css");
- animatorCss.setAttribute("rel", "stylesheet");
- animatorCss.setAttribute("href", "./" + AnimatorConstants.ANIMATOR_MODEL_CSS_FILE);
-
- head.insertBefore(framework, head.getLastChild());
- head.insertBefore(animatorJs, framework);
- head.insertBefore(animatorCss, animatorJs);
- }
- }
- }
-
- /**
- * Remove animator related resources from index.html
- */
- public void removeAnimatorRelatedResources() {
- if (appManager instanceof AppManagerForHTML) {
- if (!((AnimatorPart) rootPart).hasAnimation()) {
- Document editDoc = ((AppManagerForHTML) appManager).getDocument();
- NodeList heads = editDoc.getElementsByTagName("head");
- Element head = null;
- if (heads != null) {
- head = (Element) heads.item(0);
- } else {
- head = editDoc.createElement("head");
- if (head != null) {
- editDoc.insertBefore(head, editDoc.getFirstChild());
- }
- }
- if (head != null) {
- NodeList scripts = head.getElementsByTagName("script");
- if (scripts != null) {
- int len = scripts.getLength();
- for (int i = 0; i < len; i++) {
- Element script = (Element) scripts.item(i);
- String src = script.getAttribute("src");
- int fileidx = src.lastIndexOf("/");
- String filename = src.substring(fileidx + 1);
- if (filename.equals(AnimatorConstants.ANIMATOR_MODEL_JS_FILE)
- || filename.equals(AnimatorConstants.ANIMATOR_FRAMEWORK_JSPATH)) {
- // elm.removeChild(script);
- script.removeAttribute("src");
- script.setTextContent("");
- }
- }
- }
- NodeList links = head.getElementsByTagName("link");
- if (links != null) {
- int len = links.getLength();
- for (int i = 0; i < len; i++) {
- Element link = (Element) links.item(i);
- String src = link.getAttribute("href");
- int fileidx = src.lastIndexOf("/");
- String filename = src.substring(fileidx + 1);
- if (filename.equals(AnimatorConstants.ANIMATOR_MODEL_CSS_FILE)) {
- // elm.removeChild(script);
- link.removeAttribute("href");
- link.removeAttribute("rel");
- link.removeAttribute("type");
- link.setTextContent("");
- }
- }
- }
- }
- }
- }
- }
}
\ No newline at end of file
* @param rootPart
* @return
*/
- public static String getOnePageAnimatorKeyFrameString(Part rootPart) {
+ public static String getOnePageAnimatorKeyFrameString(Part rootPart, Part pagePart) {
try {
AnimatorModelManager manager =
AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
- AnimatorPagePart pagePart = (AnimatorPagePart) manager.getPagePart();
StringBuffer animationCssString = new StringBuffer(new String("".getBytes(), "utf-8"));// ask
// why?
for (Part part : rootPart.getChildren()) {
if (pagePart.equals(part)) {
- for (AnimatorAnimation animation : pagePart.getAnimations()) {
+ for (AnimatorAnimation animation : ((AnimatorPagePart)pagePart).getAnimations()) {
for (AnimatorModel widget : animation.getChildren()) {
for (AnimatorModel model : widget.getChildren()) {
AnimatorSelector selector = (AnimatorSelector) model;
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.AnimatorModelEvent.EventType;
+import org.tizen.webuibuilder.animator.model.AnimatorModelEvent.Origin;
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;
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.model.AnimatorModelManager;
+import org.tizen.webuibuilder.animator.model.AnimatorWidget;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
import org.tizen.webuibuilder.model.Part;
import org.tizen.webuibuilder.model.descriptors.WidgetPartDescriptor;
return animatorWidgets;
}
+ /**
+ * Edit widget Property
+ *
+ * @param part
+ */
+ public void widgetPropertyEdit() {
+ AnimatorPagePart pagePart = (AnimatorPagePart)getOwnerPage();
+ AnimatorAnimation animation = pagePart.getCurrentAnimation();
+ if (animation != null) {
+ AnimatorWidget widget = (AnimatorWidget) animation.findAnimatorModelByPartLink(this);
+
+ if (widget != null) {
+ // temporary is not always need...
+ widget.setId(getPropertyValue("id"));
+ /*******************************/
+ AnimatorModelManager modelManager = AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+ modelManager.fireEvent(widget, EventType.WIDGET_EDIT, Origin.PROPERTY, null);
+ }
+ }
+ }
+
private Map<AnimatorModel, Integer> collectWillRemoveAnimatorWidget(Part child) {
Map<AnimatorModel, Integer> animatorWidgets = new LinkedHashMap<AnimatorModel, Integer>();
AnimatorPagePart pagePart = (AnimatorPagePart) getOwnerPage();
import java.util.List;
import org.tizen.webuibuilder.animator.model.AnimatorAnimation;
-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.AnimatorWidgetPart;
json.addProperty("id", arg0.getPropertyValue("id"));
boolean isHome = false;
- // ProjectManager projectManager = ProjectManager.getProjectManager(project);
- // AppManager appManager = projectManager.getDefaultAppManager();
- // List<PageData> pageDatas = appManager.getPages();
- // for (PageData pageData : pageDatas) {
- // Part rootPart = pageData.getRootPart();
- //
- // if (rootPart == arg0.getParent()) {
- // // TODO - pageData.getPage is not List. why?
- // // String pageId = arg0.getPropertyValue("id");
- // //Page page = pageData.getPage();
- // //isHome = page.isStartup();
- // // isHome = pageData == appManager.getStartupPage();
- // //FIXME
- // //show sets true for first page temporarily
- // if(rootPart.getChildren().indexOf(arg0) == 0)
- // isHome = true;
- // }
- // }
-
- AnimatorModelManager modelManager = AnimatorModelManager.getInstance(appManager);
- Part rootPart = modelManager.getRootPart();
+// AnimatorModelManager modelManager = AnimatorModelManager.getInstance(appManager);
+// Part rootPart = modelManager.getRootPart();
+
+ Part rootPart = appManager.getPageDataSet().getBaseRootPart();
if (rootPart.getChildren().indexOf(arg0) == 0)
isHome = true;
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.TimelineViewer;
import org.tizen.webuibuilder.animator.ui.views.timeline.header.TimelineOutlineHeader;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
-import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
/**
}
}
+ currentSelector.updateSelectorTime();
newSelectors.add(currentSelector.cloneAnimatorSelector());
manager.fireEvent(true, currentSelector,
AnimatorModelEvent.EventType.SELECTOR_REFRESH, AnimatorModelEvent.Origin.TIMELINE, currentSelector);
keyframe.removeChild(frame, true);
+ currentSelector.updateSelectorTime();
newSelector = currentSelector.cloneAnimatorSelector();
} else {
currentSelector.replaceAll(newSelector);
keyframe.removeChild(frame, false);
keyframe.addChild(frame, false);
+ currentSelector.updateSelectorTime();
newSelector = currentSelector.cloneAnimatorSelector();
-
} else {
currentSelector.replaceAll(newSelector);
}
keyframe = currentSelector.findAnimatorKeyframe(keyframe);
currentSelector.removeChild(keyframe);
+ currentSelector.updateSelectorTime();
newSelector = currentSelector.cloneAnimatorSelector();
} else {
currentSelector.replaceAll(newSelector);
((AnimatorSelector)keyframe.getParent()).addChild(keyframe);
currentSelector.updateSelectorTime();
-
newSelector = currentSelector.cloneAnimatorSelector();
} else {
import java.util.Map.Entry;
import org.eclipse.gef.commands.Command;
+import org.tizen.webuibuilder.animator.model.AnimatorAnimation;
import org.tizen.webuibuilder.animator.model.AnimatorModel;
-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.model.AnimatorModelManager;
+import org.tizen.webuibuilder.animator.model.AnimatorWidget;
import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
import org.tizen.webuibuilder.animator.model.part.AnimatorWidgetPart;
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
} else {
group.getParent().insertChildBefore(child, nextSibling, true);
}
+
+ List<AnimatorModel> animatorWidgets = new ArrayList<AnimatorModel>();
+ AnimatorPagePart pagePart = (AnimatorPagePart)child.getOwnerPage();
+ AnimatorAnimation currentAnimation = pagePart.getCurrentAnimation();
+ Iterator<Entry<AnimatorModel, Integer>> iterator = animatorWidgetGroup.entrySet().iterator();
+ while(iterator.hasNext()) {
+ Entry<AnimatorModel, Integer> next = iterator.next();
+ AnimatorModel animatorWidget = (AnimatorWidget)next.getKey();
+ if (animatorWidget != null) {
+ if(animatorWidget.getPartLink().equals(child)) {
+ AnimatorAnimation animation = (AnimatorAnimation) animatorWidget.getParent();
+ animation.addChild(next.getValue(), animatorWidget);
+
+ if (currentAnimation != null) {
+ if (currentAnimation.equals(animation))
+ animatorWidgets.add(animatorWidget);
+ }
+ }
+ }
+ }
+
+
+ animatorModelManager
+ .fireEvent(currentAnimation, EventType.WIDGET_ADD, Origin.EDITOR, null, animatorWidgets);
+ animatorModelManager.fireEvent(EventType.WIDGET_ADD, Origin.EDITOR, null);
}
}
-
- animatorModelManager.addAnimatorWidgets(animatorWidgetGroup, Origin.EDITOR);
}
-
}
\ No newline at end of file
import org.eclipse.gef.SnapToHelper;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
import org.eclipse.gef.rulers.RulerProvider;
-import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
-import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
+import org.tizen.webuibuilder.animator.model.part.AnimatorWidgetPart;
import org.tizen.webuibuilder.gef.figure.PageFigure;
import org.tizen.webuibuilder.gef.figure.PartFigure;
import org.tizen.webuibuilder.gef.figure.WidgetFigure;
public void propertyChanged(PartEvent e) {
((HoverBrowserViewer) getViewer()).updateModel();
((HoverBrowserViewer) getViewer()).updateAllPositionsForce();
+
+ ((AnimatorWidgetPart)e.getPart()).widgetPropertyEdit();
- AnimatorModelManager modelManager =
- AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
- modelManager.widgetPropertyEdit((Part) e.getPart());
}
@Override
import org.eclipse.core.runtime.CoreException;
import org.tizen.webuibuilder.BuilderConstants;
import org.tizen.webuibuilder.BuilderPlugin;
-import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
import org.tizen.webuibuilder.animator.model.io.AnimatorFileWriter;
import org.tizen.webuibuilder.builder.WebUIBuilderBuilder;
import org.tizen.webuibuilder.model.Part;
+ "/tizen-ui-builder-fw/tizen-animator-fw.js\"></script>";
html = html.replace("%animator%", animator_script);
- AnimatorModelManager modelManager = this.getAnimatorModelManager();
- Part aniRootPart = modelManager.getRootPart();
+// AnimatorModelManager modelManager = this.getAnimatorModelManager();
+// Part aniRootPart = modelManager.getRootPart();
+ Part aniRootPart = getPageDataSet().getBaseRootPart();
String animatorCss = AnimatorFileWriter.getAnimatorKeyFrameString(aniRootPart);
String animatorJs =
- AnimatorFileWriter.getOneAnimationGroupModelString(modelManager.getPageId(),
+ AnimatorFileWriter.getOneAnimationGroupModelString(getPageData(index).getName(),
animationGroupId, this, aniRootPart);
html = html.replace("%animatorCss%", animatorCss);
html = html.replace("%animatorJs%", animatorJs);
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.tizen.webuibuilder.BuilderConstants;
-import org.tizen.webuibuilder.animator.model.AnimatorModelManager;
import org.tizen.webuibuilder.animator.model.io.AnimatorFileWriter;
import org.tizen.webuibuilder.builder.WebUIBuilderBuilder;
import org.tizen.webuibuilder.model.GotoPageProperty;
/*
* animation css, animation js
*/
- AnimatorModelManager modelManager = this.getAnimatorModelManager();
- Part aniRootPart = modelManager.getRootPart();
- String animatorCss = AnimatorFileWriter.getOnePageAnimatorKeyFrameString(aniRootPart);
+// AnimatorModelManager modelManager = this.getAnimatorModelManager();
+// Part aniRootPart = modelManager.getRootPart();
+ Part aniRootPart = getPageDataSet().getBaseRootPart();
+ String animatorCss = AnimatorFileWriter.getOnePageAnimatorKeyFrameString(aniRootPart, getPageData(index).getPagePart());
String animatorJs =
- AnimatorFileWriter.getOneAnimationGroupModelString(modelManager.getPageId(),
+ AnimatorFileWriter.getOneAnimationGroupModelString(getPageData(index).getName(),
animationGroupId, this, aniRootPart);
Element newAniElm1 = editDoc.createElement("style");