Merge remote-tracking branch 'origin/develop' into tizen 44/18744/1
authoryonghwan82.jeon <yonghwan82.jeon@samsung.com>
Mon, 31 Mar 2014 07:46:09 +0000 (16:46 +0900)
committeryonghwan82.jeon <yonghwan82.jeon@samsung.com>
Mon, 31 Mar 2014 07:46:09 +0000 (16:46 +0900)
* origin/develop:
  ANIMATOR : Change keyframe add/edit policy Add only property that user put in and write tempolary computed properties to CSS
  PROP : Refactoring code about properties. Advanced string/double compare code. Removes inner classes.
  DATABIND : Remove NPE.
  UIB: remove NPE

Change-Id: I4b004d125394b5dd496e22c52a8c92381f73e672
Signed-off-by: yonghwan82.jeon <yonghwan82.jeon@samsung.com>
34 files changed:
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/action/AnimatorKeyHandler.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/command/AnimationCreateAndChangeFrameCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/policies/AnimatorDragEditPolicy.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/viewer/AnimatorBrowserViewer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/AnimationPathModel.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/AnimatorFrame.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/AnimatorKeyframe.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/AnimatorModelManager.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/AnimatorSelector.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/AnimatorWidget.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/deserializer/AnimatorKeyframeDeserializer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/utils/AnimatorUtils.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/utils/Constants.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/CommandUtil.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/PastePartCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/figure/SelectionBorder.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/viewer/HoverBrowserViewer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/app/io/HtmlMetaReader_ver_1.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/html/io/HtmlReader.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/io/CodeGenerator.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/io/PageReader_ver_1.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/io/PageReader_ver_2.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/dialog/Helper.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/action/ActionAnimationGroupComposite.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/action/ActionCustomEventComposite.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/action/ActionExpanderbleTriggerM.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/action/ActionGoToPageComposite.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/ClipMethod.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/ColorData.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/ColorFillMethod.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/NewColorMethod.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/TextEditor.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/UserColorData.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/style/CssStyleAnimationEventDelegater.java

index b6d8ffa..18e5b5a 100644 (file)
@@ -23,6 +23,9 @@
 
 package org.tizen.webuibuilder.animator.action;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.eclipse.draw2d.geometry.Point;
 import org.eclipse.draw2d.geometry.Rectangle;
 import org.eclipse.gef.GraphicalViewer;
@@ -34,9 +37,14 @@ import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.KeyEvent;
+import org.tizen.webuibuilder.animator.gef.command.AnimationCreateAndChangeFrameCommand;
 import org.tizen.webuibuilder.animator.gef.command.AnimatorChangeLayoutCommand;
 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.AnimatorPart;
+import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
 import org.tizen.webuibuilder.model.Part;
 
 
@@ -85,13 +93,41 @@ public class AnimatorKeyHandler extends GraphicalViewerKeyHandler {
                     if (editPart instanceof AnimatorEditPart) {
                        AnimatorPart part = (AnimatorPart) ((AnimatorEditPart) editPart).getModel();
                         Rectangle originalRect = part.getOriginalPosition();
-                        Rectangle movedRect =
-                                new Rectangle(part.getAniPosition().x + delta.x,
-                                              part.getAniPosition().y + delta.y,
-                                              part.getAniPosition().width,
-                                              part.getAniPosition().height);
+//                        Rectangle movedRect =
+//                                new Rectangle(part.getAniPosition().x + delta.x,
+//                                              part.getAniPosition().y + delta.y,
+//                                              part.getAniPosition().width,
+//                                              part.getAniPosition().height);
+//
+//                        command.add(new AnimatorChangeLayoutCommand(part, movedRect, originalRect));
+                       
+                        int left = 0;
+                        int top = 0;
+                        if (part.getPositionMode() == Part.PositionMode.ABSOLUTE_POSITION) {
+                            left = part.getAniPosition().x + delta.x;
+                            top = part.getAniPosition().y + delta.y;
+                        } 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());
+                       String animationGroupId =
+                                       AnimatorUtils.getActiveAnimatorBrowserViewer().getCurrentAnimationGroupId();
 
-                        command.add(new AnimatorChangeLayoutCommand(part, movedRect, originalRect));
+                        AnimatorSelector selector = 
+                                       animatorModelManager.findAnimatorSelector(animationGroupId, part,
+                                                                          part.getUiSelector());
+                        
+                        double currentTime = AnimatorUtils.getActiveAnimatorBrowserViewer().getPointTime();
+                        
+                        Map<String, String> properties = new HashMap<String, String>();
+                        properties.put("translateX", left + "px");
+                        properties.put("translateY", top + "px");
+                        
+                        command.add(new AnimationCreateAndChangeFrameCommand(selector, currentTime, properties,
+                                                                                                               AnimatorModelEvent.Origin.EDITOR));
                     }
                 }
 
index 396da69..6cb939c 100644 (file)
@@ -23,6 +23,7 @@
 
 package org.tizen.webuibuilder.animator.gef.command;
 
+import java.util.HashMap;
 import java.util.Map;
 
 import org.eclipse.gef.commands.Command;
@@ -42,7 +43,8 @@ public class AnimationCreateAndChangeFrameCommand extends Command {
     private double currentTime = 0.0;
     private Map<String, String> properties = null;
     private AnimatorModelEvent.Origin origin = null;
-    private Map<String, String> oldProperties = null;
+    private Map<String, String> oldProperties = new HashMap<String, String>();
+    private boolean isCreate;
 
     /**
      * Constructor
@@ -70,8 +72,8 @@ public class AnimationCreateAndChangeFrameCommand extends Command {
     public void execute() {
         AnimatorModelManager animatorModelManager =
                 AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
-        oldProperties =
-                animatorModelManager.createOrEditAnimatorFrame(animatorModelManager.getModelFactory(), selector, currentTime, properties,
+        isCreate =
+                animatorModelManager.createOrEditAnimatorFrame(selector, currentTime, oldProperties, properties,
                                                                origin);
     }
 
@@ -95,6 +97,6 @@ public class AnimationCreateAndChangeFrameCommand extends Command {
         AnimatorModelManager animatorModelManager =
                 AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
         animatorModelManager.removeOrEditAnimatorFrame(selector, currentTime, oldProperties,
-                                                       properties, origin);
+                                                       properties, isCreate, origin);
     }
 }
index 4b579c9..68fd4dd 100644 (file)
@@ -47,7 +47,6 @@ import org.eclipse.gef.handles.MoveHandle;
 import org.eclipse.gef.requests.ChangeBoundsRequest;
 import org.eclipse.swt.graphics.Color;
 import org.tizen.webuibuilder.animator.gef.command.AnimationCreateAndChangeFrameCommand;
-import org.tizen.webuibuilder.animator.gef.command.AnimatorChangeLayoutCommand;
 import org.tizen.webuibuilder.animator.gef.editparts.AnimatorEditPart;
 import org.tizen.webuibuilder.animator.gef.editparts.AnimatorRootEditPart;
 import org.tizen.webuibuilder.animator.gef.tools.AnimatorDragEditPartsTracker;
@@ -244,7 +243,7 @@ public class AnimatorDragEditPolicy extends ResizableEditPolicy {
     @Override
     public Command getCommand(Request request) {
         if (REQ_MOVE.equals(request.getType())) {
-            Point moveDelta = ((ChangeBoundsRequest) request).getMoveDelta();
+            /*Point moveDelta = ((ChangeBoundsRequest) request).getMoveDelta();
             moveDelta.x /= ((AnimatorRootEditPart) getHost().getRoot()).getZoomManager().getZoom();
             moveDelta.y /= ((AnimatorRootEditPart) getHost().getRoot()).getZoomManager().getZoom();
             ((ChangeBoundsRequest) request).setMoveDelta(moveDelta);
@@ -255,7 +254,47 @@ public class AnimatorDragEditPolicy extends ResizableEditPolicy {
             return new AnimatorChangeLayoutCommand(getHost().getModel(),
                                                    ((ChangeBoundsRequest) request)
                                                            .getTransformedRectangle(rect),
-                                                   originalRect);
+                                                   originalRect);*/
+            
+            Point moveDelta = ((ChangeBoundsRequest) request).getMoveDelta();
+            moveDelta.x /= ((AnimatorRootEditPart) getHost().getRoot()).getZoomManager().getZoom();
+            moveDelta.y /= ((AnimatorRootEditPart) getHost().getRoot()).getZoomManager().getZoom();
+            ((ChangeBoundsRequest) request).setMoveDelta(moveDelta);
+            AnimatorPart part = (AnimatorPart) (getHost().getModel());
+            Rectangle rect = new Rectangle(part.getAniPosition());
+            
+            Rectangle layout = ((ChangeBoundsRequest) request)
+                    .getTransformedRectangle(rect);
+            Rectangle originalRect = part.getOriginalPosition();
+            int left = 0;
+            int top = 0;
+
+            if (part.getPositionMode() == Part.PositionMode.ABSOLUTE_POSITION) {
+                left = layout.x;
+                top = layout.y;
+            } else if (part.getPositionMode() == Part.PositionMode.RELATIVE_POSITION) {
+                left = layout.x - originalRect.x;
+                top = layout.y - originalRect.y;
+            }
+            
+               AnimatorModelManager animatorModelManager =
+                    AnimatorModelManager.getInstance(AnimatorUtils.getAppManager());
+               String animationGroupId =
+                               AnimatorUtils.getActiveAnimatorBrowserViewer().getCurrentAnimationGroupId();
+
+            AnimatorSelector selector = 
+                       animatorModelManager.findAnimatorSelector(animationGroupId, part,
+                                                              part.getUiSelector());
+            
+            double currentTime = AnimatorUtils.getActiveAnimatorBrowserViewer().getPointTime();
+            
+            Map<String, String> properties = new HashMap<String, String>();
+            properties.put("translateX", left + "px");
+            properties.put("translateY", top + "px");
+            
+            return new AnimationCreateAndChangeFrameCommand(selector, currentTime, properties,
+                                                                                               AnimatorModelEvent.Origin.EDITOR);
+            
         } else if (REQ_RESIZE.equals(request.getType())) {
             Dimension sizeDelta = ((ChangeBoundsRequest) request).getSizeDelta();
             sizeDelta.width /=
index 8f4444d..e4170ce 100644 (file)
@@ -691,7 +691,7 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer {
          */
         private void updateAnimationFW(AnimatorSelector selector, String animationGroupId,
                                        double pointTime) {
-            selector.getMergedFrames();
+            selector.updateSelectorTime();
             int delay = (int) (selector.getDelay() * 1000);
             int duration = (int) (selector.getDuration() * 1000);
             String keyFrameId = selector.getId();
@@ -711,7 +711,7 @@ public class AnimatorBrowserViewer extends HoverBrowserViewer {
          */
         private void updateAnimationFWAndDetect(AnimatorSelector selector, String animationGroupId,
                                                 double pointTime) {
-            selector.getMergedFrames();
+            selector.updateSelectorTime();
             int delay = (int) (selector.getDelay() * 1000);
             int duration = (int) (selector.getDuration() * 1000);
             String keyFrameId = selector.getId();
index b4f715f..32d215b 100644 (file)
@@ -76,7 +76,7 @@ public class AnimationPathModel implements IPropertySource {
         int top = translateInDesigner.height;
 
         int i = 0;
-        List<AnimatorFrame> mergedFrames = selector.getMergedFrames();
+        List<AnimatorFrame> mergedFrames = selector.getMergedPropertyWithWidgetProperty();
         Set<String> propertiesUsed = selector.getAllPropertiesUsed(mergedFrames);
 
         for (AnimatorFrame frame : mergedFrames) {
@@ -297,14 +297,14 @@ public class AnimationPathModel implements IPropertySource {
         int originX = 50;
         int originY = 50;
 
-        List<AnimatorFrame> frameList = selector.getMergedFrames();
+        List<AnimatorFrame> frameList = selector.getMergedPropertyWithWidgetProperty();
         for (AnimatorModel frameElement : frameList) {
             AnimatorFrame frame = ((AnimatorFrame) frameElement).getFrameLink();
 
-            left = getPixelProperty(frame, Constants.translateX, translateInDesigner.width);
-            top = getPixelProperty(frame, Constants.translateY, translateInDesigner.height);
-            width = getPixelProperty(frame, "width", width);
-            height = getPixelProperty(frame, "height", height);
+            left = getPixelProperty(((AnimatorFrame) frameElement), Constants.translateX, translateInDesigner.width);
+            top = getPixelProperty(((AnimatorFrame) frameElement), Constants.translateY, translateInDesigner.height);
+            width = getPixelProperty(((AnimatorFrame) frameElement), "width", width);
+            height = getPixelProperty(((AnimatorFrame) frameElement), "height", height);
 
             Point point = calculatePathPoint(left, top, width, height, originX, originY);
             // if (prevPoint == null || !prevPoint.equals(point)) {
@@ -313,13 +313,15 @@ public class AnimationPathModel implements IPropertySource {
             int curveIndex = 0;
             CssValueForLocation css =
                     new CssValueForLocation(0, 0, width, height, originX, originY);
-            for (AnimatorCurveFrame curve : frame.getCurveFrames()) {
+            if(!frameElement.equals(frameList.get(frameList.size() -1))) {
+                for (AnimatorCurveFrame curve : frame.getCurveFrames()) {
 
-                AnimationPathCurve curveForView = new AnimationPathCurve();
-                convertCurveFromModel(css, curveForView, curve);
+                     AnimationPathCurve curveForView = new AnimationPathCurve();
+                     convertCurveFromModel(css, curveForView, curve);
 
-                frameForView.insertCurve(curveIndex++, curveForView);
-            }
+                     frameForView.insertCurve(curveIndex++, curveForView);
+                 }
+            }           
             points.add(frameForView);
             // }
         }
index d921688..739d425 100644 (file)
@@ -25,13 +25,16 @@ package org.tizen.webuibuilder.animator.model;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
+import org.eclipse.draw2d.geometry.Point;
 import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
+import org.tizen.webuibuilder.animator.utils.Constants;
 
 
 /**
@@ -110,6 +113,113 @@ public class AnimatorFrame extends AnimatorModel {
     public void subtractFrameTime(double time) {
         this.frameTime -= time;
     }
+    
+    /**
+     * Whether contains key or not
+     * 
+     * @param key
+     * @return true false
+     */
+    public boolean containsKey(String key) {
+        return this.properties.containsKey(key);
+    }
+
+    /**
+     * Get Curve Frames
+     * 
+     * @return List of curve frames
+     */
+    public List<AnimatorCurveFrame> getCurveFrames() {
+        return curveFrames;
+    }
+
+    /**
+     * Get Curve Frame by index
+     * 
+     * @param index
+     * @return curve frame
+     */
+    public AnimatorCurveFrame getCurveFrame(int index) {
+        return curveFrames.get(index);
+    }
+
+    /**
+     * Set Curve Frames
+     * 
+     * @param curveFrames
+     */
+    public void setCurveFrames(List<AnimatorCurveFrame> curveFrames) {
+        this.curveFrames = curveFrames;
+    }
+
+    /**
+     * Get Curve Frame size
+     * 
+     * @return size of curve frame
+     */
+    public int getCurveFrameSize() {
+        return this.curveFrames.size();
+    }
+
+    /**
+     * Add Curve Frame
+     * 
+     * @param curveFrame
+     */
+    public void addCurveFrame(AnimatorCurveFrame curveFrame) {
+        this.curveFrames.add(curveFrame);
+    }
+
+    /**
+     * Add Curve frame by index
+     * 
+     * @param index
+     * @param curveFrame
+     */
+    public void addCurveFrame(int index, AnimatorCurveFrame curveFrame) {
+        this.curveFrames.add(index, curveFrame);
+    }
+
+    /**
+     * Remove Curve frame by index
+     * 
+     * @param index
+     */
+    public void removeCurveFrame(int index) {
+        this.curveFrames.remove(index);
+    }
+
+    /**
+     * Get easing Property
+     * 
+     * @return easing Property
+     */
+    public String getEasingProperty() {
+        String easeData = getProperty("-webkit-animation-timing-function");
+        if (easeData == null) {
+            easeData = "ease";
+        }
+        return easeData;
+    }
+
+    /**
+     * Get Frame Link
+     * 
+     * @return frame
+     */
+    public AnimatorFrame getFrameLink() {
+        return this.frameLink;
+    }
+    
+    /**
+     * Get Frame Link
+     *
+     * @param AnimatorFrame
+     *
+     */
+    public void setFrameLink(AnimatorFrame frame) {
+       this.frameLink = frame;
+    }
 
     /**
      * Get Properties
@@ -131,7 +241,9 @@ public class AnimatorFrame extends AnimatorModel {
         Iterator<String> keyIterator = keySet.iterator();
         while (keyIterator.hasNext()) {
             String key = keyIterator.next();
-            results.put(key, getProperty(key));
+            if(getProperty(key) != null) {
+               results.put(key, getProperty(key));
+            }
         }
 
         return results;
@@ -335,112 +447,6 @@ public class AnimatorFrame extends AnimatorModel {
         return this.getComputedProperties().equals(animatorFrame.getComputedProperties());
     }
 
-    /**
-     * Whether contains key or not
-     * 
-     * @param key
-     * @return true false
-     */
-    public boolean containsKey(String key) {
-        return this.properties.containsKey(key);
-    }
-
-    /**
-     * Get Curve Frames
-     * 
-     * @return List of curve frames
-     */
-    public List<AnimatorCurveFrame> getCurveFrames() {
-        return curveFrames;
-    }
-
-    /**
-     * Get Curve Frame by index
-     * 
-     * @param index
-     * @return curve frame
-     */
-    public AnimatorCurveFrame getCurveFrame(int index) {
-        return curveFrames.get(index);
-    }
-
-    /**
-     * Set Curve Frames
-     * 
-     * @param curveFrames
-     */
-    public void setCurveFrames(List<AnimatorCurveFrame> curveFrames) {
-        this.curveFrames = curveFrames;
-    }
-
-    /**
-     * Get Curve Frame size
-     * 
-     * @return size of curve frame
-     */
-    public int getCurveFrameSize() {
-        return this.curveFrames.size();
-    }
-
-    /**
-     * Add Curve Frame
-     * 
-     * @param curveFrame
-     */
-    public void addCurveFrame(AnimatorCurveFrame curveFrame) {
-        this.curveFrames.add(curveFrame);
-    }
-
-    /**
-     * Add Curve frame by index
-     * 
-     * @param index
-     * @param curveFrame
-     */
-    public void addCurveFrame(int index, AnimatorCurveFrame curveFrame) {
-        this.curveFrames.add(index, curveFrame);
-    }
-
-    /**
-     * Remove Curve frame by index
-     * 
-     * @param index
-     */
-    public void removeCurveFrame(int index) {
-        this.curveFrames.remove(index);
-    }
-
-    /**
-     * Get easing Property
-     * 
-     * @return easing Property
-     */
-    public String getEasingProperty() {
-        String easeData = getProperty("-webkit-animation-timing-function");
-        if (easeData == null) {
-            easeData = "ease";
-        }
-        return easeData;
-    }
-
-    /**
-     * Get Frame Link
-     * 
-     * @return frame
-     */
-    public AnimatorFrame getFrameLink() {
-        return this.frameLink;
-    }
-    
-    /**
-     * Get Frame Link
-     *
-     * @param AnimatorFrame
-     *
-     */
-    public void setFrameLink(AnimatorFrame frame) {
-       this.frameLink = frame;
-    }
 
     /**
      * Get css string
@@ -451,10 +457,8 @@ public class AnimatorFrame extends AnimatorModel {
      * @return css string from animation for this frame
      * 
      */
-    public String getCssString(Set<String> propertiesUsed, AnimatorSelector selector) {
-        // if(properties.size() == 0){//TODO this should be omitted if ...
-        // return "";
-        // }
+    /*public String getCssString(Set<String> propertiesUsed, AnimatorSelector selector) {
+        
         Map<String, String> widgetProperties = selector.getWidgetProperties(propertiesUsed);
         double duration = selector.getDuration();
 
@@ -508,6 +512,41 @@ public class AnimatorFrame extends AnimatorModel {
         builder.append("}");
         builder.append("\n");
         return builder.toString();
+    }*/
+    
+    public String getCssString(Set<String> propertiesUsed, AnimatorSelector selector) {
+        
+        Map<String, String> widgetProperties = selector.getWidgetProperties(propertiesUsed);
+        double duration = selector.getDuration();
+
+        StringBuilder builder = new StringBuilder();
+        String percent =
+                AnimatorUtils.convertPercentToString(frameTime == 0.0 ? 0.0 : frameTime / duration
+                        * 100);
+        builder.append("\n");
+        builder.append(percent);
+        builder.append("{");
+        Map<String, String> transformRelatedProperties = new HashMap<String, String>();
+        for (String key : propertiesUsed) {
+            
+            if (isTransformRelatedProperties(key)) {
+                transformRelatedProperties.put(key, properties.get(key));
+            } else {
+                builder.append("\n\t");
+                builder.append(key);
+                builder.append(":");
+                builder.append(properties.get(key));
+                builder.append(";");
+                builder.append("\n");
+            }
+        }
+        if (transformRelatedProperties.size() > 0) {
+            builder.append(createTransformProperty(transformRelatedProperties,
+                                                   (frameLink != null) ? widgetProperties : null));
+        }
+        builder.append("}");
+        builder.append("\n");
+        return builder.toString();
     }
 
     /**
@@ -548,12 +587,78 @@ public class AnimatorFrame extends AnimatorModel {
                 if (getUsedPropertiesInThisFrame().contains(key)) {
                     computedProperties.put(key, properties.get(key));
                 } else {
-                    computedProperties.put(key, widgetProperties.get(key));
+                       String computedProperty = getComputedPropertiesFromPreviousFrame(key);
+                       if(computedProperty != null) {
+                               computedProperties.put(key, computedProperty);
+                       } else {
+//                             computedProperty = getComputedPropertiesFromNextFrame(key);
+//                             if(computedProperty != null) {
+//                                     computedProperties.put(key, computedProperty);
+//                             } else {
+                                       computedProperties.put(key, widgetProperties.get(key));
+//                             }
+                       }
                 }
             }
         }
         return this.computedProperties;
     }
+    
+    public String getComputedPropertiesFromPreviousFrame(String key) {
+       AnimatorFrame previousFrame = getPreviousAnimatorFrame(this);
+       while(previousFrame != null) {
+               String value = previousFrame.getProperty(key);
+               if(value != null) {
+                       return value;
+               }
+               previousFrame = getPreviousAnimatorFrame(previousFrame);
+       }
+       
+       return null;
+    }
+    
+    private static AnimatorFrame getPreviousAnimatorFrame(AnimatorFrame frame) {
+       
+       AnimatorFrame previousFrame = null;
+       AnimatorKeyframe currentKeyframe = (AnimatorKeyframe)frame.getParent();
+       previousFrame = (AnimatorFrame)currentKeyframe.getPrevChild(frame);
+       if(previousFrame == null) {
+               AnimatorKeyframe previousKeyframe = (AnimatorKeyframe)currentKeyframe.getParent().getPrevChild(currentKeyframe);
+               if(previousKeyframe != null) {
+                       previousFrame = previousKeyframe.getLastFrame();
+               }
+       }
+       
+       return previousFrame;
+    }
+    
+    private static AnimatorFrame getNextAnimatorFrame(AnimatorFrame frame) {
+    
+       AnimatorFrame nextFrame = null;
+       AnimatorKeyframe currentKeyframe = (AnimatorKeyframe)frame.getParent();
+       nextFrame = (AnimatorFrame)currentKeyframe.getPrevChild(frame);
+       if(nextFrame == null) {
+               AnimatorKeyframe nextKeyframe = (AnimatorKeyframe)currentKeyframe.getParent().getNextChild(currentKeyframe);
+               if(nextKeyframe != null) {
+                       nextFrame = nextKeyframe.getFirstFrame();
+               }
+       }
+       
+       return nextFrame;
+    }
+    
+    public String getComputedPropertiesFromNextFrame(String key) {
+       AnimatorFrame nextFrame = getNextAnimatorFrame(this);
+       while(nextFrame != null) {
+               String value = nextFrame.getProperty(key);
+               if(value != null) {
+                       return value;
+               }
+               nextFrame = getNextAnimatorFrame(nextFrame);
+       }
+       
+       return null;
+    }
 
     /**
      * Get Computed Properties
@@ -565,6 +670,19 @@ public class AnimatorFrame extends AnimatorModel {
         Set<String> propertiesUsed = selector.getAllPropertiesUsed(selector.getMergedFrames());
         return getComputedProperties(propertiesUsed);
     }
+    
+       public void addComputedPropertiesIfNotExist(Set<String> properties) {
+               Map<String, String> computedProperties = getComputedProperties(properties);
+               Iterator<Entry<String, String>> computedPropertiesIterator = 
+                               computedProperties.entrySet().iterator();
+        while (computedPropertiesIterator.hasNext()) {
+            Entry<String, String> propertyNext = computedPropertiesIterator.next();
+            String key = propertyNext.getKey();
+            if(!getProperties().containsKey(key)) {
+               addProperty(key, propertyNext.getValue());
+            }
+        }
+    }
 
     private String createTransformProperty(Map<String, String> transformRelatedProperties,
                                            Map<String, String> widgetProperties) {
@@ -572,4 +690,71 @@ public class AnimatorFrame extends AnimatorModel {
                 new TransformationProperty(transformRelatedProperties, widgetProperties);
         return property.toPropertyString();
     }
+    
+
+    /**
+     * find animated properties
+     * 
+     * @param frame
+     * @param keyframe
+     */
+    public void findAnimatedPropertyAndSetInFrame(AnimatorFrame previousFrame, AnimatorFrame nextFrame) {
+        if(previousFrame == null || nextFrame == null) {
+               return;
+        }
+        
+        Set<String> animatedProperties = getAnimatedProperties(previousFrame, nextFrame);
+        // set the interpolated value
+        double middle =
+                (getFrameTime() - previousFrame.getFrameTime())
+                        / (nextFrame.getFrameTime() - previousFrame.getFrameTime()) * 100.0;
+        String easingProperty = previousFrame.getEasingProperty();
+        Map<String, String> previousFrameProperties = previousFrame.getComputedProperties();
+        Map<String, String> nextFrameProperties = nextFrame.getComputedProperties();
+        for (String key : animatedProperties) {
+            if (key.indexOf("color") >= 0) // TODO remove this after fixing color property
+                continue;
+            if(key.indexOf("timing-function") >=0) {
+//             frame.addProperty(key, easingProperty);
+               continue;
+            }
+            String start = previousFrameProperties.get(key);
+            String end = nextFrameProperties.get(key);
+            String interpolatedValue =
+                    getInterpolatedValue(key, start, end, middle, easingProperty);
+            addProperty(key, interpolatedValue);
+        }
+        if (previousFrame.getCurveFrames().size() > 0) {
+            Point p;
+            p =
+                    AnimationPathModel
+                            .findTranslateValueAtTime(getModelFactory(), getFrameTime(), previousFrame,
+                                                      nextFrame,
+                                                      AnimatorUtils.getEasingMethod(easingProperty));
+
+            addProperty(Constants.translateX, AnimatorUtils.convertPixToString(p.x));
+            addProperty(Constants.translateY, AnimatorUtils.convertPixToString(p.y));
+        }
+    }
+
+    private String getInterpolatedValue(String key, String start, String end, double middle,
+                                        String easingProperty) {
+        CSSProperty startValue = new CSSProperty(key, start);
+        return startValue.getInterpolcatedValue(new CSSProperty(key, end), middle,
+                                                AnimatorUtils.getEasingMethod(easingProperty));
+    }
+
+    /**
+     * 
+     * @param previousFrame
+     * @param nextFrame
+     * @return a set of animated properties
+     */
+    private Set<String> getAnimatedProperties(AnimatorFrame previousFrame, AnimatorFrame nextFrame) {
+        Set<String> properties1 = previousFrame.getProperties().keySet();
+        Set<String> properties2 = nextFrame.getProperties().keySet();
+        Set<String> union = new HashSet<String>(properties1);
+        union.addAll(properties2);
+        return union;
+    }
 }
index 1060e4f..2d19b28 100644 (file)
@@ -37,10 +37,11 @@ public class AnimatorKeyframe extends AnimatorModel {
     private List<String> names = new ArrayList<String>();
     private double duration = 0.0;
     private double delay = 0.0;
-
+    
     public AnimatorKeyframe() {
                // TODO Auto-generated constructor stub
        }
+  
 
        /**
      * Set initial property member value
@@ -49,7 +50,7 @@ public class AnimatorKeyframe extends AnimatorModel {
      * @param duration
      * @param delay
      */
-    public void setNames(String name) {
+    public void setName(String name) {
         if (name != null) {
             String[] array = name.split(",");
 
@@ -58,24 +59,36 @@ public class AnimatorKeyframe extends AnimatorModel {
             }
         }
     }
-
-    /**
+    
+   
+       /**
      * Get merged animation names
      * 
      * @return String
      */
     public String getName() {
         String result = "";
+        String previousElement = null;
         for (int i = 0; i < names.size(); i++) {
             String element = names.get(i);
             if (i == 0)
                 result += element;
-            else
-                result += "," + element;
+            else {
+               if(previousElement != null) {
+                       if(previousElement.equals("custom") && element.equals("custom")) {
+                               
+                       } else {
+                               result += "," + element;
+                       }
+                }
+                
+            }
+            previousElement = names.get(i);
         }
 
         return result;
     }
+    
 
     /**
      * Add animation name If last name is custom just skip operation
@@ -83,12 +96,15 @@ public class AnimatorKeyframe extends AnimatorModel {
      * @param name
      */
     public void addName(String name) {
-        if (!name.equals("custom")) {
+        /*if (!name.equals("custom")) {
             this.names.add(name);
         } else {
             if (!names.get(names.size() - 1).equals("custom"))
                 this.names.add(name);
-        }
+        }*/
+       
+       
+        this.names.add(name);
     }
 
     /**
@@ -116,14 +132,20 @@ public class AnimatorKeyframe extends AnimatorModel {
             return this.names.get(this.names.size() - 1);
         return null;
     }
-
+    
+    
+   
+    
     /**
      * Remove last animation name
      */
     public void removeLastName() {
-        this.names.remove(this.names.size() - 1);
+       if(this.names.size() != 0) {
+               this.names.remove(this.names.size() - 1);
+       }
     }
 
+
     /**
      * Get keyframe duration
      * 
@@ -461,19 +483,20 @@ public class AnimatorKeyframe extends AnimatorModel {
                 }
                 if (nextParent != null) {
                     AnimatorFrame nextFrame = nextParent.getFirstFrame();
-                    assert !nextFrame.hasSamePropertyValue(frame) : "This should be always true, if not previous logic is corrupt";
+//                    assert !nextFrame.hasSamePropertyValue(frame) : "This should be always true, if not previous logic is corrupt";
                     // if (!nextFrame.hasSamePropertyValue(this)) {// doesn't need to, because
                     // always true; confirmation required
-                    if (merged) {
-                        previousParent.mergeFrame(nextFrame, true);
-                    } else {
-                        mergeFrame(nextFrame, true);
+                    if (!nextFrame.hasSamePropertyValue(frame)) {
+                       if (merged) {
+                               previousParent.mergeFrame(nextFrame, true);
+                               } else {
+                                       mergeFrame(nextFrame, true);
+                               }
                     }
-                    // }
                 }
             }
         } else if (keyframeChildrenSize > 1) {// case 2
-            if (getChildIndex(this) == 0) { // case 2.1 (left most case)
+            if (getChildIndex(frame) == 0) { // case 2.1 (left most case)
                 // merge left and check right
                 if (previousParent != null) {
                     AnimatorFrame previousFrame = previousParent.getLastFrame();
@@ -482,7 +505,7 @@ public class AnimatorKeyframe extends AnimatorModel {
                     }
                 }
                 // TODO check right
-            } else if (getChildIndex(this) == (keyframeChildrenSize - 1)) { // case 2.2 (right most
+            } else if (getChildIndex(frame) == (keyframeChildrenSize - 1)) { // case 2.2 (right most
                                                                             // case)
                 // merge next frame
                 if (nextParent != null) {
@@ -545,8 +568,8 @@ public class AnimatorKeyframe extends AnimatorModel {
             if (nextFrame.hasSamePropertyValue(frame)) {
                 AnimatorKeyframe nextKeyframe =
                         selector.createKeyframe(getLastName(), frame.getFrameTime());
-                splitFrame(nextKeyframe, nextFrame, true);
                 removeLastName();
+                splitFrame(nextKeyframe, nextFrame, true);
                 selector.addChild(nextKeyframe);
             }
         }
@@ -556,8 +579,8 @@ public class AnimatorKeyframe extends AnimatorModel {
             if (previousFrame.hasSamePropertyValue(frame)) {
                 AnimatorKeyframe currentKeyframe =
                         selector.createKeyframe(getLastName(), frame.getFrameTime());
-                splitFrame(currentKeyframe, frame, true);
                 removeLastName();
+                splitFrame(currentKeyframe, frame, true);
                 selector.addChild(currentKeyframe);
             }
         }
index 74e6556..37ca0a8 100644 (file)
 package org.tizen.webuibuilder.animator.model;
 
 import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.Set;
 
-import org.eclipse.draw2d.geometry.Point;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.IEditorPart;
@@ -50,7 +46,6 @@ import org.tizen.webuibuilder.animator.model.descriptor.AnimatorDescriptorManage
 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.animator.utils.Constants;
 import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.model.app.AppManager;
 import org.tizen.webuibuilder.model.app.AppManagerForHTML;
@@ -674,18 +669,16 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
                 for (AnimatorFrame frame : frames) {
                     keyframe.addChild(frame, false);
                 }
-            }
-        }
-
-        if (keyframe != null) {
-            animatorSelector.addChild(keyframe);
-            if (animatorSelector.mergeKeyframe(keyframe)) {
-                animatorSelector.removeChild(keyframe);
-                eventSource.fireEvent(AnimatorModelEvent.EventType.KEYFRAME_REMOVE, origin,
-                                      keyframe);
-            } else {
-                eventSource.fireEvent(true, animatorSelector,
-                                      AnimatorModelEvent.EventType.KEYFRAME_ADD, origin, keyframe);
+                
+                animatorSelector.addChild(keyframe);
+                if (animatorSelector.mergeKeyframe(keyframe)) {
+                    animatorSelector.removeChild(keyframe);
+                    eventSource.fireEvent(AnimatorModelEvent.EventType.KEYFRAME_REMOVE, origin,
+                                          keyframe);
+                } else {
+                    eventSource.fireEvent(true, animatorSelector,
+                                          AnimatorModelEvent.EventType.KEYFRAME_ADD, origin, keyframe);
+                }
             }
         }
     }
@@ -747,7 +740,9 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
             selector.addChild(keyframe);
 //            copyPropertiesInLeftOrRightFrame(frame, keyframe);
         } else {// case 2
-            findAnimatedPropertyAndSetInFrame(frame, keyframe);
+               frame.findAnimatedPropertyAndSetInFrame((AnimatorFrame) keyframe.getPrevChild(frame),
+                               (AnimatorFrame) keyframe.getNextChild(frame));
+//            findAnimatedPropertyAndSetInFrame(frame, keyframe);
         }
 
         eventSource.fireEvent(AnimatorModelEvent.EventType.FRAME_ADD, origin, frame);
@@ -785,7 +780,7 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
      * @param frame
      * @param keyframe
      */
-    private void findAnimatedPropertyAndSetInFrame(AnimatorFrame frame, AnimatorKeyframe keyframe) {
+/*    private void findAnimatedPropertyAndSetInFrame(AnimatorFrame frame, AnimatorKeyframe keyframe) {
         AnimatorFrame previousFrame = (AnimatorFrame) keyframe.getPrevChild(frame);
         AnimatorFrame nextFrame = (AnimatorFrame) keyframe.getNextChild(frame);
         if(previousFrame == null || nextFrame == null) {
@@ -831,7 +826,7 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
         CSSProperty startValue = new CSSProperty(key, start);
         return startValue.getInterpolcatedValue(new CSSProperty(key, end), middle,
                                                 AnimatorUtils.getEasingMethod(easingProperty));
-    }
+    }*/
 
     /**
      * 
@@ -839,13 +834,13 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
      * @param nextFrame
      * @return a set of animated properties
      */
-    private Set<String> getAnimatedProperties(AnimatorFrame previousFrame, AnimatorFrame nextFrame) {
+    /*private Set<String> getAnimatedProperties(AnimatorFrame previousFrame, AnimatorFrame nextFrame) {
         Set<String> properties1 = previousFrame.getProperties().keySet();
         Set<String> properties2 = nextFrame.getProperties().keySet();
         Set<String> union = new HashSet<String>(properties1);
         union.addAll(properties2);
         return union;
-    }
+    }*/
 
     /**
      * Edit Animator frame
@@ -881,20 +876,39 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
      * @param properties
      * @param origin
      */
-    public Map<String, String> createOrEditAnimatorFrame(AnimatorModelFactory modelFactory,
-                                                                                                        AnimatorSelector selector,
+    public boolean createOrEditAnimatorFrame(AnimatorSelector selector,
                                                          double currentTime,
+                                                         Map<String, String> oldProperties,
                                                          Map<String, String> properties,
                                                          Origin origin) {
-        Map<String, String> oldProperties = new HashMap<String, String>();
-        AnimatorFrame frame = selector.getOrCreateAnimatorFrame(currentTime);
+        boolean isCreate = true;
+        AnimatorFrame frame = selector.getAnimatorFrameByCurrentTime(currentTime);
+        if(frame != null) {
+               isCreate = false;
+        } else {
+               frame = selector.getOrCreateAnimatorFrame(currentTime);
+        }              
+        
         if (frame != null) {
+               AnimatorKeyframe currentKeyframe = (AnimatorKeyframe)frame.getParent();
+            AnimatorKeyframe previousParent = (AnimatorKeyframe) selector.getPrevChild(currentKeyframe);
+            int keyframeChildrenSize = currentKeyframe.getChildrenSize();
+            if (keyframeChildrenSize == 1) {
+                if (currentKeyframe.getChildIndex(frame) == 0) {
+                    if (previousParent != null) {
+                       if(previousParent.getChildrenSize() == 1) {
+                               AnimatorFrame previousFrame = previousParent.getLastFrame();
+                            previousFrame.addComputedPropertiesIfNotExist(properties.keySet());
+                       }
+                    }
+                }
+            }
             oldProperties = frame.getProperties(properties.keySet());
             frame.addOrEditProperties(properties);
         }
 
         eventSource.fireEvent(AnimatorModelEvent.EventType.FRAME_EDIT, origin, frame);
-        return oldProperties;
+        return isCreate;
     }
 
     /**
@@ -908,14 +922,18 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
      */
     public void removeOrEditAnimatorFrame(AnimatorSelector selector, double currentTime,
                                           Map<String, String> oldProperties,
-                                          Map<String, String> properties, Origin origin) {
+                                          Map<String, String> properties, boolean isCreate, Origin origin) {
         AnimatorKeyframe keyframe = selector.getCurrentKeyframe(currentTime);
         if (keyframe != null) {
             AnimatorFrame frame = keyframe.getFrameByCurrentTime(currentTime);
             if (frame != null) {
                 frame.removeOrReplaceProperties(oldProperties, properties);
+                if (frame.getPropertySize() == 0 && isCreate) {
+                       AnimatorKeyframe currentKeyframe = (AnimatorKeyframe)frame.getParent();
+                       currentKeyframe.removeChild(frame, true);
+                       currentKeyframe.removeLastName();
+                }
                 if (frame.getPropertySize() == 0) {
-                    keyframe.removeChild(frame, true);
                     eventSource.fireEvent(AnimatorModelEvent.EventType.FRAME_REMOVE, origin, frame);
                 } else
                     eventSource.fireEvent(AnimatorModelEvent.EventType.FRAME_EDIT, origin, frame);
@@ -946,7 +964,8 @@ public class AnimatorModelManager implements ISelectionListener, IPageDataSetLis
     public void removeAnimatorFrame(AnimatorModel model, String name, Origin origin) {
         AnimatorFrame frame = (AnimatorFrame) model;
         AnimatorKeyframe keyframe = (AnimatorKeyframe) frame.getParent();
-        keyframe.removeName(name);
+//        keyframe.removeName(name);
+//        keyframe.removeLastName();
 
         keyframe.removeChild(frame, true);
         eventSource.fireEvent(AnimatorModelEvent.EventType.FRAME_REMOVE, origin, frame);
index c4fb6d2..27efff8 100644 (file)
@@ -195,6 +195,7 @@ public class AnimatorSelector extends AnimatorModel {
     public double calculateMergeFrameTime(double currentTime) {
         return currentTime - getDelay();
     }
+    
 
     /*
      * (non-Javadoc)
@@ -298,7 +299,7 @@ public class AnimatorSelector extends AnimatorModel {
         }
     }
 
-    private void updateSelectorTime() {
+    public void updateSelectorTime() {
 
         // TODO find max delay value
         double maxDelay = AnimatorConstants.ANIMATOR_MAX_START_TIME;
@@ -375,6 +376,43 @@ public class AnimatorSelector extends AnimatorModel {
         }
         return frames;
     }
+    
+    public List<AnimatorFrame> getMergedPropertyWithWidgetProperty() {
+       
+       List<AnimatorFrame> mergedFrames = getMergedFrames();
+       Set<String> propertiesUsed = getAllPropertiesUsed(mergedFrames);
+       Map<String, String> widgetProperties = getWidgetProperties(propertiesUsed);
+       
+       for(AnimatorFrame mergedFrame : mergedFrames) {
+               for(String key : propertiesUsed) {
+                       if(!mergedFrame.getUsedPropertiesInThisFrame().contains(key)) {
+                               int index = mergedFrames.indexOf(mergedFrame);
+                               if(index != 0) { // not first frame
+                                       if(index == mergedFrames.size() -1){ //last frame
+                                               AnimatorFrame previousFrame = mergedFrames.get((mergedFrames.indexOf(mergedFrame) - 1));
+                                               mergedFrame.addProperty(key, previousFrame.getProperty(key));
+                                       } else { //middle frame
+                                                       AnimatorFrame previousFrame = mergedFrames.get(index - 1);
+                                               mergedFrame.addProperty(key, previousFrame.getProperty(key));
+                                       }
+                               } else { //first frame
+                                       if(mergedFrame.getParent().getChildrenSize() == 1) { // if it is only frame in keyframe
+                                               AnimatorFrame nextFrame = mergedFrames.get(index + 1);
+                                               if(nextFrame != null) {
+                                                       mergedFrame.addProperty(key, nextFrame.getProperty(key));
+                                               } else {
+                                                       mergedFrame.addProperty(key, widgetProperties.get(key));
+                                               }
+                                       } else {
+                                               mergedFrame.addProperty(key, widgetProperties.get(key));
+                                       }
+                               }
+                       }
+               }
+       }
+       
+       return mergedFrames;
+    }
 
     /**
      * Create keyframe
@@ -385,7 +423,7 @@ public class AnimatorSelector extends AnimatorModel {
      */
     public AnimatorKeyframe createKeyframe(String name, double frameTime) {        
         AnimatorKeyframe keyframe = (AnimatorKeyframe)getModelFactory().createAnimatorModel(AnimatorModelType.KEYFRAME);
-        keyframe.setNames(name);
+        keyframe.setName(name);
         keyframe.setDuration(0.0);
         keyframe.setDelay(frameTime);
         keyframe.setParent(this);
@@ -481,14 +519,13 @@ public class AnimatorSelector extends AnimatorModel {
 
         if (previousKeyframe != null) {
             AnimatorFrame previousFrame = previousKeyframe.getLastFrame();
-            copyLeftPropertiesToAllFramesInKeyframe(previousFrame, keyframe);
+//            copyLeftPropertiesToAllFramesInKeyframe(previousFrame, keyframe);
 
             if (previousFrame != null) {
                 if (!previousFrame.hasSamePropertyValue(keyframe.getFirstFrame())) {
                     previousKeyframe.mergeFrame(keyframe.getFirstFrame(), true);
                     keyframe = previousKeyframe;
                     result = true;
-
                 }
             }
         }
@@ -511,7 +548,7 @@ public class AnimatorSelector extends AnimatorModel {
      * @param previousFrame
      * @param keyframe
      */
-    private void copyLeftPropertiesToAllFramesInKeyframe(AnimatorFrame previousFrame,
+/*    private void copyLeftPropertiesToAllFramesInKeyframe(AnimatorFrame previousFrame,
                                                          AnimatorKeyframe keyframe) {
         List<AnimatorModel> frames = keyframe.getChildren();
         for (AnimatorModel frameModel : frames) {
@@ -535,7 +572,7 @@ public class AnimatorSelector extends AnimatorModel {
                 }
             }
         }
-    }
+    }*/
 
     /**
      * Get css string
@@ -545,7 +582,6 @@ public class AnimatorSelector extends AnimatorModel {
      * @return css string from animation for this selector
      */
     public String getCssString(AnimatorModelFactory modelFactory) {
-        // String separator = System.getProperty( "line.separator" );
         StringBuilder builder = new StringBuilder("\n");
         if (getChildrenSize() > 0) {
             String id = this.getId();
@@ -590,54 +626,6 @@ public class AnimatorSelector extends AnimatorModel {
     }
 
     /**
-     * Create Predefined frames for predefined animation
-     * 
-     * @param preDefinedAnimationDescriptor
-     * @param delay
-     * @return
-     */
-    /*public List<AnimatorFrame> createPredefinedFrames(CssAnimationDescriptor preDefinedAnimationDescriptor,
-                                                      double delay) {
-
-        List<AnimatorFrame> frames = new ArrayList<AnimatorFrame>();
-        List<CssAnimationPropertyDescriptor> defaultKeyFrames =
-                preDefinedAnimationDescriptor.getDefaultKeyFrames();
-
-        double duration =
-                AnimatorUtils.convertTimeToDouble(preDefinedAnimationDescriptor
-                        .getPropertyValueByName(AnimatorConstants.PROPERTY_NAME_DURATION));
-
-        for (CssAnimationPropertyDescriptor property : defaultKeyFrames) {
-            AnimatorFrame frame =
-                    new AnimatorFrame(AnimatorUtils.doubleRoundCeiling(AnimatorUtils
-                            .convertPercentToDouble(property.getName()) / 100 * duration));
-            List<CssAnimationPropertyDescriptor> childProperties = property.getChildProperties();
-            for (CssAnimationPropertyDescriptor childProperty : childProperties) {
-                String name = childProperty.getName();
-                String value = childProperty.getDefaultValue();
-                frame.addProperty(name, value);
-            }
-
-            frame.setFrameTime(frame.getFrameTime() + delay);
-            addListByFrameTime(frames, frame);
-        }
-        return frames;
-    }*/
-
-    /*private void addListByFrameTime(List<AnimatorFrame> frames, AnimatorFrame addFrame) {
-        int index = 0;
-        for (AnimatorModel model : frames) {
-            AnimatorFrame frame = (AnimatorFrame) model;
-            if (frame.getFrameTime() < addFrame.getFrameTime())
-                index++;
-            else
-                break;
-        }
-
-        frames.add(index, addFrame);
-    }*/
-
-    /**
      * if there exists a Frame, return exist frame. if not, create and return it.
      * 
      * @param model
@@ -646,12 +634,15 @@ public class AnimatorSelector extends AnimatorModel {
      */
     public AnimatorFrame getOrCreateAnimatorFrame(double currentTime) {
         AnimatorKeyframe keyframe = getCurrentKeyframe(currentTime);
-        if (keyframe == null)
+        if (keyframe == null) {
             keyframe = createKeyframe("custom", currentTime);
+            addChild(keyframe);
+        }
 
         AnimatorFrame frame = keyframe.getFrameByCurrentTime(currentTime);
         if (frame == null) {
-               keyframe.createAnimatorFrame(currentTime);
+               frame = keyframe.createAnimatorFrame(currentTime);
+               keyframe.addChild(frame, true);
         }
 
         return frame;
index 71560ea..d4e989d 100644 (file)
@@ -194,7 +194,7 @@ public class AnimatorWidget extends AnimatorModel {
                 if (property.equals("translateX") || property.equals("translateY")
                         || property.equals("scaleX") || property.equals("scaleY")
                         || property.equals("skewX") || property.equals("skewY")
-                        || property.equals("rotateZ")) {
+                        || property.equals("rotateZ") || property.equals("perspective")) {
                     fillTransformProperties(properties, cssSelector);
                 } else {
                     CssStyle style = cssSelector.getCssStyle(property);
index dcb5bff..0472798 100644 (file)
@@ -60,7 +60,7 @@ public class AnimatorKeyframeDeserializer extends AnimatorModelDeserializer<Anim
         JsonObject jobject = (JsonObject) json;
 
         AnimatorKeyframe keyframe = (AnimatorKeyframe)getModelFactory().createAnimatorModel(AnimatorModelType.KEYFRAME);
-        keyframe.setNames(jobject.get("name").getAsString());
+        keyframe.setName(jobject.get("name").getAsString());
         keyframe.setDuration(AnimatorUtils.convertTimeToDouble(jobject.get("duration").getAsString()));
         keyframe.setDelay( AnimatorUtils.convertTimeToDouble(jobject.get("start").getAsString()));        
 
index 2fb38ad..b292f94 100644 (file)
@@ -631,7 +631,7 @@ public class AnimatorUtils {
         }
 
         Pattern p =
-                Pattern.compile(".*translate\\((\\-?\\d*\\.?\\d+)px,\\s*(\\-?\\d*\\.?\\d+)px\\).*rotate\\((\\-?\\d*\\.?\\d+)deg\\).*scale\\((\\-?\\d*\\.?\\d+),\\s*(\\-?\\d*\\.?\\d+)\\).*skew\\((\\-?\\d*\\.?\\d+)deg,\\s*(\\-?\\d*)deg\\).*");
+                Pattern.compile(".*translate\\((\\-?\\d*\\.?\\d+)px,\\s*(\\-?\\d*\\.?\\d+)px\\).*rotate\\((\\-?\\d*\\.?\\d+)deg\\).*scale\\((\\-?\\d*\\.?\\d+),\\s*(\\-?\\d*\\.?\\d+)\\).*skew\\((\\-?\\d*\\.?\\d+)deg,\\s*(\\-?\\d*)deg\\).*perspective\\((\\-?\\d*\\.?\\d+)px\\)");
         Matcher m = p.matcher(fullTransform);
         if (m.find()) {
             String matchValue = m.group(1);
@@ -654,6 +654,9 @@ public class AnimatorUtils {
 
             matchValue = m.group(7);
             properties.put(Constants.skewY, matchValue + "deg");
+            
+            matchValue = m.group(8);
+            properties.put(Constants.perspective, matchValue + "px");
         }
     }
 
index 0b8cf9a..eae8649 100644 (file)
@@ -33,6 +33,7 @@ public class Constants {
     public static String skewY = "skewY";
     public static String scaleX = "scaleX";
     public static String scaleY = "scaleY";
+    public static String perspective = "perspective";
 
     // css Property default value
     public static String none = "none";
index 91a4d19..33d663e 100644 (file)
@@ -55,6 +55,10 @@ public class CommandUtil {
         }
 
         Part clone = part.cloneWidget();
+        if(clone == null) {
+               return null;
+        }
+        
         List<Part> children = part.getChildren();
         int size = children.size();
         for (int i = 0; i < size; i++) {
index f3b1a7f..d1660a7 100644 (file)
@@ -197,7 +197,13 @@ public class PastePartCommand extends Command {
             int size = children.size();
             for (int i = 0; i < size; i++) {
                 Part original = children.get(i);
+                if (original == null) {
+                       continue;
+                }
                 Part clone = original.cloneWidget();
+                if (clone == null) {
+                       continue;
+                }
 
                 clones.add(clone);
 
index edf621b..077fb51 100644 (file)
@@ -98,6 +98,9 @@ public class SelectionBorder extends AbstractBorder {
         int edgeSize = 7;
 
         WidgetPosition widgetPos = ((Part) part.getModel()).getWidgetPosition();
+        if(widgetPos == null) {
+               return;
+        }
         PointList polygonPoints = widgetPos.getPolygonPoints();
         Point origin = null;
 
index d68ef66..f94bd1d 100644 (file)
@@ -689,11 +689,11 @@ public class HoverBrowserViewer extends ScrollingGraphicalViewer
             if (part.getPartId() != null && !part.getPartId().isEmpty()) {
                 WidgetPosition pos = widgetPositions.get(part.getPartId());
                 if (pos != null) {
-                    if (isFireEvent) {
+//                    if (isFireEvent) {
                         part.setVisualPosition(pos);
-                    } else {
-                        part.setVisualPosition(pos);
-                    }
+//                    } else {
+//                        part.setVisualPosition(pos);
+//                    }
                 }
             }
 
@@ -788,7 +788,9 @@ public class HoverBrowserViewer extends ScrollingGraphicalViewer
                 currentPageEditPart = pageEditPart;
 
                 HideAllPages();
-                ((HoverViewerEditPart) currentPageEditPart).getFigure().setVisible(true);
+                if(currentPageEditPart != null) {
+                       ((HoverViewerEditPart) currentPageEditPart).getFigure().setVisible(true);
+                }
                 // DeactivateAllPages();
                 // currentPageEditPart.activate();
 
index fcfa129..dea15e2 100644 (file)
@@ -271,7 +271,7 @@ public class HtmlMetaReader_ver_1 {
         for (int i = 0; i < elementList.getLength(); i++) {
             Element elem2 = (Element) elementList.item(i);
             Part part = parseElement(fileData, elem2, partFactory, selectors);
-            if (part.isDocumentPart()) {
+            if (part != null && part.isDocumentPart()) {
                 fileData.addRootPart("", part);
             }
         }
index 2819648..93bd60f 100644 (file)
@@ -344,9 +344,11 @@ public class HtmlReader {
                 Node node = nodes.item(i);
                 if(node instanceof Element){
                        Part childPart = parseElement(pageFileData, part, (Element) node, manager, factory);
-                       part.addChildWhenPageRead(childPart);
-                       if (childPart.getDescriptorId().equals("tizen.page")) {
-                           pageFileData.addRootPart(childPart.getIdPropertyValue(), childPart);
+                       if(childPart != null) {
+                               part.addChildWhenPageRead(childPart);
+                               if (childPart.getDescriptorId() != null && childPart.getDescriptorId().equals("tizen.page")) {
+                                   pageFileData.addRootPart(childPart.getIdPropertyValue(), childPart);
+                               }
                        }
                 }
             }
index 74fcb5f..e40bd13 100644 (file)
@@ -156,7 +156,10 @@ public class CodeGenerator {
                        boolean includePid, Document xslt, boolean partialGen)
                        throws IOException {
                Document doc = PageWriter.writePart(part, includePid);
-
+               if(doc == null) {
+                       return;
+               }
+               
                Element elem0 = null;
                if (partialGen) {
                        elem0 = doc.createElement("tizen.dummy");
index 3b6d87a..53fcc5b 100644 (file)
@@ -106,7 +106,7 @@ public class PageReader_ver_1 {
                        if(childNode instanceof Element){
                                Part part = parseElement(pageFileData, (Element) childNode,
                                                partFactory);
-                               if (part.isDocumentPart()) {
+                               if (part != null && part.isDocumentPart()) {
                                        pageFileData.addRootPart(BuilderConstants.EMPTY, part);
                                }
                        }
index ffdbf2b..12bc0b1 100644 (file)
@@ -186,7 +186,7 @@ public class PageReader_ver_2 {
         for (int i = 0; i < elemList.getLength(); i++) {
             Element elem2 = (Element) elemList.item(i);
             Part part = parseElement(pageFileData, elem2, partFactory, selectors);
-            if (part.isDocumentPart()) {
+            if (part != null && part.isDocumentPart()) {
                 pageFileData.addRootPart("", part);
             }
         }
index 9bccb50..2f17202 100644 (file)
@@ -232,20 +232,24 @@ public class Helper {
 
         String imageName = null;
         
-        if( type.equals("Boolean") ){
-            imageName = null;
-        }else if( type.equals( "Number" ) ){
-            imageName = null;
-        }else if( type.equals( "String" ) ){
-            imageName = null;
-        }else if( type.equals( "Array" ) ){
-            imageName = "temp.png";
-        }else if( type.equals( "Index" ) ){
-            imageName = null;
-        }else{
-            imageName = null;
+//        if( type.equals("Boolean") ){
+//            imageName = null;
+//        }else if( type.equals( "Number" ) ){
+//            imageName = null;
+//        }else if( type.equals( "String" ) ){
+//            imageName = null;
+//        }else if( type.equals( "Array" ) ){
+//            imageName = "temp.png";
+//        }else if( type.equals( "Index" ) ){
+//            imageName = null;
+//        }else{
+//            imageName = null;
+//        }
+        
+        if( type.equals( "Array" ) ){
+          imageName = "temp.png";
         }
-
+        
         if (imageName != null) {
             treeItem.setImage ( ResourceManager.getImage( BuilderConstants.ICON_DIR, imageName ) );
         }
@@ -260,20 +264,11 @@ public class Helper {
         
         TreeItem[] items = parentItem.getItems();
         
-        JsonObject parentJson = null;
-        JsonArray parentArray = null;
-        
-        if( parentJsonElement instanceof JsonObject ){
-            parentJson = (JsonObject) parentJsonElement;
-        } else if( parentJsonElement instanceof JsonArray ){
-            parentArray = (JsonArray) parentJsonElement;
-        }
-        
         JsonObject jsonOb = null;
         
         if( type.equals("Array") ){
             JsonArray array = new JsonArray();
-            parentJson.add(key, array);
+            ((JsonObject)parentJsonElement).add(key, array);
             jsonOb = null;
             for (TreeItem item : items) {
                 if( item.getText(2).equals("Index") ){
@@ -288,7 +283,7 @@ public class Helper {
             }
         }else if( type.equals("Object") ){
             jsonOb = new JsonObject();
-            parentJson.add(key, jsonOb);
+            ((JsonObject)parentJsonElement).add(key, jsonOb);
             for (TreeItem item : items) {
                 makeJsonFromTree( item, jsonOb );
             }
@@ -298,19 +293,19 @@ public class Helper {
                 if(item.getText().length() > 0){
                     makeJsonFromTree( item, jsonOb );
                 }else{
-                    parentArray.add( new JsonPrimitive(item.getText(1)) );
+                    ((JsonArray)parentJsonElement).add( new JsonPrimitive(item.getText(1)) );
                 }
             }
             if( !jsonOb.entrySet().isEmpty() )
-                parentArray.add(jsonOb);
+                ((JsonArray)parentJsonElement).add(jsonOb);
         }else if( type.equals("String") ){
-            parentJson.addProperty( key, value );
+            ((JsonObject)parentJsonElement).addProperty( key, value );
         }else if( type.equals("Boolean") ){
-            parentJson.addProperty( key, Boolean.valueOf( value ) );
+            ((JsonObject)parentJsonElement).addProperty( key, Boolean.valueOf( value ) );
         }else if( type.equals("Number") ){
-            parentJson.addProperty( key, Long.parseLong( value ) );
+            ((JsonObject)parentJsonElement).addProperty( key, Long.parseLong( value ) );
         }else{
-            parentJson.add( key, null );
+            ((JsonObject)parentJsonElement).add( key, null );
         }
     }
     
@@ -444,4 +439,4 @@ public class Helper {
 //        }
 //        return false;
 //    } 
-}
+}
\ No newline at end of file
index a14bf34..2e027f1 100644 (file)
@@ -339,7 +339,7 @@ public class ActionAnimationGroupComposite extends Composite implements IActionA
             long lTime2 = d2.getTime();
             double tempTime = (double) (lTime - lTime2) / 1000;
 
-            if (dTime != 0.0 && dTime == tempTime) {
+            if (Double.compare(dTime, 0.0) != 0 && Double.compare(dTime, tempTime) == 0) {
                 return false;
             }
 
index 6783f5d..02ac77a 100644 (file)
@@ -160,7 +160,7 @@ public class ActionCustomEventComposite extends ActionEventComposite {
             public void mouseUp(MouseEvent e) {
                 btnNewButton.setImage(ResourceManager.getImage(BuilderConstants.ICON_DIR,
                                                                "animator_action_add_normal.png"));
-                if ((text_2.getText() == null) || (text_2.getText() == "")) {
+                if ((text_2.getText() == null) || (text_2.getText().equals(BuilderConstants.EMPTY))) {
                     return;
                 }
                 addSelectionBar(text_2.getText());
index 5f843df..a23bc97 100644 (file)
@@ -568,7 +568,10 @@ public class ActionExpanderbleTriggerM {
      * @param bar
      */
     public void removeSelectionBar(ActionSelectBarComposite bar) {
-        actionSelectionBars.remove(actionSelectionBars);
+       if (actionSelectionBars != null && !actionSelectionBars.isEmpty()) {
+               actionSelectionBars.remove(bar);        
+       }
+        
     }
 
     /**
index e2eb55d..cf8d98d 100644 (file)
@@ -31,6 +31,7 @@ import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
+import org.tizen.webuibuilder.BuilderConstants;
 import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
 import org.tizen.webuibuilder.gef.commands.SetPartMovePageEventCommand;
 import org.tizen.webuibuilder.model.GotoPageProperty;
@@ -153,11 +154,11 @@ public class ActionGoToPageComposite extends Composite implements IActionActionC
      */
     private void valueChanged() {
         String pageValue = pageCombo.getText();
-        if ((pageValue == null) || (pageValue == "")) {
+        if ((pageValue == null) || (pageValue.equals(BuilderConstants.EMPTY))) {
             return;
         }
         String transitionValue = transitionCombo.getText();
-        if ((transitionValue == null) || (transitionValue == "")) {
+        if ((transitionValue == null) || (transitionValue.equals(BuilderConstants.EMPTY))) {
             return;
         }
 
index 22f24b3..c42818c 100644 (file)
@@ -51,10 +51,6 @@ public class ClipMethod extends Method {
     static final String CLIP_WIDTH = "width";
     static final String CLIP_HEIGHT = "height";
 
-    private final int VIEW_POINT_X = 80;
-    // private final int VIEW_POINT_Y = 20;
-    private final int EDITOR_WIDTH = 60;
-    private final int EDITOR_HEIGHT = 20;
     private final int MARGIN = 10;
 
     private final String DEFAULT_VALUE = "0";
@@ -72,186 +68,6 @@ public class ClipMethod extends Method {
     private Label originWidth;
 
     /**
-     * This class is a inner class of the {@link ClipMethod}. This class creates a text editor and
-     * then adds it to the parent {@link Composite}.
-     */
-    public class TextEditor {
-        private final int LIMITED_LENGTH = 6;
-
-        private Composite parent;
-        private Label label;
-        private Text editor;
-
-        private final Color bgColor = new Color(null, 219, 218, 218);
-
-        /**
-         * Construct
-         * 
-         * @param parent
-         *            the parent {@link Composite}
-         * @param input
-         *            initial value
-         */
-        public TextEditor(final Composite parent, String input) {
-            this.parent = parent;
-            label = new Label(this.parent, SWT.CENTER | SWT.READ_ONLY | SWT.BORDER);
-            editor = new Text(this.parent, SWT.CENTER | SWT.BORDER);
-
-            label.setText(input);
-            /** set default background color */
-            label.setBackground(bgColor);
-            editor.setTextLimit(LIMITED_LENGTH);
-        }
-
-        /**
-         * This method shows the {@link Label} and hides the {@link Text}.
-         */
-        public void showLabel() {
-            label.setVisible(true);
-            editor.setVisible(false);
-        }
-
-        /**
-         * This method shows the {@link Text} and hides the {@link Label}.
-         */
-        public void showEditor() {
-            label.setVisible(false);
-            editor.setVisible(true);
-
-            editor.setText(label.getText());
-            editor.selectAll();
-            editor.setFocus();
-        }
-
-        /**
-         * This method returns the parent {@link Composite} of the {@link TextEditor}.
-         * 
-         * @return a {@link Composite}
-         */
-        public Composite getParent() {
-            return parent;
-        }
-
-        /**
-         * This method returns the {@link Label} of the {@link TextEditor}.
-         * 
-         * @return a {@link Label}
-         */
-        public Label getLabel() {
-            return label;
-        }
-
-        /**
-         * This method returns the {@link Text} of the {@link TextEditor}.
-         * 
-         * @return a {@link Text}
-         */
-        public Text getEditor() {
-            return editor;
-        }
-
-        /**
-         * This method set value of the {@link Label}.
-         * 
-         * @param value
-         *            new value of the {@link Label}
-         */
-        public void setLabel(String value) {
-            if (label == null || label.isDisposed()) {
-                return;
-            }
-            label.setText(value);
-        }
-
-        /**
-         * This method set {@link MouseListener} for the mouse event at the {@link Label}.
-         * 
-         * @param listener
-         *            a {@link MouseListener}
-         */
-        public void setLabelListener(MouseListener listener) {
-            label.addMouseListener(listener);
-        }
-
-        /**
-         * This method set {@link Listener} for the keyboard and mouse event at the {@link Text}.
-         * 
-         * @param listener
-         *            a {@link Listener}
-         */
-        public void setEditorListener(Listener listener) {
-            editor.addListener(SWT.FocusOut, listener);
-            editor.addListener(SWT.Traverse, listener);
-            editor.addListener(SWT.Deactivate, listener);
-        }
-
-        /**
-         * This method set top position of the {@link TextEditor} included in the 'Clip component'.
-         * 
-         * @param left
-         *            a {@link Label}, which is located on the left side
-         */
-        public void setTopPosition(final Label left) {
-            FormData topEditorData = new FormData();
-            topEditorData.left = new FormAttachment(left, 0);
-            // topEditorData.top = new FormAttachment(0, VIEW_POINT_Y);
-            topEditorData.top = new FormAttachment(0, 0);
-            topEditorData.right = new FormAttachment(left, EDITOR_WIDTH * 2);
-            // topEditorData.bottom = new FormAttachment(0, VIEW_POINT_Y + EDITOR_HEIGHT);
-            topEditorData.bottom = new FormAttachment(0, EDITOR_HEIGHT);
-            label.setLayoutData(topEditorData);
-            editor.setLayoutData(topEditorData);
-        }
-
-        /**
-         * This method set right position of the {@link TextEditor} included in the 'Clip
-         * component'.
-         * 
-         * @param left
-         *            a {@link Label}, which is located on the left side
-         */
-        public void setRightPosition(final Label left) {
-            FormData rightEditorData = new FormData();
-            rightEditorData.left = new FormAttachment(left, 0);
-            rightEditorData.top = new FormAttachment(0, EDITOR_HEIGHT);
-            rightEditorData.right = new FormAttachment(left, EDITOR_WIDTH * 2);
-            rightEditorData.bottom = new FormAttachment(0, EDITOR_HEIGHT * 2);
-            label.setLayoutData(rightEditorData);
-            editor.setLayoutData(rightEditorData);
-        }
-
-        /**
-         * This method set left position of the {@link TextEditor} included in the 'Clip component'.
-         */
-        public void setLeftPosition() {
-            FormData rightEditorData = new FormData();
-            rightEditorData.left = new FormAttachment(0, VIEW_POINT_X);
-            rightEditorData.top = new FormAttachment(0, EDITOR_HEIGHT);
-            rightEditorData.right = new FormAttachment(0, VIEW_POINT_X + EDITOR_WIDTH);
-            rightEditorData.bottom = new FormAttachment(0, EDITOR_HEIGHT * 2);
-            label.setLayoutData(rightEditorData);
-            editor.setLayoutData(rightEditorData);
-        }
-
-        /**
-         * This method set bottom position of the {@link TextEditor} included in the 'Clip
-         * component'.
-         * 
-         * @param left
-         *            a {@link Label}, which is located on the left side
-         */
-        public void setBottomPosition(final Label left) {
-            FormData bottomEditorData = new FormData();
-            bottomEditorData.left = new FormAttachment(left, 0);
-            bottomEditorData.top = new FormAttachment(0, EDITOR_HEIGHT * 2);
-            bottomEditorData.right = new FormAttachment(left, EDITOR_WIDTH * 2);
-            bottomEditorData.bottom = new FormAttachment(0, EDITOR_HEIGHT * 3);
-            label.setLayoutData(bottomEditorData);
-            editor.setLayoutData(bottomEditorData);
-        }
-    }
-
-    /**
      * Construct
      * 
      * @param parent
@@ -336,12 +152,12 @@ public class ClipMethod extends Method {
         Label blankTopLeft = createBlankLabel(composite);
         // blankTL.addPaintListener(fillLabelBGListener());
         FormData blankTopLeftData = new FormData();
-        blankTopLeftData.left = new FormAttachment(0, VIEW_POINT_X);
+        blankTopLeftData.left = new FormAttachment(0, TextEditor.VIEW_POINT_X);
         // blankTopLeftData.top = new FormAttachment(0, VIEW_POINT_Y);
         blankTopLeftData.top = new FormAttachment(0, 0);
-        blankTopLeftData.right = new FormAttachment(0, VIEW_POINT_X + EDITOR_WIDTH);
-        // blankTopLeftData.bottom = new FormAttachment(0, VIEW_POINT_Y + EDITOR_HEIGHT);
-        blankTopLeftData.bottom = new FormAttachment(0, EDITOR_HEIGHT);
+        blankTopLeftData.right = new FormAttachment(0, TextEditor.VIEW_POINT_X + TextEditor.EDITOR_WIDTH);
+        // blankTopLeftData.bottom = new FormAttachment(0, VIEW_POINT_Y + TextEditor.EDITOR_HEIGHT);
+        blankTopLeftData.bottom = new FormAttachment(0, TextEditor.EDITOR_HEIGHT);
         blankTopLeft.setLayoutData(blankTopLeftData);
 
         topTextEditor = new TextEditor(composite, DEFAULT_VALUE);
@@ -355,8 +171,8 @@ public class ClipMethod extends Method {
         FormData blankTopRightData = new FormData();
         blankTopRightData.left = new FormAttachment(topTextEditor.getLabel(), 0);
         blankTopRightData.top = new FormAttachment(0, 0);
-        blankTopRightData.right = new FormAttachment(topTextEditor.getLabel(), EDITOR_WIDTH * 2);
-        blankTopRightData.bottom = new FormAttachment(0, EDITOR_HEIGHT);
+        blankTopRightData.right = new FormAttachment(topTextEditor.getLabel(), TextEditor.EDITOR_WIDTH * 2);
+        blankTopRightData.bottom = new FormAttachment(0, TextEditor.EDITOR_HEIGHT);
         blankTopRight.setLayoutData(blankTopRightData);
 
         /**
@@ -372,9 +188,9 @@ public class ClipMethod extends Method {
         // blankCenter.addPaintListener(fillLabelBGListener());
         FormData blankCenterData = new FormData();
         blankCenterData.left = new FormAttachment(leftTextEditor.getLabel(), 0);
-        blankCenterData.top = new FormAttachment(0, EDITOR_HEIGHT);
-        blankCenterData.right = new FormAttachment(leftTextEditor.getLabel(), EDITOR_WIDTH * 2);
-        blankCenterData.bottom = new FormAttachment(0, EDITOR_HEIGHT * 2);
+        blankCenterData.top = new FormAttachment(0, TextEditor.EDITOR_HEIGHT);
+        blankCenterData.right = new FormAttachment(leftTextEditor.getLabel(), TextEditor.EDITOR_WIDTH * 2);
+        blankCenterData.bottom = new FormAttachment(0, TextEditor.EDITOR_HEIGHT * 2);
         blankCenter.setLayoutData(blankCenterData);
 
         rightTextEditor = new TextEditor(composite, DEFAULT_VALUE);
@@ -389,10 +205,10 @@ public class ClipMethod extends Method {
         Label blankBottomLeft = createBlankLabel(composite);
         // blankBottomLeft.addPaintListener(fillLabelBGListener());
         FormData blankBottomLeftData = new FormData();
-        blankBottomLeftData.left = new FormAttachment(0, VIEW_POINT_X);
-        blankBottomLeftData.top = new FormAttachment(0, EDITOR_HEIGHT * 2);
-        blankBottomLeftData.right = new FormAttachment(0, VIEW_POINT_X + EDITOR_WIDTH);
-        blankBottomLeftData.bottom = new FormAttachment(0, EDITOR_HEIGHT * 3);
+        blankBottomLeftData.left = new FormAttachment(0, TextEditor.VIEW_POINT_X);
+        blankBottomLeftData.top = new FormAttachment(0, TextEditor.EDITOR_HEIGHT * 2);
+        blankBottomLeftData.right = new FormAttachment(0, TextEditor.VIEW_POINT_X + TextEditor.EDITOR_WIDTH);
+        blankBottomLeftData.bottom = new FormAttachment(0, TextEditor.EDITOR_HEIGHT * 3);
         blankBottomLeft.setLayoutData(blankBottomLeftData);
 
         bottomTextEditor = new TextEditor(composite, DEFAULT_VALUE);
@@ -405,10 +221,10 @@ public class ClipMethod extends Method {
         // blankBottomRight.addPaintListener(fillLabelBGListener());
         FormData blankBottomRightData = new FormData();
         blankBottomRightData.left = new FormAttachment(bottomTextEditor.getLabel(), 0);
-        blankBottomRightData.top = new FormAttachment(0, EDITOR_HEIGHT * 2);
+        blankBottomRightData.top = new FormAttachment(0, TextEditor.EDITOR_HEIGHT * 2);
         blankBottomRightData.right =
-                new FormAttachment(bottomTextEditor.getLabel(), EDITOR_WIDTH * 2);
-        blankBottomRightData.bottom = new FormAttachment(0, EDITOR_HEIGHT * 3);
+                new FormAttachment(bottomTextEditor.getLabel(), TextEditor.EDITOR_WIDTH * 2);
+        blankBottomRightData.bottom = new FormAttachment(0, TextEditor.EDITOR_HEIGHT * 3);
         blankBottomRight.setLayoutData(blankBottomRightData);
 
         /**
@@ -418,9 +234,9 @@ public class ClipMethod extends Method {
         leftArrow
                 .setImage(ResourceManager.getImage(BuilderConstants.ICON_DIR, LEFT_ARROW_IMG_PATH));
         FormData leftArrowData = new FormData();
-        leftArrowData.left = new FormAttachment(0, VIEW_POINT_X);
+        leftArrowData.left = new FormAttachment(0, TextEditor.VIEW_POINT_X);
         leftArrowData.top = new FormAttachment(bottomTextEditor.getLabel(), MARGIN);
-        leftArrowData.right = new FormAttachment(0, VIEW_POINT_X + EDITOR_WIDTH);
+        leftArrowData.right = new FormAttachment(0, TextEditor.VIEW_POINT_X + TextEditor.EDITOR_WIDTH);
         leftArrowData.bottom = new FormAttachment(100, -MARGIN);
         leftArrow.setLayoutData(leftArrowData);
 
@@ -429,7 +245,7 @@ public class ClipMethod extends Method {
         FormData originWidthData = new FormData();
         originWidthData.left = new FormAttachment(leftArrow, 0);
         originWidthData.top = new FormAttachment(bottomTextEditor.getLabel(), MARGIN);
-        originWidthData.right = new FormAttachment(leftArrow, EDITOR_WIDTH * 2);
+        originWidthData.right = new FormAttachment(leftArrow, TextEditor.EDITOR_WIDTH * 2);
         originWidthData.bottom = new FormAttachment(100, -MARGIN);
         originWidth.setLayoutData(originWidthData);
 
@@ -439,7 +255,7 @@ public class ClipMethod extends Method {
         FormData rightArrowData = new FormData();
         rightArrowData.left = new FormAttachment(originWidth, 0);
         rightArrowData.top = new FormAttachment(bottomTextEditor.getLabel(), MARGIN);
-        rightArrowData.right = new FormAttachment(originWidth, EDITOR_WIDTH * 2);
+        rightArrowData.right = new FormAttachment(originWidth, TextEditor.EDITOR_WIDTH * 2);
         rightArrowData.bottom = new FormAttachment(100, -MARGIN);
         rightArrow.setLayoutData(rightArrowData);
 
@@ -451,29 +267,29 @@ public class ClipMethod extends Method {
         FormData upArrowData = new FormData();
         upArrowData.left = new FormAttachment(rightTextEditor.getLabel(), 0);
         upArrowData.top = new FormAttachment(0, 0);
-        // upArrowData.right = new FormAttachment(100, -EDITOR_WIDTH);
-        upArrowData.right = new FormAttachment(rightTextEditor.getLabel(), EDITOR_WIDTH * 2);
-        upArrowData.bottom = new FormAttachment(0, EDITOR_HEIGHT);
+        // upArrowData.right = new FormAttachment(100, -TextEditor.EDITOR_WIDTH);
+        upArrowData.right = new FormAttachment(rightTextEditor.getLabel(), TextEditor.EDITOR_WIDTH * 2);
+        upArrowData.bottom = new FormAttachment(0, TextEditor.EDITOR_HEIGHT);
         upArrow.setLayoutData(upArrowData);
 
         originHeight = new Label(composite, SWT.CENTER | SWT.READ_ONLY);
         originHeight.setText(DEFAULT_VALUE);
         FormData originHeightData = new FormData();
         originHeightData.left = new FormAttachment(rightTextEditor.getLabel(), 0);
-        originHeightData.top = new FormAttachment(0, EDITOR_HEIGHT);
-        // originHeightData.right = new FormAttachment(100, -EDITOR_WIDTH);
-        originHeightData.right = new FormAttachment(rightTextEditor.getLabel(), EDITOR_WIDTH * 2);
-        originHeightData.bottom = new FormAttachment(0, EDITOR_HEIGHT * 2);
+        originHeightData.top = new FormAttachment(0, TextEditor.EDITOR_HEIGHT);
+        // originHeightData.right = new FormAttachment(100, -TextEditor.EDITOR_WIDTH);
+        originHeightData.right = new FormAttachment(rightTextEditor.getLabel(), TextEditor.EDITOR_WIDTH * 2);
+        originHeightData.bottom = new FormAttachment(0, TextEditor.EDITOR_HEIGHT * 2);
         originHeight.setLayoutData(originHeightData);
 
         Label downArrow = new Label(composite, SWT.CENTER | SWT.READ_ONLY);
         downArrow.setImage(ResourceManager.getImage(BuilderConstants.ICON_DIR, DOWN_ARROW_PATH));
         FormData downArrowData = new FormData();
         downArrowData.left = new FormAttachment(rightTextEditor.getLabel(), 0);
-        downArrowData.top = new FormAttachment(0, EDITOR_HEIGHT * 2);
-        // downArrowData.right = new FormAttachment(100, -EDITOR_WIDTH);
-        downArrowData.right = new FormAttachment(rightTextEditor.getLabel(), EDITOR_WIDTH * 2);
-        downArrowData.bottom = new FormAttachment(0, EDITOR_HEIGHT * 3);
+        downArrowData.top = new FormAttachment(0, TextEditor.EDITOR_HEIGHT * 2);
+        // downArrowData.right = new FormAttachment(100, -TextEditor.EDITOR_WIDTH);
+        downArrowData.right = new FormAttachment(rightTextEditor.getLabel(), TextEditor.EDITOR_WIDTH * 2);
+        downArrowData.bottom = new FormAttachment(0, TextEditor.EDITOR_HEIGHT * 3);
         downArrow.setLayoutData(downArrowData);
 
         Label unit = new Label(composite, SWT.CENTER | SWT.READ_ONLY);
@@ -481,7 +297,7 @@ public class ClipMethod extends Method {
         FormData unitData = new FormData();
         unitData.left = new FormAttachment(rightTextEditor.getLabel(), 0);
         unitData.top = new FormAttachment(bottomTextEditor.getLabel(), MARGIN);
-        unitData.right = new FormAttachment(rightTextEditor.getLabel(), EDITOR_WIDTH * 2);
+        unitData.right = new FormAttachment(rightTextEditor.getLabel(), TextEditor.EDITOR_WIDTH * 2);
         unitData.bottom = new FormAttachment(100, -MARGIN);
         unit.setLayoutData(unitData);
 
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/ColorData.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/ColorData.java
new file mode 100644 (file)
index 0000000..67c3496
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * UI Builder
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.webuibuilder.ui.views.properties.method;
+
+import org.eclipse.swt.graphics.RGB;
+
+/**
+ * This class creates a color data model that contains Alpha value and {@link RGB} value.
+ */
+public class ColorData {
+       
+       private int alphaValue;
+    private RGB rgbValue;
+
+    /**
+     * Construct
+     * 
+     * @param alpha
+     *            alpha value of the {@link ColorData}
+     * @param rgb
+     *            a {@link RGB}
+     */
+    public ColorData(int alpha, RGB rgb) {
+        alphaValue = alpha;
+        rgbValue = rgb;
+    }
+
+    /**
+     * This method returns the alpha value of the {@link ColorData}.
+     * 
+     * @return alpha value of the {@link ColorData}
+     */
+    public int getAlphaValue() {
+        return alphaValue;
+    }
+
+    /**
+     * This method returns the {@link RGB} of the {@link ColorData}.
+     * 
+     * @return a {@link RGB}
+     */
+    public RGB getRGBValue() {
+        return rgbValue;
+    }
+
+    /**
+     * This method set alpha value of the {@link ColorData}.
+     * 
+     * @param value
+     *            new alpha value of the {@link ColorData}
+     */
+    public void setAlphaValue(int value) {
+        alphaValue = value;
+    }
+
+    /**
+     * This method set {@link RGB} value of the {@link ColorData}.
+     * 
+     * @param value
+     *            new {@link RGB}
+     */
+    public void setRGBValue(RGB value) {
+        rgbValue = value;
+    }
+}
index 32ce77b..a35336d 100644 (file)
@@ -69,157 +69,15 @@ public class ColorFillMethod extends Method {
     private final int MARGIN = 20;
 
     /**
-     * This class is a inner class of the {@link ColorFillMethod}. This class creates a color data
-     * model that contains Alpha value and {@link RGB} value.
-     */
-    public class ColorData {
-        private int alphaValue;
-        private RGB rgbValue;
-
-        /**
-         * Construct
-         * 
-         * @param alpha
-         *            alpha value of the {@link ColorData}
-         * @param rgb
-         *            a {@link RGB}
-         */
-        public ColorData(int alpha, RGB rgb) {
-            alphaValue = alpha;
-            rgbValue = rgb;
-        }
-
-        /**
-         * This method returns the alpha value of the {@link ColorData}.
-         * 
-         * @return alpha value of the {@link ColorData}
-         */
-        public int getAlphaValue() {
-            return alphaValue;
-        }
-
-        /**
-         * This method returns the {@link RGB} of the {@link ColorData}.
-         * 
-         * @return a {@link RGB}
-         */
-        public RGB getRGBValue() {
-            return rgbValue;
-        }
-
-        /**
-         * This method set alpha value of the {@link ColorData}.
-         * 
-         * @param value
-         *            new alpha value of the {@link ColorData}
-         */
-        public void setAlphaValue(int value) {
-            alphaValue = value;
-        }
-
-        /**
-         * This method set {@link RGB} value of the {@link ColorData}.
-         * 
-         * @param value
-         *            new {@link RGB}
-         */
-        public void setRGBValue(RGB value) {
-            rgbValue = value;
-        }
-    }
-
-    /**
-     * This class is a inner class of the {@link ColorFillMethod}. This class is used to represent
-     * the custom color.
-     */
-    public class UserColorData {
-        private ColorData color;
-        private int labelWidth;
-        private int labelHeight;
-
-        /**
-         * Construct
-         * 
-         * @param color
-         *            custom {@link ColorData}
-         * @param width
-         *            width of the area to represent the custom color
-         * @param height
-         *            height of the area to represent the custom color
-         */
-        public UserColorData(ColorData color, int width, int height) {
-            this.color = color;
-            labelWidth = width;
-            labelHeight = height;
-        }
-
-        /**
-         * This method returns color data.
-         * 
-         * @return a {@link ColorData}
-         */
-        public ColorData getColorData() {
-            return color;
-        }
-
-        /**
-         * This method returns width of the area to represent the custom color.
-         * 
-         * @return width of the area to represent the custom color
-         */
-        public int getLabelWidth() {
-            return labelWidth;
-        }
-
-        /**
-         * Thid method returns height of the area to represent the custom color.
-         * 
-         * @return height of the area to represent the custom color
-         */
-        public int getLabelHeight() {
-            return labelHeight;
-        }
-
-        /**
-         * This method set color data.
-         * 
-         * @param color
-         *            new {@link ColorData}
-         */
-        public void setColorData(ColorData color) {
-            this.color = color;
-        }
-
-        /**
-         * This method set width of the area to represent the custom color.
-         * 
-         * @param width
-         *            width of the area to represent the custom color
-         */
-        public void setLabelWidth(int width) {
-            labelWidth = width;
-        }
-
-        /**
-         * This method set height of the area to represent the custom color.
-         * 
-         * @param height
-         *            height of the area to represent the custom color
-         */
-        public void setLabelHeight(int height) {
-            labelHeight = height;
-        }
-    }
-
-    /**
      * Enumerations for the color format
      */
     public enum ColorType {
         NONE, HEX, RGB, RGBA
     };
 
-    private List<ColorData> usedColorDataList;
-    private List<ColorData> usingColorDataList;
+    //TODO : implements used, using.
+//    private List<ColorData> usedColorDataList;
+//    private List<ColorData> usingColorDataList;
     private List<UserColorData> userColorDataList;
 
     private List<Label> userColorViewList;
@@ -389,8 +247,8 @@ public class ColorFillMethod extends Method {
                 userBrightness = 0f;
 
                 /** TODO : add data loading & set loaded data - usedColor, usingColor, userColor */
-                usedColorDataList = new ArrayList<ColorData>(MAX_LIST_COUNT);
-                usingColorDataList = new ArrayList<ColorData>(MAX_LIST_COUNT);
+//                usedColorDataList = new ArrayList<ColorData>(MAX_LIST_COUNT);
+//                usingColorDataList = new ArrayList<ColorData>(MAX_LIST_COUNT);
                 userColorViewList = new ArrayList<Label>(MAX_LIST_COUNT - 1);
 
                 /** saturation : x / brightness : y */
index 3c58bef..c6358c8 100644 (file)
@@ -68,157 +68,15 @@ public class NewColorMethod extends Method {
     private final int MARGIN = 20;
 
     /**
-     * This class is a inner class of the {@link NewColorMethod}. This class creates a color data
-     * model that contains Alpha value and {@link RGB} value.
-     */
-    public class ColorData {
-        private int alphaValue;
-        private RGB rgbValue;
-
-        /**
-         * Construct
-         * 
-         * @param alpha
-         *            alpha value of the {@link ColorData}
-         * @param rgb
-         *            a {@link RGB}
-         */
-        public ColorData(int alpha, RGB rgb) {
-            alphaValue = alpha;
-            rgbValue = rgb;
-        }
-
-        /**
-         * This method returns the alpha value of the {@link ColorData}.
-         * 
-         * @return alpha value of the {@link ColorData}
-         */
-        public int getAlphaValue() {
-            return alphaValue;
-        }
-
-        /**
-         * This method returns the {@link RGB} of the {@link ColorData}.
-         * 
-         * @return {@link RGB} of the {@link ColorData}
-         */
-        public RGB getRGBValue() {
-            return rgbValue;
-        }
-
-        /**
-         * This method set alpha value of the {@link ColorData}.
-         * 
-         * @param value
-         *            new alpha value of the {@link ColorData}
-         */
-        public void setAlphaValue(int value) {
-            alphaValue = value;
-        }
-
-        /**
-         * This method set {@link RGB} value of the {@link ColorData}.
-         * 
-         * @param value
-         *            new {@link RGB} of the {@link ColorData}
-         */
-        public void setRGBValue(RGB value) {
-            rgbValue = value;
-        }
-    }
-
-    /**
-     * This class is a inner class of the {@link NewColorMethod}. This class is used to represent
-     * the custom color.
-     */
-    public class UserColorData {
-        private ColorData color;
-        private int labelWidth;
-        private int labelHeight;
-
-        /**
-         * Construct
-         * 
-         * @param color
-         *            custom {@link ColorData}
-         * @param width
-         *            width of the area to represent the custom color
-         * @param height
-         *            height of the area to represent the custom color
-         */
-        public UserColorData(ColorData color, int width, int height) {
-            this.color = color;
-            labelWidth = width;
-            labelHeight = height;
-        }
-
-        /**
-         * This method returns {@link ColorData}.
-         * 
-         * @return a {@link ColorData}
-         */
-        public ColorData getColorData() {
-            return color;
-        }
-
-        /**
-         * This method returns width of the area to represent the custom color.
-         * 
-         * @return width of the area to represent the custom color
-         */
-        public int getLabelWidth() {
-            return labelWidth;
-        }
-
-        /**
-         * Thid method returns height of the area to represent the custom color.
-         * 
-         * @return height of the area to represent the custom color
-         */
-        public int getLabelHeight() {
-            return labelHeight;
-        }
-
-        /**
-         * This method set {@link ColorData}.
-         * 
-         * @param color
-         *            new {@link ColorData}
-         */
-        public void setColorData(ColorData color) {
-            this.color = color;
-        }
-
-        /**
-         * This method set width of the area to represent the custom color.
-         * 
-         * @param width
-         *            width of the area to represent the custom color
-         */
-        public void setLabelWidth(int width) {
-            labelWidth = width;
-        }
-
-        /**
-         * This method set height of the area to represent the custom color.
-         * 
-         * @param height
-         *            height of the area to represent the custom color
-         */
-        public void setLabelHeight(int height) {
-            labelHeight = height;
-        }
-    }
-
-    /**
      * Enumerations for the color format
      */
     public enum ColorType {
         NONE, HEX, RGB, RGBA
     };
 
-    private List<ColorData> usedColorDataList;
-    private List<ColorData> usingColorDataList;
+    // TODO : implements used, using.
+//    private List<ColorData> usedColorDataList;
+//    private List<ColorData> usingColorDataList;
     private List<UserColorData> userColorDataList;
 
     private List<Label> userColorViewList;
@@ -391,8 +249,8 @@ public class NewColorMethod extends Method {
                 // }
 
                 /** TODO : add data loading & set loaded data - usedColor, usingColor, userColor */
-                usedColorDataList = new ArrayList<ColorData>(MAX_LIST_COUNT);
-                usingColorDataList = new ArrayList<ColorData>(MAX_LIST_COUNT);
+//                usedColorDataList = new ArrayList<ColorData>(MAX_LIST_COUNT);
+//                usingColorDataList = new ArrayList<ColorData>(MAX_LIST_COUNT);
                 userColorViewList = new ArrayList<Label>(MAX_LIST_COUNT - 1);
 
                 /** saturation : x / brightness : y */
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/TextEditor.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/TextEditor.java
new file mode 100644 (file)
index 0000000..948f8f6
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ * UI Builder
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.webuibuilder.ui.views.properties.method;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * This class creates a text editor and then adds it to the parent {@link Composite}.
+ */
+public class TextEditor {
+       
+       public static final int VIEW_POINT_X = 80;
+       public static final int EDITOR_WIDTH = 60;
+    public static final int EDITOR_HEIGHT = 20;
+       private final int LIMITED_LENGTH = 6;
+
+    private Composite parent;
+    private Label label;
+    private Text editor;
+
+    private final Color bgColor = new Color(null, 219, 218, 218);
+
+    /**
+     * Construct
+     * 
+     * @param parent
+     *            the parent {@link Composite}
+     * @param input
+     *            initial value
+     */
+    public TextEditor(final Composite parent, String input) {
+        this.parent = parent;
+        label = new Label(this.parent, SWT.CENTER | SWT.READ_ONLY | SWT.BORDER);
+        editor = new Text(this.parent, SWT.CENTER | SWT.BORDER);
+
+        label.setText(input);
+        /** set default background color */
+        label.setBackground(bgColor);
+        editor.setTextLimit(LIMITED_LENGTH);
+    }
+
+    /**
+     * This method shows the {@link Label} and hides the {@link Text}.
+     */
+    public void showLabel() {
+        label.setVisible(true);
+        editor.setVisible(false);
+    }
+
+    /**
+     * This method shows the {@link Text} and hides the {@link Label}.
+     */
+    public void showEditor() {
+        label.setVisible(false);
+        editor.setVisible(true);
+
+        editor.setText(label.getText());
+        editor.selectAll();
+        editor.setFocus();
+    }
+
+    /**
+     * This method returns the parent {@link Composite} of the {@link TextEditor}.
+     * 
+     * @return a {@link Composite}
+     */
+    public Composite getParent() {
+        return parent;
+    }
+
+    /**
+     * This method returns the {@link Label} of the {@link TextEditor}.
+     * 
+     * @return a {@link Label}
+     */
+    public Label getLabel() {
+        return label;
+    }
+
+    /**
+     * This method returns the {@link Text} of the {@link TextEditor}.
+     * 
+     * @return a {@link Text}
+     */
+    public Text getEditor() {
+        return editor;
+    }
+
+    /**
+     * This method set value of the {@link Label}.
+     * 
+     * @param value
+     *            new value of the {@link Label}
+     */
+    public void setLabel(String value) {
+        if (label == null || label.isDisposed()) {
+            return;
+        }
+        label.setText(value);
+    }
+
+    /**
+     * This method set {@link MouseListener} for the mouse event at the {@link Label}.
+     * 
+     * @param listener
+     *            a {@link MouseListener}
+     */
+    public void setLabelListener(MouseListener listener) {
+        label.addMouseListener(listener);
+    }
+
+    /**
+     * This method set {@link Listener} for the keyboard and mouse event at the {@link Text}.
+     * 
+     * @param listener
+     *            a {@link Listener}
+     */
+    public void setEditorListener(Listener listener) {
+        editor.addListener(SWT.FocusOut, listener);
+        editor.addListener(SWT.Traverse, listener);
+        editor.addListener(SWT.Deactivate, listener);
+    }
+
+    /**
+     * This method set top position of the {@link TextEditor} included in the 'Clip component'.
+     * 
+     * @param left
+     *            a {@link Label}, which is located on the left side
+     */
+    public void setTopPosition(final Label left) {
+        FormData topEditorData = new FormData();
+        topEditorData.left = new FormAttachment(left, 0);
+        // topEditorData.top = new FormAttachment(0, VIEW_POINT_Y);
+        topEditorData.top = new FormAttachment(0, 0);
+        topEditorData.right = new FormAttachment(left, EDITOR_WIDTH * 2);
+        // topEditorData.bottom = new FormAttachment(0, VIEW_POINT_Y + EDITOR_HEIGHT);
+        topEditorData.bottom = new FormAttachment(0, EDITOR_HEIGHT);
+        label.setLayoutData(topEditorData);
+        editor.setLayoutData(topEditorData);
+    }
+
+    /**
+     * This method set right position of the {@link TextEditor} included in the 'Clip
+     * component'.
+     * 
+     * @param left
+     *            a {@link Label}, which is located on the left side
+     */
+    public void setRightPosition(final Label left) {
+        FormData rightEditorData = new FormData();
+        rightEditorData.left = new FormAttachment(left, 0);
+        rightEditorData.top = new FormAttachment(0, EDITOR_HEIGHT);
+        rightEditorData.right = new FormAttachment(left, EDITOR_WIDTH * 2);
+        rightEditorData.bottom = new FormAttachment(0, EDITOR_HEIGHT * 2);
+        label.setLayoutData(rightEditorData);
+        editor.setLayoutData(rightEditorData);
+    }
+
+    /**
+     * This method set left position of the {@link TextEditor} included in the 'Clip component'.
+     */
+    public void setLeftPosition() {
+        FormData rightEditorData = new FormData();
+        rightEditorData.left = new FormAttachment(0, VIEW_POINT_X);
+        rightEditorData.top = new FormAttachment(0, EDITOR_HEIGHT);
+        rightEditorData.right = new FormAttachment(0, VIEW_POINT_X + EDITOR_WIDTH);
+        rightEditorData.bottom = new FormAttachment(0, EDITOR_HEIGHT * 2);
+        label.setLayoutData(rightEditorData);
+        editor.setLayoutData(rightEditorData);
+    }
+
+    /**
+     * This method set bottom position of the {@link TextEditor} included in the 'Clip
+     * component'.
+     * 
+     * @param left
+     *            a {@link Label}, which is located on the left side
+     */
+    public void setBottomPosition(final Label left) {
+        FormData bottomEditorData = new FormData();
+        bottomEditorData.left = new FormAttachment(left, 0);
+        bottomEditorData.top = new FormAttachment(0, EDITOR_HEIGHT * 2);
+        bottomEditorData.right = new FormAttachment(left, EDITOR_WIDTH * 2);
+        bottomEditorData.bottom = new FormAttachment(0, EDITOR_HEIGHT * 3);
+        label.setLayoutData(bottomEditorData);
+        editor.setLayoutData(bottomEditorData);
+    }
+}
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/UserColorData.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/UserColorData.java
new file mode 100644 (file)
index 0000000..cde87d5
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * UI Builder
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.webuibuilder.ui.views.properties.method;
+
+import org.eclipse.swt.graphics.RGB;
+
+/**
+ * This class creates a color data model that contains Alpha value and {@link RGB} value.
+ */
+public class UserColorData {
+    
+    private ColorData color;
+    private int labelWidth;
+    private int labelHeight;
+
+    /**
+     * Construct
+     * 
+     * @param color
+     *            custom {@link ColorData}
+     * @param width
+     *            width of the area to represent the custom color
+     * @param height
+     *            height of the area to represent the custom color
+     */
+    public UserColorData(ColorData color, int width, int height) {
+        this.color = color;
+        labelWidth = width;
+        labelHeight = height;
+    }
+
+    /**
+     * This method returns color data.
+     * 
+     * @return a {@link ColorData}
+     */
+    public ColorData getColorData() {
+        return color;
+    }
+
+    /**
+     * This method returns width of the area to represent the custom color.
+     * 
+     * @return width of the area to represent the custom color
+     */
+    public int getLabelWidth() {
+        return labelWidth;
+    }
+
+    /**
+     * Thid method returns height of the area to represent the custom color.
+     * 
+     * @return height of the area to represent the custom color
+     */
+    public int getLabelHeight() {
+        return labelHeight;
+    }
+
+    /**
+     * This method set color data.
+     * 
+     * @param color
+     *            new {@link ColorData}
+     */
+    public void setColorData(ColorData color) {
+        this.color = color;
+    }
+
+    /**
+     * This method set width of the area to represent the custom color.
+     * 
+     * @param width
+     *            width of the area to represent the custom color
+     */
+    public void setLabelWidth(int width) {
+        labelWidth = width;
+    }
+
+    /**
+     * This method set height of the area to represent the custom color.
+     * 
+     * @param height
+     *            height of the area to represent the custom color
+     */
+    public void setLabelHeight(int height) {
+        labelHeight = height;
+    }
+}
index 9b7863e..212c2a7 100644 (file)
@@ -236,7 +236,7 @@ public class CssStyleAnimationEventDelegater implements IValueChangeListener, IC
     private void putMapProperty(Map<String, String> propertiesMap, String key, String defaultValue) {
 
         String value = getIntervalValue(key);
-        if (value == null || value == BuilderConstants.EMPTY) {
+        if (value == null || value.equals(BuilderConstants.EMPTY)) {
             value = defaultValue;
         }
 
@@ -281,7 +281,7 @@ public class CssStyleAnimationEventDelegater implements IValueChangeListener, IC
             if (frameTime > currentTime) {
                 nextIndex = iter;
                 break;
-            } else if (frameTime == currentTime) {
+            } else if (Double.compare(frameTime, currentTime) == 0) {
                 currentFrame = frame;
                 if (iter + 1 < frameListSize) {
                     nextIndex = iter + 1;
@@ -369,7 +369,7 @@ public class CssStyleAnimationEventDelegater implements IValueChangeListener, IC
     private String getTransformValueBetweenTwoFrames(String propertyName,
                                                      AnimatorFrame previewFrame,
                                                      AnimatorFrame postFrame, double currentTime) {
-        if (propertyName != null && propertyName == BuilderConstants.EMPTY) {
+        if (propertyName != null && propertyName.equals(BuilderConstants.EMPTY)) {
             return null;
         }
         if (previewFrame == null && postFrame == null) {