PROP : Refactoring code about properties. 37/18737/1
authornakyoung2.choi <nakyoung2.choi@samsung.com>
Mon, 31 Mar 2014 05:54:21 +0000 (14:54 +0900)
committernakyoung2.choi <nakyoung2.choi@samsung.com>
Mon, 31 Mar 2014 05:54:21 +0000 (14:54 +0900)
Advanced string/double compare code. Removes inner classes.

Change-Id: I10e0037dc40b7804ee6b2fe0c88c16a288554737
Signed-off-by: nakyoung2.choi <nakyoung2.choi@samsung.com>
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 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) {