ANIMATOR : Control time in TimeText 61/19861/4
authorjinwooim.bae <jinwooim.bae@samsung.com>
Tue, 22 Apr 2014 06:47:59 +0000 (15:47 +0900)
committerjinwooim.bae <jinwooim.bae@samsung.com>
Tue, 22 Apr 2014 07:56:41 +0000 (16:56 +0900)
This is new composite for control time selection.

Change-Id: I98c60fac55dcbd01ead97c08dd8f49d87bf8fa4a
Signed-off-by: jinwooim.bae <jinwooim.bae@samsung.com>
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/TimelineContentContainer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/TimelinePage.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/common/Formatter.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/header/PlayHeader.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/header/TimeBar.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/tool/TimelineToolbar.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/tree/TimeTreeElement.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/utils/AnimatorUtils.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/editor/PageDesigner.java

index 9b70e56..783c3f0 100644 (file)
@@ -131,12 +131,6 @@ public class TimelineContentContainer extends Composite {
         playHeaderLine.setSize(1, 1);
         playHeaderLine.setBackground(ColorResource.BLACK);
 
-        playHeaderLine.addPaintListener(new PaintListener() {
-            public void paintControl(PaintEvent e) {
-                refreshPlayHeader(true);
-            }
-        });
-
         contentTreeContainer.setContent(contentTree);
 
         // Content Tools Container
@@ -148,6 +142,27 @@ public class TimelineContentContainer extends Composite {
         contentToolsContainerFormData.right = new FormAttachment(100);
         contentToolsContainer.setLayoutData(contentToolsContainerFormData);
 
+        playHeaderLine.addPaintListener(new PaintListener() {
+            public void paintControl(PaintEvent e) {
+                refreshPlayHeader(true);
+            }
+        });
+
+        contentTreeContainer.addControlListener(new ControlListener() {
+
+            @Override
+            public void controlResized(ControlEvent e) {
+                refreshPlayHeader(true);
+
+            }
+
+            @Override
+            public void controlMoved(ControlEvent e) {
+                // TODO Auto-generated method stub
+
+            }
+        });
+
         contentHeaderContainer.getOutlineHeader().addControlListener(new ControlListener() {
             @Override
             public void controlMoved(ControlEvent e) {
@@ -170,8 +185,8 @@ public class TimelineContentContainer extends Composite {
                 if (Platform.getOS().equals(Platform.OS_WIN32)) {
                     SEPERATOR_WIDTH = 5;
                     OUTLINE_WIDTH = 2;
-                } else if (Platform.getOS().equals(Platform.OS_LINUX) || 
-                        Platform.getOS().equals(Platform.OS_MACOSX)) {
+                } else if (Platform.getOS().equals(Platform.OS_LINUX)
+                        || Platform.getOS().equals(Platform.OS_MACOSX)) {
                     SEPERATOR_WIDTH = 1;
                     OUTLINE_WIDTH = 0;
                     EXPANDCOLUMN_WIDTH = 1;
@@ -316,7 +331,7 @@ public class TimelineContentContainer extends Composite {
                     contentTree.getColumn(0).getWidth() + contentTree.getColumn(1).getWidth()
                             + contentTree.getColumn(2).getWidth() + 9;// borderwidth;
         }
-        
+
         return prePoint;
     }
 
@@ -346,10 +361,12 @@ public class TimelineContentContainer extends Composite {
      *            current playheader position time
      * @param path
      *            left moving is 0, right moving is 1
-     * @param viewer
-     *            {@link TimelineViewer}
+     * @param incrementSize
+     *            left moving is -1, right moving is 1
+     * @param scrollMove
+     *            non move is 0, move is 1, have to move 2
      */
-    public void refreshHScroll(double pointTime, int path, int incrementSize, boolean scrollMove) {
+    public void refreshHScroll(double pointTime, int path, int incrementSize, int scrollMove) {
 
         TimeBar timeBar = contentHeaderContainer.getKeyframeHeader().getTimeBar();
 
@@ -382,27 +399,30 @@ public class TimelineContentContainer extends Composite {
         ScrollBar hScroll = contentToolsContainer.gethScroll();
         int lastTimeSel = (int) (lastTime * TimelineConstants.DEFAULT_TIME_INTERVAL);
 
-        if (scrollMove == true) {
-            int increment = lastTimeSel / TimelineConstants.DEFAULT_HSCROLL_SELECTION_INTERVAL;
-            hScroll.setSelection(increment * TimelineConstants.DEFAULT_HSCROLL_SELECTION_INTERVAL);
-        }
-
         if (lastTimeSel <= TimelineConstants.DEFAULT_HSCROLL_SIZE) {
             hScroll.setMaximum(TimelineConstants.DEFAULT_HSCROLL_SIZE);
         } else {
             hScroll.setMaximum(lastTimeSel + TimelineConstants.DEFAULT_HSCROLL_EXPANSION);
         }
 
+        if (scrollMove == 1 || scrollMove == 2) {
+            int increment = lastTimeSel / TimelineConstants.DEFAULT_HSCROLL_SELECTION_INTERVAL;
+            hScroll.setSelection(increment * TimelineConstants.DEFAULT_HSCROLL_SELECTION_INTERVAL);
+        }
+
         // start Time
-        if (path == 0 && (startTime <= 0.0)) {
+        if ((path == 0 && (startTime <= 0.0)) || ((pointTime <= 2) && scrollMove == 2)) {
             startTime = 0.0;
             hScroll.setSelection(0);
+        } else if (scrollMove == 2) {
+            // last Time
+            startTime = (pointTime - 2) * 10.0;
         } else {
             // last Time
             startTime = startTime + (incrementSize / timeBar.getScale());
         }
 
-        if (scrollMove == true) {
+        if (scrollMove == 1 || scrollMove == 2) {
 
             timeBar.setStartTime(startTime);
             timeBar.redraw();
index 3b146a0..3e8f705 100644 (file)
@@ -225,7 +225,7 @@ public class TimelinePage extends ContentOutlinePage {
                 .initialize(pagePart);
 
         // refresh h-scroll
-        getMainContainer().getContentContainer().refreshHScroll(0.0, 0, 0, false);
+        getMainContainer().getContentContainer().refreshHScroll(0.0, 0, 0, 0);
 
         if (animatorBrowserViwer != null) {
             viewer.setContents(model);
@@ -297,7 +297,7 @@ public class TimelinePage extends ContentOutlinePage {
                     .initialize((AnimatorPagePart)pagePart);
 
             // refresh h-scroll
-            getMainContainer().getContentContainer().refreshHScroll(0.0, 0, 0, false);
+            getMainContainer().getContentContainer().refreshHScroll(0.0, 0, 0, 0);
 
             if (animatorBrowserViwer != null) {
                 viewer.setContents(model);
index 5f7a4bc..2302a18 100644 (file)
@@ -38,27 +38,58 @@ public class Formatter {
     public static String toTimeFormat(double time) {
         int mst = (int) time;
 
-        int ms = (int) ((time - (double) mst) * 100.00);
+        int ms = (int) ((time - (double) mst) * 1000.00);
         int minute = mst / 60;
         int second = mst % 60;
 
         String strMinute = Long.toString(minute);
-        if (strMinute.length() < 2) {
+        if (strMinute.length() == 1) {
             strMinute = "0" + strMinute; //$NON-NLS-1$
         }
 
         String strSecond = Long.toString(second);
-        if (strSecond.length() < 2) {
+        if (strSecond.length() == 1) {
             strSecond = "0" + strSecond; //$NON-NLS-1$
         }
 
         String strMs = Long.toString(ms);
-        if (strMs.length() < 2) {
+        if (strMs.length() == 1) {
+            strMs = "00" + strMs; //$NON-NLS-1$
+        } else if (strMs.length() == 2) {
             strMs = "0" + strMs; //$NON-NLS-1$
-        } /*
-           * else if(strMs.length() < 2) { strMs = "00" + strMs; //$NON-NLS-1$ }
-           */
+        }
+
         String output = strMinute + " : " + strSecond + " . " + strMs; //$NON-NLS-1$ //$NON-NLS-2$
         return output;
     }
+
+    public static double toStringTimeFormat(String timeText) {
+
+        if (timeText == null) {
+            return 0;
+        }
+
+        String min = null;
+        String sec = null;
+        String mSec = null;
+        double minTime = 0;
+        double secTime = 0;
+        double mSecTime = 0.0;
+        double fullTime = 0.0;
+
+        String[] firstSplit = timeText.split(":");
+        int firstSplitLength = firstSplit[0].length();
+
+        min = firstSplit[0].substring(0, firstSplitLength - 1);
+        sec = firstSplit[1].substring(1, 3);
+        mSec = firstSplit[1].substring(6, 9);
+
+        minTime = Double.valueOf(min) * 60;
+        secTime = Double.valueOf(sec);
+        mSecTime = Double.valueOf(mSec) / 1000;
+
+        fullTime = minTime + secTime + mSecTime;
+
+        return fullTime;
+    }
 }
index 2e78e7e..bc0857c 100644 (file)
@@ -167,7 +167,7 @@ public class PlayHeader extends Composite {
                                     (TimelineContentContainer) ((TimelineContentHeaderContainer) (((SashForm) ((TimelineKeyframeHeader) (timebar
                                             .getParent())).getParent()).getParent())).getParent();
 
-                            contentContainer.refreshHScroll(pointTime, 1, 1, true);
+                            contentContainer.refreshHScroll(pointTime, 1, 1, 1);
                         }
                         beforePoint = rMarker.x;
 
@@ -178,7 +178,7 @@ public class PlayHeader extends Composite {
                                             .getParent())).getParent()).getParent())).getParent();
 
                             // Logger.trace("startTime : " + startTime);
-                            contentContainer.refreshHScroll(pointTime, 0, -1, true);
+                            contentContainer.refreshHScroll(pointTime, 0, -1, 1);
 
                         }
                         beforePoint = rMarker.x;
@@ -279,7 +279,7 @@ public class PlayHeader extends Composite {
 
         boolean isToolbar = searchToolBar();
         if (isToolbar == true) {
-            toolbar.getTimeText().setText(timeText);
+            toolbar.setCurrentTime(timeText);
         }
 
         Display.getDefault().asyncExec(new Runnable() {
index ad69479..70a1bc0 100644 (file)
@@ -172,15 +172,16 @@ public class TimeBar extends Canvas {
         TimelineToolbar toolBar = mainContainer.getTimelineToolbar();
         toolBar.stopPlaying();
 
-        if (positionTime < 0) {
+/*        if (positionTime < 0) {
             playHeader.setLocation(0, playHeader.getBounds().y);
             playHeader.setPositionMarker(0);
-        } else {
+        } else {*/
             playHeader.setLocation(positionTime, playHeader.getBounds().y);
             playHeader.setPositionMarker(positionTime);
-        }
+        //}
 
         double pointTime = playHeader.getPlayHeaderTime();
+        playHeader.setCurrentPointTime(pointTime);
 
         // update marker point time
         playHeader.sendPointTime(pointTime);
index 58d9000..57acab0 100644 (file)
@@ -25,13 +25,19 @@ package org.tizen.webuibuilder.animator.ui.views.timeline.tool;
 
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Pattern;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.CLabel;
 import org.eclipse.swt.events.DisposeEvent;
 import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
 import org.eclipse.swt.events.MouseAdapter;
 import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.graphics.Color;
@@ -50,6 +56,7 @@ import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.MenuItem;
 import org.eclipse.swt.widgets.ScrollBar;
+import org.eclipse.swt.widgets.Text;
 import org.tizen.webuibuilder.BuilderConstants;
 import org.tizen.webuibuilder.animator.gef.command.AnimationPropertyChangeCommand;
 import org.tizen.webuibuilder.animator.gef.viewer.AnimationEvent;
@@ -65,11 +72,13 @@ 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.ui.views.timeline.TimelineContentContainer;
 import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineMainContainer;
 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.header.TimeBar;
+import org.tizen.webuibuilder.animator.ui.views.timeline.common.Formatter;
 import org.tizen.webuibuilder.animator.ui.views.timeline.header.PlayHeader;
+import org.tizen.webuibuilder.animator.ui.views.timeline.header.TimeBar;
 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.utils.AnimatorUtils;
@@ -88,7 +97,8 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
     private Button forward = null;
     private Button repeat = null;
 
-    private CLabel timeText = null;
+    private Text timeText = null;
+    private String currentTime = null;
 
     private Button easingPanel = null;
     private Button easing = null;
@@ -155,18 +165,179 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
 
         // TimeText
         // -------------------------------------------------------------------------------
-        timeText = new CLabel(this, SWT.CENTER);
+        timeText = new Text(this, SWT.SINGLE | SWT.CENTER);
 
         FormData timeTextFormData = new FormData();
         timeTextFormData.top = new FormAttachment(0, 4);
         timeTextFormData.left = new FormAttachment(0, 269);
-        timeTextFormData.width = 117;
+        timeTextFormData.width = 113;
+        timeTextFormData.height = 21;
         timeText.setLayoutData(timeTextFormData);
-
         timeText.setBackgroundImage(ResourceManager.getImage(BuilderConstants.ICON_DIR,
                                                              "animator_toolbar_time_text.png"));
-        timeText.setForeground(ColorResource.WHITE);
-        timeText.setText("00 : 00 . 00");
+        setCurrentTime("00 : 00 . 000");
+
+        timeText.addFocusListener(new FocusListener() {
+
+            @Override
+            public void focusLost(FocusEvent e) {
+                timeText.clearSelection();
+            }
+
+            @Override
+            public void focusGained(FocusEvent e) {
+                // TODO Auto-generated method stub
+
+            }
+        });
+
+        timeText.addKeyListener(new KeyListener() {
+
+            @Override
+            public void keyReleased(KeyEvent e) {
+                // TODO Auto-generated method stub
+                char myChar = e.character;
+                int caret = timeText.getCaretPosition();
+
+                String fullTime = timeText.getText();
+                String[] first = null;
+                String[] second = null;
+                first = fullTime.split(":");
+                second = fullTime.split(Pattern.quote("."));
+
+                int firstSplit = first[0].length() - 1;
+                int secSplit = second[0].length() - 1;
+
+                boolean isNumber = Character.isDigit(myChar);
+                if (isNumber) {
+                    if (caret <= firstSplit) {
+
+                        setCurrentTime(fullTime);
+                        setTimeTextPoint();
+                        timeText.setSelection(caret);
+                    } else if (caret > firstSplit + 3 && caret <= firstSplit + 5) {
+                        int count = secSplit - firstSplit;
+                        if (count > 5) {
+                            if (firstSplit + 4 == caret) {
+                                char lastSec = second[0].charAt(second[0].length() - 2);
+                                fullTime = first[0] + ": " + myChar + lastSec + " ." + second[1];
+                            } else {
+                                char firstSec = second[0].charAt(second[0].length() - 4);
+                                fullTime = first[0] + ": " + firstSec + myChar + " ." + second[1];
+                            }
+                        } else if (count <= 4) {
+                            fullTime = first[0] + ": " + myChar + "0" + " ." + second[1];
+                        } else {
+                        }
+                        setCurrentTime(fullTime);
+                        setTimeTextPoint();
+                        timeText.setSelection(caret);
+                    } else if (caret > firstSplit + 8 && caret <= firstSplit + 11) {
+                        int count = second[1].length();
+                        if (count > 4) {
+                            fullTime = second[0] + "." + second[1].substring(0, 4);
+                        } else if (count == 0 || count == 1) {
+                            fullTime = second[0] + "." + " 000";
+                        } else if (count == 2) {
+                            fullTime = second[0] + "." + second[1].substring(0, 2) + "00";
+                        } else if (count == 3) {
+                            fullTime = second[0] + "." + second[1].substring(0, 3) + "0";
+                        }
+                        setCurrentTime(fullTime);
+                        setTimeTextPoint();
+                        timeText.setSelection(caret);
+                    } else {
+                        e.doit = false;
+                    }
+                }
+
+                if (caret > firstSplit && caret <= firstSplit + 2) {
+                    timeText.setSelection(firstSplit + 3);
+                } else if (caret > secSplit && caret < secSplit + 3) {
+                    timeText.setSelection(secSplit + 3);
+                }
+            }
+
+            @Override
+            public void keyPressed(KeyEvent e) {
+                String fullTime = timeText.getText();
+                char myChar = e.character;
+                int caret = timeText.getCaretPosition();
+
+                int selectionCount = timeText.getSelectionCount();
+
+                String[] first = null;
+                first = fullTime.split(":");
+                int firstSplit = first[0].length() - 1;
+
+                boolean isNumber = Character.isDigit(myChar);
+                if (isNumber) {
+                    if (caret <= firstSplit) {
+                    } else if ((selectionCount >= 1 && caret > firstSplit + 1 && caret <= firstSplit + 5)
+                            || (selectionCount == 0 && caret >= firstSplit + 3 && caret < firstSplit + 5)) {
+                    } else if ((selectionCount >= 1 && caret > firstSplit + 7 && caret <= firstSplit + 11)
+                            || (selectionCount == 0 && caret >= firstSplit + 8 && caret < firstSplit + 11)) {
+                    } else {
+                        e.doit = false;
+                    }
+                } else if (e.keyCode == SWT.ARROW_LEFT || e.keyCode == SWT.ARROW_RIGHT) {
+
+                } else {
+                    e.doit = false;
+                }
+            }
+        });
+
+        timeText.addMouseListener(new MouseListener() {
+
+            @Override
+            public void mouseUp(MouseEvent e) {
+                int caret = timeText.getCaretPosition();
+                String fullTime = timeText.getText();
+
+                String[] first = null;
+                String[] second = null;
+                first = fullTime.split(":");
+                second = fullTime.split(Pattern.quote("."));
+
+                int firstSplit = first[0].length() - 1;
+                int secSplit = second[0].length() - 1;
+
+                if (caret < firstSplit) {
+                    timeText.setSelection(0, firstSplit);
+                } else if (caret > firstSplit && caret <= secSplit) {
+                    timeText.setSelection(firstSplit + 3, secSplit);
+                } else if (caret > secSplit) {
+                    timeText.setSelection(secSplit + 3, secSplit + 6);
+                }
+            }
+
+            @Override
+            public void mouseDown(MouseEvent e) {
+            }
+
+            @Override
+            public void mouseDoubleClick(MouseEvent e) {
+
+            }
+        });
+
+        timeText.addListener(SWT.Paint, new Listener() {
+
+            @Override
+            public void handleEvent(Event event) {
+                GC gc = event.gc;
+                String time = timeText.getText();
+
+                gc.drawImage(ResourceManager.getImage(BuilderConstants.ICON_DIR,
+                                                      "animator_toolbar_time_text.png"), 0, 0);
+
+                if (time != null) {
+                    timeText.setForeground(ColorResource.WHITE);
+                     gc.drawText(time, 22 , 3,true);
+                }
+            }
+        });
 
         // Animation play control
         // ------------------------------------------------------------------------------
@@ -203,7 +374,7 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
                 marker.setCurrentPointTime(0.0);
                 marker.draw(true);
 
-                timeText.setText("00 : 00 . 00");
+                setCurrentTime("00 : 00 . 000");
 
                 TimelineContentToolsContainer contentToolsContainer =
                         mainContainer.getContentContainer().getContentToolsContainer();
@@ -388,7 +559,7 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
 
                 double markerTime = marker.getPlayHeaderTime();
                 String time = AnimatorUtils.convertTimetoTimeText(markerTime);
-                timeText.setText(time);
+                setCurrentTime(time);
 
                 TimelineContentToolsContainer contentToolsContainer =
                         mainContainer.getContentContainer().getContentToolsContainer();
@@ -547,15 +718,15 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
             marker.setCurrentPointTime((double) millSecond / 1000);
             if (Platform.getOS().equals(Platform.OS_WIN32)) {
                 marker.draw(false);
-            } else if (Platform.getOS().equals(Platform.OS_LINUX)) {
-                marker.draw(true);
-            } else if (Platform.getOS().equals(Platform.OS_MACOSX)) {
+            } else if (Platform.getOS().equals(Platform.OS_LINUX)
+                    || (Platform.getOS().equals(Platform.OS_MACOSX))) {
                 marker.draw(true);
             }
 
             double markerTime = marker.getPlayHeaderTime();
             String time = AnimatorUtils.convertTimetoTimeText(markerTime);
-            timeText.setText(time);
+
+            setCurrentTime(time);
             timeText.redraw();
 
         }
@@ -597,6 +768,31 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
     /*****************************************************************************************
      * Class Method
      *****************************************************************************************/
+
+    /**
+     * set TimeTextPoint
+     */
+    private void setTimeTextPoint() {
+        TimelineContentContainer contentContainer =
+                ((TimelineMainContainer) getParent()).getContentContainer();
+        TimeBar timeBar =
+                contentContainer.getContentHeaderContainer().getKeyframeHeader().getTimeBar();
+
+        double scale = timeBar.getScale();
+        double newTime = Formatter.toStringTimeFormat(currentTime);
+
+        contentContainer.refreshHScroll(newTime, 1, 0, 2);
+
+        double startTime = timeBar.getStartTime();
+        int positionTime = (int) ((newTime * (scale * 100.0)) - startTime * (scale * 10.0));
+
+        timeBar.setPosition(positionTime);
+        contentContainer.refreshPlayHeader(true);
+
+        timeText.clearSelection();
+
+    }
+
     /**
      * Set Last Animation Point
      */
@@ -634,7 +830,7 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
 
         double markerTime = marker.getPlayHeaderTime();
         String time = AnimatorUtils.convertTimetoTimeText(markerTime);
-        timeText.setText(time);
+        setCurrentTime(time);
 
         AnimatorUtils.getActiveAnimatorBrowserViewer().showAnimationAtMoment(animationGroupId,
                                                                              markerTime);
@@ -775,9 +971,9 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
                     if (!beforeEaseData.equals(easeData)) {
                         AnimationPropertyChangeCommand propertyCommand =
                                 new AnimationPropertyChangeCommand(
-                                                                        frame,
-                                                                        "-webkit-animation-timing-function",
-                                                                        easeData);
+                                                                   frame,
+                                                                   "-webkit-animation-timing-function",
+                                                                   easeData);
 
                         TimelineViewer viewer = ((TimelineMainContainer) getParent()).getViewer();
                         viewer.getEditDomain().getCommandStack().execute(propertyCommand);
@@ -845,7 +1041,7 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
         setSelectedAnimationGroupId(animationGroupId);
 
         // redraw text button
-        timeText.setText("00 : 00 . 00");
+        setCurrentTime("00 : 00 . 000");
         timeText.redraw();
 
         // redraw play button
@@ -1029,7 +1225,7 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
      * 
      * @return {@link CLabel}
      */
-    public CLabel getTimeText() {
+    public Text getTimeText() {
         return timeText;
     }
 
@@ -1071,6 +1267,15 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
         this.map = map;
     }
 
+    public String getCurrentTime() {
+        return currentTime;
+    }
+
+    public void setCurrentTime(String currentTime) {
+        this.currentTime = currentTime;
+        timeText.setText(currentTime);
+    }
+
     /*****************************************************************************************
      * Listener , Event
      *****************************************************************************************/
index 2dc635a..13c9c5c 100644 (file)
@@ -948,11 +948,11 @@ public class TimeTreeElement extends Canvas {
                     if ((parent.width - TimelineConstants.DEFAULT_TIME_INTERVAL < mouseDownPoint)
                             && (beforeMouseDownPoint < mouseDownPoint)) {
                         TimelineContentContainer container = findTimelineContentContainer();
-                        container.refreshHScroll(currentTime, 1, 1, true);
+                        container.refreshHScroll(currentTime, 1, 1, 1);
                     } else if ((TimelineConstants.DEFAULT_TIME_INTERVAL > mouseDownPoint)
                             && (beforeMouseDownPoint > mouseDownPoint)) {
                         TimelineContentContainer container = findTimelineContentContainer();
-                        container.refreshHScroll(currentTime, 0, -1, true);
+                        container.refreshHScroll(currentTime, 0, -1, 1);
                     }
                     beforeMouseDownPoint = mouseDownPoint;
 
index 88f9f97..a9fee18 100644 (file)
@@ -23,7 +23,6 @@
 
 package org.tizen.webuibuilder.animator.utils;
 
-import java.lang.reflect.Method;
 import java.math.BigDecimal;
 import java.util.Map;
 import java.util.regex.Matcher;
@@ -41,13 +40,6 @@ import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
-
-import org.eclipse.ui.internal.ILayoutContainer;
-import org.eclipse.ui.internal.PartPane;
-import org.eclipse.ui.internal.ViewPane;
-import org.eclipse.ui.internal.ViewStack;
-import org.eclipse.ui.internal.WorkbenchPage;
-import org.eclipse.ui.internal.WorkbenchPartReference;
 import org.tizen.webuibuilder.BuilderConstants;
 import org.tizen.webuibuilder.animator.AnimatorConstants;
 import org.tizen.webuibuilder.animator.gef.viewer.AnimatorBrowserViewer;
@@ -232,49 +224,6 @@ public class AnimatorUtils {
         });
     }
 
-    /**
-     * Check that passed view is on top in view stack
-     * 
-     * @param viewId
-     * @return
-     */
-    public static boolean checkViewIsOnTopInViewStack(String viewId) {
-        boolean isOnTop = false;
-
-        IWorkbenchPage activePage =
-                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-        if (activePage instanceof WorkbenchPage) {
-            IViewReference refereceView = activePage.findViewReference(viewId);
-            if (refereceView == null) {
-                return isOnTop;
-            }
-
-            try {
-                Method setItemHeightMethod =
-                        WorkbenchPartReference.class.getDeclaredMethod("getPane");
-
-                setItemHeightMethod.setAccessible(true);
-                Object invoke = setItemHeightMethod.invoke(refereceView);
-                if (invoke instanceof ViewPane) {
-                    ILayoutContainer container = ((ViewPane) invoke).getContainer();
-                    if (container instanceof ViewStack) {
-                        PartPane selectedViewPane = ((ViewStack) container).getSelection();
-                        if (selectedViewPane.getID().equals(viewId)) {
-                            isOnTop = true;
-                        } else {
-                            isOnTop = false;
-                        }
-                    }
-                }
-                setItemHeightMethod.setAccessible(false);
-            } catch (Exception exception) {
-                exception.printStackTrace();
-            }
-        }
-
-        return isOnTop;
-    }
-
     /*****************************************************************************************
      * Start : Tizen Web UI Builder Utils
      *****************************************************************************************/
index 712be3f..b980552 100644 (file)
@@ -768,7 +768,11 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
                     preview.prepareToShow();
                     enableDesignerMode();
                 } else if (tabs.getSelectionIndex() == ANIMATOR_TAB) {
-                    enableAnimatorMode();
+                    if(animatorTabItem.getControl() == null) {
+                        tabs.setSelection(DESIGN_TAB);
+                    } else {
+                        enableAnimatorMode();
+                    }
                 }
             }
         });
@@ -1480,12 +1484,8 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
             }
         }
 
-        boolean isOnTop =
-                AnimatorUtils
-                        .checkViewIsOnTopInViewStack(AnimatorConstants.ANIMATOR_TIMELINE_VIEW_ID);
-        if (!isOnTop) {
-            AnimatorUtils.bringToTopInViewStack(AnimatorConstants.ANIMATOR_TIMELINE_VIEW_ID);
-        }
+        AnimatorUtils.bringToTopInViewStack(AnimatorConstants.ANIMATOR_TIMELINE_VIEW_ID);
+
         if (properties != null) {
             properties.setPropertiesMode(PropertiesMode.ANIMATOR);
         }