import org.eclipse.ui.actions.ActionFactory;\r
import org.tizen.webuibuilder.animator.model.descriptor.AnimatorDescriptorManager;\r
import org.tizen.webuibuilder.animator.model.descriptor.CssAnimationDescriptor;\r
+import org.tizen.webuibuilder.animator.ui.views.timeline.action.ZOrderKeyFrameAction;\r
import org.tizen.webuibuilder.animator.ui.views.timeline.common.TimelineMessages;\r
+import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrameUnit;\r
import org.tizen.webuibuilder.animator.utils.AnimatorUtils;\r
import org.tizen.webuibuilder.model.app.AppManager;\r
import org.tizen.webuibuilder.ui.contextmenu.ContextMenu;\r
\r
action = getAction(TimelineMessages.PASTE_KEYFRAME);\r
menu.appendToGroup(GEFActionConstants.GROUP_COPY, action);\r
+\r
+ MenuManager zorder = buildContextZorderMenu();\r
+ menu.appendToGroup(GEFActionConstants.GROUP_REST, zorder);\r
+\r
}\r
\r
private MenuManager buildContextPredefineMenu() {\r
\r
return addPKeyframes;\r
}\r
+\r
+ private MenuManager buildContextZorderMenu() {\r
+ MenuManager zOderMenu = new MenuManager(TimelineMessages.Z_ORDER, TimelineMessages.Z_ORDER);\r
+\r
+ TimelineViewer treeViewer = (TimelineViewer) getViewer();\r
+ List<KeyFrameUnit> findStackKeyframeUnits = treeViewer.findStackKeyframeUnit();\r
+\r
+ if (findStackKeyframeUnits != null && findStackKeyframeUnits.size() > 1) {\r
+\r
+ for (final KeyFrameUnit keyFrameUnit : findStackKeyframeUnits) {\r
+ IAction action = new ZOrderKeyFrameAction(keyFrameUnit, getViewer());\r
+ zOderMenu.add(action);\r
+ }\r
+ }\r
+\r
+ return zOderMenu;\r
+ }\r
}\r
package org.tizen.webuibuilder.animator.ui.views.timeline;
import java.lang.reflect.Method;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.RootEditPart;
import org.eclipse.gef.editparts.RootTreeEditPart;
import org.eclipse.gef.ui.parts.TreeViewer;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.layout.TreeColumnLayout;
import org.eclipse.jface.viewers.ColumnPixelData;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.tizen.webuibuilder.animator.model.AnimatorModelListenerAdapter;
import org.tizen.webuibuilder.animator.model.AnimatorWidget;
import org.tizen.webuibuilder.animator.model.part.AnimatorPart;
+import org.tizen.webuibuilder.animator.ui.views.timeline.action.ZOrderKeyFrameAction;
import org.tizen.webuibuilder.animator.ui.views.timeline.common.TimelineConstants;
import org.tizen.webuibuilder.animator.ui.views.timeline.editpart.TimelineEditPart;
import org.tizen.webuibuilder.animator.ui.views.timeline.tree.TimeTreeElement;
import org.tizen.webuibuilder.animator.ui.views.timeline.tree.TimelineOutlineElement;
+import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrame;
import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrameComponent;
+import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrameUnit;
import org.tizen.webuibuilder.model.Part;
import org.tizen.webuibuilder.utility.Platform;
}
}
}
-
+
refreshTree();
refreshContextMenu();
}
* Refresh ContextMenu
*/
private void refreshContextMenu() {
- //refresh contextMenu
+ // refresh contextMenu
this.getControl().setMenu(getContextMenu().createContextMenu(this.getControl()));
- RootEditPart rootEditPart = getRootEditPart();
- List children = rootEditPart.getChildren();
- if (children != null) {
- List<TimelineEditPart> editParts = ((EditPart) children.get(0)).getChildren();
- for (TimelineEditPart editPart : editParts) {
- List<TimelineEditPart> childEditParts = editPart.getChildren();
- for(TimelineEditPart treeEditPart : childEditParts) {
- TimeTreeElement treeElement = treeEditPart.getTimeElement();
- if(treeElement != null) {
- treeElement.createContextMenu();
- }
- }
- }
- }
+ RootEditPart rootEditPart = getRootEditPart();
+ List children = rootEditPart.getChildren();
+ if (children != null) {
+ List<TimelineEditPart> editParts = ((EditPart) children.get(0)).getChildren();
+ for (TimelineEditPart editPart : editParts) {
+ List<TimelineEditPart> childEditParts = editPart.getChildren();
+ for (TimelineEditPart treeEditPart : childEditParts) {
+ TimeTreeElement treeElement = treeEditPart.getTimeElement();
+ if (treeElement != null) {
+ treeElement.createContextMenu();
+ }
+ }
+ }
+ }
}
/**
* applyNonFilter
*/
private void applyNonFilter() {
- //setContents(getPage().getModel());
+ // setContents(getPage().getModel());
TimelineEditPart pageEditPart = getPageEditPart();
pageEditPart.refresh();
Tree contentTree = (Tree) getControl();
contentTree.pack();
- //refreshTimelineViewer();
+ // refreshTimelineViewer();
}
/**
});
}
+ /**
+ * Find KeyFrameUnit in Stack for z-ordering
+ *
+ * @return {@link KeyFrameUnit}
+ */
+ public List<KeyFrameUnit> findStackKeyframeUnit() {
+ List<KeyFrameUnit> keyFrameUnits = new ArrayList<KeyFrameUnit>();
+
+ KeyFrameComponent selectedkeyFrameComponent = getLastSelectedKeyframeComponent();
+
+ if (selectedkeyFrameComponent != null) {
+ KeyFrameUnit selectKeyFrameUnit = null;
+ if (selectedkeyFrameComponent instanceof KeyFrameUnit) {
+ selectKeyFrameUnit = (KeyFrameUnit) selectedkeyFrameComponent;
+ } else if (selectedkeyFrameComponent instanceof KeyFrame) {
+ selectKeyFrameUnit = ((KeyFrame) selectedkeyFrameComponent).getKeyFrameUnit();
+ }
+
+ if (selectKeyFrameUnit != null) {
+ TimeTreeElement timeTreeElement = selectKeyFrameUnit.getTimeTreeElement();
+ keyFrameUnits.add((KeyFrameUnit) selectKeyFrameUnit);
+ timeTreeElement.addKeyFrameUnit(selectKeyFrameUnit, keyFrameUnits);
+ }
+ }
+ return keyFrameUnits;
+ }
+
/**********************************************************************************************
* Getter, Setter
**********************************************************************************************/
private TimelineEditPart getPageEditPart() {
return (TimelineEditPart) getRootEditPart().getChildren().get(0);
}
+
/*****************************************************************************************
* Listener , Event
*****************************************************************************************/
--- /dev/null
+\r
+\r
+package org.tizen.webuibuilder.animator.ui.views.timeline.action;\r
+\r
+import org.eclipse.gef.EditPartViewer;\r
+import org.eclipse.jface.action.Action;\r
+import org.tizen.webuibuilder.animator.model.AnimatorModelEvent;\r
+import org.tizen.webuibuilder.animator.model.AnimatorModelManager;\r
+import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineViewer;\r
+import org.tizen.webuibuilder.animator.ui.views.timeline.tree.TimeTreeElement;\r
+import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrameUnit;\r
+import org.tizen.webuibuilder.animator.utils.AnimatorUtils;\r
+\r
+\r
+public class ZOrderKeyFrameAction extends Action {\r
+\r
+ private EditPartViewer editPartViewer = null;\r
+ private KeyFrameUnit keyFrameUnit = null;\r
+\r
+ public ZOrderKeyFrameAction(KeyFrameUnit keyFrameUnit, EditPartViewer editPartViewer) {\r
+ super(null);\r
+\r
+ this.keyFrameUnit = keyFrameUnit;\r
+ this.editPartViewer = editPartViewer;\r
+\r
+ setText(keyFrameUnit.getModel().getName());\r
+ setId(keyFrameUnit.getModel().getName());\r
+ }\r
+\r
+ public void run() {\r
+\r
+ if (keyFrameUnit != null) {\r
+ TimelineViewer viewer = (TimelineViewer) editPartViewer;\r
+ keyFrameUnit.selected();\r
+ viewer.setLastSelectedKeyframeComponent(keyFrameUnit);\r
+\r
+ TimeTreeElement timeTreeElement = keyFrameUnit.getTimeTreeElement();\r
+ timeTreeElement.redraw();\r
+\r
+ AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();\r
+ manager.fireEvent(AnimatorModelEvent.EventType.SELECTION_CHANGE,\r
+ AnimatorModelEvent.Origin.TIMELINE, keyFrameUnit.getModel());\r
+ }\r
+ }\r
+}\r
public static String CUT_KEYFRAME;
public static String PASTE_KEYFRAME;
+ public static String Z_ORDER;
+
public static String NEW_ANIMATION_GROUP;
public static String DELETE_ANIMATION_GROUP;
public static String EDIT_ANIMATION_GROUP;
CUT_KEYFRAME = &Cut\tCtrl+X
PASTE_KEYFRAME = &Paste\tCtrl+V
+Z_ORDER = Bring to front
+
NEW_ANIMATION_GROUP = New animation group
DELETE_ANIMATION_GROUP = Delete animation group
EDIT_ANIMATION_GROUP = Show and Edit animation group
TimelineConstants.DEFAULT_TIMEELEMENT_ZOOMIN_HEIGHT);
}
-
@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
// TODO Auto-generated method stub
}
-
/*******************************************************************************
* Class Method
*******************************************************************************/
if (keyframeUnit.getModel().getId().equals(keyframe.getId())) {
keyframeUnit.deleteChild(model);
int size = keyframeUnit.getKeyframelist().size();
- if(size == 0) {
+ if (size == 0) {
keyframeUnits.remove(keyframeUnit);
}
break;
// System.out.println("startTime " + startTime + " durationTime " + durationTime);
Command animationPropertyChange =
- new TimelineKeyframeEditCommand(keyframeUnit.getModel(), startTime,
- durationTime);
+ new TimelineKeyframeEditCommand(keyframeUnit.getModel(), startTime, durationTime);
viewer.getEditDomain().getCommandStack().execute(animationPropertyChange);
TimelineViewer viewer = getEditpart().getViewer();
viewer.getEditDomain().getCommandStack().execute(animationPropertyChange);
+ }
+ /**
+ * Add KeyFrameUnit in sameTime
+ *
+ * @param selectKeyFrameUnit
+ * {@link KeyFrameUnit}
+ *
+ * @param keyFrameUnits
+ * {@link KeyFrameUnit}
+ */
+ public void addKeyFrameUnit(KeyFrameUnit selectKeyFrameUnit, List<KeyFrameUnit> keyFrameUnits) {
+ double selectKeyFrameStart = selectKeyFrameUnit.getKeyframeUnitStartTime();
+ double selectKeyFrameDuration = selectKeyFrameUnit.getKeyframeUnitDurationTime();
+ List<KeyFrameUnit> childrenKeyframeWidget = getKeyframeUnits();
+ for (KeyFrameUnit childKeyframeWidget : childrenKeyframeWidget) {
+ if (!childKeyframeWidget.equals(selectKeyFrameUnit)) {
+
+ KeyFrameUnit currentKeyframeWidget = (KeyFrameUnit) childKeyframeWidget;
+ double currentKeyFrameStart = currentKeyframeWidget.getKeyframeUnitStartTime();
+ double currentKeyFrameDuration =
+ currentKeyframeWidget.getKeyframeUnitDurationTime();
+
+ if (selectKeyFrameStart <= currentKeyFrameStart) {
+ if (selectKeyFrameStart + selectKeyFrameDuration >= currentKeyFrameStart
+ + currentKeyFrameDuration) {
+ keyFrameUnits.add((KeyFrameUnit) childKeyframeWidget);
+ }
+ }
+ }
+ }
}
/*******************************************************************************
}
}
};
-
}