Merge remote-tracking branch 'origin/develop' into nscreen 95/21495/2 nscreen
authoryonghwan82.jeon <yonghwan82.jeon@samsung.com>
Thu, 22 May 2014 01:11:09 +0000 (10:11 +0900)
committeryonghwan jeon <yonghwan82.jeon@samsung.com>
Thu, 22 May 2014 01:13:19 +0000 (18:13 -0700)
* origin/develop: (33 commits)
  ANIMATOR : Bug fix for loading animation Serailize & Deserailize boolean variable whether predefined or not for Keyframe
  NSCREEN : nscreen debug log added, viewport fixed 1. add nscreen hidden log added 1-1. css layer and viewport log (on/off available) 2. viewport sync(between designer and source) added.
  DATABIND: update the descriptors a. add attrhref type in the tizen.types.xml b. add ID_OF_DATABINDING_ATTR_HREF in TypeDescriptor.java and DescriptorManager.java c. add attrhref binding for the link widget
  ANIMATOR : Convert milliseconds and position This is for compute milliseconds and convert time to position, position to time.
  PROP : Fix setCssStyleCommand undo bug. And advanced refresh on HoverViewerEditPart.
  DATABIND: bug fixed (databinding view)
  Merge remote-tracking branch 'origin/mw' into develop
  ANIMATOR : Bug fix for opacity property Modify opacity realted point proloem and change type to double when calculate interpolaved value
  DESIGNER : code refactoring
  DATABIND: Modify the width of the set target dialog
  DATABIND : add the icon in the databinding view
  DATABIND: modify the rename functions
  Show MetricsMethod on Ubuntu.And fix set background color problem on MetricsMethod.
  ANIMATOR : Get default property value from CSSProperties.xml
  ANIMATOR : Change TreeItem Height Changing for treeItem height size and multiplatform.
  DESIGNER : move/resize unit to be changed 10 -> 3
  DESIGNER : move/resize unit to be changed 10 -> 3
  PROP : fix, when edit the CSS, NPE occurs intermittently
  UIB : Fix NPE.
  PAGES: Add Delete Page action to delete pages on Pages view. Modified flow of adding pages and deleting pages while Delete Page action is added.
  ...

Change-Id: Ic15ec4f8f3c7873074cab24af5923ce995acc6af
Signed-off-by: yonghwan82.jeon <yonghwan82.jeon@samsung.com>
120 files changed:
org.tizen.webuibuilder/plugin.xml
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/CSSProperties.xml
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/tizen.types.xml
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/widget/html.headingfive.widget.xml
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/widget/html.headingfour.widget.xml
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/widget/html.headingone.widget.xml
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/widget/html.headingsix.widget.xml
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/widget/html.headingthree.widget.xml
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/widget/html.headingtwo.widget.xml
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/widget/html.image.widget.xml
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/widget/html.link.widget.xml
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/widget/tizen.datetimepicker.widget.xml
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/widget/tizen.listitemthumbnail.widget.xml
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/widget/tizen.slider.widget.xml
org.tizen.webuibuilder/res/icons/empty.png [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/BuilderConstants.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/gef/command/AnimationCreateAndChangeFrameCommand.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/AnimatorSelector.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/AnimatorWidget.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/CSSProperty.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/deserializer/AnimatorFrameDeserializer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/model/serializer/AnimatorFrameSerializer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/TimelineContentContainer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/TimelineContextMenu.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/TimelineMainContainer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/TimelinePage.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/TimelineViewer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/action/PasteKeyFrameAction.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/action/ZOrderKeyFrameAction.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/common/Formatter.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/common/TimelineConstants.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/common/TimelineMessages.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/common/TimelineMessages.properties
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/header/PlayHeader.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/header/TimeBar.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/header/TimeBarRenderer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/tool/TimelineToolbar.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/tree/TimeTreeElement.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/tree/TimelineOutlineElement.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/tree/TimelineWidgetElement.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/widget/KeyFrame.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/widget/KeyFrameUnit.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/widget/TimelineWidgetContextMenu.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/utils/AnimatorUtils.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/bridge/DesignerGoingBridge.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/bridge/GoingBridge.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/ChangeCssSelectorCommand.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/CreateCssSelectorCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/CreatePageCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/DeletePageAction.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/DeletePageCommand.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/DesignerMoveLayoutCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/DesignerResizeAndMoveLayoutCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/DesignerResizeLayoutCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/MoveAbsolutePartAction.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/ResizeAbsolutePartAction.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/SetCssStyleCommand.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/editparts/DesignerEditPart.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/editparts/HoverViewerEditPart.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/policies/DesignerAbsoluteDragEditPolicy.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/policies/DesignerDragEditPolicy.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/policies/DesignerXYLayoutEditPolicy.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/viewer/HoverBrowserEventDelegator.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/viewer/HoverBrowserViewer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/Part.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/app/AppManagerForHTML.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/css/CssSelector.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/descriptors/DescriptorManager.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/descriptors/TypeDescriptor.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/nscreen/descriptors/NScreenDescriptor.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/page/PageData.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/page/PageDataPaths.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/page/PageDataSet.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/pagetemplate/action/CssSelecotrAction.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/pagetemplate/ui/wizard/policy/NewPagePolicy.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/actions/WebUIBuilderActionConstants.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/contextmenu/Messages.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/contextmenu/Messages.properties
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/editor/PageDesigner.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/editor/PageDesignerForHTML.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/editor/PageDesignerToolbar.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/editor/ResolutionManger.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/DataBindingDnDManager.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/DataBindingPage.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/DataBindingTooltipParser.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/actions/GetSourceAction.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/actions/SetTargetAction.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/dialog/SetTargetPage.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/model/BindingInfo.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/nscreen/NScreenItem.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/nscreen/NScreenPage.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/nscreen/NScreenUtil.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/pages/PagesPage.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/pages/PagesViewContextMenu.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/PropertiesPage.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/MetricsMethod.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/method/ScaleMethod.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/style/CssStyleEventDelegater.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/properties/style/CssStyleTab.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/utility/DomUtil.java
package/adding_files/macos/ide/IDE.app/Contents/Resources/qt.conf [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/Resources/qt.conf with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/Resources/qt_menu.nib/classes.nib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/Resources/qt_menu.nib/classes.nib with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/Resources/qt_menu.nib/info.nib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/Resources/qt_menu.nib/info.nib with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/Resources/qt_menu.nib/keyedobjects.nib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/Resources/qt_menu.nib/keyedobjects.nib with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/plugins/imageformats/libqgif.dylib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/plugins/imageformats/libqgif.dylib with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/plugins/imageformats/libqico.dylib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/plugins/imageformats/libqico.dylib with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/plugins/imageformats/libqjpeg.dylib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/plugins/imageformats/libqjpeg.dylib with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/plugins/imageformats/libqmng.dylib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/plugins/imageformats/libqmng.dylib with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/plugins/imageformats/libqsvg.dylib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/plugins/imageformats/libqsvg.dylib with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/plugins/imageformats/libqtga.dylib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/plugins/imageformats/libqtga.dylib with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/plugins/imageformats/libqtiff.dylib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/plugins/imageformats/libqtiff.dylib with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/plugins/imageformats/libqwbmp.dylib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/plugins/imageformats/libqwbmp.dylib with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/plugins/platforms/libqcocoa.dylib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/plugins/platforms/libqcocoa.dylib with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/plugins/platforms/libqminimal.dylib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/plugins/platforms/libqminimal.dylib with 100% similarity]
package/adding_files/macos/ide/IDE.app/Contents/plugins/platforms/libqoffscreen.dylib [moved from package/adding_files/macos/ide/TizenIDE.app/Contents/plugins/platforms/libqoffscreen.dylib with 100% similarity]
package/changelog
package/pkginfo.manifest

index 54005db..339431d 100644 (file)
                relative="org.eclipse.ui.views.ContentOutline">
          </view>
          <view
-               id="org.tizen.injector.view.InjectorView"
-               minimized="false"
-               relationship="stack"
-               relative="org.eclipse.ui.views.ContentOutline">
-         </view>
-         <view
                id="org.eclipse.ui.views.PropertySheet"
                minimized="false"
                ratio=".7"
          point="org.eclipse.ui.perspectiveExtensions">
       <perspectiveExtension
             targetID="org.tizen.web.ui.perspective.WebWidget">
+            <!--
          <view
                id="org.tizen.webuibuilder.ui.views.PagesView"
                minimized="false"
                relationship="stack"
                relative="org.eclipse.ui.console.ConsoleView">
          </view>
+         -->
       </perspectiveExtension>
    </extension>
    <!--
index 26221fa..72fa360 100644 (file)
@@ -12,8 +12,8 @@
     <category name="dimension" displayName="Dimension" brief="%left%,%top%,%width%,%height%">
        <property name="left" type="size" displayName="Left" default="auto" inline="true"></property>
         <property name="top" type="size" displayName="Top" default="auto" inline="true"></property>
-        <property name="width" type="size" displayName="Width" inline="true"></property>
-           <property name="height" type="size" displayName="Height" inline="true"></property>
+        <property name="width" type="size" displayName="Width" inline="true" default="auto"></property>
+           <property name="height" type="size" displayName="Height" inline="true" default="auto"></property>
     </category>
 
     <category name="text" displayName="Text" brief="">
index 65d2c37..953d976 100644 (file)
                <constant value="foreach" displayName=""/>
        </type>
 
+       <type id="slider@databinding">
+               <constant value="slider" displayName=""/>
+       </type>
+
        <type id="textchecked@databinding">
                <constant value="text" displayName=""/>
                <constant value="checked" displayName=""/>
                <constant value="text" displayName=""/>
        </type>
 
-       <type id="attr@databinding">
+       <type id="attrsrc@databinding">
                <constant value="attr" displayName="src"/>
        </type>
 
                <constant value="attr" displayName="for"/>
                <constant value="attr" displayName="form"/>
        </type>
+
+       <type id="attrhref@databinding">
+               <constant value="text" displayName=""/>
+               <constant value="attr" displayName="href"/>
+       </type>
 </types>
\ No newline at end of file
index 30ff2c6..5d54fb4 100644 (file)
@@ -15,6 +15,8 @@
        </property>
        <property name="text" type="string"            displayName="Text" default="" initValue="Heading5" xpath="text()"/>
 
+       <property name="data-bind" type="text@databinding" displayName="Data Binding" default="" initValue=""/>
+
        <event name="ontap" displayName="Tap" eventType="event.defaultevent" />
        <event name="ontaphold" displayName="TapHold" eventType="event.defaultevent" />
        <event name="onswipe" displayName="Swipe" eventType="event.defaultevent" />
index 27c49d2..d853d5c 100644 (file)
@@ -15,6 +15,8 @@
        </property>
        <property name="text" type="string"            displayName="Text" default="" initValue="Heading4" xpath="text()"/>
 
+       <property name="data-bind" type="text@databinding" displayName="Data Binding" default="" initValue=""/>
+
        <event name="ontap" displayName="Tap" eventType="event.defaultevent" />
        <event name="ontaphold" displayName="TapHold" eventType="event.defaultevent" />
        <event name="onswipe" displayName="Swipe" eventType="event.defaultevent" />
index 28854cf..3a0b161 100644 (file)
@@ -25,7 +25,7 @@
                <condition name="disable-property-by-parent" value="tizen.header"/>
        </property> -->
        
-       <property name="data-bind" type="text@databinding" displayName="Data Binding" default="text" initValue=""/>
+       <property name="data-bind" type="text@databinding" displayName="Data Binding" default="" initValue=""/>
 
        <event name="ontap" displayName="Tap" eventType="event.defaultevent" />
        <event name="ontaphold" displayName="TapHold" eventType="event.defaultevent" />
index a434e7e..be5c965 100644 (file)
@@ -15,6 +15,8 @@
        </property>
        <property name="text" type="string"            displayName="Text" default="" initValue="Heading6" xpath="text()"/>
 
+       <property name="data-bind" type="text@databinding" displayName="Data Binding" default="" initValue=""/>
+
        <event name="ontap" displayName="Tap" eventType="event.defaultevent" />
        <event name="ontaphold" displayName="TapHold" eventType="event.defaultevent" />
        <event name="onswipe" displayName="Swipe" eventType="event.defaultevent" />
index cde1295..b2a31ca 100644 (file)
@@ -15,6 +15,8 @@
        </property>
        <property name="text" type="string"            displayName="Text" default="" initValue="Heading3" xpath="text()"/>
 
+       <property name="data-bind" type="text@databinding" displayName="Data Binding" default="" initValue=""/>
+
        <event name="ontap" displayName="Tap" eventType="event.defaultevent" />
        <event name="ontaphold" displayName="TapHold" eventType="event.defaultevent" />
        <event name="onswipe" displayName="Swipe" eventType="event.defaultevent" />
index 5f6ae64..2a8b48a 100644 (file)
@@ -15,6 +15,8 @@
        </property>
        <property name="text" type="string"            displayName="Text" default="" initValue="Heading2" xpath="text()"/>
 
+       <property name="data-bind" type="text@databinding" displayName="Data Binding" default="" initValue=""/>
+
        <event name="ontap" displayName="Tap" eventType="event.defaultevent" />
        <event name="ontaphold" displayName="TapHold" eventType="event.defaultevent" />
        <event name="onswipe" displayName="Swipe" eventType="event.defaultevent" />
index 6fc5729..702ec15 100644 (file)
@@ -28,7 +28,7 @@
                <property name="border-style" type="border@style" displayName="Style" selector="#%id%"/>
        </property> -->
        
-       <property name="data-bind" type="attr@databinding" displayName="Data Binding" default="" initValue=""/>
+       <property name="data-bind" type="attrsrc@databinding" displayName="Data Binding" default="" initValue=""/>
 
        <event name="ontap" displayName="Tap" eventType="event.defaultevent" />
        <event name="ontaphold" displayName="TapHold" eventType="event.defaultevent" />
index 04b1256..8520426 100644 (file)
@@ -31,6 +31,8 @@
        <!-- <property name="data-rel"        type="html.link@rel"        displayName="Rel"        default=""/> -->
        <property name="data-transition" type="html.link@transition" displayName="Transition" default=""/>
 
+       <property name="data-bind" type="attrhref@databinding" displayName="Data Binding" default="" initValue=""/>
+
        <event name="ontap" displayName="Tap" eventType="event.defaultevent" />
        <event name="ontaphold" displayName="TapHold" eventType="event.defaultevent" />
        <event name="onswipe" displayName="Swipe" eventType="event.defaultevent" />
index 5773339..9a55fcf 100644 (file)
@@ -46,6 +46,8 @@
        <property name="value"       type="tizen.datetimepicker@value"  displayName="Value"  default=""
                tooltip="Sets the picker date value"/>
 
+       <property name="data-bind" type="value@databinding" displayName="Data Binding" default="" initValue=""/>
+
        <event name="onchange" displayName="Change" eventType="event.defaultevent" />
 
        <xsl-for-output xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
index de2d6fc..8545eb3 100644 (file)
@@ -26,7 +26,7 @@
                <property name="border-style" type="border@style" displayName="Style" selector="#%id%"/>
        </property> -->
        
-       <property name="data-bind" type="attr@databinding" displayName="Data Binding" default="" initValue=""/>
+       <property name="data-bind" type="attrsrc@databinding" displayName="Data Binding" default="" initValue=""/>
 
        <event name="ontap" displayName="Tap" eventType="event.defaultevent" />
        <event name="ontaphold" displayName="TapHold" eventType="event.defaultevent" />
index c0ea2d7..2bd5734 100644 (file)
@@ -68,6 +68,8 @@
                tooltip="Enables or disables a pop-up showing the current value while the handle is dragged"/>
        <property name="data-highlight"  type="tizen@boolean1"    displayName="Highlight"  default=""/>
 
+       <property name="data-bind" type="slider@databinding" displayName="Data Binding" default="" initValue=""/>
+
        <!-- <event name="ontap" displayName="Tap" eventType="event.defaultevent" /> 
        <event name="ontaphold" displayName="TapHold" eventType="event.defaultevent" />
        <event name="onswipe" displayName="Swipe" eventType="event.defaultevent" />
diff --git a/org.tizen.webuibuilder/res/icons/empty.png b/org.tizen.webuibuilder/res/icons/empty.png
new file mode 100644 (file)
index 0000000..782431c
Binary files /dev/null and b/org.tizen.webuibuilder/res/icons/empty.png differ
index 1406bc1..b6d6e33 100644 (file)
@@ -99,6 +99,9 @@ public class BuilderConstants {
        // Model IO
        public static final String ATTRIBUTE_PID = "part-id"; //$NON-NLS-1$
        public static final String ATTRIBUTE_STYLE = "style"; //$NON-NLS-1$
+       public static final String ATTRIBUTE_VALUE_POSITION = "position"; //$NON-NLS-1$
+       public static final String ATTRIBUTE_VALUE_LEFT = "left"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_VALUE_TOP = "top"; //$NON-NLS-1$
        public static final String ATTRIBUTE_VALUE_WIDTH = "width"; //$NON-NLS-1$
        public static final String ATTRIBUTE_VALUE_HEIGHT = "height"; //$NON-NLS-1$
        public static final String ATTRIBUTE_VALUE_PX = PX;
@@ -258,6 +261,7 @@ public class BuilderConstants {
        public static final String DATABINDING_TYPE_REMOTECALL = "Remote Call"; //$NON-NLS-1$
        public static final String DATABINDING_ARRAY_ICON = "temp.png"; //$NON-NLS-1$
        public static final String DATABINDING_BINDING_ICON = "binded.gif"; //$NON-NLS-1$
+       public static final String DATABINDING_STRING_ICON = "empty.png"; //$NON-NLS-1$
        
        // HandlerCodeWriter
        public static final String FILENAME = "%FileName%"; //$NON-NLS-1$
@@ -304,4 +308,12 @@ public class BuilderConstants {
        public static final String NSCREENPORTRAIT = "Portrait"; //$NON-NLS-1$
        public static final String NSCREENLANDSCAPE = "Landscape"; //$NON-NLS-1$
 
+       // Profile
+    public static final String PROFILE_MOBILE = "mobile"; //$NON-NLS-1$
+    public static final String PROFILE_WEARABLE = "wearable"; //$NON-NLS-1$
+    public static final String PROFILE_TV = "tv"; //$NON-NLS-1$
+
+    public static final String PROFILE_MOBILE_2_3 = PROFILE_MOBILE + DASH + "2.3"; //$NON-NLS-1$
+    public static final String PROFILE_WEARABLE_2_3 = PROFILE_WEARABLE + DASH + "2.3"; //$NON-NLS-1$
+
 }
index ae201f3..8d97640 100644 (file)
@@ -27,7 +27,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.eclipse.gef.commands.Command;
-import org.eclipse.wst.sse.core.internal.model.ModelManagerImpl;
 import org.tizen.webuibuilder.animator.model.AnimatorFrame;
 import org.tizen.webuibuilder.animator.model.AnimatorKeyframe;
 import org.tizen.webuibuilder.animator.model.AnimatorModelEvent;
index 8c7556d..8aa47a9 100644 (file)
@@ -578,8 +578,9 @@ public class AnimatorFrame extends AnimatorModel {
                }
                
                 if (getUsedPropertiesInThisFrame().contains(key)) {
-                       if(!keyframe.getName().contains("custom")) {
-                               computedProperties.put(key, getComputedPropertyforPredefinedAnimationFromPreviousKeyframe(key, widgetProperties.get(key)));
+                       if(isPredefined) {
+//                             computedProperties.put(key, getComputedPropertyforPredefinedAnimationFromPreviousKeyframe(key, widgetProperties.get(key)));
+                               computedProperties.put(key, getComputedPropertyforPredefinedAnimationFromPreviousCustomFrame(selector.getPreviousComputedProperty(this, key), key, widgetProperties.get(key)));
                        } else {
                         computedProperties.put(key, properties.get(key));
                        }
@@ -597,6 +598,8 @@ public class AnimatorFrame extends AnimatorModel {
         return this.computedProperties;
     }
     
+
+    
     /**
      * Get value that as a percentage of the css3 value
      * 
@@ -825,9 +828,11 @@ public class AnimatorFrame extends AnimatorModel {
             }
             String start = previousFrameProperties.get(key);
             String end = nextFrameProperties.get(key);
-            String interpolatedValue =
+            if(start != null && end != null) {
+               String interpolatedValue =
                     getInterpolatedValue(key, start, end, middle, easingProperty);
-            addProperty(key, interpolatedValue);
+               addProperty(key, interpolatedValue);
+            }
         }
         if (previousFrame.getCurveFrames().size() > 0) {
             Point p;
index a456b60..82d6535 100644 (file)
@@ -177,7 +177,7 @@ public class AnimatorKeyframe extends AnimatorModel {
      * @return
      */
     public double calculateFramePercent(double frameTime) {
-        return frameTime / duration * 100;
+        return frameTime / duration * 100.0;
     }
 
     /**
index f109858..e54b4ef 100644 (file)
@@ -419,7 +419,6 @@ public class AnimatorSelector extends AnimatorModel {
                                mergedFrame.addProperty(key, 
                                                mergedFrame.getComputedPropertyforPredefinedAnimationFromPreviousCustomFrame(
                                                                previousProperty, key, widgetProperties.get(key)));
-                       
                        } else {
                                String mergedFrameProperty = mergedFrame.getProperty(key);
                                if(mergedFrameProperty != null) {
@@ -585,7 +584,16 @@ public class AnimatorSelector extends AnimatorModel {
         return result;
     }
     
-    
+    /**
+     * Check with two keyframes that has same properties
+     * case 1. they have different properties and have same parent just keep going
+     * case 2. different properties and have different parent, merge to first keyframe's parent
+     * case 3. they have same properties and have same parent create other keyframe unit and move to last one to created keyframe unit
+     * case 4. they have same properties and have different parent just keep going     * 
+     * 
+     * @param keyframe
+     * @return
+     */
     public boolean mergeOrSplitKeyframe(AnimatorModelFactory modelFactory, List<AnimatorKeyframe> removedKeyframes) {
        boolean result = false;
        AnimatorFrame currentFrame = getNextAnimatorFrameByTime(null);
@@ -647,6 +655,20 @@ public class AnimatorSelector extends AnimatorModel {
        return result;
     }
     
+    public String getPreviousComputedProperty(AnimatorFrame currentFrame, String key) {
+       AnimatorFrame frame = getPreviousAnimatorFrameByTime(currentFrame);
+       while(frame != null) {
+               if(!frame.isPredefined()) {
+                       String value = frame.getProperty(key);
+                       if(value != null) {
+                               return value;
+                       }
+               }
+                       frame = getPreviousAnimatorFrameByTime(frame);
+       }
+       return null;
+    }
+    
 
     private AnimatorFrame getPreviousAnimatorFrameByTime(AnimatorFrame currentFrame) {         
        
index d5e731b..c933b96 100644 (file)
@@ -23,6 +23,7 @@
 
 package org.tizen.webuibuilder.animator.model;
 
+import java.text.DecimalFormat;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -36,6 +37,10 @@ import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.model.css.CssFile;
 import org.tizen.webuibuilder.model.css.CssSelector;
 import org.tizen.webuibuilder.model.css.CssStyle;
+import org.tizen.webuibuilder.model.css.descriptors.CssCategoryDescriptor;
+import org.tizen.webuibuilder.model.css.descriptors.CssDescriptor;
+import org.tizen.webuibuilder.model.descriptors.DescriptorManager;
+import org.tizen.webuibuilder.model.descriptors.PropertyDescriptor;
 import org.tizen.webuibuilder.model.page.PageData;
 
 
@@ -45,6 +50,7 @@ import org.tizen.webuibuilder.model.page.PageData;
 public class AnimatorWidget extends AnimatorModel {
     private boolean visibility = true;
     private boolean lock = false;
+    private Map<String, String> initializeProperties = new HashMap<String, String>();
     
     public AnimatorWidget() {
                // TODO Auto-generated constructor stub
@@ -195,9 +201,6 @@ public class AnimatorWidget extends AnimatorModel {
      */
     public Map<String, String> getWidgetProperties(Set<String> propertiesUsed, String selector) {
         Map<String, String> properties = new HashMap<String, String>();
-        initializeWithDefault(properties);
-        properties.put("width", getPartLink().getPositionProperty().width + "px");
-        properties.put("height", getPartLink().getPositionProperty().height + "px");
         AnimatorWidgetPart widgetPart = (AnimatorWidgetPart)getPartLink();
         AnimatorPagePart pagePart = (AnimatorPagePart)widgetPart.getOwnerPage();
         if(!(pagePart.getOwnerRef() instanceof PageData)) {
@@ -205,6 +208,13 @@ public class AnimatorWidget extends AnimatorModel {
         }
         
         PageData pageData = (PageData)pagePart.getOwnerRef();
+        if(initializeProperties.size() == 0) {
+               initializeWithDefault(pageData.getDescriptorManager());
+        }
+        properties.putAll(initializeProperties);
+        properties.put("width", getPartLink().getPositionProperty().width + "px");
+        properties.put("height", getPartLink().getPositionProperty().height + "px");
+        
         CssFile cssFile = pageData.getCurrentCssFile();
         if(cssFile == null)
                return properties;
@@ -239,18 +249,61 @@ public class AnimatorWidget extends AnimatorModel {
         }
     }
 
-    private void initializeWithDefault(Map<String, String> properties) {
-        properties.put("background-color", "#ffffff");
-        properties.put("opacity", "1");
-        properties.put("translateX", "0px");
-        properties.put("translateY", "0px");
-        properties.put("rotateX", "0deg");
-        properties.put("rotateY", "0deg");
-        properties.put("rotateZ", "0deg");
-        properties.put("scaleX", "1");
-        properties.put("scaleY", "1");
-        properties.put("skewX", "0deg");
-        properties.put("skewY", "0deg");
-        properties.put("perspective", "0px");
+    private void initializeWithDefault(DescriptorManager descriptorManager) {
+       
+       CssDescriptor cssDescriptor = descriptorManager.getCssDescriptor();
+       for(CssCategoryDescriptor categoryDescriptor : cssDescriptor.getCssCategoryDescriptors()) {
+               initializeProperties.putAll(getCssPropertyDescriptor(categoryDescriptor.getCssPropertyDescriptors()));
+               }
+       
+       
+//        properties.put("background-color", "#ffffff");
+//        properties.put("opacity", "1");
+//        properties.put("translateX", "0px");
+//        properties.put("translateY", "0px");
+//        properties.put("rotateX", "0deg");
+//        properties.put("rotateY", "0deg");
+//        properties.put("rotateZ", "0deg");
+//        properties.put("scaleX", "1");
+//        properties.put("scaleY", "1");
+//        properties.put("skewX", "0deg");
+//        properties.put("skewY", "0deg");
+//        properties.put("perspective", "0px");
+    }
+    
+    
+    private <T extends PropertyDescriptor> Map<String, String> getCssPropertyDescriptor(List<T> cssPropertyDescriptor) {
+       Map<String, String> properties = new HashMap<String, String>();
+       
+       for(PropertyDescriptor propertyDescriptor : cssPropertyDescriptor) {
+               String property = propertyDescriptor.getPropertyName();
+                       String defaultValue = propertyDescriptor.getDefaultValue();
+                       if(property != null && !property.equals("") && defaultValue != null && !defaultValue.equals("")) {
+                               //change defaultValue or Property name... change not to hard coding
+                               if(property.equals("opacity")) {
+                                       DecimalFormat format = new DecimalFormat("#.###");
+                               defaultValue = format.format(Double.parseDouble(defaultValue) / 100);
+                       } else if(property.equals("translate.x")) {
+                               property = "translateX";
+                       } else if(property.equals("translate.y")) {
+                               property = "translateY";
+                       } else if(property.equals("rotate.z")) {
+                               property = "rotateZ";
+                       } else if(property.equals("scale.x")) {
+                               property = "scaleX";
+                       } else if(property.equals("scale.y")) {
+                               property = "scaleY";
+                       } else if(property.equals("skew.x")) {
+                               property = "skewX";
+                       } else if(property.equals("skew.y")) {
+                               property = "skewY";
+                       }
+                               properties.put(property, defaultValue);
+                       }
+                       
+                       properties.putAll(getCssPropertyDescriptor(propertyDescriptor.getChildPropertyDescriptors()));
+       }
+       
+       return properties;
     }
 }
index bdd0520..036547e 100644 (file)
@@ -52,6 +52,7 @@ public class CSSProperty {
         propertyTypeMap.put("skewY", PropertyType.Double);
         propertyTypeMap.put("scaleX", PropertyType.Double);
         propertyTypeMap.put("scaleY", PropertyType.Double);
+        propertyTypeMap.put("opacity", PropertyType.Double);
     }
 
     /**
@@ -76,15 +77,17 @@ public class CSSProperty {
     }
 
     private void parseValue(String value) {
-        if (type == PropertyType.Int) {
-            parseIntOrDouble(value);
-            this.value = (double) Integer.parseInt(stringValue);
-        } else if (type == PropertyType.Double) {
-            parseIntOrDouble(value);
-            this.value = Double.parseDouble(stringValue);
-        } else {// Hexa case
-            parseHexa(value);
-        }
+       if(value != null) {
+               if (type == PropertyType.Int) {
+                   parseIntOrDouble(value);
+                   this.value = (double) Integer.parseInt(stringValue);
+               } else if (type == PropertyType.Double) {
+                   parseIntOrDouble(value);
+                   this.value = Double.parseDouble(stringValue);
+               } else {// Hexa case
+                   parseHexa(value);
+               }
+       }
     }
 
     private void parseIntOrDouble(String value) {
index 09b28f8..1986939 100644 (file)
@@ -62,15 +62,18 @@ public class AnimatorFrameDeserializer extends AnimatorModelDeserializer<Animato
         AnimatorFrame frame = (AnimatorFrame)getModelFactory().createAnimatorModel(AnimatorModelType.FRAME);
         for (Map.Entry<String, JsonElement> entry : jobject.entrySet()) {
             String key = entry.getKey();
-            if (key.equals("time"))
+            if (key.equals("time")) {
                 frame.setFrameTime(entry.getValue().getAsDouble());
-            else if (key.equals("curveFrames")) {
+            } else if (key.equals("isPredefined") ){
+               frame.setPredefined(entry.getValue().getAsBoolean());
+            } else if (key.equals("curveFrames")) {
                 for (JsonElement curveFrame : jobject.get("curveFrames").getAsJsonArray()) {
                     frame.addCurveFrame((AnimatorCurveFrame) context
                             .deserialize(curveFrame, AnimatorCurveFrame.class));
                 }
-            } else
+            } else {
                 frame.addProperty(key, entry.getValue().getAsString());
+            }
         }
 
         return frame;
index e98ba76..e757f61 100644 (file)
@@ -56,6 +56,7 @@ public class AnimatorFrameSerializer implements JsonSerializer<AnimatorFrame> {
 
         final JsonObject json = new JsonObject();
         json.addProperty("time", frame.getFrameTime());
+        json.addProperty("isPredefined", frame.isPredefined());
 
         Iterator<Entry<String, String>> iterator = ((AnimatorFrame) frame).getPropertyIterator();
         while (iterator.hasNext()) {
index f853e24..f8a34c4 100644 (file)
@@ -46,6 +46,7 @@ import org.eclipse.swt.widgets.TreeItem;
 import org.tizen.webuibuilder.animator.model.AnimatorAnimation;
 import org.tizen.webuibuilder.animator.model.part.AnimatorPagePart;
 import org.tizen.webuibuilder.animator.ui.views.timeline.common.ColorResource;
+import org.tizen.webuibuilder.animator.ui.views.timeline.common.Formatter;
 import org.tizen.webuibuilder.animator.ui.views.timeline.common.TimelineConstants;
 import org.tizen.webuibuilder.animator.ui.views.timeline.header.PlayHeader;
 import org.tizen.webuibuilder.animator.ui.views.timeline.header.TimeBar;
@@ -104,7 +105,7 @@ public class TimelineContentContainer extends Composite {
         contentHeaderContainer = new TimelineContentHeaderContainer(this, SWT.NONE);
         FormData contentHeaderContainerFormData = new FormData();
         contentHeaderContainerFormData.top = new FormAttachment(0);
-        contentHeaderContainerFormData.bottom = new FormAttachment(0, 30);
+        contentHeaderContainerFormData.bottom = new FormAttachment(0, TimelineConstants.DEFAULT_TIMEBAR_HEIGHT);
         contentHeaderContainerFormData.left = new FormAttachment(0);
         contentHeaderContainerFormData.right = new FormAttachment(100);
         contentHeaderContainer.setLayoutData(contentHeaderContainerFormData);
@@ -264,7 +265,7 @@ public class TimelineContentContainer extends Composite {
 
                 // null check
                 TimeBar timeBar = contentHeaderContainer.getKeyframeHeader().getTimeBar();
-                timeBar.setStartTime(sel);
+                timeBar.setStartTime(sel * TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL);
                 timeBar.redraw();
 
                 // TimeMarker
@@ -317,7 +318,7 @@ public class TimelineContentContainer extends Composite {
             int lineXpoint = treeX + marker.getBounds().x;
             int lineHeight =
                     contentTreeContainer.getBounds().height
-                            + TimelineConstants.DEFAULT_TIMEBAR_MARGINE + 1;
+                            + TimelineConstants.DEFAULT_TIMEBAR_HEIGHT;
 
             playHeaderLine.setSize(1, lineHeight);
             playHeaderLine.setLocation(lineXpoint, 0);
@@ -380,12 +381,12 @@ public class TimelineContentContainer extends Composite {
      * @param scrollMove
      *            non move is 0, move is 1, have to move 2
      */
-    public void refreshHScroll(double pointTime, int path, int incrementSize, int scrollMove) {
-
+    public void refreshHScroll(int pointTime, int path, int incrementSize, int scrollMove) {
+        int MINT_TIMEPOINT = 2000;
         TimeBar timeBar = contentHeaderContainer.getKeyframeHeader().getTimeBar();
 
-        double startTime = timeBar.getStartTime();
-        double lastTime = 0.0;
+        int startTime = timeBar.getStartTime();
+        int lastTime = 0;
 
         lastTime = getLastTimeInAnimationGroup();
 
@@ -395,7 +396,7 @@ public class TimelineContentContainer extends Composite {
         }
 
         ScrollBar hScroll = contentToolsContainer.gethScroll();
-        int lastTimeSel = (int) (lastTime * TimelineConstants.DEFAULT_TIME_INTERVAL);
+        int lastTimeSel = (int) (lastTime / TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL);
 
         if (lastTimeSel <= TimelineConstants.DEFAULT_HSCROLL_SIZE) {
             hScroll.setMaximum(TimelineConstants.DEFAULT_HSCROLL_SIZE);
@@ -407,17 +408,17 @@ public class TimelineContentContainer extends Composite {
             int increment = lastTimeSel / TimelineConstants.DEFAULT_HSCROLL_SELECTION_INTERVAL;
             hScroll.setSelection(increment * TimelineConstants.DEFAULT_HSCROLL_SELECTION_INTERVAL);
         }
-
+        
         // start Time
-        if ((path == 0 && (startTime <= 0.0)) || ((pointTime <= 2) && scrollMove == 2)) {
-            startTime = 0.0;
+        if ((path == 0 && (startTime <= 0)) || ((pointTime <= MINT_TIMEPOINT) && scrollMove == 2)) {
+            startTime = 0;
             hScroll.setSelection(0);
         } else if (scrollMove == 2) {
             // last Time
-            startTime = (pointTime - 2) * 10.0;
+            startTime = (pointTime - MINT_TIMEPOINT);
         } else {
             // last Time
-            startTime = startTime + (incrementSize / timeBar.getScale());
+            startTime = (int) (startTime + ((incrementSize / timeBar.getScale()) * TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL));
         }
 
         if (scrollMove == 1 || scrollMove == 2) {
@@ -454,8 +455,8 @@ public class TimelineContentContainer extends Composite {
      * 
      * @return
      */
-    public double getLastTimeInAnimationGroup() {
-        double lastTime = 0.0;
+    public int getLastTimeInAnimationGroup() {
+        int lastTime = 0;
 
         String animationGroupId =
                 getContentHeaderContainer().getOutlineHeader().getSelectedAnimationGroupId();
@@ -465,8 +466,8 @@ public class TimelineContentContainer extends Composite {
 
         animation.calculateAnimationDuration();
         String timeString = animation.getDuration();
-
-        lastTime = AnimatorUtils.convertTimeToDouble(timeString);
+        double converTime = AnimatorUtils.convertTimeToDouble(timeString);
+        lastTime = Formatter.timeToComputeTime(converTime);
 
         return lastTime;
     }
index b996a66..255b105 100644 (file)
@@ -15,7 +15,9 @@ import org.eclipse.jface.action.Separator;
 import org.eclipse.ui.actions.ActionFactory;\r
 import org.tizen.webuibuilder.animator.model.descriptor.AnimatorDescriptorManager;\r
 import org.tizen.webuibuilder.animator.model.descriptor.CssAnimationDescriptor;\r
+import org.tizen.webuibuilder.animator.ui.views.timeline.action.ZOrderKeyFrameAction;\r
 import org.tizen.webuibuilder.animator.ui.views.timeline.common.TimelineMessages;\r
+import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrameUnit;\r
 import org.tizen.webuibuilder.animator.utils.AnimatorUtils;\r
 import org.tizen.webuibuilder.model.app.AppManager;\r
 import org.tizen.webuibuilder.ui.contextmenu.ContextMenu;\r
@@ -58,6 +60,10 @@ public class TimelineContextMenu extends ContextMenu {
 \r
         action = getAction(TimelineMessages.PASTE_KEYFRAME);\r
         menu.appendToGroup(GEFActionConstants.GROUP_COPY, action);\r
+\r
+        MenuManager zorder = buildContextZorderMenu();\r
+        menu.appendToGroup(GEFActionConstants.GROUP_REST, zorder);\r
+\r
     }\r
 \r
     private MenuManager buildContextPredefineMenu() {\r
@@ -104,4 +110,21 @@ public class TimelineContextMenu extends ContextMenu {
 \r
         return addPKeyframes;\r
     }\r
+\r
+    private MenuManager buildContextZorderMenu() {\r
+        MenuManager zOderMenu = new MenuManager(TimelineMessages.Z_ORDER, TimelineMessages.Z_ORDER);\r
+\r
+        TimelineViewer treeViewer = (TimelineViewer) getViewer();\r
+        List<KeyFrameUnit> findStackKeyframeUnits = treeViewer.findStackKeyframeUnit();\r
+\r
+        if (findStackKeyframeUnits != null && findStackKeyframeUnits.size() > 1) {\r
+\r
+            for (final KeyFrameUnit keyFrameUnit : findStackKeyframeUnits) {\r
+                IAction action = new ZOrderKeyFrameAction(keyFrameUnit, getViewer());\r
+                zOderMenu.add(action);\r
+            }\r
+        }\r
+\r
+        return zOderMenu;\r
+    }\r
 }\r
index 6cd0dfe..6fe7ed9 100644 (file)
@@ -87,7 +87,7 @@ public class TimelineMainContainer extends Composite {
         contentContainer.setLayout(new FormLayout());
 
         FormData contentContainerFormData = new FormData();
-        contentContainerFormData.top = new FormAttachment(toolbar, 3);
+        contentContainerFormData.top = new FormAttachment(toolbar, 1);
         contentContainerFormData.bottom = new FormAttachment(100, -3);
         contentContainerFormData.left = new FormAttachment(0, 7);
         contentContainerFormData.right = new FormAttachment(100, -7);
index d025842..2b5dfa4 100644 (file)
@@ -401,7 +401,7 @@ public class TimelinePage extends ContentOutlinePage {
                 getMainContainer().getContentContainer().getContentHeaderContainer()
                         .getOutlineHeader().initialize();
                 // refresh h-scroll
-                getMainContainer().getContentContainer().refreshHScroll(0.0, 0, 0, 0);
+                getMainContainer().getContentContainer().refreshHScroll(0, 0, 0, 0);
                 // refresh filter
                 getMainContainer().getContentContainer().getContentToolsContainer()
                         .setFilter(false);
index f9852c7..a1cbf3b 100644 (file)
@@ -24,6 +24,7 @@
 package org.tizen.webuibuilder.animator.ui.views.timeline;
 
 import java.lang.reflect.Method;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.gef.EditPart;
@@ -59,7 +60,9 @@ import org.tizen.webuibuilder.animator.ui.views.timeline.common.TimelineConstant
 import org.tizen.webuibuilder.animator.ui.views.timeline.editpart.TimelineEditPart;
 import org.tizen.webuibuilder.animator.ui.views.timeline.tree.TimeTreeElement;
 import org.tizen.webuibuilder.animator.ui.views.timeline.tree.TimelineOutlineElement;
+import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrame;
 import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrameComponent;
+import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrameUnit;
 import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.utility.Platform;
 
@@ -119,8 +122,12 @@ public class TimelineViewer extends TreeViewer implements ISelectionChangedListe
                 @Override
                 public void handleEvent(Event event) {
                     // int clientHeight = contentTree.getClientArea().height;
-                    event.height = TimelineConstants.DEFAULT_TIMELINE_TREE_HEIGHT;
-
+                    if (Platform.getOS().equals(Platform.OS_WIN32)) {
+                        event.height = TimelineConstants.DEFAULT_TIMELINE_TREE_HEIGHT;
+                    } else if (Platform.getOS().equals(Platform.OS_LINUX)
+                            || Platform.getOS().equals(Platform.OS_MACOSX)) {
+                        event.height = TimelineConstants.DEFAULT_TIMELINE_TREE_HEIGHT_LINUX;
+                    }
                 }
             });
 
@@ -130,7 +137,6 @@ public class TimelineViewer extends TreeViewer implements ISelectionChangedListe
         outlineColumn = new TreeColumn(contentTree, SWT.NONE);
         seperatorColumn = new TreeColumn(contentTree, SWT.NONE);
         keyframeColumn = new TreeColumn(contentTree, SWT.NONE);
-        parent.setLayout(contentTreeContainerColumnLayout);
 
         int SEPERATOR_WIDTH = 0;
         int EXPANDCOLUMN_WIDTH = 0;
@@ -495,7 +501,7 @@ public class TimelineViewer extends TreeViewer implements ISelectionChangedListe
                     }
                 }
             }
-            
+
             refreshTree();
             refreshContextMenu();
         }
@@ -513,37 +519,37 @@ public class TimelineViewer extends TreeViewer implements ISelectionChangedListe
      * Refresh ContextMenu
      */
     private void refreshContextMenu() {
-      //refresh contextMenu
+        // refresh contextMenu
 
         this.getControl().setMenu(getContextMenu().createContextMenu(this.getControl()));
 
-      RootEditPart rootEditPart = getRootEditPart();
-      List children = rootEditPart.getChildren();
-      if (children != null) {
-          List<TimelineEditPart> editParts = ((EditPart) children.get(0)).getChildren();
-          for (TimelineEditPart editPart : editParts) {
-              List<TimelineEditPart> childEditParts = editPart.getChildren();
-              for(TimelineEditPart treeEditPart : childEditParts) {
-                  TimeTreeElement treeElement = treeEditPart.getTimeElement();
-                  if(treeElement != null) {
-                      treeElement.createContextMenu();
-                  }
-              }
-          }
-      }
+        RootEditPart rootEditPart = getRootEditPart();
+        List children = rootEditPart.getChildren();
+        if (children != null) {
+            List<TimelineEditPart> editParts = ((EditPart) children.get(0)).getChildren();
+            for (TimelineEditPart editPart : editParts) {
+                List<TimelineEditPart> childEditParts = editPart.getChildren();
+                for (TimelineEditPart treeEditPart : childEditParts) {
+                    TimeTreeElement treeElement = treeEditPart.getTimeElement();
+                    if (treeElement != null) {
+                        treeElement.createContextMenu();
+                    }
+                }
+            }
+        }
     }
 
     /**
      * applyNonFilter
      */
     private void applyNonFilter() {
-        //setContents(getPage().getModel());
+        // setContents(getPage().getModel());
         TimelineEditPart pageEditPart = getPageEditPart();
         pageEditPart.refresh();
 
         Tree contentTree = (Tree) getControl();
         contentTree.pack();
-        //refreshTimelineViewer();
+        // refreshTimelineViewer();
     }
 
     /**
@@ -664,6 +670,33 @@ public class TimelineViewer extends TreeViewer implements ISelectionChangedListe
         });
     }
 
+    /**
+     * Find KeyFrameUnit in Stack for z-ordering
+     * 
+     * @return {@link KeyFrameUnit}
+     */
+    public List<KeyFrameUnit> findStackKeyframeUnit() {
+        List<KeyFrameUnit> keyFrameUnits = new ArrayList<KeyFrameUnit>();
+
+        KeyFrameComponent selectedkeyFrameComponent = getLastSelectedKeyframeComponent();
+
+        if (selectedkeyFrameComponent != null) {
+            KeyFrameUnit selectKeyFrameUnit = null;
+            if (selectedkeyFrameComponent instanceof KeyFrameUnit) {
+                selectKeyFrameUnit = (KeyFrameUnit) selectedkeyFrameComponent;
+            } else if (selectedkeyFrameComponent instanceof KeyFrame) {
+                selectKeyFrameUnit = ((KeyFrame) selectedkeyFrameComponent).getKeyFrameUnit();
+            }
+
+            if (selectKeyFrameUnit != null) {
+                TimeTreeElement timeTreeElement = selectKeyFrameUnit.getTimeTreeElement();
+                keyFrameUnits.add((KeyFrameUnit) selectKeyFrameUnit);
+                timeTreeElement.addKeyFrameUnit(selectKeyFrameUnit, keyFrameUnits);
+            }
+        }
+        return keyFrameUnits;
+    }
+
     /**********************************************************************************************
      * Getter, Setter
      **********************************************************************************************/
@@ -842,6 +875,7 @@ public class TimelineViewer extends TreeViewer implements ISelectionChangedListe
     private TimelineEditPart getPageEditPart() {
         return (TimelineEditPart) getRootEditPart().getChildren().get(0);
     }
+
     /*****************************************************************************************
      * Listener , Event
      *****************************************************************************************/
index 61c6f32..bf908e6 100644 (file)
@@ -25,6 +25,7 @@ import org.tizen.webuibuilder.animator.model.descriptor.CssAnimationDescriptor;
 import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineClipboard;\r
 import org.tizen.webuibuilder.animator.ui.views.timeline.TimelinePage;\r
 import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineViewer;\r
+import org.tizen.webuibuilder.animator.ui.views.timeline.common.Formatter;\r
 import org.tizen.webuibuilder.animator.ui.views.timeline.tree.TimelineOutlineElement;\r
 import org.tizen.webuibuilder.animator.utils.AnimatorUtils;\r
 import org.tizen.webuibuilder.model.Part;\r
@@ -129,9 +130,12 @@ public class PasteKeyFrameAction extends SelectionAction {
         String animationGroupId =\r
                 viewer.getMainContainer().getContentContainer().getContentHeaderContainer()\r
                         .getOutlineHeader().getSelectedAnimationGroupId();\r
-        double pointTime =\r
-                viewer.getMainContainer().getContentContainer().getContentHeaderContainer()\r
-                        .getKeyframeHeader().getTimeBar().getPlayHeader().getCurrentPointTime();\r
+        \r
+        int currentPointTime = viewer.getMainContainer().getContentContainer().getContentHeaderContainer()\r
+                .getKeyframeHeader().getTimeBar().getPlayHeader().getCurrentPointTime();\r
+        \r
+        double pointTime = Formatter.computeTimeTotime(currentPointTime);\r
+        \r
         CompoundCommand command = new CompoundCommand();
         for (AnimatorModel selectorModel : children) {\r
             AnimatorSelector selector = (AnimatorSelector) selectorModel;\r
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/action/ZOrderKeyFrameAction.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/action/ZOrderKeyFrameAction.java
new file mode 100644 (file)
index 0000000..ff3a685
--- /dev/null
@@ -0,0 +1,45 @@
+\r
+\r
+package org.tizen.webuibuilder.animator.ui.views.timeline.action;\r
+\r
+import org.eclipse.gef.EditPartViewer;\r
+import org.eclipse.jface.action.Action;\r
+import org.tizen.webuibuilder.animator.model.AnimatorModelEvent;\r
+import org.tizen.webuibuilder.animator.model.AnimatorModelManager;\r
+import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineViewer;\r
+import org.tizen.webuibuilder.animator.ui.views.timeline.tree.TimeTreeElement;\r
+import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrameUnit;\r
+import org.tizen.webuibuilder.animator.utils.AnimatorUtils;\r
+\r
+\r
+public class ZOrderKeyFrameAction extends Action {\r
+\r
+    private EditPartViewer editPartViewer = null;\r
+    private KeyFrameUnit keyFrameUnit = null;\r
+\r
+    public ZOrderKeyFrameAction(KeyFrameUnit keyFrameUnit, EditPartViewer editPartViewer) {\r
+        super(null);\r
+\r
+        this.keyFrameUnit = keyFrameUnit;\r
+        this.editPartViewer = editPartViewer;\r
+\r
+        setText(keyFrameUnit.getModel().getName());\r
+        setId(keyFrameUnit.getModel().getName());\r
+    }\r
+\r
+    public void run() {\r
+\r
+        if (keyFrameUnit != null) {\r
+            TimelineViewer viewer = (TimelineViewer) editPartViewer;\r
+            keyFrameUnit.selected();\r
+            viewer.setLastSelectedKeyframeComponent(keyFrameUnit);\r
+\r
+            TimeTreeElement timeTreeElement = keyFrameUnit.getTimeTreeElement();\r
+            timeTreeElement.redraw();\r
+\r
+            AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();\r
+            manager.fireEvent(AnimatorModelEvent.EventType.SELECTION_CHANGE,\r
+                              AnimatorModelEvent.Origin.TIMELINE, keyFrameUnit.getModel());\r
+        }\r
+    }\r
+}\r
index 2302a18..5c7911e 100644 (file)
@@ -38,7 +38,7 @@ public class Formatter {
     public static String toTimeFormat(double time) {
         int mst = (int) time;
 
-        int ms = (int) ((time - (double) mst) * 1000.00);
+        int ms = (int) ((time - (double) mst) * 1000.000);
         int minute = mst / 60;
         int second = mst % 60;
 
@@ -63,7 +63,49 @@ public class Formatter {
         return output;
     }
 
-    public static double toStringTimeFormat(String timeText) {
+    /**
+     * compute time double to String
+     * 
+     * @param time
+     *            double time value
+     * @return String time value xx:yy.zzz
+     */
+    public static String toTimeFormatInt(int time) {
+        int mst = (int) time / 1000;
+
+        int ms = (int) ((time - mst * 1000));
+        int minute = mst / 60;
+        int second = mst % 60;
+
+        String strMinute = Long.toString(minute);
+        if (strMinute.length() == 1) {
+            strMinute = "0" + strMinute; //$NON-NLS-1$
+        }
+
+        String strSecond = Long.toString(second);
+        if (strSecond.length() == 1) {
+            strSecond = "0" + strSecond; //$NON-NLS-1$
+        }
+
+        String strMs = Long.toString(ms);
+        if (strMs.length() == 1) {
+            strMs = "00" + strMs; //$NON-NLS-1$
+        } else if (strMs.length() == 2) {
+            strMs = "0" + strMs; //$NON-NLS-1$
+        }
+
+        String output = strMinute + " : " + strSecond + " . " + strMs; //$NON-NLS-1$ //$NON-NLS-2$
+        return output;
+    }
+
+    /**
+     * convert String to time
+     * 
+     * @param timeText
+     *            String time value xx:yy.zzz
+     * @return
+     */
+    public static int toStringTimeFormat(String timeText) {
 
         if (timeText == null) {
             return 0;
@@ -72,10 +114,10 @@ public class Formatter {
         String min = null;
         String sec = null;
         String mSec = null;
-        double minTime = 0;
-        double secTime = 0;
-        double mSecTime = 0.0;
-        double fullTime = 0.0;
+        int minTime = 0;
+        int secTime = 0;
+        int mSecTime = 0;
+        int fullTime = 0;
 
         String[] firstSplit = timeText.split(":");
         int firstSplitLength = firstSplit[0].length();
@@ -84,12 +126,29 @@ public class Formatter {
         sec = firstSplit[1].substring(1, 3);
         mSec = firstSplit[1].substring(6, 9);
 
-        minTime = Double.valueOf(min) * 60;
-        secTime = Double.valueOf(sec);
-        mSecTime = Double.valueOf(mSec) / 1000;
+        minTime = Integer.valueOf(min) * 60000;
+        secTime = Integer.valueOf(sec) * 1000;
+        mSecTime = Integer.valueOf(mSec);
 
         fullTime = minTime + secTime + mSecTime;
 
         return fullTime;
     }
+    
+    /**
+     * Time to ComputeTime
+     */
+    public static int timeToComputeTime(double time) {
+        return (int) (time * 1000);
+    }
+    
+    /**
+     * CompouteTime to Time
+     * @param time
+     * @return
+     */
+    public static double computeTimeTotime(int time) {
+        return time / 1000.000;
+    }
+
 }
index 076e27c..5f8322d 100644 (file)
@@ -29,10 +29,11 @@ package org.tizen.webuibuilder.animator.ui.views.timeline.common;
 public class TimelineConstants {
 
     public static final int DEFAULT_TIMELINE_TIMEBAR_0 = 0;
-    public static final int DEFAULT_KEYFRAME_MARGINE = 3;
+    public static final int DEFAULT_KEYFRAME_MARGIN_LINUX = 5;
+    public static final int DEFAULT_KEYFRAME_MARGIN = 4;
     public static final int DEFAULT_START_KEYFRAME_POINT = -3;
 
-    public static final int DEFAULT_LIFE_WIGET_HEIGHT = 20;
+    public static final int DEFAULT_LIFE_WIGET_HEIGHT = 14;
     public static final int DEFAULT_LIFE_WIDGET_WIDTH = 100;
     public static final int DEFAULT_LIFE_WIDGET_MIN_WIDTH = 10;
 
@@ -40,9 +41,11 @@ public class TimelineConstants {
     public static final int DEFAULT_FRAME_WIDGET_HEIGHT = 13;
     public static final int DEFAULT_FRAME_WIDGET_HALF_WIDTH = 6;
     public static final int DEFAULT_FRAME_WIDGET_CENTER_POINT = 7;
-
+    public static final int DEFAULT_FRAME_WIDGET_MARGIN = DEFAULT_KEYFRAME_MARGIN + 1 ;
+    public static final int DEFAULT_FRAME_WIDGET_MARGIN_LINUX = DEFAULT_KEYFRAME_MARGIN_LINUX + 1 ;
+    
     public static final int DEFAULT_TIMELINE_LEFT_MARGIN = 3;
-    public static final int DEFAULT_TIMEBAR_HEIGHT = 20;
+    public static final int DEFAULT_TIMEBAR_HEIGHT = 26;
     public static final int DEFAULT_SECOND_CELL_WIDTH = 100;
 
     public static final int DEFAULT_TIMEELEMENT_ZOOMIN_HEIGHT = 30;
@@ -50,7 +53,7 @@ public class TimelineConstants {
 
     public static final int DEFAULT_TIMELINE_MARKER_WIDTH = 9;
     public static final int DEFAULT_TIMELINE_MARKER_HEIGHT = 13;
-    public static final int DEFAULT_TIMELINE_MARKER_Y = 12;
+    public static final int DEFAULT_TIMELINE_MARKER_Y = 9;
 
     public static final int DEFAULT_TIMELINE_MARKER_LINE_OFFSET = 6;
 
@@ -59,10 +62,10 @@ public class TimelineConstants {
     public static final int DEFAULT_HSCROLL_SELECTION_INTERVAL = 50;
 
     public static final int DEFAULT_TIME_INTERVAL = 10;
-    public static final int DEFAULT_TIME_MILLISECOND = 100;
+    public static final int DEFAULT_TIME_POSITION_INTERVAL = 100;
+    public static final int DEFAULT_CONVERTTIME_POSITION_INTERVAL = 10;
+    public static final int DEFAULT_TIME_MILLISECOND = 1000;
 
-    public static final int DEFAULT_TIMEBAR_MARGINE = 30;
-    
     public static final int DEFAULT_TIMELINE_SASH_WIDTH = 5;
     public static final int DEFAULT_TREE_EXPANDCOLUMN_WIDTH = 1;
     public static final int DEFAULT_TREE_OUTLINECOLUMN_WIDTH = 217;
@@ -72,5 +75,7 @@ public class TimelineConstants {
     
     public static final int DEFAULT_SASH_SEPERATOR_MARGIN_WIDTH = 11;
     
-    public static final int DEFAULT_TIMELINE_TREE_HEIGHT = 26;
+    public static final int DEFAULT_TIMELINE_TREE_HEIGHT = 23;
+    public static final int DEFAULT_TIMELINE_TREE_HEIGHT_LINUX = 22;
+    public static final int DEFAULT_TIMELINE_TREEITEM_HEIGHT = 21;
 }
index 53a835e..0382b3e 100644 (file)
@@ -37,6 +37,8 @@ public class TimelineMessages {
     public static String CUT_KEYFRAME;
     public static String PASTE_KEYFRAME;
 
+    public static String Z_ORDER;
+    
     public static String NEW_ANIMATION_GROUP;
     public static String DELETE_ANIMATION_GROUP;
     public static String EDIT_ANIMATION_GROUP;
index daa2341..9c5de08 100644 (file)
@@ -7,6 +7,8 @@ COPY_KEYFRAME = &Copy\tCtrl+C
 CUT_KEYFRAME = &Cut\tCtrl+X
 PASTE_KEYFRAME = &Paste\tCtrl+V
 
+Z_ORDER = Bring to front
+
 NEW_ANIMATION_GROUP = New animation group
 DELETE_ANIMATION_GROUP = Delete animation group
 EDIT_ANIMATION_GROUP = Show and Edit animation group
index bc0857c..7585dfb 100644 (file)
@@ -37,6 +37,7 @@ import org.eclipse.swt.widgets.Display;
 import org.tizen.webuibuilder.BuilderConstants;
 import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineContentContainer;
 import org.tizen.webuibuilder.animator.ui.views.timeline.common.ColorResource;
+import org.tizen.webuibuilder.animator.ui.views.timeline.common.Formatter;
 import org.tizen.webuibuilder.animator.ui.views.timeline.common.TimelineConstants;
 import org.tizen.webuibuilder.animator.ui.views.timeline.tool.TimelineToolbar;
 import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
@@ -53,7 +54,7 @@ public class PlayHeader extends Composite {
     private int mouseDownPoint = 0;
 
     private int positionMarker = TimelineConstants.DEFAULT_TIMELINE_TIMEBAR_0;
-    private double currentPointTime = 0.0;
+    private int currentPointTime = 0;
 
     private TimelineToolbar toolbar = null;
 
@@ -79,11 +80,12 @@ public class PlayHeader extends Composite {
             public void paintControl(PaintEvent e) {
 
                 Rectangle clientArea = getClientArea();
-
+                Rectangle bounds = getBounds();
+                
                 e.gc.setBackground(ColorResource.TIMEBAR_BOTTOM);
                 e.gc.setForeground(ColorResource.TIMEBAR_TOP);
-                e.gc.fillGradientRectangle(0, 0, getBounds().width, getBounds().height, true);
 
+                e.gc.fillGradientRectangle(0, 0, bounds.width, bounds.height, true);
                 e.gc.setForeground(ColorResource.LATTICE);
 
                 e.gc.drawImage(ResourceManager.getImage(BuilderConstants.ICON_DIR,
@@ -112,9 +114,9 @@ public class PlayHeader extends Composite {
                 markerflag = false;
                 mouseDownPoint = 0;
 
-                double pointTime = getPlayHeaderTime();
-                if (pointTime < 0.0) {
-                    pointTime = 0.0;
+                int pointTime = getPlayHeaderTime();
+                if (pointTime < 0) {
+                    pointTime = 0;
                 }
 
                 beforePoint = 0;
@@ -129,26 +131,26 @@ public class PlayHeader extends Composite {
                     Rectangle rMarker = getBounds();
 
                     TimeBar timebar = (TimeBar) getParent();
-                    double startTime = timebar.getStartTime();
+                    int startTime = timebar.getStartTime();
                     Point timeBarsize = timebar.getSize();
 
-                    if (startTime == 0.0
+                    if (startTime == 0
                             && rMarker.x < TimelineConstants.DEFAULT_TIMELINE_TIMEBAR_0) {
                         markerflag = false;
                         setLocation(TimelineConstants.DEFAULT_TIMELINE_TIMEBAR_0,
                                     TimelineConstants.DEFAULT_TIMELINE_MARKER_Y);
                         setPositionMarker(TimelineConstants.DEFAULT_TIMELINE_TIMEBAR_0);
-                        setCurrentPointTime(0.0);
+                        setCurrentPointTime(0);
                     } else {
-                        setPositionMarker(rMarker.x - mouseDownPoint + e.x);
-                        setLocation(getPositionMarker(),
+                        setPositionMarker((rMarker.x - mouseDownPoint + e.x) * TimelineConstants.DEFAULT_CONVERTTIME_POSITION_INTERVAL);
+                        setLocation(getPositionMarker() / TimelineConstants.DEFAULT_CONVERTTIME_POSITION_INTERVAL,
                                     TimelineConstants.DEFAULT_TIMELINE_MARKER_Y);
                     }
 
                     // update marker point time
-                    double pointTime = getPlayHeaderTime();
-                    if (pointTime < 0.0) {
-                        pointTime = 0.0;
+                    int pointTime = getPlayHeaderTime();
+                    if (pointTime < 0) {
+                        pointTime = 0;
                     }
 
                     sendPointTime(pointTime);
@@ -157,7 +159,7 @@ public class PlayHeader extends Composite {
                     refreshPlayHeaderLine();
 
                     int incresementPoint =
-                            timeBarsize.x - TimelineConstants.DEFAULT_TIMEBAR_MARGINE;
+                            timeBarsize.x - TimelineConstants.DEFAULT_TIMEBAR_HEIGHT;
                     // Logger.trace("marker : " + rMarker.x);
 
                     if (rMarker.x > incresementPoint) {
@@ -171,7 +173,7 @@ public class PlayHeader extends Composite {
                         }
                         beforePoint = rMarker.x;
 
-                    } else if (rMarker.x < TimelineConstants.DEFAULT_TIMEBAR_MARGINE) {
+                    } else if (rMarker.x < TimelineConstants.DEFAULT_TIMEBAR_HEIGHT) {
                         if (beforePoint > rMarker.x) {
                             TimelineContentContainer contentContainer =
                                     (TimelineContentContainer) ((TimelineContentHeaderContainer) (((SashForm) ((TimelineKeyframeHeader) (timebar
@@ -197,16 +199,13 @@ public class PlayHeader extends Composite {
      */
     public void draw(boolean isPlayHeaderLine) {
         double scale = ((TimeBar) getParent()).getScale();
-
-        double startTime = ((TimeBar) getParent()).getStartTime();
+        int startTime = ((TimeBar) getParent()).getStartTime();
 
         if (startTime == 0 && getCurrentPointTime() <= TimelineConstants.DEFAULT_TIMELINE_TIMEBAR_0) {
             this.setLocation(TimelineConstants.DEFAULT_TIMELINE_TIMEBAR_0,
                              TimelineConstants.DEFAULT_TIMELINE_MARKER_Y);
         } else {
-            int timelineMarkerX =
-                    (int) ((getCurrentPointTime() * scale * TimelineConstants.DEFAULT_TIME_MILLISECOND) - (startTime
-                            * scale * TimelineConstants.DEFAULT_TIME_INTERVAL));
+            int timelineMarkerX = (int) ((getCurrentPointTime() * scale) - (startTime * scale)) / TimelineConstants.DEFAULT_CONVERTTIME_POSITION_INTERVAL ;
             this.setLocation(timelineMarkerX, TimelineConstants.DEFAULT_TIMELINE_MARKER_Y);
         }
         
@@ -259,12 +258,12 @@ public class PlayHeader extends Composite {
      * 
      * @return {@link PlayHeader} TimeMarker current Time value
      */
-    public double getPlayHeaderTime() {
+    public int getPlayHeaderTime() {
         double scale = ((TimeBar) getParent()).getScale();
         double startTime = ((TimeBar) getParent()).getStartTime();
 
-        return (((positionMarker / scale) + (startTime * TimelineConstants.DEFAULT_TIME_INTERVAL)))
-                / TimelineConstants.DEFAULT_TIME_MILLISECOND;
+        return (int) (((positionMarker / scale) + (startTime)));
+                /// TimelineConstants.DEFAULT_TIME_MILLISECOND;
     }
 
     /**
@@ -273,9 +272,9 @@ public class PlayHeader extends Composite {
      * @param pointTime
      *            current Time value
      */
-    public void sendPointTime(final double pointTime) {
+    public void sendPointTime(int pointTime) {
         this.setCurrentPointTime(pointTime);
-        String timeText = AnimatorUtils.convertTimetoTimeText(pointTime);
+        String timeText = AnimatorUtils.convertTimetoTimeIntText(pointTime);
 
         boolean isToolbar = searchToolBar();
         if (isToolbar == true) {
@@ -287,8 +286,12 @@ public class PlayHeader extends Composite {
             public void run() {
                 String animationGroupId =
                         AnimatorUtils.getActiveAnimatorBrowserViewer().getCurrentAnimationGroupId();
+
+                int currentPointTime = getCurrentPointTime();
+                double pointTime = Formatter.computeTimeTotime(currentPointTime);
+
                 AnimatorUtils.getActiveAnimatorBrowserViewer()
-                        .showAnimationAtMoment(animationGroupId, getCurrentPointTime());
+                        .showAnimationAtMoment(animationGroupId, pointTime);
             }
         });
     }
@@ -320,7 +323,7 @@ public class PlayHeader extends Composite {
      * 
      * @return current point Time
      */
-    public double getCurrentPointTime() {
+    public int getCurrentPointTime() {
         return currentPointTime;
     }
 
@@ -330,7 +333,7 @@ public class PlayHeader extends Composite {
      * @param currentPointTime
      *            current point time
      */
-    public void setCurrentPointTime(double currentPointTime) {
+    public void setCurrentPointTime(int currentPointTime) {
         this.currentPointTime = currentPointTime;
     }
 
index 70a1bc0..340ab6e 100644 (file)
@@ -31,6 +31,7 @@ import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineContentContainer;
 import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineMainContainer;
+import org.tizen.webuibuilder.animator.ui.views.timeline.common.TimelineConstants;
 import org.tizen.webuibuilder.animator.ui.views.timeline.tool.TimelineToolbar;
 
 
@@ -46,7 +47,7 @@ public class TimeBar extends Canvas {
     public final static double SCALE_400 = 4.0d;
 
     private double scale = SCALE_100;
-    private double startTime = 0.0;
+    private int startTime = 0;
 
     private TimeBarRenderer timelineRenderer = null;
 
@@ -78,7 +79,7 @@ public class TimeBar extends Canvas {
             @Override
             public void mouseDown(MouseEvent e) {
 
-                setPosition(e.x);
+                setPosition(e.x * TimelineConstants.DEFAULT_CONVERTTIME_POSITION_INTERVAL);
 
                 TimelineContentContainer container =
                         (TimelineContentContainer) ((((getParent()).getParent()).getParent())
@@ -108,7 +109,7 @@ public class TimeBar extends Canvas {
      * 
      * @return double time value
      */
-    public double getStartTime() {
+    public int getStartTime() {
         return startTime;
     }
 
@@ -118,7 +119,7 @@ public class TimeBar extends Canvas {
      * @param startTime
      *            double time value
      */
-    public void setStartTime(double startTime) {
+    public void setStartTime(int startTime) {
         this.startTime = startTime;
     }
 
@@ -172,15 +173,10 @@ public class TimeBar extends Canvas {
         TimelineToolbar toolBar = mainContainer.getTimelineToolbar();
         toolBar.stopPlaying();
 
-/*        if (positionTime < 0) {
-            playHeader.setLocation(0, playHeader.getBounds().y);
-            playHeader.setPositionMarker(0);
-        } else {*/
-            playHeader.setLocation(positionTime, playHeader.getBounds().y);
-            playHeader.setPositionMarker(positionTime);
-        //}
+        playHeader.setLocation(positionTime / TimelineConstants.DEFAULT_CONVERTTIME_POSITION_INTERVAL, playHeader.getBounds().y);
+        playHeader.setPositionMarker(positionTime);
 
-        double pointTime = playHeader.getPlayHeaderTime();
+        int pointTime = playHeader.getPlayHeaderTime();
         playHeader.setCurrentPointTime(pointTime);
 
         // update marker point time
index 2dc6edf..12ebc61 100644 (file)
@@ -37,7 +37,7 @@ import org.tizen.webuibuilder.animator.ui.views.timeline.common.TimelineConstant
  */
 public class TimeBarRenderer {
 
-    private double startTime = 0.0;
+    private int startTime = 0;
     private double scale = 1.0;
 
     /**
@@ -95,8 +95,8 @@ public class TimeBarRenderer {
         int xPixel = TimelineConstants.DEFAULT_TIMELINE_TIMEBAR_0;
         scale = timeline.getScale();
         double secondInterval = scale * TimelineConstants.DEFAULT_TIME_INTERVAL;
-        startTime = (int) timeline.getStartTime();
-        xPixel -= (timeline.getStartTime() - (double) startTime) * ((double) secondInterval);
+        startTime = (int) timeline.getStartTime() / TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL;
+        xPixel -= ((timeline.getStartTime() / TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL) - (int) startTime) * ((double) secondInterval);
 
         for (; xPixel < rt.width; startTime++, xPixel += secondInterval) {
             if (startTime % 10 == 0) {
index 0401057..0da44ca 100644 (file)
@@ -74,6 +74,7 @@ import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineMainContainer;
 import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineViewer;
 import org.tizen.webuibuilder.animator.ui.views.timeline.common.ColorResource;
 import org.tizen.webuibuilder.animator.ui.views.timeline.common.Formatter;
+import org.tizen.webuibuilder.animator.ui.views.timeline.common.TimelineConstants;
 import org.tizen.webuibuilder.animator.ui.views.timeline.common.TimelineMessages;
 import org.tizen.webuibuilder.animator.ui.views.timeline.header.PlayHeader;
 import org.tizen.webuibuilder.animator.ui.views.timeline.header.TimeBar;
@@ -369,7 +370,7 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
                                 .getKeyframeHeader().getTimeBar().getPlayHeader();
 
                 marker.setPositionMarker(0);
-                marker.setCurrentPointTime(0.0);
+                marker.setCurrentPointTime(0);
                 marker.draw(true);
 
                 setCurrentTime("00 : 00 . 000");
@@ -534,8 +535,12 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
                                 .getKeyframeHeader().getTimeBar();
 
                 PlayHeader marker = timeBar.getPlayHeader();
-                marker.setPositionMarker((int) (lastTime * timeBar.getScale() * 100));
-                marker.setCurrentPointTime(lastTime);
+                
+                int timelinePoint = (int) (lastTime * timeBar.getScale() * TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL);
+                int timePoint = Formatter.timeToComputeTime(lastTime);
+                
+                marker.setPositionMarker(timelinePoint);
+                marker.setCurrentPointTime(timePoint);
                 marker.draw(true);
 
                 double markerTime = marker.getPlayHeaderTime();
@@ -697,8 +702,14 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
                             .getKeyframeHeader().getTimeBar();
 
             PlayHeader marker = timeBar.getPlayHeader();
-            marker.setPositionMarker((int) (((double) millSecond / 1000) * timeBar.getScale() * 100));
-            marker.setCurrentPointTime((double) millSecond / 1000);
+            
+            int timelinePoint = (int) (timeBar.getScale() * TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL);
+            double pointTime = Formatter.computeTimeTotime(millSecond);
+            int timePoint = Formatter.timeToComputeTime(millSecond);
+            
+            marker.setPositionMarker((int) (pointTime * timelinePoint));
+            marker.setCurrentPointTime(millSecond);
+            
             if (Platform.getOS().equals(Platform.OS_WIN32)) {
                 marker.draw(false);
             } else if (Platform.getOS().equals(Platform.OS_LINUX)
@@ -756,6 +767,7 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
     /**
      * set TimeTextPoint
      */
+
     private void setTimeTextPoint() {
         TimelineContentContainer contentContainer =
                 ((TimelineMainContainer) getParent()).getContentContainer();
@@ -763,13 +775,16 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
                 contentContainer.getContentHeaderContainer().getKeyframeHeader().getTimeBar();
 
         double scale = timeBar.getScale();
-        double newTime = Formatter.toStringTimeFormat(currentTime);
+        int newTime = Formatter.toStringTimeFormat(currentTime);
 
         contentContainer.refreshHScroll(newTime, 1, 0, 2);
 
         double startTime = timeBar.getStartTime();
-        int positionTime = (int) ((newTime * (scale * 100.0)) - startTime * (scale * 10.0));
-
+        
+        int currentPositionTime = (int) (newTime * (scale));
+        int startPositionTime = (int) (startTime * (scale));
+        int positionTime = (currentPositionTime - startPositionTime);
         timeBar.setPosition(positionTime);
         contentContainer.refreshPlayHeader(true);
 
@@ -794,8 +809,12 @@ public class TimelineToolbar extends Composite implements IAnimationListener {
                         .getTimeBar();
 
         PlayHeader marker = timeBar.getPlayHeader();
-        marker.setPositionMarker((int) (lastTime * timeBar.getScale() * 100));
-        marker.setCurrentPointTime(lastTime);
+        
+        int timelinePoint = (int) (lastTime * timeBar.getScale() * TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL);
+        int timePoint = Formatter.timeToComputeTime(timelinePoint);
+        
+        marker.setPositionMarker(timelinePoint);
+        marker.setCurrentPointTime(timePoint);
 
         marker.draw(true);
 
index eb904de..463bba2 100644 (file)
@@ -54,6 +54,7 @@ import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineViewer;
 import org.tizen.webuibuilder.animator.ui.views.timeline.command.TimelineFrameEditCommand;
 import org.tizen.webuibuilder.animator.ui.views.timeline.command.TimelineKeyframeEditCommand;
 import org.tizen.webuibuilder.animator.ui.views.timeline.common.ColorResource;
+import org.tizen.webuibuilder.animator.ui.views.timeline.common.Formatter;
 import org.tizen.webuibuilder.animator.ui.views.timeline.common.TimelineConstants;
 import org.tizen.webuibuilder.animator.ui.views.timeline.editpart.TimelineEditPart;
 import org.tizen.webuibuilder.animator.ui.views.timeline.header.TimeBar;
@@ -62,6 +63,7 @@ import org.tizen.webuibuilder.animator.ui.views.timeline.header.TimelineKeyframe
 import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrame;
 import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrameComponent;
 import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrameUnit;
+import org.tizen.webuibuilder.utility.Platform;
 
 
 /**
@@ -70,7 +72,8 @@ import org.tizen.webuibuilder.animator.ui.views.timeline.widget.KeyFrameUnit;
  */
 public class TimeTreeElement extends Canvas implements ISelectionProvider {
 
-    private double visibleStartTime = 0.0;
+    private int DEFAULT_KEYFRAME_MARGINE = 4;
+    private int visibleStartTime = 0;
 
     private Composite treeContainer = null;
     private Tree tree = null;
@@ -124,6 +127,12 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
         addListener(SWT.MouseMove, mouseListener);
         addListener(SWT.MouseDoubleClick, mouseListener);
 
+        if (Platform.getOS().equals(Platform.OS_WIN32)) {
+            DEFAULT_KEYFRAME_MARGINE = TimelineConstants.DEFAULT_KEYFRAME_MARGIN;
+        } else if (Platform.getOS().equals(Platform.OS_LINUX)
+                || Platform.getOS().equals(Platform.OS_MACOSX)) {
+            DEFAULT_KEYFRAME_MARGINE = TimelineConstants.DEFAULT_KEYFRAME_MARGIN_LINUX;
+        }
     }
 
     /*
@@ -151,7 +160,6 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
                          TimelineConstants.DEFAULT_TIMEELEMENT_ZOOMIN_HEIGHT);
     }
 
-
     @Override
     public void addSelectionChangedListener(ISelectionChangedListener listener) {
         // TODO Auto-generated method stub
@@ -180,7 +188,6 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
 
     }
 
-    
     /*******************************************************************************
      * Class Method
      *******************************************************************************/
@@ -371,7 +378,7 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
             if (keyframeUnit.getModel().getId().equals(keyframe.getId())) {
                 keyframeUnit.deleteChild(model);
                 int size = keyframeUnit.getKeyframelist().size();
-                if(size == 0) {
+                if (size == 0) {
                     keyframeUnits.remove(keyframeUnit);
                 }
                 break;
@@ -382,18 +389,23 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
     /**
      * Move CurrentTimeMarker
      */
-    private void moveCurrentTimeMarker() {
+    private void moveCurrentTimeMarker(boolean isSelected) {
         TimelineContentContainer timelineContentContainer = findTimelineContentContainer();
         TimelineContentHeaderContainer contentHeaderContainer =
                 timelineContentContainer.getContentHeaderContainer();
         TimeBar timebar = contentHeaderContainer.getKeyframeHeader().getTimeBar();
-        int positionTime =
-                selectedKeyFrame.getKeyFrameUnit().getKeyFrameUnitModelXpoint()
-                        + selectedKeyFrame.getKeyFrameModelXpoint()
-                        - TimelineConstants.DEFAULT_TIMELINE_LEFT_MARGIN
-                        - getVisibleStartTimePoint();
-
-        timebar.setPosition(positionTime);
+        int positionTime = 0;
+        if (isSelected == true) {
+            positionTime =
+                    selectedKeyFrame.getKeyFrameUnit().getKeyFrameUnitModelXpoint()
+                            + selectedKeyFrame.getKeyFrameModelXpoint()
+                            - TimelineConstants.DEFAULT_TIMELINE_LEFT_MARGIN;
+            // - getVisibleStartTimePoint();
+        } else {
+            positionTime = mouseDownPoint - TimelineConstants.DEFAULT_TIMELINE_LEFT_MARGIN;
+            // + getVisibleStartTimePoint();
+        }
+        timebar.setPosition(positionTime * TimelineConstants.DEFAULT_CONVERTTIME_POSITION_INTERVAL);
         timebar.redraw();
 
         timebar.getPlayHeader().draw(true);
@@ -408,7 +420,7 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
     private void updateKeyFrameUnitModel(KeyFrameUnit keyframeUnit) {
         TimelineViewer viewer = getEditpart().getViewer();
 
-        double visibleStartTime = getVisibleStartTime();
+        int visibleStartTime = getVisibleStartTime();
         Rectangle keyframeBounds = keyframeUnit.getKeyframeUnit();
         double scale = getScale();
 
@@ -417,15 +429,15 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
          * keyframeBounds.width);
          */
         double startTime = 0.0;
+        double timelinePoint = scale * TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL;
+        double pointTime = Formatter.computeTimeTotime(visibleStartTime);
 
         startTime =
-                (double) (((keyframeBounds.x - TimelineConstants.DEFAULT_TIMELINE_LEFT_MARGIN) / (scale * TimelineConstants.DEFAULT_TIME_MILLISECOND)) + (visibleStartTime / TimelineConstants.DEFAULT_TIME_INTERVAL));
+                (double) (((keyframeBounds.x - TimelineConstants.DEFAULT_TIMELINE_LEFT_MARGIN) / timelinePoint) + pointTime);
 
         double durationTime = 0.0;
         if (keyframeUnit.getModel().getChildrenSize() > 1) {
-            durationTime =
-                    (double) keyframeBounds.width
-                            / (scale * TimelineConstants.DEFAULT_TIME_MILLISECOND);
+            durationTime = (double) keyframeBounds.width / timelinePoint;
         }
 
         keyframeUnit.setKeyframeUnitStartTime(startTime);
@@ -433,8 +445,7 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
 
         // System.out.println("startTime " + startTime + " durationTime " + durationTime);
         Command animationPropertyChange =
-                new TimelineKeyframeEditCommand(keyframeUnit.getModel(), startTime,
-                                                durationTime);
+                new TimelineKeyframeEditCommand(keyframeUnit.getModel(), startTime, durationTime);
 
         viewer.getEditDomain().getCommandStack().execute(animationPropertyChange);
 
@@ -449,9 +460,10 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
     private void updateKeyFrameModel(KeyFrame keyframe) {
 
         double scale = getScale();
+        double timelineScalePoint = scale * TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL;
         double currentSecond =
                 (double) (keyframe.getAfterPoint() - keyframe.getKeyFrameUnit().getKeyframeUnit().x + TimelineConstants.DEFAULT_FRAME_WIDGET_HALF_WIDTH)
-                        / ((double) TimelineConstants.DEFAULT_TIME_MILLISECOND * scale);
+                        / (timelineScalePoint);
         // System.out.println("current Second " + currentSecond);
 
         AnimatorFrame model = keyframe.getModel();
@@ -459,7 +471,37 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
 
         TimelineViewer viewer = getEditpart().getViewer();
         viewer.getEditDomain().getCommandStack().execute(animationPropertyChange);
+    }
 
+    /**
+     * Add KeyFrameUnit in sameTime
+     * 
+     * @param selectKeyFrameUnit
+     *            {@link KeyFrameUnit}
+     * 
+     * @param keyFrameUnits
+     *            {@link KeyFrameUnit}
+     */
+    public void addKeyFrameUnit(KeyFrameUnit selectKeyFrameUnit, List<KeyFrameUnit> keyFrameUnits) {
+        double selectKeyFrameStart = selectKeyFrameUnit.getKeyframeUnitStartTime();
+        double selectKeyFrameDuration = selectKeyFrameUnit.getKeyframeUnitDurationTime();
+        List<KeyFrameUnit> childrenKeyframeWidget = getKeyframeUnits();
+        for (KeyFrameUnit childKeyframeWidget : childrenKeyframeWidget) {
+            if (!childKeyframeWidget.equals(selectKeyFrameUnit)) {
+
+                KeyFrameUnit currentKeyframeWidget = (KeyFrameUnit) childKeyframeWidget;
+                double currentKeyFrameStart = currentKeyframeWidget.getKeyframeUnitStartTime();
+                double currentKeyFrameDuration =
+                        currentKeyframeWidget.getKeyframeUnitDurationTime();
+
+                if (selectKeyFrameStart <= currentKeyFrameStart) {
+                    if (selectKeyFrameStart + selectKeyFrameDuration >= currentKeyFrameStart
+                            + currentKeyFrameDuration) {
+                        keyFrameUnits.add((KeyFrameUnit) childKeyframeWidget);
+                    }
+                }
+            }
+        }
     }
 
     /*******************************************************************************
@@ -470,7 +512,7 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
      * 
      * @return visibleStartTime
      */
-    public double getVisibleStartTime() {
+    public int getVisibleStartTime() {
         return visibleStartTime;
     }
 
@@ -480,7 +522,7 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
      * @param visibleStartTime
      *            visibleStartTime
      */
-    public void setVisibleStartTime(double visibleStartTime) {
+    public void setVisibleStartTime(int visibleStartTime) {
         this.visibleStartTime = visibleStartTime;
     }
 
@@ -613,7 +655,7 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
      */
     public int getVisibleStartTimePoint() {
         double scale = getScale();
-        return (int) (visibleStartTime * scale * TimelineConstants.DEFAULT_TIME_INTERVAL);
+        return (int) (visibleStartTime * scale / TimelineConstants.DEFAULT_TIME_INTERVAL);
     }
 
     /**
@@ -622,10 +664,10 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
      * @param point
      * @return
      */
-    public double getPointToTime(int point) {
+    public int getPointToTime(int point) {
         double scale = getScale();
-        return (((point / scale) + (visibleStartTime * TimelineConstants.DEFAULT_TIME_INTERVAL)))
-                / TimelineConstants.DEFAULT_TIME_MILLISECOND;
+        return (int) (((point / scale) + (visibleStartTime / TimelineConstants.DEFAULT_TIME_INTERVAL)));// /
+                                                                   // TimelineConstants.DEFAULT_TIME_MILLISECOND;
     }
 
     /**
@@ -636,7 +678,7 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
      */
     public int getTimeToPoint(double time) {
         double scale = getScale();
-        return (int) ((((time * TimelineConstants.DEFAULT_TIME_MILLISECOND) - (visibleStartTime * TimelineConstants.DEFAULT_TIME_INTERVAL))) * scale);
+        return (int) ((((time * TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL) - (visibleStartTime / TimelineConstants.DEFAULT_CONVERTTIME_POSITION_INTERVAL))) * scale);
     }
 
     /**
@@ -715,11 +757,14 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
             int pixcelX = TimelineConstants.DEFAULT_TIMELINE_LEFT_MARGIN;
             double scale = getScale();
             double secondInterval = scale * TimelineConstants.DEFAULT_TIME_INTERVAL;
-            int startTime = (int) visibleStartTime;
-            pixcelX -= (visibleStartTime - (double) startTime) * ((double) secondInterval);
+            int startTime =
+                    (int) visibleStartTime / TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL;
+            pixcelX -=
+                    (visibleStartTime / TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL - (double) startTime)
+                            * ((double) secondInterval);
 
             for (; pixcelX < timeElementClientArea.width; startTime++, pixcelX += secondInterval) {
-                if (startTime % TimelineConstants.DEFAULT_TIME_INTERVAL == 0) {
+                if (startTime % 10 == 0) {
                     e.gc.drawLine(pixcelX, 0, pixcelX, timeElementClientArea.height - 1);
                 }
             }
@@ -754,10 +799,9 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
                     }
                 }
 
+                mouseDownPoint = event.x;
+                beforeMouseDownPoint = event.x;
                 if (isKeyFrameMouseDown == true || isKeyFrameUnitMouseDown == true) {
-                    // System.out.println("mouseDown " +event.x);
-                    mouseDownPoint = event.x;
-                    beforeMouseDownPoint = event.x;
 
                     if (isKeyFrameMouseDown == true) {
                         int currentPoint = (int) (selectedKeyFrame.getKeyframe().x);
@@ -765,9 +809,13 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
                         selectedKeyFrame.setBeforePoint(currentPoint);
                         selectedKeyFrame.setAfterPoint(currentPoint);
                         extendsPoint = mouseDownPoint - selectedKeyFrame.getKeyframe().x;
+                        moveCurrentTimeMarker(true);
                     } else {
                         extendsPoint = mouseDownPoint - selectedKeyFrameUnit.getKeyframeUnit().x;
+                        moveCurrentTimeMarker(false);
                     }
+                } else {
+                    moveCurrentTimeMarker(false);
                 }
 
                 // Mouse Up
@@ -777,12 +825,11 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
                     KeyFrameUnit keyframeUnit = selectedKeyFrame.getKeyFrameUnit();
                     double exPoint = getPointToTime(keyframeUnit.getKeyframeUnit().x);
                     if (exPoint < 0) {
-                        keyframeUnit.getKeyframeUnit().x =
-                                TimelineConstants.DEFAULT_KEYFRAME_MARGINE;
+                        keyframeUnit.getKeyframeUnit().x = DEFAULT_KEYFRAME_MARGINE;
                         int beforekeyframeEndPoint =
                                 keyframeUnit.getKeyFrameUnitModelXpoint()
-                                        + keyframeUnit.getKeyFrameUnitModelWidth()
-                                        - getVisibleStartTimePoint();
+                                        + keyframeUnit.getKeyFrameUnitModelWidth();
+                        // - getVisibleStartTimePoint();
                         keyframeUnit.refresh(keyframeUnit.getKeyframeUnit().x,
                                              beforekeyframeEndPoint);
                         redraw();
@@ -793,10 +840,9 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
                 } else if (selectedKeyFrameUnit != null) {
                     double exPoint = getPointToTime(selectedKeyFrameUnit.getKeyframeUnit().x);
                     if (exPoint < 0) {
-                        selectedKeyFrameUnit.getKeyframeUnit().x =
-                                TimelineConstants.DEFAULT_KEYFRAME_MARGINE;
-                    }
+                        selectedKeyFrameUnit.getKeyframeUnit().x = DEFAULT_KEYFRAME_MARGINE;
 
+                    }
                     if (mouseMoveReleasePoint != 0
                             && selectedKeyFrameUnit.getKeyFrameUnitModelXpoint() != mouseMoveReleasePoint) {
                         // System.out.println("mouseMoveReleasePoint " + mouseMoveReleasePoint);
@@ -826,8 +872,9 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
                         // Just one Keyframe
                         if (parentUnit.getModel().getChildrenSize() == 1) {
                             double exPoint = getPointToTime(parentArea.x);
-                            if (exPoint < 0.0 && getVisibleStartTime() == 0.0) {
-                                parentArea.x = TimelineConstants.DEFAULT_KEYFRAME_MARGINE;
+                            if (exPoint < 0.0 && getVisibleStartTime() == 0) {
+                                parentArea.x = DEFAULT_KEYFRAME_MARGINE;
+
                                 selectedKeyFrame
                                         .setAfterPoint(TimelineConstants.DEFAULT_TIMELINE_TIMEBAR_0);
 
@@ -874,16 +921,16 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
                                         isKeyFrameUnitMouseDown = false;
                                         return;
                                     } else if (exPoint < 0.0) {
-                                        parentArea.x = TimelineConstants.DEFAULT_KEYFRAME_MARGINE;
+                                        parentArea.x = DEFAULT_KEYFRAME_MARGINE;
+
                                         selectedKeyFrame
                                                 .setAfterPoint(TimelineConstants.DEFAULT_START_KEYFRAME_POINT);
 
                                         afterkeyframeWidth =
-                                                beforekeyframeEndPoint
-                                                        - TimelineConstants.DEFAULT_KEYFRAME_MARGINE;
+                                                beforekeyframeEndPoint - DEFAULT_KEYFRAME_MARGINE;
                                         parentUnit.refresh(parentArea.x, afterkeyframeWidth);
 
-                                        if (getVisibleStartTime() == 0.0) {
+                                        if (getVisibleStartTime() == 0) {
                                             isKeyFrameMouseDown = false;
                                             isKeyFrameUnitMouseDown = false;
                                             updateModel(selectedKeyFrame);
@@ -965,9 +1012,8 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
                         }
                     } else {
                         double exPoint = getPointToTime(selectedKeyFrameUnit.getKeyframeUnit().x);
-                        if (exPoint < 0.0 && getVisibleStartTime() == 0.0) {
-                            selectedKeyFrameUnit.getKeyframeUnit().x =
-                                    TimelineConstants.DEFAULT_KEYFRAME_MARGINE;
+                        if (exPoint < 0.0 && getVisibleStartTime() == 0) {
+                            selectedKeyFrameUnit.getKeyframeUnit().x = DEFAULT_KEYFRAME_MARGINE;
 
                             isKeyFrameMouseDown = false;
                             isKeyFrameUnitMouseDown = false;
@@ -989,13 +1035,12 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
 
                     // refresh scroll
                     Rectangle parent = getBounds();
-                    double currentTime = getPointToTime(mouseDownPoint);
-                    if ((parent.width - TimelineConstants.DEFAULT_TIME_INTERVAL < mouseDownPoint)
+                    int currentTime = getPointToTime(mouseDownPoint);
+                    if ((parent.width - 10 < mouseDownPoint)
                             && (beforeMouseDownPoint < mouseDownPoint)) {
                         TimelineContentContainer container = findTimelineContentContainer();
                         container.refreshHScroll(currentTime, 1, 1, 1);
-                    } else if ((TimelineConstants.DEFAULT_TIME_INTERVAL > mouseDownPoint)
-                            && (beforeMouseDownPoint > mouseDownPoint)) {
+                    } else if ((10 > mouseDownPoint) && (beforeMouseDownPoint > mouseDownPoint)) {
                         TimelineContentContainer container = findTimelineContentContainer();
                         container.refreshHScroll(currentTime, 0, -1, 1);
                     }
@@ -1005,10 +1050,9 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
                 }
             } else if (event.type == SWT.MouseDoubleClick) {
                 if (isKeyFrameMouseDown == true) {
-                    moveCurrentTimeMarker();
+                    moveCurrentTimeMarker(true);
                 }
             }
         }
     };
-
 }
index 4d345dc..1297255 100644 (file)
@@ -171,12 +171,12 @@ public class TimelineOutlineElement extends Canvas {
     private void createControls() {
 
         if (Platform.getOS().equals(Platform.OS_WIN32)) {
-            imageHeight = 5;
-            textHeight = 6;
+            imageHeight = 4;
+            textHeight = 5;
         } else if (Platform.getOS().equals(Platform.OS_LINUX)
                 || Platform.getOS().equals(Platform.OS_MACOSX)) {
-            imageHeight = 6;
-            textHeight = 6;
+            imageHeight = 5;
+            textHeight = 5;
         }
 
         // Widget Name
@@ -184,7 +184,7 @@ public class TimelineOutlineElement extends Canvas {
 
         if (getElementType() == 0) {
             // ExpandArrow
-            treeExpandArrowImage = new Rectangle(5, 9, 7, 7);
+            treeExpandArrowImage = new Rectangle(5, 8, 7, 7);
 
             // Widget Icon
             widgetIconFile = "page_16.png";
index 712831e..96f9364 100644 (file)
@@ -51,7 +51,7 @@ public class TimelineWidgetElement extends Canvas {
 
     private int imageHeight = 5;
     private int textHeight = 6;
-    
+
     private Image animationsCountImage = null;
     private String animationsCountText = null;
     private Image playTimeImage = null;
@@ -88,12 +88,12 @@ public class TimelineWidgetElement extends Canvas {
      */
     private void createControls() {
         if (Platform.getOS().equals(Platform.OS_WIN32)) {
-            imageHeight = 5;
-            textHeight = 6;
+            imageHeight = 4;
+            textHeight = 5;
         } else if (Platform.getOS().equals(Platform.OS_LINUX)
                 || Platform.getOS().equals(Platform.OS_MACOSX)) {
-            imageHeight = 6;
-            textHeight = 6;
+            imageHeight = 5;
+            textHeight = 5;
 
         }
         animationsCountImage =
@@ -113,7 +113,7 @@ public class TimelineWidgetElement extends Canvas {
         animationsCountText = TimelineMessages.ANIMATIONS + "0EA";
         playTimeText = TimelineMessages.PLAY_TIME + "0.000s";
         startTimeText = TimelineMessages.START_TIME + "0.000s";
-        endTimeText = TimelineMessages.END_TIME +  "0.000s";
+        endTimeText = TimelineMessages.END_TIME + "0.000s";
     }
 
     /**
@@ -157,9 +157,9 @@ public class TimelineWidgetElement extends Canvas {
         double totalPlayTime = currentEndTime - currentStartTime;
 
         animationsCountText = TimelineMessages.ANIMATIONS + totalAnimationCount + "EA";
-        playTimeText = TimelineMessages.PLAY_TIME + String.format("%.3f", totalPlayTime) + "s";
-        startTimeText = TimelineMessages.START_TIME + String.format("%.3f", currentStartTime) + "s";
-        endTimeText = TimelineMessages.END_TIME + String.format("%.3f", currentEndTime) + "s";
+        playTimeText = TimelineMessages.PLAY_TIME + String.format("%.1f", totalPlayTime) + "s";
+        startTimeText = TimelineMessages.START_TIME + String.format("%.1f", currentStartTime) + "s";
+        endTimeText = TimelineMessages.END_TIME + String.format("%.1f", currentEndTime) + "s";
 
         redraw();
     }
@@ -206,16 +206,31 @@ public class TimelineWidgetElement extends Canvas {
         }
 
         private void drawImageAndText(GC gc) {
-            gc.drawImage(animationsCountImage, 10, imageHeight);
-            gc.drawImage(playTimeImage, 140, imageHeight);
-            gc.drawImage(startTimeImage, 280, imageHeight);
-            gc.drawImage(endTimeImage, 420, imageHeight);
+            int animationsMargine = 10;
+            int playTimeImageMargine = 140;
+            int startTimeImageMargine = 260;
+            int endTimeImageMargine = 385;
+            int textMargine = 20;
+
+            if (Platform.getOS().equals(Platform.OS_WIN32)) {
+                // do nothing
+            } else if (Platform.getOS().equals(Platform.OS_LINUX)
+                    || Platform.getOS().equals(Platform.OS_MACOSX)) {
+                animationsMargine = 10;
+                playTimeImageMargine = 150;
+                startTimeImageMargine = 280;
+                endTimeImageMargine = 415;
+            }
+            gc.drawImage(animationsCountImage, animationsMargine, imageHeight);
+            gc.drawImage(playTimeImage, playTimeImageMargine, imageHeight);
+            gc.drawImage(startTimeImage, startTimeImageMargine, imageHeight);
+            gc.drawImage(endTimeImage, endTimeImageMargine, imageHeight);
 
             gc.setForeground(ColorResource.KEYFRAMEWIDGET_TEXT);
-            gc.drawText(animationsCountText, 30, textHeight, true);
-            gc.drawText(playTimeText, 160, textHeight, true);
-            gc.drawText(startTimeText, 300, textHeight, true);
-            gc.drawText(endTimeText, 440, textHeight, true);
+            gc.drawText(animationsCountText, animationsMargine + textMargine, textHeight, true);
+            gc.drawText(playTimeText, playTimeImageMargine + textMargine, textHeight, true);
+            gc.drawText(startTimeText, startTimeImageMargine + textMargine, textHeight, true);
+            gc.drawText(endTimeText, endTimeImageMargine + textMargine, textHeight, true);
             gc.setForeground(ColorResource.LATTICE);
         }
     };
index 48c78ef..653307c 100644 (file)
@@ -10,6 +10,7 @@ import org.tizen.webuibuilder.animator.model.AnimatorModel;
 import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineViewer;
 import org.tizen.webuibuilder.animator.ui.views.timeline.common.TimelineConstants;
 import org.tizen.webuibuilder.animator.ui.views.timeline.tree.TimeTreeElement;
+import org.tizen.webuibuilder.utility.Platform;
 import org.tizen.webuibuilder.utility.ResourceManager;
 
 
@@ -68,19 +69,25 @@ public class KeyFrame extends KeyFrameComponent {
     @Override
     public void selected() {
         keyFrameUnit.selected();
-        
+
     }
 
     /**
      * Re Location
      */
     public void reLocation() {
-        double startPoint = getKeyFrameUnit().getKeyframeUnit().x;
-        double delayPoint = getKeyFrameModelXpoint();
+        int startPoint = getKeyFrameUnit().getKeyframeUnit().x;
+        int delayPoint = getKeyFrameModelXpoint();
 
         getKeyframe().x =
                 (int) (startPoint + delayPoint - TimelineConstants.DEFAULT_FRAME_WIDGET_HALF_WIDTH);
-        getKeyframe().y = TimelineConstants.DEFAULT_KEYFRAME_MARGINE * 2;
+        if (Platform.getOS().equals(Platform.OS_WIN32)) {
+            getKeyframe().y = TimelineConstants.DEFAULT_FRAME_WIDGET_MARGIN;
+        } else if (Platform.getOS().equals(Platform.OS_LINUX)
+                || Platform.getOS().equals(Platform.OS_MACOSX)) {
+            getKeyframe().y = TimelineConstants.DEFAULT_FRAME_WIDGET_MARGIN_LINUX;
+        }
+
     }
 
     /**
@@ -141,7 +148,7 @@ public class KeyFrame extends KeyFrameComponent {
      */
     public int getKeyFrameModelXpoint() {
         double scale = getKeyFrameUnit().getTimeTreeElement().getScale();
-        return (int) (getModel().getFrameTime() * scale * (double) TimelineConstants.DEFAULT_TIME_MILLISECOND);
+        return (int) (getModel().getFrameTime() * scale * (double) TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL);
     }
 
     /*******************************************************************************
@@ -277,6 +284,4 @@ public class KeyFrame extends KeyFrameComponent {
         return keyFrameUnit.getTimeTreeElement();
     }
 
-
-
 }
index d3290e2..12f5594 100644 (file)
@@ -15,6 +15,7 @@ import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineViewer;
 import org.tizen.webuibuilder.animator.ui.views.timeline.common.ColorResource;
 import org.tizen.webuibuilder.animator.ui.views.timeline.common.TimelineConstants;
 import org.tizen.webuibuilder.animator.ui.views.timeline.tree.TimeTreeElement;
+import org.tizen.webuibuilder.utility.Platform;
 
 
 /**
@@ -83,7 +84,12 @@ public class KeyFrameUnit extends KeyFrameComponent {
      */
     private void reLocation() {
         getKeyframeUnit().x = getKeyFrameUnitModelXpoint();
-        getKeyframeUnit().y = TimelineConstants.DEFAULT_KEYFRAME_MARGINE;
+        if (Platform.getOS().equals(Platform.OS_WIN32)) {
+            getKeyframeUnit().y = TimelineConstants.DEFAULT_KEYFRAME_MARGIN;
+        } else if (Platform.getOS().equals(Platform.OS_LINUX)
+                || Platform.getOS().equals(Platform.OS_MACOSX)) {
+            getKeyframeUnit().y = TimelineConstants.DEFAULT_KEYFRAME_MARGIN_LINUX;
+        }
         getKeyframeUnit().width = getKeyFrameUnitModelWidth();
         getKeyframeUnit().height = TimelineConstants.DEFAULT_LIFE_WIGET_HEIGHT;
     }
@@ -155,7 +161,7 @@ public class KeyFrameUnit extends KeyFrameComponent {
      * @param width
      */
     public void refresh(int startPoint, int width) {
-        //System.out.println("unit start " + startPoint + " unit width " + width);
+        // System.out.println("unit start " + startPoint + " unit width " + width);
         getKeyframeUnit().x = startPoint;
         getKeyframeUnit().width = width;
 
@@ -165,7 +171,7 @@ public class KeyFrameUnit extends KeyFrameComponent {
             double percent =
                     ((AnimatorKeyframe) frameModel.getParent()).calculateFramePercent(frameTime);
 
-            int xPoint = (int) (width * percent / TimelineConstants.DEFAULT_TIME_MILLISECOND);
+            int xPoint = (int) (width * percent / TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL);
             // System.out.println("psercent " + percent + " framePoint " + xPoint);
 
             keyFrame.getKeyframe().x =
@@ -267,7 +273,7 @@ public class KeyFrameUnit extends KeyFrameComponent {
      */
     public int getKeyFrameUnitModelXpoint() {
         double scale = getTimeTreeElement().getScale();
-        return (int) (getModel().getDelay() * scale * (double) TimelineConstants.DEFAULT_TIME_MILLISECOND)
+        return (int) (getModel().getDelay() * scale * (double) TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL)
                 + TimelineConstants.DEFAULT_TIMELINE_LEFT_MARGIN;
     }
 
@@ -278,7 +284,7 @@ public class KeyFrameUnit extends KeyFrameComponent {
      */
     public int getKeyFrameUnitModelWidth() {
         double scale = getTimeTreeElement().getScale();
-        return (int) (getModel().getDuration() * scale * (double) TimelineConstants.DEFAULT_TIME_MILLISECOND);
+        return (int) (getModel().getDuration() * scale * (double) TimelineConstants.DEFAULT_TIME_POSITION_INTERVAL);
     }
 
     /**
@@ -287,7 +293,7 @@ public class KeyFrameUnit extends KeyFrameComponent {
     public void selected() {
         moveToBottom();
     }
-    
+
     /**
      * Move to bottom
      */
@@ -295,6 +301,7 @@ public class KeyFrameUnit extends KeyFrameComponent {
         timeTreeElement.getKeyframeUnits().remove(this);
         timeTreeElement.getKeyframeUnits().add(this);
     }
+
     /*******************************************************************************
      * Getter, Setter
      *******************************************************************************/
index ec30160..1f97819 100644 (file)
@@ -53,6 +53,7 @@ import org.tizen.webuibuilder.animator.ui.views.timeline.TimelineViewer;
 import org.tizen.webuibuilder.animator.ui.views.timeline.command.TimelineFrameCreateCommand;
 import org.tizen.webuibuilder.animator.ui.views.timeline.command.TimelineFrameDeleteCommand;
 import org.tizen.webuibuilder.animator.ui.views.timeline.command.TimelineKeyframeDeleteCommand;
+import org.tizen.webuibuilder.animator.ui.views.timeline.common.Formatter;
 import org.tizen.webuibuilder.animator.ui.views.timeline.editpart.TimelineEditPart;
 import org.tizen.webuibuilder.animator.ui.views.timeline.tree.TimeTreeElement;
 import org.tizen.webuibuilder.animator.ui.views.timeline.tree.TimelineOutlineElement;
@@ -571,10 +572,12 @@ public class TimelineWidgetContextMenu {
                                 viewer.getMainContainer().getContentContainer()
                                         .getContentHeaderContainer().getOutlineHeader()
                                         .getSelectedAnimationGroupId();
-                        double pointTime =
-                                viewer.getMainContainer().getContentContainer()
-                                        .getContentHeaderContainer().getKeyframeHeader()
-                                        .getTimeBar().getPlayHeader().getCurrentPointTime();
+                        int currentPointTime = viewer.getMainContainer().getContentContainer()
+                                .getContentHeaderContainer().getKeyframeHeader()
+                                .getTimeBar().getPlayHeader().getCurrentPointTime();
+                        
+                        double pointTime = Formatter.computeTimeTotime(currentPointTime);
+                                
                         Command command =
                                 new AnimationCreateCommand(animationGroupId, cssAnimation,
                                                            appManager,
index 0dbf898..22bcd35 100644 (file)
@@ -399,6 +399,15 @@ public class AnimatorUtils {
     }
 
     /**
+     * Convert time int to string
+     * 
+     * @param pointTime
+     * @return
+     */
+    public static String convertTimetoTimeIntText(int pointTime) {
+        return Formatter.toTimeFormatInt(pointTime);
+    }
+    /**
      * Convert percent to target time
      * 
      * @param percent
@@ -432,28 +441,6 @@ public class AnimatorUtils {
     }
 
     /**
-     * Get viewer
-     * 
-     * @param keyframeWidget
-     * @return
-     */
-    /*public static TimelineViewer getViewer(KeyFrameWidget keyframeWidget) {
-        
-        TimeTreeElement timeTreeElement = (TimeTreeElement) keyframeWidget.getParent();
-        TreeItem treeItem = (TreeItem) timeTreeElement.getData("RefrenceTreeItem");
-
-        Object data = treeItem.getData();
-        if (data instanceof TimelineEditPart) {
-            TimelineViewer viewer = ((TimelineEditPart) data).getViewer();
-
-            return viewer;
-        }
-
-        return null;
-    }*/
-
-
-    /**
      * ex) input : "translate(100px, 0px) rotate(0deg)", 200, 50 output :
      * "translate(200px, 50px) rotate(0deg)"
      * 
index d9fcb85..278a5ae 100644 (file)
@@ -633,5 +633,9 @@ public class DesignerGoingBridge extends GoingBridge {
 
         call("modifyStyle", new Jsonizable[] { new JsString(result) });
     }
+    
+    public void modifyStyle(String style) {
+        call("modifyStyle", new Jsonizable[] { new JsString(style) });
+    }
 
 }
index e17a88f..3eb936c 100644 (file)
@@ -34,6 +34,10 @@ public abstract class GoingBridge {
     }
 
     protected Object call(String funcName, Jsonizable[] arguments) {
+        if (browser == null) {
+            return null;
+        }
+
         StringBuffer script = new StringBuffer();
 
         script.append(funcName);
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/ChangeCssSelectorCommand.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/ChangeCssSelectorCommand.java
new file mode 100644 (file)
index 0000000..0a14baf
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * 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.gef.commands;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.gef.commands.Command;
+import org.tizen.webuibuilder.model.Part;
+import org.tizen.webuibuilder.model.css.CssFile;
+import org.tizen.webuibuilder.model.css.CssSelector;
+import org.tizen.webuibuilder.model.css.CssStyle;
+import org.tizen.webuibuilder.model.page.PageData;
+import org.tizen.webuibuilder.ui.views.nscreen.NScreenUtil;
+
+
+abstract public class ChangeCssSelectorCommand extends Command {
+
+    private Part model;
+    private String selectorName;
+    private PageData pageData;
+    private CssFile appliedCssFile;
+    private CssSelector newSelector = null;
+
+    public ChangeCssSelectorCommand(Object model, PageData pageData, String selectorName) {
+        setModel(model);
+        this.pageData = pageData;
+        this.selectorName = selectorName;
+    }
+
+    public void setModel(Object model) {
+        this.model = (Part) model;
+    }
+
+    abstract public void execute2();
+
+    abstract public void undo2();
+
+    /**
+     * Do not override this method. You must override execute2().
+     */
+    @Override
+    public void execute() {
+        // prepare selector
+        Map<String, CssSelector> selectorMap = model.getEditSelectorMap();
+        CssSelector selector = selectorMap.get(selectorName);
+        if (selector == null) {
+            // create selector
+            selector = new CssSelector(selectorName);
+            selectorMap.put(selectorName, selector);
+            appliedCssFile = pageData.getCurrentCssFile();
+            appliedCssFile.addCssSelector(selector);
+            newSelector = selector;
+
+        }
+
+        // Setting all selector of Part
+        // List<CssFile> appliedCssFileList = pageData.getAppliedCssFiles();
+        // int index = appliedCssFileList.indexOf(appliedCssFile);
+        // int size = appliedCssFileList.size();
+        // Map<String, CssSelector> allMap = model.getAllSelectorMap();
+        // boolean skip = false;
+        // CssSelector cloneSelector = selector.cloneCssSelector(selectorName);
+        // if (size - 1 == index) {
+        // allMap.put(selectorName, cloneSelector);
+        // } else {
+        // for (int i = index + 1; i <= size - 1; i++) {
+        // CssSelector targetSelector = allMap.get(selectorName);
+        // if (targetSelector != null) {
+        // for (CssStyle style : selector.getStyles()) {
+        // targetSelector.getStyleMap().put(style.getKey(), style);
+        // }
+        // skip = true;
+        // break;
+        // }
+        // }
+        // if (!skip) {
+        // allMap.put(selectorName, cloneSelector);
+        // }
+        // }
+
+        execute2();
+
+        if (NScreenUtil.isLogEnabled()) {
+            NScreenUtil.nscreen_log("=====================Edit code=======================\n" + NScreenUtil.selectorCodeGen(selector));
+        }
+    }
+
+    /**
+     * Do not override this method. You must override undo2().
+     */
+    @Override
+    public void undo() {
+        undo2();
+        if (newSelector != null) {
+            model.getEditSelectorMap().remove(newSelector);
+            model.getAllSelectorMap().remove(newSelector);
+            appliedCssFile.removeCssSelector(newSelector);
+        }
+    }
+
+    public Part getModel() {
+        return model;
+    }
+
+    public String getSelectorName() {
+        return selectorName;
+    }
+}
index c08f086..a9635af 100644 (file)
@@ -27,52 +27,55 @@ import org.eclipse.gef.commands.Command;
 import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.model.css.CssFile;
 import org.tizen.webuibuilder.model.css.CssSelector;
+import org.tizen.webuibuilder.model.page.PageData;
 
 
-public class CreateCssSelectorCommand extends Command {
+public class CreateCssSelectorCommand extends ChangeCssSelectorCommand {
 
-    private CssFile cssFile;
-    private CssSelector selector;
-    private Part part;
-    private String selectorName;
-
-    public CreateCssSelectorCommand(CssFile cssFile, Part part, CssSelector selector) {
-        this.cssFile = cssFile;
-        this.part = part;
-        this.selector = selector;
-    }
-
-    public CreateCssSelectorCommand(CssFile cssFile, Part part, String selectorName) {
-        this.cssFile = cssFile;
-        this.part = part;
-        this.selectorName = selectorName;
+    public CreateCssSelectorCommand(PageData pageData, Part model, String selectorName) {
+        super(model, pageData, selectorName);
     }
 
     @Override
     public boolean canExecute() {
-        if (cssFile == null || part == null || selectorName == null || selectorName.isEmpty()) {
-            return false;
-        } else if (cssFile.getSelector(selectorName) != null) {
-            return false;
-        } else {
+        Part model = getModel();
+        if (getSelectorName() != null && !getSelectorName().isEmpty() && model != null) {
             return true;
+        } else {
+            return false;
         }
     }
 
-    @Override
-    public void execute() {
-        if (selector == null) {
-            selector = new CssSelector(selectorName);
-        }
+//    @Override
+//    public void execute() {
+//        if (selector == null) {
+//            selector = new CssSelector(selectorName);
+//        }
+//
+//        cssFile.addCssSelector(selector);
+//        part.addSelector(selector.getSelectorName(), selector);
+//    }
+//
+//    @Override
+//    public void undo() {
+//        cssFile.removeCssSelector(selector);
+//        part.removeSelector(selector.getSelectorName());
+//    }
 
-        cssFile.addCssSelector(selector);
-        part.addSelector(selector.getSelectorName(), selector);
+    @Override
+    public void execute2() {
+        String selectorName = getSelectorName();
+        CssSelector selector = new CssSelector(selectorName);
+        Part model = getModel();
+        model.addSelector(selectorName, selector);
     }
 
     @Override
-    public void undo() {
-        cssFile.removeCssSelector(selector);
-        part.removeSelector(selector.getSelectorName());
+    public void undo2() {
+        // TODO Auto-generated method stub
+        String selectorName = getSelectorName();
+        Part model = getModel();
+        model.removeSelector(selectorName);
     }
 
 }
index 99db7fa..955ec8b 100644 (file)
@@ -28,21 +28,18 @@ import java.util.List;
 
 import org.eclipse.gef.commands.Command;
 import org.tizen.webuibuilder.BuilderConstants;
+import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.model.app.AppManagerForHTML;
 import org.tizen.webuibuilder.model.filedata.PageFileData;
 import org.tizen.webuibuilder.model.page.PageData;
 import org.tizen.webuibuilder.model.page.PageDataForHTML;
 import org.tizen.webuibuilder.utility.DomUtil;
-import org.w3c.dom.Node;
+import org.w3c.dom.Element;
 
 public class CreatePageCommand extends Command {
        
        private AppManagerForHTML appManager;
        private List<PageData> pageDatas;
-       private Node pageNode;
-       
-       private final String BODY_ELEMENT = "//BODY";
-       private final String BODY_ELEMENT_LOWER = "//body";
        
     public CreatePageCommand(AppManagerForHTML appManager, String html, String name) {
        this.appManager = appManager;
@@ -62,21 +59,20 @@ public class CreatePageCommand extends Command {
                
                for(int i = 0; i < size; i++) {
                        PageData pageData = new PageDataForHTML(BuilderConstants.EMPTY,
-                                       pageFileData, i, pageFileData.getDocument(),
+                                       pageFileData, i, appManager.getDocument(),
                                        appManager.getDescriptorManager(), null);
                        
                        if(pageData != null) {
                                pageDatas.add(pageData);
+                               Part pagePart = pageData.getPagePart();
+                               pagePart.setElement((Element)DomUtil.importedNode(appManager.getDocument(), pagePart.getElement()));
                        }
                }
-               
-               Node bodyNode = DomUtil.getBodyNode(pageFileData.getDocument(), BODY_ELEMENT);
-               pageNode = DomUtil.importedNode(appManager.getDocument(), bodyNode.getFirstChild());
     }
     
     @Override
     public boolean canExecute() {
-       return (pageDatas != null && pageNode != null) ? true : false;
+       return (pageDatas != null) ? true : false;
     }
     
     @Override
@@ -85,8 +81,6 @@ public class CreatePageCommand extends Command {
                return;
        }
        
-               DomUtil.appendPageNode(appManager.getDocument(), BODY_ELEMENT_LOWER, pageNode);
-               
                for(PageData pagaData : pageDatas) {
                        appManager.addPage(pagaData, true);
                }
@@ -95,12 +89,9 @@ public class CreatePageCommand extends Command {
        
     @Override
     public void undo() {
-       DomUtil.removePageNode(this.appManager.getDocument(), BODY_ELEMENT_LOWER, pageNode);
-       
        for(PageData pagaData : pageDatas) {
-                       appManager.removePage(pagaData);
+                       appManager.removePage(appManager.getPageIndex(pagaData));
                }
-    
     }
        
 }
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/DeletePageAction.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/DeletePageAction.java
new file mode 100644 (file)
index 0000000..d89a8e2
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * 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.gef.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.ui.actions.SelectionAction;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.tizen.webuibuilder.model.Part;
+import org.tizen.webuibuilder.model.app.AppManager;
+import org.tizen.webuibuilder.ui.actions.WebUIBuilderActionConstants;
+import org.tizen.webuibuilder.ui.contextmenu.Messages;
+import org.tizen.webuibuilder.ui.editor.PageDesigner;
+
+
+/**
+ * An action to delete selected page.
+ */
+public class DeletePageAction extends SelectionAction {
+
+    /**
+     * Creates a {@link DeletePageAction} and associates it with the given workbench part.
+     * 
+     * @param part
+     *            the workbench part
+     */
+    public DeletePageAction(IWorkbenchPart part) {
+        super(part);
+        setLazyEnablementCalculation(false);
+    }
+
+    /**
+     * Returns <code>true</code> if the selected objects can be deleted.
+     * 
+     * @return <code>true</code> if the command should be enabled, and <code>false</code> otherwise
+     */
+    @Override
+    protected boolean calculateEnabled() {
+        Command command = createDeletePageCommand(getSelectedObjects());
+        if (command == null) {
+            return false;
+        }
+
+        return command.canExecute();
+    }
+
+    /**
+     * Creates a {@link DeletePageCommand}.
+     * 
+     * @param selectedObjects
+     *            a List containing the currently selected objects
+     * @return a {@link DeletePageCommand}
+     */
+    private Command createDeletePageCommand(List<?> selectedObjects) {
+        if (selectedObjects == null || selectedObjects.isEmpty()) {
+            return null;
+        }
+
+        List<Part> parts = new ArrayList<Part>();
+        for (Object obj : selectedObjects) {
+            if ((obj instanceof EditPart)) {
+                Object model = ((EditPart) obj).getModel();
+                if (model instanceof Part) {
+                    Part part = (Part) model;
+                    if(!part.isPagePart()) {
+                       return null;
+                    }
+                    parts.add(part);
+                }
+            }
+        }
+        
+        IWorkbenchPart workbenchPart = getWorkbenchPart();
+               if(!(workbenchPart instanceof PageDesigner)) {
+                       return null;
+               }
+               PageDesigner pageDesigner = (PageDesigner) workbenchPart;
+               AppManager appManager = pageDesigner.getAppManager();
+
+        DeletePageCommand command = new DeletePageCommand(appManager, parts);
+
+        return command;
+    }
+
+    /**
+     * Initializes the delete action's text and images.
+     */
+    @Override
+    protected void init() {
+        super.init();
+
+        ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
+
+               setId(WebUIBuilderActionConstants.DELETE_PAGE);
+               setText(Messages.DELETE_PAGE);
+//        setText(Messages.ACTION_DELETE);
+//        setId(ActionFactory.DELETE.getId());
+        setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+        setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+        setDisabledImageDescriptor(images
+                .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
+        setEnabled(false);
+    }
+
+    /**
+     * Performs the delete action on the selected objects.
+     */
+    @Override
+    public void run() {
+        Command command = createDeletePageCommand(getSelectedObjects());
+        if (command != null && command.canExecute()) {
+            execute(command);
+        }
+    }
+
+}
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/DeletePageCommand.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/DeletePageCommand.java
new file mode 100644 (file)
index 0000000..15587f4
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * 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.gef.commands;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeSet;
+
+import org.eclipse.gef.commands.Command;
+import org.tizen.webuibuilder.animator.utils.AnimatorUtils;
+import org.tizen.webuibuilder.model.Part;
+import org.tizen.webuibuilder.model.app.AppManager;
+import org.tizen.webuibuilder.model.page.PageData;
+
+
+/**
+ * The command to delete {@link Part}s.
+ */
+public class DeletePageCommand extends Command {
+       
+       
+       private AppManager appManager;
+       private Map<Integer, PageData> pageDatas;
+       private TreeSet<Integer> indexes;
+       
+       /**
+     * A List containing {@link Part} which is removed.
+     */
+       protected List<Part> pages = new ArrayList<Part>();
+       
+       /**
+     * Constructs a {@link DeletePageCommand}.
+     * @param appManager 
+     * 
+     * @param child
+     *            a List containing {@link Part} which is removed
+     */
+       public DeletePageCommand(AppManager appManager, List<Part> parts) {
+               this.appManager = appManager;
+               this.pages = parts;
+       }
+
+    /**
+     * Checks whether a {@link DeletePageCommand} can be executed.
+     * 
+     * @return <code>true</code> if a {@link DeletePageCommand} can be executed, and
+     *         <code>false</code> otherwise
+     */
+    @Override
+    public boolean canExecute() {
+        if (AnimatorUtils.getActivePageDesigner().isAnimatorMode()) {
+            return false;
+        }
+        
+        if (pages == null || pages.isEmpty() || appManager.getPages().size() <= 1) {
+            return false;
+        }
+        
+        return true;
+    }
+    
+    /**
+     * Executes a {@link DeletePageCommand}.
+     */
+    @Override
+    public void execute() {
+        if (!canExecute()) {
+            return;
+        }
+
+        init();
+
+        // Deletes parts.
+        redo();
+    }
+
+    /**
+     * Initializes {@link PageData list}.
+     */
+    private void init() {
+       for(Part part : pages) {
+               if(part.getOwnerRef() instanceof PageData) {
+                       if(pageDatas == null) {
+                               pageDatas = new HashMap<Integer, PageData>(pages.size());
+                       }
+                       PageData pageData = (PageData) part.getOwnerRef();
+                       int index = appManager.getPageIndex(pageData);
+                       pageDatas.put(index, pageData);
+               }
+        }
+       indexes = new TreeSet<Integer>(pageDatas.keySet());
+    }
+
+    /**
+     * Re-executes a {@link DeletePageCommand}
+     */
+    @Override
+    public void redo() {
+       Iterator<Integer> iter = indexes.descendingIterator();
+       while(iter.hasNext()) {
+               int index = iter.next();
+               appManager.removePage(index);
+       }
+    }
+
+    /**
+     * Undoes a {@link DeletePageCommand}.
+     */
+    @Override
+    public void undo() {
+       Iterator<Integer> iter = indexes.iterator();
+       while(iter.hasNext()) {
+               int index = iter.next();
+               appManager.addPage(index, pageDatas.get(index), true);
+       }
+    }
+}
\ No newline at end of file
index 3a43db6..49986ae 100644 (file)
 
 package org.tizen.webuibuilder.gef.commands;
 
+import java.util.List;
+import java.util.Map;
+
 import org.eclipse.draw2d.geometry.Point;
 import org.eclipse.draw2d.geometry.Rectangle;
 import org.eclipse.gef.commands.Command;
 import org.tizen.webuibuilder.model.Part;
+import org.tizen.webuibuilder.model.css.CssFile;
+import org.tizen.webuibuilder.model.css.CssSelector;
+import org.tizen.webuibuilder.model.page.PageData;
 
 
-public class DesignerMoveLayoutCommand extends Command {
-
-    private Part model;
+public class DesignerMoveLayoutCommand extends ChangeCssSelectorCommand {
 
     private Point delta;
     private Point oldPosition;
+    
 
-    public DesignerMoveLayoutCommand(Object model, Point delta) {
-        setModel(model);
+    public DesignerMoveLayoutCommand(Object model, Point delta, PageData pageData, String selectorName) {
+        super(model, pageData, selectorName);
         setDelta(delta);
     }
 
@@ -45,19 +50,69 @@ public class DesignerMoveLayoutCommand extends Command {
         this.delta = delta;
     }
 
-    public void setModel(Object model) {
-        this.model = (Part) model;
-    }
+//    public void setModel(Object model) {
+//        this.model = (Part) model;
+//    }
+
+//    @Override
+//    public void execute() {
+//        Map<String, CssSelector> selectorMap = model.getEditSelectorMap();
+//        // create new selector
+//        CssSelector selector = selectorMap.get(selectorName); 
+//        if (selector == null) {
+//            selector = new CssSelector(selectorName);
+//            selectorMap.put(selectorName, selector);
+//            pageData.getCurrentCssFile().addCssSelector(selector);
+//            newSelector = selector;
+//        }
+//        
+//        Rectangle pos = model.getPositionProperty();
+//        oldPosition = new Point(pos.x, pos.y);
+//        model.setPosition(new Point(oldPosition.x + delta.x, oldPosition.y + delta.y));
+//        
+//        List<CssFile> appliedCssFileList = pageData.getAppliedCssFiles();
+//        int index = appliedCssFileList.indexOf(pageData.getCurrentCssFile());
+//        int size = appliedCssFileList.size();
+//        Map<String, CssSelector> allMap = model.getAllSelectorMap();
+//        boolean skip = false;
+//        if (size - 1 == index) {
+//            allMap.put(selectorName, selector);
+//        } else {
+//            for (int i = index + 1; i <= size - 1; i++) {
+//                if (allMap.get(selectorName) != null) {
+//                    skip = true;
+//                    break;
+//                }
+//            }
+//            if (!skip) {
+//                allMap.put(selectorName, selector);
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void undo() {
+//        if (oldPosition != null) {
+//            model.setPosition(new Point(oldPosition.x, oldPosition.y));
+//            if (newSelector != null) {
+//                model.getEditSelectorMap().remove(newSelector);
+//                model.getAllSelectorMap().remove(newSelector);
+//                appliedCssFile.removeCssSelector(newSelector);
+//            }
+//        }
+//    }
 
     @Override
-    public void execute() {
+    public void execute2() {
+        Part model = getModel();
         Rectangle pos = model.getPositionProperty();
         oldPosition = new Point(pos.x, pos.y);
         model.setPosition(new Point(oldPosition.x + delta.x, oldPosition.y + delta.y));
     }
 
     @Override
-    public void undo() {
+    public void undo2() {
+        Part model = getModel();
         if (oldPosition != null) {
             model.setPosition(new Point(oldPosition.x, oldPosition.y));
         }
index 427664d..9b9ad31 100644 (file)
@@ -25,24 +25,58 @@ package org.tizen.webuibuilder.gef.commands;
 
 import org.eclipse.draw2d.geometry.Point;
 import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.commands.Command;
 import org.tizen.webuibuilder.model.Part;
+import org.tizen.webuibuilder.model.page.PageData;
 
 
-public class DesignerResizeAndMoveLayoutCommand extends Command {
+public class DesignerResizeAndMoveLayoutCommand extends ChangeCssSelectorCommand {
 
-    private Part model;
 
     private Rectangle delta;
     private Rectangle oldLayout;
 
-    public DesignerResizeAndMoveLayoutCommand(Object model, Rectangle delta) {
-        this.model = (Part)model;
+    public DesignerResizeAndMoveLayoutCommand(Object model, Rectangle delta, PageData pageData, String selectorName) {
+        super(model, pageData, selectorName);
         this.delta = delta;
     }
 
+//    @Override
+//    public void execute() {
+//        Map<String, CssSelector> selectorMap = model.getEditSelectorMap();
+//        // create new selector
+//        if (selectorMap.get(selectorName) == null) {
+//            CssSelector selector = new CssSelector(selectorName);
+//            selectorMap.put(selectorName, selector);
+//        }
+//        if (model.getPositionMode() == Part.PositionMode.ABSOLUTE_POSITION) {
+//            oldLayout = new Rectangle(model.getPositionProperty());
+//            if (delta.x != 0 || delta.y != 0) {
+//                model.setPosition(new Point(oldLayout.x + delta.x, oldLayout.y + delta.y));
+//            }
+//            if (delta.width != 0 || delta.height != 0) {
+//                model.setSize(new Point(oldLayout.width + delta.width, oldLayout.height + delta.height));
+//            }
+//        } else if (model.getPositionMode() == Part.PositionMode.RELATIVE_POSITION) {
+//            oldLayout = new Rectangle(model.getPositionProperty());
+//            if (delta.x != 0 || delta.y != 0) {
+//                model.setPosition(new Point(oldLayout.x + delta.x, oldLayout.y + delta.y));
+//            }
+//            if (delta.width != 0 || delta.height != 0) {
+//                model.setSize(new Point(oldLayout.width + delta.width, oldLayout.height + delta.height));
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void undo() {
+//        if (oldLayout != null) {
+//            model.setPosition(oldLayout);
+//        }
+//    }
+
     @Override
-    public void execute() {
+    public void execute2() {
+        Part model = getModel();
         if (model.getPositionMode() == Part.PositionMode.ABSOLUTE_POSITION) {
             oldLayout = new Rectangle(model.getPositionProperty());
             if (delta.x != 0 || delta.y != 0) {
@@ -63,7 +97,8 @@ public class DesignerResizeAndMoveLayoutCommand extends Command {
     }
 
     @Override
-    public void undo() {
+    public void undo2() {
+        Part model = getModel();
         if (oldLayout != null) {
             model.setPosition(oldLayout);
         }
index 544d186..070bda2 100644 (file)
@@ -25,19 +25,18 @@ package org.tizen.webuibuilder.gef.commands;
 
 import org.eclipse.draw2d.geometry.Dimension;
 import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.commands.Command;
 import org.tizen.webuibuilder.model.Part;
+import org.tizen.webuibuilder.model.page.PageData;
 
 
-public class DesignerResizeLayoutCommand extends Command {
+public class DesignerResizeLayoutCommand extends ChangeCssSelectorCommand {
 
-    private Part model;
 
     private Dimension delta;
     private Dimension oldSize;
 
-    public DesignerResizeLayoutCommand(Object model, Dimension delta) {
-        setModel(model);
+    public DesignerResizeLayoutCommand(Object model, Dimension delta, PageData pageData, String selectorName) {
+        super(model, pageData, selectorName);
         setDelta(delta);
     }
 
@@ -45,18 +44,40 @@ public class DesignerResizeLayoutCommand extends Command {
         this.delta = delta;
     }
 
-    public void setModel(Object model) {
-        this.model = (Part) model;
-    }
+//    public void setModel(Object model) {
+//        this.model = (Part) model;
+//    }
+//
+//    @Override
+//    public void execute() {
+//        Map<String, CssSelector> selectorMap = model.getEditSelectorMap();
+//        // create new selector
+//        if (selectorMap.get(selectorName) == null) {
+//            CssSelector selector = new CssSelector(selectorName);
+//            selectorMap.put(selectorName, selector);
+//        }
+//        
+//        oldSize = new Dimension(model.getPositionProperty().width, model.getPositionProperty().height);
+//        model.setSize(new Point(oldSize.width + delta.width, oldSize.height + delta.height));
+//    }
+//
+//    @Override
+//    public void undo() {
+//        if (oldSize != null) {
+//            model.setSize(new Point(oldSize.width, oldSize.height));
+//        }
+//    }
 
     @Override
-    public void execute() {
+    public void execute2() {
+        Part model = getModel();
         oldSize = new Dimension(model.getPositionProperty().width, model.getPositionProperty().height);
-        model.setSize(new Point(oldSize.width + delta.width, oldSize.height + delta.height));
+        model.setSize(new Point(oldSize.width + delta.width, oldSize.height + delta.height));        
     }
 
     @Override
-    public void undo() {
+    public void undo2() {
+        Part model = getModel();
         if (oldSize != null) {
             model.setSize(new Point(oldSize.width, oldSize.height));
         }
index 4470077..a9f1ffc 100644 (file)
@@ -42,6 +42,8 @@ import org.tizen.webuibuilder.model.Part;
  */
 public class MoveAbsolutePartAction extends SelectionAction {
 
+    public static int MOVE_DIST = 6;
+    
     private int direct = 0;
     private int dist = 0;
 
@@ -128,28 +130,28 @@ public class MoveAbsolutePartAction extends SelectionAction {
     private void initUi() {
         switch (direct) {
             case PositionConstants.LEFT:
-                if(dist == 10){
+                if(dist == MOVE_DIST){
                     setId(Messages.ACTION_MOVE_LEFT);
                 } else if(dist == 1){
                     setId(Messages.ACTION_MOVE_LEFT_DETAIL);
                 }
                 break;
             case PositionConstants.RIGHT:
-                if(dist == 10){
+                if(dist == MOVE_DIST){
                     setId(Messages.ACTION_MOVE_RIGHT);
                 } else if(dist == 1){
                     setId(Messages.ACTION_MOVE_RIGHT_DETAIL);
                 }
                 break;
             case PositionConstants.TOP:
-                if(dist == 10){
+                if(dist == MOVE_DIST){
                     setId(Messages.ACTION_MOVE_UP);
                 } else if(dist == 1){
                     setId(Messages.ACTION_MOVE_UP_DETAIL);
                 }
                 break;
             case PositionConstants.BOTTOM:
-                if(dist == 10){
+                if(dist == MOVE_DIST){
                     setId(Messages.ACTION_MOVE_DOWN);
                 } else if(dist == 1){
                     setId(Messages.ACTION_MOVE_DOWN_DETAIL);
index 9dd5fc3..9b16243 100644 (file)
@@ -42,6 +42,8 @@ import org.tizen.webuibuilder.model.Part;
  */
 public class ResizeAbsolutePartAction extends SelectionAction {
 
+    public static int RESIZE_DIST = 6;
+
     private int direct = 0;
     private int dist = 0;
 
@@ -128,28 +130,28 @@ public class ResizeAbsolutePartAction extends SelectionAction {
     private void initUi() {
         switch (direct) {
             case PositionConstants.LEFT:
-                if(dist == 10){
+                if(dist == RESIZE_DIST){
                     setId(Messages.ACTION_DEC_WIDTH);
                 } else if(dist == 1){
                     setId(Messages.ACTION_DEC_WIDTH_DETAIL);
                 }
                 break;
             case PositionConstants.RIGHT:
-                if(dist == 10){
+                if(dist == RESIZE_DIST){
                     setId(Messages.ACTION_INC_WIDTH);
                 } else if(dist == 1){
                     setId(Messages.ACTION_INC_WIDTH_DETAIL);
                 }
                 break;
             case PositionConstants.TOP:
-                if(dist == 10){
+                if(dist == RESIZE_DIST){
                     setId(Messages.ACTION_DEC_HEIGHT);
                 } else if(dist == 1){
                     setId(Messages.ACTION_DEC_HEIGHT_DETAIL);
                 }
                 break;
             case PositionConstants.BOTTOM:
-                if(dist == 10){
+                if(dist == RESIZE_DIST){
                     setId(Messages.ACTION_INC_HEIGHT);
                 } else if(dist == 1){
                     setId(Messages.ACTION_INC_HEIGHT_DETAIL);
index ece87c3..88ff300 100644 (file)
 
 package org.tizen.webuibuilder.gef.commands;
 
-import org.eclipse.gef.commands.Command;
+import org.tizen.webuibuilder.BuilderConstants;
 import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.model.css.CssFile;
 import org.tizen.webuibuilder.model.css.CssSelector;
+import org.tizen.webuibuilder.model.page.PageData;
 
 
 /**
  * The command to set css style.
  */
-public class SetCssStyleCommand extends Command {
-
-    /**
-     * A {@link CssFile}.
-     */
-    private CssFile cssFile;
-
-    /**
-     * A {@link Part}.
-     */
-    private Part part;
-
-    /**
-     * A {@link CssSelector}.
-     */
-    private CssSelector selector;
+public class SetCssStyleCommand extends ChangeCssSelectorCommand {
 
     /**
      * A css style name.
@@ -76,11 +62,9 @@ public class SetCssStyleCommand extends Command {
      * @param value
      *            css style value
      */
-    public SetCssStyleCommand(CssFile cssFile, Part part, CssSelector selector, String key,
+    public SetCssStyleCommand(PageData pageData, Part part, String selectorName, String key,
             String value) {
-        this.cssFile = cssFile;
-        this.part = part;
-        this.selector = selector;
+        super(part, pageData, selectorName);
         this.key = key;
         this.value = value;
     }
@@ -88,52 +72,73 @@ public class SetCssStyleCommand extends Command {
     /**
      * Checks whether a {@link SetCssStyleCommand} can be executed.
      * 
-     * @return <code>true</code> if a {@link SetCssStyleCommand} can be executed, and
-     *         <code>false</code> otherwise
+     * @return <code>true</code> if a {@link SetCssStyleCommand} can be
+     *         executed, and <code>false</code> otherwise
      */
-    @Override
-    public boolean canExecute() {
-        if (cssFile == null || part == null || selector == null) {
-            return false;
-        } else {
-            if (part.getIdPropertyValue().equals(selector.getPartId())) {
-                return true;
-            } else {
-                return false;
-            }
-        }
-    }
+    // @Override
+    // public boolean canExecute() {
+    // if (cssFile == null || part == null || selector == null) {
+    // return false;
+    // } else {
+    // if (part.getIdPropertyValue().equals(selector.getPartId())) {
+    // return true;
+    // } else {
+    // return false;
+    // }
+    // }
+    // }
+    //
+    // /**
+    // * Executes a {@link SetCssStyleCommand}.
+    // */
+    // @Override
+    // public void execute() {
+    // if (canExecute()) {
+    // if (oldValue == null) {
+    // oldValue = selector.getPropertyValue(key);
+    // }
+    //
+    // if (cssFile.getSelector(selector.getSelectorName()) == null) {
+    // cssFile.addCssSelector(selector);
+    // }
+    // selector.setStyle(key, value);
+    // String selectorName = selector.getSelectorName();
+    //
+    // if (part.getSelector(selectorName) == null) {
+    // part.addSelector(selectorName, selector);
+    // }
+    // part.setSelectorPropertyValue(selectorName, key, value);
+    // }
+    // }
+    //
+    // /**
+    // * Undoes a {@link SetCssStyleCommand}.
+    // */
+    // @Override
+    // public void undo() {
+    // selector.setStyle(key, oldValue);
+    // part.setSelectorPropertyValue(selector.getSelectorName(), key, oldValue);
+    // }
 
-    /**
-     * Executes a {@link SetCssStyleCommand}.
-     */
     @Override
-    public void execute() {
-        if (canExecute()) {
-            if (oldValue == null) {
-                oldValue = selector.getPropertyValue(key);
-            }
-
-            if (cssFile.getSelector(selector.getSelectorName()) == null) {
-                cssFile.addCssSelector(selector);
-            }
-            selector.setStyle(key, value);
-            String selectorName = selector.getSelectorName();
-
-            if (part.getSelector(selectorName) == null) {
-                part.addSelector(selectorName, selector);
-            }
-            part.setSelectorPropertyValue(selectorName, key, value);
+    public void execute2() {
+        Part part = getModel();
+        String selectorName = getSelectorName();
+        CssSelector selector = part.getSelector(selectorName);
+        if (selector != null) {
+            oldValue = selector.getPropertyValue(key);
+        }
+        
+        if (oldValue == null) {
+            oldValue = BuilderConstants.EMPTY;
         }
+        part.setSelectorPropertyValue(selectorName, key, value);
     }
 
-    /**
-     * Undoes a {@link SetCssStyleCommand}.
-     */
     @Override
-    public void undo() {
-        selector.setStyle(key, oldValue);
-        part.setSelectorPropertyValue(selector.getSelectorName(), key, oldValue);
+    public void undo2() {
+        Part part = getModel();
+        part.setSelectorPropertyValue(getSelectorName(), key, oldValue);
     }
 
 }
index e6efdcb..2a62728 100644 (file)
@@ -24,7 +24,9 @@
 package org.tizen.webuibuilder.gef.editparts;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.eclipse.gef.CompoundSnapToHelper;
 import org.eclipse.gef.DragTracker;
@@ -43,8 +45,13 @@ import org.tizen.webuibuilder.gef.policies.DesignerXYLayoutEditPolicy;
 import org.tizen.webuibuilder.gef.tools.DesignDragAbsoluteEditPartsTracker;
 import org.tizen.webuibuilder.gef.tools.DesignDragEditPartsTracker;
 import org.tizen.webuibuilder.gef.viewer.DesignerBrowserViewer;
+import org.tizen.webuibuilder.gef.viewer.HoverBrowserViewer;
 import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.model.css.CssEvent;
+import org.tizen.webuibuilder.model.css.CssFile;
+import org.tizen.webuibuilder.model.css.CssSelector;
+import org.tizen.webuibuilder.model.css.CssStyle;
+import org.tizen.webuibuilder.model.page.PageData;
 
 
 public class DesignerEditPart extends HoverViewerEditPart {
@@ -79,7 +86,11 @@ public class DesignerEditPart extends HoverViewerEditPart {
 
     @Override
     public void cssPropertyChanged(CssEvent event) {
-        if (event.getPropertyKey().equals("position")) {
+        String selectorName = event.getSelectorName();
+        String key = event.getPropertyKey();
+        String value = event.getPropertyValue();
+        
+        if (key.equals("position")) {
             if (((Part) getModel()).getPositionMode() == Part.PositionMode.ABSOLUTE_POSITION) {
                 installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
                                   new DesignerAbsoluteDragEditPolicy());
@@ -89,6 +100,27 @@ public class DesignerEditPart extends HoverViewerEditPart {
             }
             refreshVisuals();
         }
+        
+        //delete style
+        if (selectorName != null && key != null && value != null && value.isEmpty()) {
+            Part model = (Part) getModel();
+            Map<String, CssSelector> allMap = model.getAllSelectorMap();
+            CssSelector selector = allMap.get(selectorName);
+            selector.setStyle(key, value);
+            
+            PageData pageData = ((HoverBrowserViewer) getViewer()).getPageData();
+            List<CssFile> appliedCssFileList = pageData.getAppliedCssFiles();
+            
+            for (CssFile cssFile : appliedCssFileList) {
+                CssSelector tempSelector = cssFile.getSelector(selectorName);
+                if (tempSelector != null) {
+                    CssStyle style = tempSelector.getCssStyle(key);
+                    if (style != null) {
+                        selector.setStyle(style, false);
+                    }
+                }
+            }
+        }
 
         super.cssPropertyChanged(event);
     }
@@ -150,4 +182,46 @@ public class DesignerEditPart extends HoverViewerEditPart {
             figure.setBinded(false);
         }
     }
+    
+    @Override
+    public void needRefresh(CssEvent event) {
+        // called needRefresh(e) in HoverVrowserViewer()
+        String selectorName = event.getSelectorName();
+        if (selectorName != null) {
+            PageData pageData = ((HoverBrowserViewer) getViewer()).getPageData();
+            Part model = (Part) getModel();
+            CssSelector selector = model.getSelector(selectorName);
+            List<CssFile> appliedCssFileList = pageData.getAppliedCssFiles();
+            int index = appliedCssFileList.indexOf(pageData.getCurrentCssFile());
+            int size = appliedCssFileList.size();
+            Map<String, CssSelector> allMap = model.getAllSelectorMap();
+            CssSelector cloneSelector = selector.cloneCssSelector(selectorName);
+
+            for (int i = index + 1; i < size; i++) {
+                CssFile cssFile = appliedCssFileList.get(i);
+                CssSelector skipSelector = cssFile.getSelector(selectorName);
+                if (skipSelector == null) {
+                    continue;
+                }
+                Map<String, CssStyle> skipStyleMap = skipSelector.getStyleMap();
+
+                for (Iterator<CssStyle> iter = cloneSelector.getStyles().iterator(); iter.hasNext();) {
+                    CssStyle style = iter.next();
+                    String key = style.getKey();
+                    if (skipStyleMap.get(key) != null) {
+                        iter.remove();
+                    }
+                }
+            }
+            CssSelector cssSelector = allMap.get(selectorName);
+            if (cssSelector == null) {
+                allMap.put(selectorName, cloneSelector);
+            } else {
+                for (CssStyle style : cloneSelector.getStyles()) {
+                    cssSelector.setStyle(style);
+                }
+            }
+        }
+        super.needRefresh(event);
+    }
 }
\ No newline at end of file
index 0762100..f974604 100644 (file)
@@ -42,12 +42,13 @@ import org.eclipse.gef.SnapToGuides;
 import org.eclipse.gef.SnapToHelper;
 import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
 import org.eclipse.gef.rulers.RulerProvider;
-import org.tizen.webuibuilder.BuilderConstants;
 import org.tizen.webuibuilder.animator.model.part.AnimatorWidgetPart;
 import org.tizen.webuibuilder.bridge.DesignerGoingBridge.WidgetPosition;
 import org.tizen.webuibuilder.gef.figure.PageFigure;
 import org.tizen.webuibuilder.gef.figure.PartFigure;
 import org.tizen.webuibuilder.gef.figure.WidgetFigure;
+import org.tizen.webuibuilder.gef.policies.DesignerAbsoluteDragEditPolicy;
+import org.tizen.webuibuilder.gef.policies.DesignerDragEditPolicy;
 import org.tizen.webuibuilder.gef.policies.HoverViewerXYLayoutEditPolicy;
 import org.tizen.webuibuilder.gef.tools.HoverViewerDragEditPartsTracker;
 import org.tizen.webuibuilder.gef.viewer.HoverBrowserViewer;
@@ -161,8 +162,7 @@ public class HoverViewerEditPart extends AbstractGraphicalEditPart implements IP
         WidgetPosition position = model.getWidgetPosition();
         if (position != null) {
             // figure.setLayout(model.getWidgetPosition());
-            figure.setLayout(new Rectangle(position.x, position.y, position.width,
-                                           position.height));
+            figure.setLayout(new Rectangle(position.x, position.y, position.width, position.height));
             if (model.getPolygonPoints() != null) {
                 figure.setLayout(model.getPolygonPoints());
             }
@@ -238,11 +238,6 @@ public class HoverViewerEditPart extends AbstractGraphicalEditPart implements IP
 
     @Override
     public void cssPropertyChanged(CssEvent event) {
-        // called cssPropertyChanged(e) in HoverBrowserViewer()
-        String key = event.getPropertyKey();
-        if (key.equals(BuilderConstants.ATTRIBUTE_VALUE_WIDTH) || key.equals(BuilderConstants.ATTRIBUTE_VALUE_HEIGHT)) {
-            ((HoverBrowserViewer) getViewer()).updateModel();
-        }
     }
 
     @Override
@@ -260,6 +255,19 @@ public class HoverViewerEditPart extends AbstractGraphicalEditPart implements IP
     public void needRefresh(CssEvent event) {
         // called needRefresh(e) in HoverVrowserViewer()
         ((HoverBrowserViewer) getViewer()).updateStyle();
+
+        String key = event.getPropertyKey();
+        if (key != null && key.equals("position")) {
+            // FIXME : call setPositionMode() function
+            if (((Part) getModel()).getPositionMode() == Part.PositionMode.ABSOLUTE_POSITION) {
+                installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
+                                  new DesignerAbsoluteDragEditPolicy());
+            }
+            if (((Part) getModel()).getPositionMode() == Part.PositionMode.RELATIVE_POSITION) {
+                installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DesignerDragEditPolicy());
+            }
+            refreshVisuals();
+        }
     }
 
     @SuppressWarnings("rawtypes")
index 3336b59..47cae4e 100644 (file)
@@ -43,7 +43,6 @@ import org.eclipse.gef.handles.MoveHandle;
 import org.eclipse.gef.requests.AlignmentRequest;
 import org.eclipse.gef.requests.ChangeBoundsRequest;
 import org.eclipse.swt.graphics.Color;
-import org.tizen.webuibuilder.gef.commands.DesignerChangeLayoutCommand;
 import org.tizen.webuibuilder.gef.commands.DesignerMoveLayoutCommand;
 import org.tizen.webuibuilder.gef.commands.DesignerResizeAndMoveLayoutCommand;
 import org.tizen.webuibuilder.gef.commands.DesignerResizeLayoutCommand;
@@ -51,7 +50,9 @@ import org.tizen.webuibuilder.gef.commands.WidgetRelation;
 import org.tizen.webuibuilder.gef.editparts.DesignerRootEditPart;
 import org.tizen.webuibuilder.gef.editparts.HoverViewerEditPart;
 import org.tizen.webuibuilder.gef.figure.SelectionBorder;
+import org.tizen.webuibuilder.gef.viewer.HoverBrowserViewer;
 import org.tizen.webuibuilder.model.Part;
+import org.tizen.webuibuilder.model.page.PageData;
 
 
 public class DesignerAbsoluteDragEditPolicy extends ResizableEditPolicy {
@@ -60,6 +61,11 @@ public class DesignerAbsoluteDragEditPolicy extends ResizableEditPolicy {
 
     @Override
     public Command getCommand(Request request) {
+        HoverBrowserViewer viewer = (HoverBrowserViewer) getHost().getViewer();
+        PageData pageData = viewer.getPageData();
+        Part part = (Part) getHost().getModel();
+        String selectorName = part.getDefaultSelectorName();
+        
         if (REQ_RESIZE.equals(request.getType())) {
             Dimension sizeDelta = ((ChangeBoundsRequest) request).getSizeDelta();
             sizeDelta.width /=
@@ -78,18 +84,22 @@ public class DesignerAbsoluteDragEditPolicy extends ResizableEditPolicy {
             if((direct & PositionConstants.NORTH) != 0){
                 layoutDelta.y -= sizeDelta.height; 
             }
+            
+            
             if(layoutDelta.x != 0 || layoutDelta.y != 0){
                 layoutDelta.width = sizeDelta.width;
                 layoutDelta.height = sizeDelta.height;
-                return new DesignerResizeAndMoveLayoutCommand(getHost().getModel(), layoutDelta);
+                return new DesignerResizeAndMoveLayoutCommand(part, layoutDelta, pageData, selectorName);
             } else {
-                return new DesignerResizeLayoutCommand(getHost().getModel(), sizeDelta);
+                return new DesignerResizeLayoutCommand(part, sizeDelta, pageData, selectorName);
             }
             // return new DesignerChangeLayoutCommand(getHost().getModel(),
             // ((ChangeBoundsRequest) request)
             // .getTransformedRectangle(rect));
         }
         if (REQ_MOVE.equals(request.getType())) {
+            
+            
             Point moveDelta = ((ChangeBoundsRequest) request).getMoveDelta();
             moveDelta.x /= ((DesignerRootEditPart) getHost().getRoot()).getZoomManager().getZoom();
             moveDelta.y /= ((DesignerRootEditPart) getHost().getRoot()).getZoomManager().getZoom();
@@ -99,7 +109,9 @@ public class DesignerAbsoluteDragEditPolicy extends ResizableEditPolicy {
             // return new DesignerChangeLayoutCommand(getHost().getModel(),
             // ((ChangeBoundsRequest) request)
             // .getTransformedRectangle(rect), 0);
-            return new DesignerMoveLayoutCommand(getHost().getModel(), moveDelta);
+//            CssFile cssFile = viewer.getPageData().getCurrentCssFile();
+            
+            return new DesignerMoveLayoutCommand(part, moveDelta, pageData, selectorName);
         }
         if (REQ_ALIGN.equals(request.getType())) {
             return getAlignCommand((AlignmentRequest) request);
index dc860ad..517a6fd 100644 (file)
@@ -56,9 +56,11 @@ import org.tizen.webuibuilder.gef.dnd.model.ITemplate;
 import org.tizen.webuibuilder.gef.editparts.DesignerRootEditPart;
 import org.tizen.webuibuilder.gef.editparts.HoverViewerEditPart;
 import org.tizen.webuibuilder.gef.figure.SelectionBorder;
+import org.tizen.webuibuilder.gef.viewer.HoverBrowserViewer;
 import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.model.PartProperty;
 import org.tizen.webuibuilder.model.descriptors.ConstantDescriptor;
+import org.tizen.webuibuilder.model.page.PageData;
 import org.tizen.webuibuilder.request.MoveRequest;
 
 
@@ -101,7 +103,12 @@ public class DesignerDragEditPolicy extends ResizableEditPolicy {
             // return new DesignerChangeLayoutCommand(getHost().getModel(),
             // ((ChangeBoundsRequest) request)
             // .getTransformedRectangle(rect));
-            return new DesignerResizeLayoutCommand(getHost().getModel(), sizeDelta);
+            
+            HoverBrowserViewer viewer = (HoverBrowserViewer) getHost().getViewer();
+            PageData pageData = viewer.getPageData();
+            Part part = (Part) getHost().getModel();
+            String selectorName = part.getDefaultSelectorName();
+            return new DesignerResizeLayoutCommand(getHost().getModel(), sizeDelta, pageData, selectorName);
         }
         if (REQ_MOVE.equals(request.getType())) {
             if (request instanceof MoveRequest) {
index 6fc6f0b..ff449c0 100644 (file)
@@ -182,7 +182,7 @@ public class DesignerXYLayoutEditPolicy extends HoverViewerXYLayoutEditPolicy {
                             final String value = list.get(i).getValue();
                             final String displayName = list.get(i).getDisplayName();
                             if ((displayName != null) && (!displayName.isEmpty())) {
-                                item.setText(displayName);
+                                item.setText(value + "[" + displayName + "]");
                             } else {
                                 item.setText(value);
                             }
@@ -190,7 +190,7 @@ public class DesignerXYLayoutEditPolicy extends HoverViewerXYLayoutEditPolicy {
                             item.addListener(SWT.Selection, new Listener() {
                                 public void handleEvent(Event e) {
                                     String str = targetPart.getProperty(BuilderConstants.ATTRIBUTE_DATA_BIND).getValue();
-                                    final String info = makeInfoString(targetPart, property2, displayName, value, str);
+                                    final String info = DataBindingTooltipParser.makeInfoString(targetPart, property2.getValue(), displayName, value, str);
                                     command =
                                             new SetPartPropertyCommand(targetPart, BuilderConstants.ATTRIBUTE_DATA_BIND,
                                                                        info);
@@ -216,41 +216,6 @@ public class DesignerXYLayoutEditPolicy extends HoverViewerXYLayoutEditPolicy {
         return command;
     }
 
-    
-    private String makeInfoString(Part targetPart, PartProperty property2, String displayName, String value, String str) {
-        String string = "";
-        
-        if ((str != null) && (!str.isEmpty())) {
-            Map<String, String> bindingInfos = DataBindingTooltipParser.parseToMap(str);
-            
-            if (bindingInfos.containsKey(value)) {
-                bindingInfos.remove(value);
-            } else if (bindingInfos.containsKey("attr-"+displayName)) {
-                bindingInfos.remove("attr-"+displayName);
-            }
-            
-            if ((displayName != null) && (!displayName.isEmpty())) {
-                bindingInfos.put("attr-"+displayName, property2.getValue());
-            } else {
-                bindingInfos.put(value, property2.getValue());
-            }
-                        
-            string = DataBindingTooltipParser.makeStringFromMap(bindingInfos);
-        } else {
-            if ((displayName != null) && (!displayName.isEmpty())) {
-                string = value + ": { " + displayName + ": " + property2.getValue() + " }";
-            } else {
-                if (targetPart.getDescriptorId().equals("tizen.listitem")) {
-                    string = value + ": " + property2.getValue() + BuilderConstants.DATABINDING_ARRAYITEM_VALUE_SUFFIX;
-                } else {
-                    string = value + ": " + property2.getValue();
-                }
-            }
-        }
-        
-        return string;
-    }
-
     private boolean hasProperty(EditPart editPart, String name) {
         if (editPart == null) {
             return false;
index 721bc41..a3b1932 100644 (file)
@@ -75,7 +75,7 @@ public class HoverBrowserEventDelegator implements MouseMoveListener, MouseListe
 
     @Override
     public void keyReleased(KeyEvent e) {
-        designEditPartViewer.getEditDomain().keyDown(e, designEditPartViewer);
+        //designEditPartViewer.getEditDomain().keyDown(e, designEditPartViewer);
     }
 
     @Override
index 73b3a09..d950d4a 100644 (file)
@@ -59,6 +59,7 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.ToolTip;
 import org.eclipse.ui.IEditorInput;
+import org.tizen.webuibuilder.BuilderConstants;
 import org.tizen.webuibuilder.bridge.DesignerGoingBridge;
 import org.tizen.webuibuilder.bridge.DesignerGoingBridge.WidgetPosition;
 import org.tizen.webuibuilder.browserwidget.ImageBufferedBrowserWidget.ContentsAreaChangedListener;
@@ -234,6 +235,8 @@ public class HoverBrowserViewer extends ScrollingGraphicalViewer
     private ImageBufferedBrowserProvider createBrowser(Composite parent) {
         ImageBufferedBrowserProvider webBrowser =
                 new ImageBufferedBrowserProvider(parent.getDisplay(), this);
+        goingBridge = new DesignerGoingBridge(webBrowser.getBrowser());
+        
         zoomScale = 1.0f;
         webBrowser.getBrowser().addProgressListener(new ProgressListener() {
             @Override
@@ -361,7 +364,7 @@ public class HoverBrowserViewer extends ScrollingGraphicalViewer
 
             }
         });
-        goingBridge = new DesignerGoingBridge(webBrowser.getBrowser());
+        //goingBridge = new DesignerGoingBridge(webBrowser.getBrowser());
         setBasePath();
         resizeBrowser();
         updateModel();
@@ -569,6 +572,7 @@ public class HoverBrowserViewer extends ScrollingGraphicalViewer
 
     private void setCssStyle(String cssStyle) {
         // Logger.trace("setCssStyle : " + cssStyle.substring(0, 40));
+        goingBridge.modifyStyle(BuilderConstants.EMPTY);
         goingBridge.setCssStyle(cssStyle);
     }
 
index 2f2f488..d853647 100644 (file)
@@ -121,7 +121,9 @@ public class Part implements ISerializer {
     /**
      * A Map containing css selector.
      */
-    private Map<String, CssSelector> selectors = new HashMap<String, CssSelector>();
+    private Map<String, CssSelector> allSelectorMap = new HashMap<String, CssSelector>();
+    
+    private Map<String, CssSelector> editSelectorMap = new HashMap<String, CssSelector>();
 
     private AbsolutePositionProvider absolutePositionProvider = null;
     private Map<String, GotoPageProperty> gotoPageProperties =
@@ -797,14 +799,7 @@ public class Part implements ISerializer {
             lockRefresh();
             //Point newPosition = ScreenToPage(new Point(position.x, position.y));
             Point newPosition = new Point(position.x, position.y);
-            Part page = getOwnerPage();
-            String selectorName = EMPTY;
-            if (page == null) {
-                selectorName = SHARP + getIdPropertyValue();
-            } else {
-                selectorName =
-                        SHARP + page.getIdPropertyValue() + SPACE + SHARP + getIdPropertyValue();
-            }
+            String selectorName = getDefaultSelectorName();
 
             // String parentName = TypeDescriptor.ID_OF_GROUP_POSITION;
             setSelectorPropertyValue(selectorName, LEFT, String.valueOf(newPosition.x) + PX, null);
@@ -1465,7 +1460,7 @@ public class Part implements ISerializer {
             return;
         }
 
-        selectors.put(selectorName, cssSelector);
+        editSelectorMap.put(selectorName, cssSelector);
 
         fireEvent(new CssEvent(EventType.CSS_SELECTOR_ADDED, this, cssSelector.getSelectorName(),
                                null, null));
@@ -1486,8 +1481,26 @@ public class Part implements ISerializer {
         if (cssSelector == null) {
             return;
         }
+        
+        String selectorName = cssSelector.getSelectorName();
+        
+        CssSelector prevSelector = allSelectorMap.get(selectorName);
+        if (prevSelector == null) {
+            CssSelector cloneSelector = cssSelector.cloneCssSelector(selectorName);
+            allSelectorMap.put(selectorName, cloneSelector);
+        } else {
+            for (CssStyle style : cssSelector.getStyles()) {
+                prevSelector.getStyleMap().put(style.getKey(), style);
+            }
+        }
+    }
+    
+    public void addEditSelectorWhenReadCss(CssSelector cssSelector) {
+        if (cssSelector == null) {
+            return;
+        }
 
-        selectors.put(cssSelector.getSelectorName(), cssSelector);
+        editSelectorMap.put(cssSelector.getSelectorName(), cssSelector);
     }
 
     /**
@@ -1496,7 +1509,11 @@ public class Part implements ISerializer {
      * @return Collection containing css selector
      */
     public Collection<CssSelector> getSelectors() {
-        return selectors.values();
+        return allSelectorMap.values();
+    }
+    
+    public Map<String, CssSelector> getAllSelectorMap() {
+        return allSelectorMap;
     }
 
     /**
@@ -1505,7 +1522,7 @@ public class Part implements ISerializer {
      * @return List containing css selector name
      */
     public List<String> getSelectorNameList() {
-        return new ArrayList<String>(selectors.keySet());
+        return new ArrayList<String>(editSelectorMap.keySet());
     }
 
     /**
@@ -1517,7 +1534,7 @@ public class Part implements ISerializer {
      *         otherwise
      */
     public CssSelector getSelector(String selectorName) {
-        return selectors.get(selectorName);
+        return editSelectorMap.get(selectorName);
     }
 
     /**
@@ -1531,7 +1548,7 @@ public class Part implements ISerializer {
      *         exist, and <code>null</code> otherwise
      */
     public String getSelectorPropertyValue(String selectorName, String propertyKey) {
-        CssSelector selector = selectors.get(selectorName);
+        CssSelector selector = allSelectorMap.get(selectorName);
         if (selector != null) {
             return selector.getPropertyValue(propertyKey);
         } else {
@@ -1540,8 +1557,11 @@ public class Part implements ISerializer {
     }
 
     public void clearAllSelector() {
-        if (selectors.size() > 0) {
-            selectors.clear();
+        if (allSelectorMap.size() > 0) {
+            allSelectorMap.clear();
+        }
+        if (editSelectorMap.size() > 0) {
+            editSelectorMap.clear();
         }
         if (getChildren().size() > 0) {
             for (Part child : getChildren()) {
@@ -1563,7 +1583,8 @@ public class Part implements ISerializer {
         }
 
         CssSelector cssSelector = getSelector(selectorName);
-        selectors.remove(selectorName);
+        editSelectorMap.remove(selectorName);
+        allSelectorMap.remove(selectorName);
 
         fireEvent(new CssEvent(EventType.CSS_SELECTOR_REMOVED, this, cssSelector.getSelectorName(),
                                null, null));
@@ -1586,7 +1607,8 @@ public class Part implements ISerializer {
         } else if (isFireEvent) {
             removeSelector(selectorName);
         } else {
-            selectors.remove(selectorName);
+            editSelectorMap.remove(selectorName);
+            allSelectorMap.remove(selectorName);
         }
     }
 
@@ -1621,7 +1643,7 @@ public class Part implements ISerializer {
      */
     public void setSelectorNameAndPartId(String selectorName, String newSelectorName,
                                          String newPartId) {
-        CssSelector cssSelector = selectors.get(selectorName);
+        CssSelector cssSelector = editSelectorMap.get(selectorName);
         if (cssSelector != null) {
             cssSelector.setSelectorName(newSelectorName);
             cssSelector.setPartId(newPartId);
@@ -1723,7 +1745,8 @@ public class Part implements ISerializer {
             return;
         }
 
-        CssSelector selector = selectors.get(selectorName);
+//        CssSelector selector = selectors.get(selectorName);
+        CssSelector selector = editSelectorMap.get(selectorName);
         if (selector == null) {
             return;
         }
@@ -2876,5 +2899,9 @@ public class Part implements ISerializer {
     public void deserialize(String text) {
         // TODO : Implementation
     }
+    
+    public Map<String, CssSelector> getEditSelectorMap() {
+        return editSelectorMap;
+    }
 
 }
index 382a7a1..4031a39 100644 (file)
@@ -58,6 +58,7 @@ import org.tizen.webuibuilder.model.page.PageDataForHTML;
 import org.tizen.webuibuilder.model.page.PageDataPaths;
 import org.tizen.webuibuilder.model.project.ProjectManager;
 import org.tizen.webuibuilder.ui.views.databinding.model.BindingData;
+import org.tizen.webuibuilder.utility.DomUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -320,6 +321,45 @@ public class AppManagerForHTML extends AppManager {
                                new ByteArrayInputStream(newHtml.getBytes())) : null;
        }
     
+    @Override
+    public void addPage(PageData page, boolean isExistsPagePart) {
+        String path = null;
+        if (page.getPagePath() != null) {
+            path =
+                    getProjectManager().getProject().getFile(page.getPagePath())
+                            .getProjectRelativePath().toString();
+        } else {
+               path = pageFileName.substring(0,
+                               pageFileName.lastIndexOf("/", pageFileName.length()-1));
+        }
+        
+        pageDataSet.addPage(page, path, isExistsPagePart);
+        
+        if(isExistsPagePart) {
+               DomUtil.appendPageNode(document, DomUtil.BODY_ELEMENT, page.getPagePart().getElement());
+        }
+    }
+
+    @Override
+    public void addPage(int index, PageData page, boolean isExistsPagePart) {
+        String path = null;
+        if (page.getPagePath() != null) {
+            path =
+                    getProjectManager().getProject().getFile(page.getPagePath())
+                            .getProjectRelativePath().toString();
+        } else {
+               path = pageFileName.substring(0,
+                               pageFileName.lastIndexOf('/', pageFileName.length()-1));
+        }
+        
+        if(isExistsPagePart) {
+               PageData refPageData = getPageByIndex(index); 
+               DomUtil.insertBeforePageNode(document, DomUtil.BODY_ELEMENT, page.getPagePart().getElement(), 
+                               (refPageData != null) ? refPageData.getPagePart().getElement() : null);
+        }
+        pageDataSet.addPage(index, page, path, isExistsPagePart);
+    }
+    
     public void addPage(String html, String pageName) {
         if (html == null || pageName == null) {
             return;
@@ -370,21 +410,10 @@ public class AppManagerForHTML extends AppManager {
 
     @Override
     public void removePage(int index) {
-
-    }
-    
-    /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.tizen.webuibuilder.model.app.AppManager#removePage(org.tizen.webuibuilder
-        * .model.page.PageData)
-        */
-       @Override
-       public void removePage(PageData page) {
-               int index = getPageIndex(page);
-
-               pageDataSet.removePageWithPart(page);
+       
+       DomUtil.removePageNode(document, DomUtil.BODY_ELEMENT, getPageData(index).getPagePart().getElement());
+       
+       pageDataSet.removePageWithPart(index);
 
                if (index == startupPage) {
                        if (getPages().size() > 0) {
@@ -396,7 +425,7 @@ public class AppManagerForHTML extends AppManager {
                                setStartupPage(-1);
                        }
                }
-       }
+    }
 
     private void addPageDocument(PageFileData pageFileData) {
         if (pageFileData == null) {
index b342ed6..c47045b 100644 (file)
@@ -204,6 +204,10 @@ public class CssSelector {
         fireEvent(new NewCssEvent(EventType.CSS_STYLE_CHANGED, null, this, style.getKey(),
                                   style.getValue()));
     }
+    
+    public Map<String, CssStyle> getStyleMap() {
+        return styles;
+    }
 
     /**
      * Sets a {@link CssStyle}. If not exist style in this {@link CssSelector},
index 26165a5..dd22a04 100644 (file)
@@ -231,11 +231,13 @@ public final class DescriptorManager {
         addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_DATABINDING_TEXT));
         addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_DATABINDING_VALUE));
         addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_DATABINDING_FOREACH));
+        addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_DATABINDING_SLIDER));
         addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_DATABINDING_TEXT_CHECK));
         addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_DATABINDING_FOREACH_TEXT));
         addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_DATABINDING_VALUE_TEXT));
-        addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_DATABINDING_ATTR));
+        addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_DATABINDING_ATTR_SRC));
         addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_DATABINDING_ATTR_TEXT));
+        addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_DATABINDING_ATTR_HREF));
         addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_OPACITY));
         addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_ICON));
         addTypeDescriptor(new TypeDescriptor(TypeDescriptor.ID_OF_GROUP_TRANSFORM));
index 2620f6f..c2b8a5e 100644 (file)
@@ -36,7 +36,7 @@ public class TypeDescriptor {
      * A property type.
      */
     public enum Types {
-        UNKNOWN, STRING, BOOLEAN, INTEGER, URL, IMAGE, COLOR, COLOR2, DATE, TIME, AUDIO, VIDEO, HTMLSTRING, GROUP, GROUP_TEXT, GROUP_POSITION, CSS_COLOR, CSS_FONT_SIZE, CSS_FONT_STYLE, CSS_FONT_WEIGHT, CSS_TEXT_ALIGN, CSS_TEXT_DECORATION, SIZE_INTEGER, SIZE_PERCENT, SIZE_REAL, SIZE, SIZE_PIXEL, SIZE_ANGLE, ENUM, OPACITY, ICON, ICON_TEXT_ALIGN, ICON_FONT_WEIGHT, ICON_FONT_STYLE, ICON_TEXT_DECORATION, ICON_TEXT_TRANSFORM, TEXT_LETTER_SPACING, TEXT_LINE_HEIGHT, GROUP_TRANSFORM, GROUP_BORDER, SEPARATOR, EMPTY, CHECK, NEW_COLOR, COLOR_FILL, SCALE, SCALE_PIXEL, SCALE_PERCENT, SCALE_ANGLE, LISTITEM_CLASS, GROUP_FILTER, GROUP_VALUE, METRICS, CUSTOM_CSS, CLIP, GROUP_ICON, DATABINDING_TEXT, DATABINDING_VALUE, DATABINDING_FOREACH, DATABINDING_TEXT_CHECK, DATABINDING_FOREACH_TEXT, DATABINDING_VALUE_TEXT, DATABINDING_ATTR, DATABINDING_ATTR_TEXT
+        UNKNOWN, STRING, BOOLEAN, INTEGER, URL, IMAGE, COLOR, COLOR2, DATE, TIME, AUDIO, VIDEO, HTMLSTRING, GROUP, GROUP_TEXT, GROUP_POSITION, CSS_COLOR, CSS_FONT_SIZE, CSS_FONT_STYLE, CSS_FONT_WEIGHT, CSS_TEXT_ALIGN, CSS_TEXT_DECORATION, SIZE_INTEGER, SIZE_PERCENT, SIZE_REAL, SIZE, SIZE_PIXEL, SIZE_ANGLE, ENUM, OPACITY, ICON, ICON_TEXT_ALIGN, ICON_FONT_WEIGHT, ICON_FONT_STYLE, ICON_TEXT_DECORATION, ICON_TEXT_TRANSFORM, TEXT_LETTER_SPACING, TEXT_LINE_HEIGHT, GROUP_TRANSFORM, GROUP_BORDER, SEPARATOR, EMPTY, CHECK, NEW_COLOR, COLOR_FILL, SCALE, SCALE_PIXEL, SCALE_PERCENT, SCALE_ANGLE, LISTITEM_CLASS, GROUP_FILTER, GROUP_VALUE, METRICS, CUSTOM_CSS, CLIP, GROUP_ICON, DATABINDING_TEXT, DATABINDING_VALUE, DATABINDING_FOREACH, DATABINDING_SLIDER, DATABINDING_TEXT_CHECK, DATABINDING_FOREACH_TEXT, DATABINDING_VALUE_TEXT, DATABINDING_ATTR_SRC, DATABINDING_ATTR_TEXT, DATABINDING_ATTR_HREF
     }
 
     // Id of type
@@ -108,11 +108,14 @@ public class TypeDescriptor {
     public static final String ID_OF_DATABINDING_TEXT = "text@databinding"; //$NON-NLS-1$
     public static final String ID_OF_DATABINDING_VALUE = "value@databinding"; //$NON-NLS-1$
     public static final String ID_OF_DATABINDING_FOREACH = "foreach@databinding"; //$NON-NLS-1$
+    public static final String ID_OF_DATABINDING_SLIDER = "slider@databinding"; //$NON-NLS-1$
     public static final String ID_OF_DATABINDING_TEXT_CHECK = "textchecked@databinding"; //$NON-NLS-1$
     public static final String ID_OF_DATABINDING_FOREACH_TEXT = "foreachtext@databinding"; //$NON-NLS-1$
     public static final String ID_OF_DATABINDING_VALUE_TEXT = "valuetext@databinding"; //$NON-NLS-1$
-    public static final String ID_OF_DATABINDING_ATTR = "attr@databinding"; //$NON-NLS-1$
+    public static final String ID_OF_DATABINDING_ATTR_SRC = "attrsrc@databinding"; //$NON-NLS-1$
     public static final String ID_OF_DATABINDING_ATTR_TEXT = "attrtext@databinding"; //$NON-NLS-1$
+    public static final String ID_OF_DATABINDING_ATTR_HREF = "attrhref@databinding"; //$NON-NLS-1$
+
 
     /**
      * A property type.
@@ -217,21 +220,25 @@ public class TypeDescriptor {
             } else if (ID_OF_CSS_FONT_SIZE.equals(id)) {
                 type = Types.CSS_FONT_SIZE;
             } else if (ID_OF_DATABINDING_TEXT.equals(id)) {
-                type = Types.CSS_FONT_SIZE;
+                type = Types.DATABINDING_TEXT;
             } else if (ID_OF_DATABINDING_VALUE.equals(id)) {
-                type = Types.CSS_FONT_SIZE;
+                type = Types.DATABINDING_VALUE;
             } else if (ID_OF_DATABINDING_FOREACH.equals(id)) {
-                type = Types.CSS_FONT_SIZE;
+                type = Types.DATABINDING_FOREACH;
+            } else if (ID_OF_DATABINDING_SLIDER.equals(id)) {
+               type = Types.DATABINDING_SLIDER;
             } else if (ID_OF_DATABINDING_TEXT_CHECK.equals(id)) {
-                type = Types.CSS_FONT_SIZE;
+                type = Types.DATABINDING_TEXT_CHECK;
             } else if (ID_OF_DATABINDING_FOREACH_TEXT.equals(id)) {
-                type = Types.CSS_FONT_SIZE;
+                type = Types.DATABINDING_FOREACH_TEXT;
             } else if (ID_OF_DATABINDING_VALUE_TEXT.equals(id)) {
-                type = Types.CSS_FONT_SIZE;
-            } else if (ID_OF_DATABINDING_ATTR.equals(id)) {
-                type = Types.CSS_FONT_SIZE;
+                type = Types.DATABINDING_VALUE_TEXT;
+            } else if (ID_OF_DATABINDING_ATTR_SRC.equals(id)) {
+                type = Types.DATABINDING_ATTR_SRC;
             } else if (ID_OF_DATABINDING_ATTR_TEXT.equals(id)) {
-                type = Types.CSS_FONT_SIZE;
+                type = Types.DATABINDING_ATTR_TEXT;
+            } else if (ID_OF_DATABINDING_ATTR_HREF.equals(id)) {
+               type = Types.DATABINDING_ATTR_HREF;
             } else if (ID_OF_GROUP_TRANSFORM.equals(id)) {
                 type = Types.GROUP_TRANSFORM;
             } else if (ID_OF_SEPARATOR.equals(id)) {
index 1abd03e..7d5852e 100644 (file)
@@ -26,6 +26,8 @@ package org.tizen.webuibuilder.model.nscreen.descriptors;
 import java.util.List;
 
 import org.eclipse.core.resources.IFile;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.tizen.webuibuilder.BuilderConstants;
 import org.tizen.webuibuilder.model.app.AppManager;
 import org.tizen.webuibuilder.model.nscreen.NScreenModel;
@@ -34,6 +36,8 @@ import org.tizen.webuibuilder.model.nscreen.NScreenModel.Orientation;
 
 
 public class NScreenDescriptor {
+    Logger logger = LoggerFactory.getLogger(NScreenDescriptor.class);
+
     private AppManager appManger = null;
     private List<NScreenModel> list = null;
 
@@ -51,8 +55,8 @@ public class NScreenDescriptor {
         }
 
         createCommonNscreen();
-        //createOrientationNscreen();
-        //createPixelRatioNscreen();
+        // createOrientationNscreen();
+        // createPixelRatioNscreen();
         createDeviceNscreen();
     }
 
@@ -75,15 +79,25 @@ public class NScreenDescriptor {
     }
 
     public void createDeviceNscreen() {
-        addNscreenModel("Wearable 320x320 (1:1)", NScreenType.RESOLUTION, null, 0, 320, 320);
-        addNscreenModel("Wearable 360x480 (3:4)", NScreenType.RESOLUTION, null, 0, 360, 480);
-        addNscreenModel("Wearable 480x360 (4:3)", NScreenType.RESOLUTION, null, 0, 480, 360);
-        addNscreenModel("Mobile 320x480 (2:3)", NScreenType.RESOLUTION, null, 0, 320, 480);
-        addNscreenModel("Mobile 480x320 (3:2)", NScreenType.RESOLUTION, null, 0, 480, 320);
-        addNscreenModel("Mobile 360x640 (9:16)", NScreenType.RESOLUTION, null, 0, 720, 1280);
-        addNscreenModel("Mobile 640x360 (16:9)", NScreenType.RESOLUTION, null, 0, 1280, 720);
-        addNscreenModel("Mobile 800x1280 (10:16)", NScreenType.RESOLUTION, null, 0, 800, 1280);
-        addNscreenModel("Mobile 1280x800 (16:10)", NScreenType.RESOLUTION, null, 0, 1280, 800);
+        if (BuilderConstants.PROFILE_WEARABLE_2_3.equalsIgnoreCase(appManger.getProjectManager()
+                .getPlatform())) {
+            addNscreenModel("Wearable 320x320 (1:1)", NScreenType.RESOLUTION, null, 0, 320, 320);
+            addNscreenModel("Wearable 360x480 (3:4)", NScreenType.RESOLUTION, null, 0, 360, 480);
+            addNscreenModel("Wearable 480x360 (4:3)", NScreenType.RESOLUTION, null, 0, 480, 360);
+
+        } else if (BuilderConstants.PROFILE_MOBILE_2_3.equalsIgnoreCase(appManger
+                .getProjectManager().getPlatform())) {
+            // addNscreenModel("Mobile 320x480 (2:3)", NScreenType.RESOLUTION, null, 0, 320, 480);
+            // addNscreenModel("Mobile 480x320 (3:2)", NScreenType.RESOLUTION, null, 0, 480, 320);
+
+            addNscreenModel("Mobile 360x640 (9:16)", NScreenType.RESOLUTION, null, 0, 720, 1280);
+            addNscreenModel("Mobile 640x360 (16:9)", NScreenType.RESOLUTION, null, 0, 1280, 720);
+            addNscreenModel("Mobile 800x1280 (10:16)", NScreenType.RESOLUTION, null, 0, 800, 1280);
+            addNscreenModel("Mobile 1280x800 (16:10)", NScreenType.RESOLUTION, null, 0, 1280, 800);
+
+        } else {
+            logger.info("Not support profile :" + appManger.getProjectManager().getPlatform());
+        }
     }
 
     public void addNscreenModel(String name, NScreenType type, Orientation orientation,
index 0092030..ba13da0 100644 (file)
@@ -35,7 +35,6 @@ import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.draw2d.geometry.Rectangle;
 import org.eclipse.swt.widgets.Display;
 import org.tizen.webuibuilder.BuilderConstants;
 import org.tizen.webuibuilder.model.IPartListener;
@@ -54,7 +53,6 @@ import org.tizen.webuibuilder.model.filedata.PageFileData;
 import org.tizen.webuibuilder.model.page.PageDataEvent.PageDataEventType;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
-import org.w3c.dom.Node;
 import org.w3c.dom.Text;
 
 public class PageData implements IPartListener, ICssListener {
@@ -214,9 +212,10 @@ public class PageData implements IPartListener, ICssListener {
 
        public void setPagePath(String path) {
                if (path != null) {
-                       if (pageDataPaths != null) {
-                               pageDataPaths.setPagePath(path);
+                       if (pageDataPaths == null) {
+                               pageDataPaths = new PageDataPaths();
                        }
+                       pageDataPaths.setPagePath(path);
                        IFile iFile = ResourcesPlugin.getWorkspace().getRoot()
                                        .getFile(new Path(path));
                        setResource(iFile);
index eb9681c..41a8d78 100644 (file)
@@ -34,6 +34,10 @@ public class PageDataPaths {
 
     private String animatorManagedJsPath;
     private String animatorManagedCssPath;
+    
+    public PageDataPaths() {
+       
+    }
 
     public PageDataPaths(String pagePath, String jsPath, String managedJsPath, String htmlPath,
             String cssPath, String managedCssPath) {
index 6c4ceff..d0bd91d 100644 (file)
@@ -91,15 +91,19 @@ public class PageDataSet {
                        return;
                }
 
-               page.setPagePath(path);
-               pages.add(index, page);
                if (isExistsPagePart) {
-                       Part docPart = baseRootPart.getChildOfId("tizen.doc");
-                       if (docPart != null) {
-                               docPart.addChild(page.getPagePart(), true);
-                       }
+                       PageData refPageData = getPageData(index);
+                       baseRootPart.insertChildBefore(page.getPagePart(), 
+                                       (refPageData != null) ? refPageData.getPagePart() : null, false);
+//                     Part docPart = baseRootPart.getChildOfId("tizen.doc");
+//                     if (docPart != null) {
+//                             docPart.addChild(page.getPagePart(), true);
+//                     }
                }
 
+               page.setPagePath(path);
+               pages.add(index, page);
+
                fireEvent(new PageDataSetEvent(PageDataSetEventType.PAGE_ADDED, page,
                                index, null));
        }
@@ -218,6 +222,9 @@ public class PageDataSet {
        }
 
        public PageData getPageByIndex(int index) {
+               if(index < 0 || index >= getPages().size()) {
+                       return null;
+               }
                return getPages().get(index);
        }
 
@@ -316,7 +323,7 @@ public class PageDataSet {
 
                return null;
        }
-
+       
        public void removePage(int index) {
                PageData page = getPages().get(index);
 
@@ -335,9 +342,8 @@ public class PageDataSet {
                removePage(index);
        }
        
-       public void removePageWithPart(PageData page) {
-               int index = getPages().indexOf(page);
-               baseRootPart.removeChild(page.getPagePart(), true);
+       public void removePageWithPart(int index) {
+               baseRootPart.removeChild(getPageByIndex(index).getPagePart(), false);
                removePage(index);
        }
 
index 982ad56..3828ec4 100644 (file)
@@ -95,8 +95,8 @@ public class CssSelecotrAction extends SelectionAction {
 
             CommandStack commandStack = designEditPartViewer.getEditDomain().getCommandStack();
             Command command =
-                    new CreateCssSelectorCommand(designEditPartViewer.getPageData()
-                            .getCurrentCssFile(), part, result);
+                    new CreateCssSelectorCommand(designEditPartViewer.getPageData(),
+                             part, result);
             commandStack.execute(command);
         }
     }
index 1af6e8b..46aac89 100644 (file)
@@ -62,22 +62,15 @@ public class NewPagePolicy implements IWizardPolicy {
      */
     @Override
     public boolean run() {
-//        if (!(model instanceof AppManagerForHTML)) {
-//            return false;
-//        }
-//        AppManagerForHTML manager = (AppManagerForHTML) model;
-//        manager.addPage(template.getDescriptor().getText(), name);
-//        PageFileData pageFileData = PageReader.readPage(template.getDescriptor().getText(), manager.getPartFactory());
-//        PageData pageData = new PageDataForHTML(BuilderConstants.EMPTY, pageFileData, 0,
-//                                    pageFileData.getDocument(), manager.getDescriptorManager(),
-//                                    null);
-//        manager.addPage(pageData, true);
-//        manager.addPage(pageFileData);
-//        manager.addPage(template.getDescriptor().getText(), name);
-       
+        if (!(model instanceof AppManagerForHTML)) {
+            return false;
+        }
+        AppManagerForHTML manager = (AppManagerForHTML) model;
+        
         return (template != null && 
                        template.getDescriptor() != null && 
                        template.getDescriptor().getText() != null && 
-                       !template.getDescriptor().getText().isEmpty());
+                       !template.getDescriptor().getText().isEmpty() &&
+                       manager.getPageData(name) == null);
     }
 }
\ No newline at end of file
index e92bd11..81571e0 100644 (file)
@@ -59,6 +59,11 @@ public final class WebUIBuilderActionConstants implements IWorkbenchActionConsta
     public static final String NEW_PAGE = "org.tizen.webuibuilder.newPage"; //$NON-NLS-1$
 
     /**
+     * Delete Page action id. Value: <code>"org.tizen.webuibuilder.deletePage"</code>
+     */
+    public static final String DELETE_PAGE = "org.tizen.webuibuilder.deletePage"; //$NON-NLS-1$
+
+    /**
      * Create Template action id. Value: <code>"org.tizen.webuibuilder.createTemplate"</code>
      */
     public static final String CREATE_TEMPLATE = "org.tizen.webuibuilder.createTemplate";//$NON-NLS-1$
index 25b5e90..f33844f 100644 (file)
@@ -35,6 +35,7 @@ public class Messages {
     public static String DELETE_SNIPPET;
     public static String RENAME_SNIPPET;
 
+    public static String DELETE_PAGE;
     public static String NEW_PAGE;
     public static String CREATE_TEMPLATE;
     public static String IMPORT_TEMPLATE;
index 128ba3e..7c49c73 100644 (file)
@@ -5,6 +5,7 @@ EXPORT_SNIPPET = Export Snippet
 DELETE_SNIPPET = Delete Snippet
 RENAME_SNIPPET = Rename Snippet
 
+DELETE_PAGE = Delete Page
 NEW_PAGE = New Page
 CREATE_TEMPLATE = Create Template
 IMPORT_TEMPLATE = Import Template
index e5eaa1a..15d650d 100644 (file)
@@ -80,6 +80,7 @@ import org.eclipse.jface.text.TextEvent;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.CTabFolder;
 import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.events.KeyEvent;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.layout.GridData;
@@ -134,6 +135,7 @@ import org.tizen.webuibuilder.browserwidget.ProgressListener;
 import org.tizen.webuibuilder.extintrf.DeclarationViewInfoProvider;
 import org.tizen.webuibuilder.gef.commands.CopyPartAction;
 import org.tizen.webuibuilder.gef.commands.CutPartAction;
+import org.tizen.webuibuilder.gef.commands.DeletePageAction;
 import org.tizen.webuibuilder.gef.commands.DeletePartAction;
 import org.tizen.webuibuilder.gef.commands.Messages;
 import org.tizen.webuibuilder.gef.commands.MoveAbsolutePartAction;
@@ -157,7 +159,6 @@ import org.tizen.webuibuilder.model.nscreen.NScreenModelController;
 import org.tizen.webuibuilder.model.page.IPageDataListener;
 import org.tizen.webuibuilder.model.page.PageData;
 import org.tizen.webuibuilder.model.page.PageDataEvent;
-import org.tizen.webuibuilder.model.page.PageDataSet.DataDataValidateType;
 import org.tizen.webuibuilder.model.project.ProjectManager;
 import org.tizen.webuibuilder.nl.BuilderMessages;
 import org.tizen.webuibuilder.outline.OutlinePage;
@@ -201,7 +202,7 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
     // private DesignerEditPartFactory factory;
     private SelectionSynchronizer synchronizer;
 
-    private PageDesignerToolbar toolbar;
+    protected PageDesignerToolbar toolbar;
 
     private CTabFolder tabs = null;
     protected Preview preview = null;
@@ -379,16 +380,35 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
             }
         }
 
-        NScreenUtil.nscreen_log("current page css : "
-                + pageData.getCurrentCssFile().getCssFilePath());
-        getViewer().updateStyle();
+        setCurrentCssFileToModel(pageData.getCurrentCssFile());
+
+        if (NScreenUtil.isLogEnabled()) {
+            List<CssFile> applied = pageData.getAppliedCssFiles();
+            int current = applied.indexOf(pageData.getCurrentCssFile());
+            NScreenUtil.nscreen_log("================= CSS Layer (" + applied.size()
+                    + ") =====================");
+            CssFile appliedCssFile = null;
+            for (int i = 0; i < applied.size(); i++) {
+                appliedCssFile = applied.get(i);
+                if (i == current) {
+                    NScreenUtil.nscreen_log(i + ". <Current> "
+                            + new File(appliedCssFile.getCssFilePath()).getName());
+                } else {
+                    NScreenUtil.nscreen_log(i + ".           "
+                            + new File(appliedCssFile.getCssFilePath()).getName());
+                }
+
+            }
+
+            NScreenUtil.nscreen_log("=====================================================");
+        }
 
+        if (getViewer() != null) {
+            getViewer().updateStyle();
+        }
     }
 
     protected void setCssFileToModel(CssFile cssFile) {
-        if (getPageData() != null) {
-            getPageData().getAppliedCssFiles().clear();
-        }
         if (rootPart != null && cssFile != null) {
             for (CssSelector selector : cssFile.getSelectors()) {
                 String pageId = selector.getPageId();
@@ -402,24 +422,28 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
                 }
 
             }
+            pageData.getAppliedCssFiles().add(cssFile);
+        }
+    }
+
+    protected void setCurrentCssFileToModel(CssFile cssFile) {
+        if (rootPart != null && cssFile != null) {
+            for (CssSelector selector : cssFile.getSelectors()) {
+                String pageId = selector.getPageId();
+                Part pagePart = rootPart.getChildOfIdPropertyValue(pageId, true);
+                if (pagePart != null) {
+                    String partId = selector.getPartId();
+                    Part part = pagePart.getChildOfIdPropertyValue(partId, true);
+                    if (part != null) {
+                        part.addEditSelectorWhenReadCss(selector);
+                    }
+                }
+            }
         }
     }
 
     protected void clearSelectorsOfRootPart() {
         rootPart.clearAllSelector();
-        // CssFile currentCssFile = pageData.getCurrentCssFile();
-        // Collection<CssSelector> selectors = rootPart.getSelectors();
-        // for (CssSelector selector : currentCssFile.getSelectors()) {
-        // String pageId = selector.getPageId();
-        // Part pagePart = rootPart.getChildOfIdPropertyValue(pageId, true);
-        // if (pagePart != null) {
-        // String partId = selector.getPartId();
-        // Part part = rootPart.getChildOfIdPropertyValue(partId, true);
-        // if (part != null) {
-        // part.removeSelector(selector.getSelectorName(), false);
-        // }
-        // }
-        // }
     }
 
     private DescriptorManager getDescriptorManager() {
@@ -509,19 +533,27 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
 
-        action = new MoveAbsolutePartAction(this, PositionConstants.LEFT, 10);
+        action =
+                new MoveAbsolutePartAction(this, PositionConstants.LEFT,
+                                           MoveAbsolutePartAction.MOVE_DIST);
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
 
-        action = new MoveAbsolutePartAction(this, PositionConstants.RIGHT, 10);
+        action =
+                new MoveAbsolutePartAction(this, PositionConstants.RIGHT,
+                                           MoveAbsolutePartAction.MOVE_DIST);
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
 
-        action = new MoveAbsolutePartAction(this, PositionConstants.TOP, 10);
+        action =
+                new MoveAbsolutePartAction(this, PositionConstants.TOP,
+                                           MoveAbsolutePartAction.MOVE_DIST);
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
 
-        action = new MoveAbsolutePartAction(this, PositionConstants.BOTTOM, 10);
+        action =
+                new MoveAbsolutePartAction(this, PositionConstants.BOTTOM,
+                                           MoveAbsolutePartAction.MOVE_DIST);
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
 
@@ -541,19 +573,27 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
 
-        action = new ResizeAbsolutePartAction(this, PositionConstants.LEFT, 10);
+        action =
+                new ResizeAbsolutePartAction(this, PositionConstants.LEFT,
+                                             ResizeAbsolutePartAction.RESIZE_DIST);
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
 
-        action = new ResizeAbsolutePartAction(this, PositionConstants.RIGHT, 10);
+        action =
+                new ResizeAbsolutePartAction(this, PositionConstants.RIGHT,
+                                             ResizeAbsolutePartAction.RESIZE_DIST);
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
 
-        action = new ResizeAbsolutePartAction(this, PositionConstants.TOP, 10);
+        action =
+                new ResizeAbsolutePartAction(this, PositionConstants.TOP,
+                                             ResizeAbsolutePartAction.RESIZE_DIST);
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
 
-        action = new ResizeAbsolutePartAction(this, PositionConstants.BOTTOM, 10);
+        action =
+                new ResizeAbsolutePartAction(this, PositionConstants.BOTTOM,
+                                             ResizeAbsolutePartAction.RESIZE_DIST);
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
 
@@ -609,6 +649,10 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
 
+        action = new DeletePageAction(this);
+        actionRegistry.registerAction(action);
+        getSelectionActions().add(action.getId());
+
         action = new NewPageAction(this);
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
@@ -993,13 +1037,24 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
     }
 
     private void configureKeyHandler(GraphicalViewer viewer) {
-        KeyHandler keyHandler = new KeyHandler();
+        KeyHandler keyHandler = new KeyHandler() {
+            @Override
+            public boolean keyPressed(KeyEvent event) {
+                return super.keyPressed(event);
+            }
+
+            @Override
+            public boolean keyReleased(KeyEvent event) {
+                return super.keyReleased(event);
+            }
+        };
+
         // GraphicalViewerKeyHandler keyHandler = new GraphicalViewerKeyHandler(viewer);
         keyHandler.put(KeyStroke.getPressed(SWT.DEL, 127, SWT.NONE),
                        getActionRegistry().getAction(ActionFactory.DELETE.getId()));
-        keyHandler.put(KeyStroke.getPressed((char)26, 122, SWT.CTRL),  // Ctrl+z
+        keyHandler.put(KeyStroke.getReleased((char) 26, 122, SWT.CTRL), // Ctrl+z
                        getActionRegistry().getAction(ActionFactory.UNDO.getId()));
-        keyHandler.put(KeyStroke.getPressed((char)25, 121, SWT.CTRL),  // Ctrl+y
+        keyHandler.put(KeyStroke.getReleased((char) 25, 121, SWT.CTRL), // Ctrl+y
                        getActionRegistry().getAction(ActionFactory.REDO.getId()));
         keyHandler.put(KeyStroke.getPressed(SWT.ARROW_LEFT, SWT.NONE), getActionRegistry()
                 .getAction(Messages.ACTION_MOVE_LEFT));
@@ -1735,7 +1790,9 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
 
     @Override
     public void pageChanged(PageDataEvent e) {
-        getViewer().updateStyle();
+        if (getViewer() != null) {
+            getViewer().updateStyle();
+        }
 
     }
 
index 7ad8764..ced52dc 100644 (file)
@@ -139,6 +139,7 @@ public class PageDesignerForHTML extends PageDesigner implements ITextEditorList
         FilenameFilterEndsWith filter = new FilenameFilterEndsWith(".css");
         File[] files = cssDir.listFiles(filter);
         if (!appManager.getPageDataSet().getPages().isEmpty()) {
+            pageData = appManager.getPageDataSet().getPages().get(0);
             for (PageData page : appManager.getPageDataSet().getPages()) {
                 String pageId = page.getName();
                 List<File> pageCssFile = new ArrayList<File>();
@@ -232,7 +233,7 @@ public class PageDesignerForHTML extends PageDesigner implements ITextEditorList
                     setCssFileToModel(applyList.get(i));
                 }
             }
-            pageData = appManager.getPageDataSet().getPages().get(0);
+            
         } else {
             rootPart = null;
         }
@@ -312,7 +313,7 @@ public class PageDesignerForHTML extends PageDesigner implements ITextEditorList
             }
         }
 
-       
+        toolbar.setScreeSizesFromNScreen();
 
         GraphicalViewer viewer = getGraphicalViewer();
         // viewer.setContents(appManager.getRootPart(currentPageIndex));
index 085bb84..0e4b359 100644 (file)
@@ -23,6 +23,7 @@
 
 package org.tizen.webuibuilder.ui.editor;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.gef.commands.Command;
@@ -189,24 +190,29 @@ public class PageDesignerToolbar implements ISelectionListener {
     }
 
     public void setResolution(List<Device> devices) {
+        NScreenUtil.nscreen_log("View port : " + mainEditor.getAppManager().getFrameworkScale());
+
         Device device = null;
-        NScreenUtil.nscreen_log(mainEditor.getAppManager().getFrameworkScale());
         resolution
                 .setScreeSizesFromNScreen(devices, mainEditor.getAppManager().getFrameworkScale());
         screenSize.setEnabled(resolution.getEnable());
 
-        String profile = appManager.getPlatform();
+        String profile = appManager.getPlatform().toLowerCase();
         if (profile.contains("mobile")) {
             device = devices.get(1);
         } else if (profile.contains("wearable")) {
             device = devices.get(0);
+        } else {
+            device = devices.get(1);
         }
         nscreen = new NScreenHistory();
         nscreen.setLastResolution(device.getDisplayName());
+        nscreen.setModelName(BuilderConstants.NSCREENCOMMON);
         nscreen.setScale(1f);
         currentScreen = resolution.getScreenSize(device.getDisplayName());
 
         screenSizeText.setText(currentScreen.getScreenSize());
+        mainEditor.setNscreenIndex2(device, nscreen);
     }
 
     public void setResolution(List<Device> devices, NScreenItem nsItem) {
@@ -223,7 +229,7 @@ public class PageDesignerToolbar implements ISelectionListener {
                 devices.add(defaultWearableDevice);
             }
         }
-        NScreenUtil.nscreen_log(mainEditor.getAppManager().getFrameworkScale());
+        NScreenUtil.nscreen_log("View port : " + mainEditor.getAppManager().getFrameworkScale());
         resolution
                 .setScreeSizesFromNScreen(devices, mainEditor.getAppManager().getFrameworkScale());
         screenSize.setEnabled(resolution.getEnable());
@@ -801,4 +807,14 @@ public class PageDesignerToolbar implements ISelectionListener {
     public void setCommandStack(CommandStack commandStack) {
         this.commandStack = commandStack;
     }
+
+    public void setScreeSizesFromNScreen() {
+        NScreenUtil.nscreen_log("start time : " + appManager.getFrameworkScale());
+        List<Device> devices = new ArrayList<Device>(); 
+                devices.addAll(resolution.getCurrentFeatureDevices());
+        resolution
+                .setScreeSizesFromNScreen(devices, mainEditor.getAppManager().getFrameworkScale());
+        currentScreen = resolution.getScreenSize(nscreen.getLastResolution());
+        mainEditor.setShowingSize(currentScreen.getWidth(), currentScreen.getHeight());
+    }
 }
index e6e4ef8..e4954ec 100644 (file)
@@ -52,6 +52,7 @@ public class ResolutionManger {
 
     public void removeAll() {
         mList.clear();
+        devices.clear();
     }
 
     public int size() {
@@ -113,7 +114,7 @@ public class ResolutionManger {
             int fixedWidth = -1;
             try {
                 fixedWidth = Integer.parseInt(deviceMode.trim());
-                removeAll();
+//                removeAll();
                 for (Device device : devices) {
                     int width = device.getDeviceWidth();
                     int height = device.getDeviceHeight();
@@ -160,4 +161,8 @@ public class ResolutionManger {
         }
         return null;
     }
+
+    public List<Device> getCurrentFeatureDevices() {
+        return devices;
+    }
 }
index 0e41498..ba4c36e 100644 (file)
@@ -96,26 +96,7 @@ public class DataBindingDnDManager {
         });
     }
 
-    /**
-     * Creates a view model information.
-     * 
-     * @param treeItem
-     * @return view model information
-     */
-    private static String makeViewModelInfo(TreeItem treeItem) {
-        String str = "";
-        while ((treeItem.getParentItem() != null)) {
-            if (str.isEmpty()) {
-                str = treeItem.getText();
-            } else {
-                str = treeItem.getText() + "." + str;
-            }
-            treeItem = treeItem.getParentItem();
-        }
-        TreeItemData treeItemData = (TreeItemData) treeItem.getData("TREEITEMDATA");
-        str = treeItemData.getOriginModelName() + "." + str;
-        return str;
-    }
+    
 
     /**
      * Adds a drag and drop listener to the view model tree.
@@ -152,7 +133,6 @@ public class DataBindingDnDManager {
                     event.doit = true;
                     dragSourceItem[0] = selection[0]; // TODO multiselect
                     TreeItemData treeItemData = (TreeItemData) selection[0].getData("TREEITEMDATA");
-                    String viewModelInfo;
                     String dataType = null;
 
                     if ((treeItemData != null) && (treeItemData.getObjectType() != null)
@@ -160,16 +140,8 @@ public class DataBindingDnDManager {
                         dataType = treeItemData.getObjectType();
                     }
 
-                    if ((selection[0].getParentItem() != null)
-                            && (selection[0].getParentItem().getData("TREEITEMDATA") != null)
-                            && (((TreeItemData) selection[0].getParentItem()
-                                    .getData("TREEITEMDATA")).getObjectType() != null)
-                            && (((TreeItemData) selection[0].getParentItem()
-                                    .getData("TREEITEMDATA")).getObjectType().equals("Array"))) {
-                        viewModelInfo = BuilderConstants.DATABINDING_ARRAYITEM_VALUE_PREFIX + selection[0].getText();
-                    } else {
-                        viewModelInfo = makeViewModelInfo(selection[0]);
-                    }
+                    String viewModelInfo = DataBindingTooltipParser.makeViewModelInfo(selection[0]);
+                    
                     // FIXME "id"
                     DataBindingTemplate dataBindingTemplate =
                             new DataBindingTemplate("id", viewModelInfo, dataType);
@@ -193,11 +165,6 @@ public class DataBindingDnDManager {
                     dragSourceItem[0].dispose();
                 }
 
-                DataBindingPage dataBindingPage = getDataBindingPage(dataBindingView);
-                if (dataBindingPage != null) {
-                       dataBindingPage.refresh();
-                }
-
                 dragSourceItem[0] = null;
                 TemplateTransfer.getInstance().setTemplate(null);
             }
@@ -552,8 +519,8 @@ public class DataBindingDnDManager {
                 } else if ((sourceTreeItemData.getObjectType() != null)
                         && (sourceTreeItemData.getObjectType().equals("Object"))) {
                     treeItemData.setObjectType(sourceTreeItemData.getObjectType());
-                }
-
+                } 
+                
                 item.setData("TREEITEMDATA", treeItemData);
 
                 TreeItem[] treeSubItems = treeItem.getItems();
index 961864f..ed44099 100644 (file)
@@ -141,9 +141,9 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
     private List<Part> pageList = new ArrayList<Part>();
     private IAction undoHandler;
     private IAction redoHandler;
-
+    private Part selectedPart = null;
     private boolean showBindInfo = false;
-
+    
     // private List<String> itemPath;
 
     public DataBindingPage(DataBindingView dataBindingView) {
@@ -312,12 +312,12 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
                         if (modelValue.startsWith(BuilderConstants.DATABINDING_ARRAYITEM_VALUE_PREFIX)) {
                             String parentPropertyValue = getParentPropertyValue(part, modelValue);
                             if (parentPropertyValue != null) {
-                                addInfoTableItem(part, parentPropertyValue, part.getIdPropertyValue(),
+                                addInfoTableItem(part, parentPropertyValue, part.getOwnerPage().getIdPropertyValue() + "." + part.getIdPropertyValue(),
                                                  key);
                                 break;
                             }
                         } else {
-                            addInfoTableItem(part, modelValue, part.getIdPropertyValue(), key);
+                            addInfoTableItem(part, modelValue, part.getOwnerPage().getIdPropertyValue() + "." + part.getIdPropertyValue(), key);
                         }
                     }
                 }
@@ -384,6 +384,8 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
                 }
                 // data.setViewModelCount(i + 1);
                 viewModelTree.setData("TREEITEMDATA", data);
+                
+                treeItem.setImage(ResourceManager.getImage(BuilderConstants.ICON_DIR, BuilderConstants.DATABINDING_STRING_ICON));
             }
         }
     }
@@ -416,6 +418,8 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
                 }
                 // data.setViewModelCount(i + 1);
                 dataSourceTree.setData("TREEITEMDATA", data);
+                
+                treeItem.setImage(ResourceManager.getImage(BuilderConstants.ICON_DIR, BuilderConstants.DATABINDING_STRING_ICON));
             }
         }
     }
@@ -445,6 +449,8 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
             if ((treeItemData.getObjectType() != null)
                     && (treeItemData.getObjectType().equals("Array"))) {
                 treeItem.setImage(ResourceManager.getImage(BuilderConstants.ICON_DIR, BuilderConstants.DATABINDING_ARRAY_ICON));
+            } else {
+                treeItem.setImage(ResourceManager.getImage(BuilderConstants.ICON_DIR, BuilderConstants.DATABINDING_STRING_ICON));
             }
             
             if (dataSource != null) {
@@ -738,6 +744,9 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
 
     public void renameViewModel(TreeItem treeItem, String newName) {
         if (treeItem.getParentItem() == null) {
+            if (!checkModelName(newName)) {
+                return;
+            }
             BindingData bindingData = pageDesigner.getAppManager().getViewModel(treeItem.getText());
             Command command =
                     new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_RENAMED,
@@ -747,6 +756,9 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
             List<String> itemPath = makeItemPath(treeItem);
             BindingData bindingData =
                     pageDesigner.getAppManager().getViewModel(itemPath.get(itemPath.size() - 1));
+            if (!checkModelItemName(bindingData, itemPath, newName)) {
+                return;
+            }
             Command command =
                     new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_ITEM_RENAMED,
                                             pageDesigner.getAppManager(), bindingData, itemPath,
@@ -756,14 +768,88 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
     }
 
     public void renameDataSource(TreeItem treeItem, String newName) {
-        if (treeItem.getParentItem() == null) {
-            BindingData bindingData =
-                    pageDesigner.getAppManager().getDataSource(treeItem.getText());
-            Command command =
-                    new SetDataSourceCommand(BindingDataSetEventType.DATASOURCE_RENAMED,
-                                             pageDesigner.getAppManager(), bindingData, newName, 0);
-            getCommandStackFromPageDesigner().execute(command);
+        if (treeItem.getParentItem() != null) {
+            return;
+        }
+        
+        if (!checkSourceName(newName)) {
+            return;
+        }
+            
+        BindingData bindingData =
+                pageDesigner.getAppManager().getDataSource(treeItem.getText());
+        Command command =
+                new SetDataSourceCommand(BindingDataSetEventType.DATASOURCE_RENAMED,
+                                         pageDesigner.getAppManager(), bindingData, newName, 0);
+        getCommandStackFromPageDesigner().execute(command);
+    }
+    
+    private boolean checkSourceName(String newName) {
+        List<BindingData> dataSources = pageDesigner.getAppManager().getDataSources();
+        if (dataSources == null) {
+            return false;
+        }
+        for (BindingData dataSource : dataSources) {
+            if (dataSource.getSourceName().equals(newName)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    private boolean checkModelName(String newName) {
+        List<BindingData> viewModels = pageDesigner.getAppManager().getViewModels();
+        if (viewModels == null) {
+            return false;
+        }
+        for (BindingData viewModel : viewModels) {
+            if (viewModel.getModelName().equals(newName)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    private boolean checkModelItemName(BindingData bindingData, List<String> itemPath, String newName) {
+        if ((itemPath == null) || (itemPath.size() < 2)) {
+            return false;
+        }
+        
+        List<String> parentItemPath = new ArrayList<String>();
+        List<BindingObject> childObjects = null;
+        
+        for (int i=1; i < itemPath.size(); i++) {
+            parentItemPath.add(itemPath.get(i));
+        }
+        
+        if (parentItemPath.size() == 1) {
+            childObjects = bindingData.getViewModelObjects();
+        } else {
+            BindingObject bindingObject = pageDesigner.getAppManager().getViewModelObject(bindingData, parentItemPath);
+            if (bindingObject == null) {
+                return false;
+            }
+            childObjects = bindingObject.getItems();
+        }
+        
+        if (childObjects == null) {
+            return false;
+        }
+        
+        for (BindingObject childObject : childObjects) {
+            if (childObject.getName().equals(newName)) {
+                return false;
+            }
         }
+        return true;
+    }
+
+    public void setBindingInfoToPart(Part targetPart, String viewModelInfo, String infoDisplayName,
+                                     String infoValue) {
+        String str = targetPart.getProperty(BuilderConstants.ATTRIBUTE_DATA_BIND).getValue();
+        final String info = DataBindingTooltipParser.makeInfoString(targetPart, viewModelInfo, infoDisplayName, infoValue, str);
+        getCommandStackFromPageDesigner().execute(new SetPartPropertyCommand(targetPart, BuilderConstants.ATTRIBUTE_DATA_BIND, info));
+        
     }
 
     /**
@@ -1392,23 +1478,29 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
     
     private void renameBindingProperties(String newValue, String oldValue) {
         TableItem[] tableItems = infoTableViewer.getTable().getItems();
+        List<Part> parts = new ArrayList<Part>();
+        
         for (TableItem tableItem : tableItems) {
             Part part = (Part) tableItem.getData("PART");
             if (part != null) {
-                String propertyValue =
-                        part.getProperty(BuilderConstants.ATTRIBUTE_DATA_BIND).getValue();
-                if ((propertyValue != null) && (!propertyValue.isEmpty())) {
-                    Map<String, String> bindingInfos = DataBindingTooltipParser.parseToMap(propertyValue);
-                    Object[] bindingTypes = bindingInfos.keySet().toArray();
-                    for (Object bindingType : bindingTypes) {
-                        String value = bindingInfos.get(bindingType);
-                        if ((value != null) && (value.startsWith(oldValue))) {
-                            value = value.replace(oldValue, newValue);
-                            bindingInfos.remove(bindingType.toString());
-                            bindingInfos.put(bindingType.toString(), value);
-                            String bindingInfo = DataBindingTooltipParser.makeStringFromMap(bindingInfos);
-                            part.setPropertyValue(BuilderConstants.ATTRIBUTE_DATA_BIND, bindingInfo);
-                        }
+                parts.add(part);                
+            }
+        }
+        
+        for (Part part : parts) {
+            String propertyValue =
+                    part.getProperty(BuilderConstants.ATTRIBUTE_DATA_BIND).getValue();
+            if ((propertyValue != null) && (!propertyValue.isEmpty())) {
+                Map<String, String> bindingInfos = DataBindingTooltipParser.parseToMap(propertyValue);
+                Object[] bindingTypes = bindingInfos.keySet().toArray();
+                for (Object bindingType : bindingTypes) {
+                    String value = bindingInfos.get(bindingType);
+                    if ((value != null) && (value.startsWith(oldValue))) {
+                        value = value.replace(oldValue, newValue);
+                        bindingInfos.remove(bindingType.toString());
+                        bindingInfos.put(bindingType.toString(), value);
+                        String bindingInfo = DataBindingTooltipParser.makeStringFromMap(bindingInfos);
+                        part.setPropertyValue(BuilderConstants.ATTRIBUTE_DATA_BIND, bindingInfo);
                     }
                 }
             }
@@ -1445,6 +1537,16 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
         return projectManager;
 
     }
+    
+    /**
+     * Gets a page designer
+     * 
+     * @return page designer
+     */
+    public PageDesigner getPageDesigner() {
+        return pageDesigner;
+
+    }
 
     private CommandStack getCommandStackFromPageDesigner() {
         // if (dataBindingView.getSite().getPage().getActiveEditor() instanceof PageDesigner) {
@@ -1476,8 +1578,23 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
                     getActionRegistryFromPageDesigner().getAction(ActionFactory.REDO.getId());
         }
 
-        pageDesigner.getAppManager().getBindingDataSet().addBindingDataListener(this);
-
+        if (pageDesigner != null) {
+            pageDesigner.getAppManager().getBindingDataSet().addBindingDataListener(this);
+            
+            //TODO addListener only current page
+            List<PageData> pageData = pageDesigner.getAppManager().getPages();
+            for (int i = 0; i < pageData.size(); i++) {
+                List<Part> childParts = pageData.get(i).getRootPart().getChildren();
+                for (Part childPart : childParts) {
+                    if (childPart.getOwnerPage() != null) {
+                        if (!pageList.contains(childPart.getOwnerPage())) {
+                            pageList.add(childPart.getOwnerPage());
+                            addListeners(childPart.getOwnerPage());
+                        }
+                    }
+                }
+            }
+        }
     }
 
     public PageDesigner getInput() {
@@ -1500,6 +1617,7 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
                         if (editPart.getModel() instanceof Part) {
                             Part model = (Part) editPart.getModel();
                             selModels.add(model);
+                            setSelectedPart(model);
                         }
                     }
                 }
@@ -1513,6 +1631,14 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
             }
         }
     }
+    
+    public Part getSelectedPart() {
+        return selectedPart;
+    }
+
+    public void setSelectedPart(Part selectedPart) {
+        this.selectedPart = selectedPart;
+    }
 
     public void updateDataSourceMenus() {
         if (removeDataSourceAction != null) {
index 3736cb4..22c9b31 100644 (file)
@@ -7,9 +7,11 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import javax.activation.CommandInfo;
-
+import org.eclipse.swt.widgets.TreeItem;
+import org.tizen.webuibuilder.BuilderConstants;
+import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.ui.views.databinding.model.DataBindingTooltipData;
+import org.tizen.webuibuilder.ui.views.databinding.model.TreeItemData;
 
 
 public class DataBindingTooltipParser {
@@ -135,15 +137,16 @@ public class DataBindingTooltipParser {
         }
         return bindingInfos;
     }
-    
+
     private static void put(Map<String, String> bindingInfos, String string) {
         String[] infos = string.split(": ");
-        if ((infos[0] != null) && (!infos[0].isEmpty())) { 
-            if ((infos[1] != null) && (!infos[1].isEmpty())) {
-                bindingInfos.put(infos[0], infos[1]);
-            }
+        if (infos.length == 2) {
+            if ((infos[0] != null) && (!infos[0].isEmpty())) { 
+                if ((infos[1] != null) && (!infos[1].isEmpty())) {
+                    bindingInfos.put(infos[0], infos[1]);
+                }
+            }            
         }
-        
     }
 
     public static String makeStringFromMap(Map<String, String> bindingInfos) {
@@ -173,4 +176,74 @@ public class DataBindingTooltipParser {
         
         return string;
     }
+    
+    public static String makeInfoString(Part targetPart, String viewModelInfo, String displayName, String value, String str) {
+        String string = "";
+        
+        if ((str != null) && (!str.isEmpty())) {
+            Map<String, String> bindingInfos = DataBindingTooltipParser.parseToMap(str);
+            
+            if (bindingInfos.containsKey(value)) {
+                bindingInfos.remove(value);
+            } else if (bindingInfos.containsKey("attr-"+displayName)) {
+                bindingInfos.remove("attr-"+displayName);
+            }
+            
+            if ((displayName != null) && (!displayName.isEmpty())) {
+                bindingInfos.put("attr-"+displayName, viewModelInfo);
+            } else {
+                bindingInfos.put(value, viewModelInfo);
+            }
+                        
+            string = DataBindingTooltipParser.makeStringFromMap(bindingInfos);
+        } else {
+            if ((displayName != null) && (!displayName.isEmpty())) {
+                string = value + ": { " + displayName + ": " + viewModelInfo + " }";
+            } else {
+                if (targetPart.getDescriptorId().equals("tizen.listitem")) {
+                    string = value + ": " + viewModelInfo + BuilderConstants.DATABINDING_ARRAYITEM_VALUE_SUFFIX;
+                } else {
+                    string = value + ": " + viewModelInfo;
+                }
+            }
+        }
+        
+        return string;
+    }
+    
+    /**
+     * Creates a view model information.
+     * 
+     * @param treeItem
+     * @return view model information
+     */
+    public static String makeViewModelInfoString(TreeItem treeItem) {
+        String str = "";
+        while ((treeItem.getParentItem() != null)) {
+            if (str.isEmpty()) {
+                str = treeItem.getText();
+            } else {
+                str = treeItem.getText() + "." + str;
+            }
+            treeItem = treeItem.getParentItem();
+        }
+        TreeItemData treeItemData = (TreeItemData) treeItem.getData("TREEITEMDATA");
+        str = treeItemData.getOriginModelName() + "." + str;
+        return str;
+    }
+
+    public static String makeViewModelInfo(TreeItem treeItem) {
+        String viewModelInfo;
+        if ((treeItem.getParentItem() != null)
+                && (treeItem.getParentItem().getData("TREEITEMDATA") != null)
+                && (((TreeItemData) treeItem.getParentItem()
+                        .getData("TREEITEMDATA")).getObjectType() != null)
+                && (((TreeItemData) treeItem.getParentItem()
+                        .getData("TREEITEMDATA")).getObjectType().equals("Array"))) {
+            viewModelInfo = BuilderConstants.DATABINDING_ARRAYITEM_VALUE_PREFIX + treeItem.getText();
+        } else {
+            viewModelInfo = DataBindingTooltipParser.makeViewModelInfoString(treeItem);
+        }
+        return viewModelInfo;
+    }
 }
index ea9fc13..7cb8cdc 100644 (file)
@@ -36,19 +36,16 @@ import org.eclipse.ui.ISharedImages;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.dialogs.ElementListSelectionDialog;
 import org.eclipse.ui.part.IPage;
-import org.tizen.webuibuilder.model.Part;
-import org.tizen.webuibuilder.model.page.PageData;
-import org.tizen.webuibuilder.model.project.ProjectManager;
+import org.tizen.webuibuilder.ui.editor.PageDesigner;
 import org.tizen.webuibuilder.ui.views.databinding.DataBindingPage;
 import org.tizen.webuibuilder.ui.views.databinding.DataBindingView;
+import org.tizen.webuibuilder.ui.views.databinding.model.BindingData;
 
 
 public class GetSourceAction extends SelectionAction {
 
     protected DataBindingView view;
-    private ProjectManager projectManager;
-    List<String> idList = new ArrayList<String>();
-    List<Part> partList = new ArrayList<Part>();
+    private PageDesigner pageDesigner;
 
     /**
      * Constructor.
@@ -70,60 +67,32 @@ public class GetSourceAction extends SelectionAction {
             return false;
         }
 
-        //return true;
-        return false;
+        if (getSelectedTreeItem() == null) {
+            return false;
+        }
+
+        return true;
     }
     
     public void refresh() {
                setEnabled(calculateEnabled());
        }
 
-    // private CommandStack getCommandStackFromPageDesigner() {
-    // PageDesigner pageDesigner =
-    // (PageDesigner)view.getSite().getPage().getActiveEditor();
-    // return (CommandStack) pageDesigner.getAdapter(CommandStack.class);
-    // }
-
-    private void makeWidgetList() {
-        List<Part> subSubPart = null;
-        List<Part> part = null;
-
-        idList.clear();
-        partList.clear();
-
-        IPage page = view.getCurrentPage();
-        if (!(page instanceof DataBindingPage)) {
-            return;
-        }
-        DataBindingPage dataBindingPage = (DataBindingPage) page;
-        projectManager = dataBindingPage.getProjectManager();
-        List<PageData> pageData = projectManager.getDefaultAppManager().getPages();
-
-        for (int i = 0; i < pageData.size(); i++) {
-            part = pageData.get(i).getRootPart().getChildren();
-            for (int j = 0; j < part.size(); j++) {
-                List<Part> subPart = part.get(j).getChildren();
-                for (int k = 0; k < subPart.size(); k++) {
-                    subSubPart = subPart.get(k).getChildren();
-                    for (int l = 0; l < subSubPart.size(); l++) {
-                        idList.add(subSubPart.get(l).getIdPropertyValue());
-                        partList.add(subSubPart.get(l));
-                    }
-                }
-            }
-        }
-    }
-
     private TreeItem getSelectedTreeItem() {
         IPage page = view.getCurrentPage();
         if (!(page instanceof DataBindingPage)) {
             return null;
         }
         DataBindingPage dataBindingPage = (DataBindingPage) page;
+        
         Tree tree = dataBindingPage.getViewModelTree();
         TreeItem[] treeItem = tree.getSelection();
+        
+        if ((treeItem == null) || (treeItem.length < 1)) {
+            return null;
+        }
 
-        if (treeItem[0].getParentItem() == null) {
+        if (treeItem[0].getParentItem() != null) {
             return null;
         }
 
@@ -131,138 +100,40 @@ public class GetSourceAction extends SelectionAction {
         return treeItem[0];
     }
 
-    /*
-     * private Tree getTree() { IPage page = view.getCurrentPage(); if (!(page instanceof
-     * DataBindingPage)) { return null; } DataBindingPage dataBindingPage = (DataBindingPage) page;
-     * Tree tree = dataBindingPage.getTree();
-     * 
-     * return tree; }
-     * 
-     * 
-     * //TODO private static String readAll(Reader rd) throws IOException { StringBuilder sb = new
-     * StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return
-     * sb.toString(); }
-     * 
-     * 
-     * public static JSONObject readJsonFromUrl(String url) throws IOException { InputStream is =
-     * null; try { is = new URL(url).openStream(); //BufferedReader rd = new BufferedReader(new
-     * InputStreamReader(is, Charset.forName("EUC-KR"))); BufferedReader rd = new BufferedReader(new
-     * InputStreamReader(is, "utf-8")); String jsonText = readAll(rd); //JSONObject json = new
-     * JSONObject(jsonText); JSONObject json = (JSONObject)JSONValue.parse(jsonText); return json; }
-     * finally { is.close(); } }
-     */
-
-    /*
-     * public Object getJSON(String json, String searchWord, Map<String, Object> resultMap) { //Json
-     * DATA 전 영역 탐사 및 원하는 데이터를 Map 형태로 리턴시킴 JSONObject jsonObj = null; try { jsonObj = new
-     * JSONObject(json); Iterator itr = jsonObj.keys(); int countJSON = 0; while (itr.hasNext()) {
-     * 
-     * String key = (String)itr.next(); Object value = jsonObj.get(key); String selecter =
-     * (String)value.toString();
-     * 
-     * if(key.equals(searchWord)){ // 조건에 걸린 word 값을 찾아서 map 형태로 리턴 resultMap.put(key, value); }
-     * 
-     * if(selecter != null && !selecter.equals("") && !selecter.equals("null") && jsonObj.get(key)
-     * instanceof JSONArray){ if((JSONArray)jsonObj.get(key) instanceof JSONArray){ JSONArray
-     * jsonArray = (JSONArray)jsonObj.get(key); //this.logger.debug(jsonArray.toString()); for(int i
-     * = 0 ; i<jsonArray.length() ; i++){ jsonArray.get(i); JSONObject jsonObj2 = new
-     * JSONObject(jsonArray.get(i).toString()); getJSON(jsonObj2.toString(), searchWord, resultMap);
-     * } } } } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); }
-     * return resultMap; }
-     */
-
-    /*
-     * private void makeDataModel(JSONObject json, String str, TreeItem parentTreeItem, int index) {
-     * 
-     * 
-     * 
-     * if ( (json.get(str) != null) && (
-     * json.get(str).getClass().getName().equals("org.json.simple.JSONArray") )) { JSONArray array =
-     * (JSONArray)json.get(str); TreeItem treeItem; if (parentTreeItem == null) { treeItem = new
-     * TreeItem(getTree(), 0); } else { treeItem = new TreeItem(parentTreeItem, 0); }
-     * treeItem.setText(str); treeItem.setData("TYPE", "Array");
-     * treeItem.setImage(newItem.setImage( ResourceManager.getImage(BuilderConstants.ICON_DIR,
-     * "temp.png"));
-     * 
-     * if (array.get(0).getClass().getName().equals("org.json.simple.JSONObject")) { for (int j=0; j
-     * < ((JSONObject)array.get(0)).size(); j++) { Object[] obj =
-     * ((JSONObject)array.get(0)).keySet().toArray(); makeDataModel((JSONObject) array.get(0),
-     * (String)obj[j], treeItem, 0); } } else {
-     * 
-     * }
-     * 
-     * } else if ( (json.get(str) != null) && (json.get(str).getClass().getName()
-     * .equals("org.json.simple.JSONObject"))) { JSONObject jsonTest = (JSONObject)json.get(str);
-     * TreeItem treeItem; if (parentTreeItem == null) { treeItem = new TreeItem(getTree(), 0); }
-     * else { treeItem = new TreeItem(parentTreeItem, 0); } treeItem.setText(str);
-     * 
-     * if (jsonTest.size() > 0) { for (int j=0; j < jsonTest.size(); j++) { Object[] obj =
-     * jsonTest.keySet().toArray(); makeDataModel(jsonTest, (String)obj[j], treeItem, j); //TODO //
-     * subTreeItem.setData((String)json.get((String)obj[j])); } } else {
-     * 
-     * //TODO treeItem.setData((String)json.get(str)); } } else { TreeItem treeItem; if
-     * (parentTreeItem == null) { treeItem = new TreeItem(getTree(), index); } else { treeItem = new
-     * TreeItem(parentTreeItem, index); } treeItem.setText((String)str);
-     * treeItem.setData(json.get(str)); } }
-     */
-
     @Override
     public void run() {
-
-        makeWidgetList();
-
+        IPage page = view.getCurrentPage();
+        if (!(page instanceof DataBindingPage)) {
+            return;
+        }
+        DataBindingPage dataBindingPage = (DataBindingPage) page;
+        pageDesigner = dataBindingPage.getPageDesigner();
+        if (pageDesigner == null) {
+            return;
+        }
+        
+        TreeItem treeItem = getSelectedTreeItem();
+        if (treeItem == null) {
+            return;
+        }
+        
+        List<BindingData> sources = pageDesigner.getAppManager().getDataSources();
+        List<String> sourceNames = new ArrayList<String>();
+        for (BindingData source : sources) {
+            sourceNames.add(source.getSourceName());
+        }
         ElementListSelectionDialog dialog =
                 new ElementListSelectionDialog(Display.getCurrent().getActiveShell(),
                                                new LabelProvider());
-        dialog.setElements(idList.toArray());
-        dialog.setTitle("Which operating system are you using");
-        // User pressed cancel
+        dialog.setElements(sourceNames.toArray());
+        dialog.setTitle("");
+
         if (dialog.open() != Window.OK) {
             return;
         }
         Object[] result = dialog.getResult();
 
-        for (int i = 0; i < partList.size(); i++) {
-            if (partList.get(i).getIdPropertyValue().equals((String) result[0])) {
-                // getCommandStackFromPageDesigner().execute(new
-                // SetPartPropertyCommand(partList.get(i), "data-bind",
-                // "value: MYOBJ.models.model0.temp", false));
-                TreeItem treeItem = getSelectedTreeItem();
-                if (treeItem == null) {
-                    return;
-                }
-                treeItem.setData(partList.get(i).getPropertyValue("text"));
-
-                IPage page = view.getCurrentPage();
-                if (!(page instanceof DataBindingPage)) {
-                    return;
-                }
-                DataBindingPage dataBindingPage = (DataBindingPage) page;
-                //dataBindingPage.updateModel();
-            }
-        }
-
-        /*
-         * InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(), "", "Enter URL",
-         * "http://apis.daum.net/search/blog?apikey=DAUM_SEARCH_DEMO_APIKEY&q=love&result=20&pageno=1&output=json"
-         * , null);
-         * 
-         * if (dlg.open() == Window.OK) { // User clicked OK; update the label with the input
-         * 
-         * IPage page = view.getCurrentPage(); if (!(page instanceof DataBindingPage)) { return; }
-         * DataBindingPage dataBindingPage = (DataBindingPage) page; TreeItem item =
-         * dataBindingPage.addTreeItem2(); item.setData("URL", dlg.getValue());
-         * 
-         * try { JSONObject json = readJsonFromUrl(dlg.getValue());
-         * 
-         * Object[] str = json.keySet().toArray(); for (int i=0; i < str.length; i++) {
-         * makeDataModel(json, (String)str[i], item, 0); //jsonTest.getClass(); }
-         * 
-         * } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }
-         * 
-         * dataBindingPage.updateModel(); }
-         */
-
+        dataBindingPage.setDataSourceToViewModel(pageDesigner.getAppManager().getDataSource(result[0].toString()), pageDesigner.getAppManager().getViewModel(treeItem.getText()));
     }
 
 }
index 2d00616..ac66e47 100644 (file)
 
 package org.tizen.webuibuilder.ui.views.databinding.actions;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.gef.commands.CommandStack;
 import org.eclipse.gef.ui.actions.SelectionAction;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.window.Window;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Tree;
 import org.eclipse.swt.widgets.TreeItem;
 import org.eclipse.ui.ISharedImages;
 import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ElementListSelectionDialog;
 import org.eclipse.ui.part.IPage;
-import org.tizen.webuibuilder.BuilderConstants;
-import org.tizen.webuibuilder.gef.commands.SetPartPropertyCommand;
 import org.tizen.webuibuilder.model.Part;
-import org.tizen.webuibuilder.model.descriptors.ConstantDescriptor;
-import org.tizen.webuibuilder.model.page.PageData;
-import org.tizen.webuibuilder.model.project.ProjectManager;
-import org.tizen.webuibuilder.ui.editor.PageDesigner;
 import org.tizen.webuibuilder.ui.views.databinding.DataBindingPage;
+import org.tizen.webuibuilder.ui.views.databinding.DataBindingTooltipParser;
 import org.tizen.webuibuilder.ui.views.databinding.DataBindingView;
+import org.tizen.webuibuilder.ui.views.databinding.dialog.SetTargetPage;
+import org.tizen.webuibuilder.ui.views.databinding.model.BindingInfo;
 
 
 public class SetTargetAction extends SelectionAction {
 
     protected DataBindingView view;
-    private ProjectManager projectManager;
-    List<String> idList = new ArrayList<String>();
-    List<Part> partList = new ArrayList<Part>();
-
+    private DataBindingPage dataBindingPage;
+  
     /**
      * Constructor.
      * 
@@ -74,185 +62,67 @@ public class SetTargetAction extends SelectionAction {
         if (view == null) {
             return false;
         }
+        
+        if (getSelectedTreeItem() == null) {
+            return false;
+        }
 
-        //return true;
-        return false;
+        return true;
     }
     
     public void refresh() {
                setEnabled(calculateEnabled());
        }
 
-    // FIXME remove? move to databindingPage?
-    private CommandStack getCommandStackFromPageDesigner() {
-        PageDesigner pageDesigner = (PageDesigner) view.getSite().getPage().getActiveEditor();
-        return (CommandStack) pageDesigner.getAdapter(CommandStack.class);
-    }
-
-    private void makeWidgetList() {
-        List<Part> part = null;
-
-        idList.clear();
-        partList.clear();
-
-        IPage page = view.getCurrentPage();
-        if (!(page instanceof DataBindingPage)) {
-            return;
-        }
-        DataBindingPage dataBindingPage = (DataBindingPage) page;
-        projectManager = dataBindingPage.getProjectManager();
-        List<PageData> pageData = projectManager.getDefaultAppManager().getPages();
-
-        for (int i = 0; i < pageData.size(); i++) {
-            part = pageData.get(i).getRootPart().getChildren();
-
-            makeSubWidgetList(part, idList, partList);
-        }
-    }
-
-    private void makeSubWidgetList(List<Part> part, List<String> idList2, List<Part> partList2) {
-
-        if (part.size() == 0) {
-            return;
-        } else {
-            for (int j = 0; j < part.size(); j++) {
-                idList.add(part.get(j).getIdPropertyValue());
-                partList.add(part.get(j));
-                List<Part> subPart = part.get(j).getChildren();
-                makeSubWidgetList(subPart, idList, partList);
-            }
-        }
-    }
-
-    private DataBindingPage getDataBindingPage() {
+    private TreeItem getSelectedTreeItem() {
         IPage page = view.getCurrentPage();
         if (!(page instanceof DataBindingPage)) {
             return null;
         }
-        return (DataBindingPage) page;
-    }
-
-    private TreeItem getSelectedTreeItem() {
-        DataBindingPage dataBindingPage = getDataBindingPage();
-        if (dataBindingPage == null) {
-               return null;
-        }
+        DataBindingPage dataBindingPage = (DataBindingPage) page;
                
         Tree tree = dataBindingPage.getViewModelTree();
         TreeItem[] treeItem = tree.getSelection();
+        
+        if ((treeItem == null) || (treeItem.length < 1)) {
+            return null;
+        }
 
         if (treeItem[0].getParentItem() == null) {
             return null;
         }
 
-        // 0 .. multi select
         return treeItem[0];
     }
 
-    private void addInfoTableItem(Part part, String modelName, String widgetName,
-                                  String bindingInfoStr) {
-
-        DataBindingPage dataBindingPage = getDataBindingPage();
-        if (dataBindingPage != null) {
-               if (dataBindingPage.checkDuplicatedTableItem(modelName, widgetName, bindingInfoStr)) {
-                   dataBindingPage.addInfoTableItem(part, modelName, widgetName, bindingInfoStr);
-                   //dataBindingPage.updateModel();
-               }
-        }
-    }
-
     @Override
     public void run() {
         IPage page = view.getCurrentPage();
         if (!(page instanceof DataBindingPage)) {
             return;
         }
+        dataBindingPage = (DataBindingPage) page;
 
         TreeItem treeItem = getSelectedTreeItem();
         if (treeItem == null) {
             return;
         }
-
-        makeWidgetList();
-
-        ElementListSelectionDialog dialog =
-                new ElementListSelectionDialog(Display.getCurrent().getActiveShell(),
-                                               new LabelProvider());
-        dialog.setElements(idList.toArray());
-        dialog.setTitle("Which operating system are you using");
-        // User pressed cancel
-        if (dialog.open() != Window.OK) {
+        
+        SetTargetPage dialog = new SetTargetPage(Display.getCurrent().getActiveShell(), dataBindingPage);
+        BindingInfo bindingInfo = dialog.open();
+        
+        if (bindingInfo == null) {
             return;
         }
-        Object[] result = dialog.getResult();
-
-        for (int i = 0; i < partList.size(); i++) {
-
-            // TODO partList.get(i).getPartId()
-            if (partList.get(i).getIdPropertyValue().equals(result[0].toString())) {
-
-                // treeItem.getText(); //temp
-                // treeItem.getParentItem().getText(); //model
-
-                String str = makePropertyValue(treeItem);
-
-                // FIXME testCode
-                List<ConstantDescriptor> enums =
-                        partList.get(i).getPartDescriptor().getPropertyDescriptor(BuilderConstants.ATTRIBUTE_DATA_BIND)
-                                .getTypeDescriptor().getAvailableConstant();
-                // String defaultBindingType =
-                // partList.get(i).getPartDescriptor().getPropertyDescriptor(BuilderConstants.ATTRIBUTE_DATA_BIND).getDefaultValue();
-
-                // TODO 0 == defaultvalue
-                String defaultBindingType = enums.get(0).getValue();
-                String bindingInfoStr;
-                if ((partList.get(i).getParent() != null)
-                        && (partList.get(i).getParent().getPartDescriptor()
-                                .getPropertyDescriptor(BuilderConstants.ATTRIBUTE_DATA_BIND) != null)
-                        && (partList.get(i).getParent().getPartDescriptor()
-                                .getPropertyDescriptor(BuilderConstants.ATTRIBUTE_DATA_BIND).getTypeDescriptor()
-                                .getAvailableConstant().get(0).getValue().equals("foreach"))) {
-                    bindingInfoStr = defaultBindingType + ": $data." + treeItem.getText();
-                } else {
-                    bindingInfoStr = defaultBindingType + ": " + str;
-                }
-
-                //TODO add -> refresh
-                addInfoTableItem(partList.get(i), str, result[0].toString(), bindingInfoStr);
-                getCommandStackFromPageDesigner()
-                        .execute(new SetPartPropertyCommand(partList.get(i), BuilderConstants.ATTRIBUTE_DATA_BIND,
-                                                            bindingInfoStr, false));
-
-                /*
-                 * //FIXME //move this code if( (treeItem.getData("TYPE") != null) &&
-                 * (treeItem.getData("TYPE").equals("Array")) ) {
-                 * getCommandStackFromPageDesigner().execute(new
-                 * SetPartPropertyCommand(partList.get(i), BuilderConstants.ATTRIBUTE_DATA_BIND,
-                 * "foreach: MYOBJ.models."+str, false)); } else if(
-                 * (treeItem.getParentItem().getData("TYPE") != null) && (treeItem
-                 * .getParentItem().getData("TYPE").equals("Array")) ) {
-                 * getCommandStackFromPageDesigner().execute(new
-                 * SetPartPropertyCommand(partList.get(i), BuilderConstants.ATTRIBUTE_DATA_BIND, "text: "+treeItem.getText(),
-                 * false)); } else { getCommandStackFromPageDesigner().execute(new
-                 * SetPartPropertyCommand(partList.get(i), BuilderConstants.ATTRIBUTE_DATA_BIND, bindingInfoStr, false)); }
-                 */
-            }
-        }
-
-    }
-
-    private String makePropertyValue(TreeItem treeItem) {
-        String str = "";
-        while ((treeItem.getParentItem() != null)) {
-            if (str == "") {
-                str = treeItem.getText();
-            } else {
-                str = treeItem.getText() + "." + str;
-            }
-            treeItem = treeItem.getParentItem();
+        
+        Part targetPart = bindingInfo.getTargetPart();
+        String infoValue = bindingInfo.getInfoValue();
+        String infoDisplayName = bindingInfo.getInfoDisplayName();
+        
+        String viewModelInfo = DataBindingTooltipParser.makeViewModelInfo(treeItem);
+        
+        if (targetPart != null) {
+            dataBindingPage.setBindingInfoToPart(targetPart, viewModelInfo, infoDisplayName, infoValue);
         }
-        str = treeItem.getData("DEFAULTTEXT") + "." + str;
-        return str;
     }
-
 }
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/dialog/SetTargetPage.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/dialog/SetTargetPage.java
new file mode 100644 (file)
index 0000000..093fff1
--- /dev/null
@@ -0,0 +1,288 @@
+package org.tizen.webuibuilder.ui.views.databinding.dialog;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Dialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.tizen.webuibuilder.BuilderConstants;
+import org.tizen.webuibuilder.model.Part;
+import org.tizen.webuibuilder.model.descriptors.ConstantDescriptor;
+import org.tizen.webuibuilder.model.page.PageData;
+import org.tizen.webuibuilder.ui.views.databinding.DataBindingPage;
+import org.tizen.webuibuilder.ui.views.databinding.model.BindingInfo;
+import org.tizen.webuibuilder.utility.ResourceManager;
+
+public class SetTargetPage extends Dialog {
+
+    private Shell shell;
+    private SashForm sashForm;
+    private DataBindingPage dataBindingPage;
+    private Tree widgetTree;
+    private Tree bindingInfoTree;
+    private Button okButton;
+    private BindingInfo bindingInfo = new BindingInfo();
+    
+    public SetTargetPage(Shell parent, DataBindingPage dataBindingPage) {
+        super( parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL );
+        setText( "Set Target" );
+        this.dataBindingPage = dataBindingPage;
+    }
+    
+    /**
+     * Opens the dialog and returns the input
+     * 
+     * @return message
+     */
+    public BindingInfo open() {
+        // Create the dialog window
+        shell = new Shell( getParent(), SWT.TITLE | SWT.CLOSE | SWT.BORDER | SWT.RESIZE );
+        shell.setText( getText() );
+        //shell.setMinimumSize(400, 500);
+        createContents();
+        shell.pack();
+        
+        shell.open();
+        Display display = getParent().getDisplay();
+        while ( !shell.isDisposed() ) {
+            if (!display.readAndDispatch()) {
+                display.sleep();
+            }
+        }
+        return bindingInfo;
+    }
+    
+    private void createContents() {
+        FormLayout layout = new FormLayout();
+        shell.setLayout(layout);
+        layout.marginWidth = 5;
+        layout.marginHeight = 5;
+        
+        sashForm = new SashForm(shell, SWT.HORIZONTAL);
+        
+        FormData sashData = new FormData();
+        sashData.top = new FormAttachment( 0, 0);
+        sashData.bottom = new FormAttachment(100, -35);
+        sashData.left = new FormAttachment(0, 0);
+        sashData.right = new FormAttachment(100, -5);
+        sashForm.setLayoutData( sashData );
+        
+        Group widgetTreeGroup = new Group(sashForm, SWT.NONE);
+        Group bindingInfoGroup = new Group(sashForm, SWT.NONE);
+        
+        sashForm.setWeights(new int[] {3, 1});
+        
+        makeBindingInfoGroup( bindingInfoGroup );
+        makeWidgetTreeGroup( widgetTreeGroup );
+        
+        // Create the cancel button and add a handler
+        // so that pressing it will set input to null
+        Button cancelButton = new Button( shell, SWT.PUSH );
+        cancelButton.setText( "CANCEL" );
+        
+        FormData data = new FormData( 100, 30 );
+        data.top = new FormAttachment( sashForm, 5 );
+        data.right = new FormAttachment( 100, -5 );
+        data.bottom = new FormAttachment( 100, -5 );
+        
+        cancelButton.setLayoutData( data );
+        
+        cancelButton.addSelectionListener( new SelectionAdapter() {
+            public void widgetSelected( SelectionEvent event ) {
+                bindingInfo = null;
+                shell.close();
+            }
+        } );
+
+        // Create the OK button and add a handler
+        // so that pressing it will set input
+        // to the entered value
+        okButton = new Button( shell, SWT.PUSH );
+        okButton.setText( "OK" );
+        
+        data = new FormData( 100, 30 );
+        data.top = new FormAttachment( sashForm, 5 );
+        data.right = new FormAttachment( cancelButton, -5 );
+        data.bottom = new FormAttachment( 100, -5 );
+        
+        okButton.setLayoutData( data );
+        okButton.setEnabled(false);
+        
+        okButton.addSelectionListener( new SelectionAdapter() {            
+            public void widgetSelected( SelectionEvent event ) {
+                TreeItem[] widetTreeItem = widgetTree.getSelection();
+                TreeItem[] bindingInfoTreeItem = bindingInfoTree.getSelection();
+                
+                if ((widetTreeItem != null) && (bindingInfoTreeItem != null)) {
+                    if ((widetTreeItem.length > 0) && (bindingInfoTreeItem.length > 0)) {
+                        if ((widetTreeItem[0] != null) && (bindingInfoTreeItem[0] != null)) {
+                            bindingInfo.setTargetPart((Part) widetTreeItem[0].getData("PART"));
+                            bindingInfo.setInfoValue((String) bindingInfoTreeItem[0].getData("INFOVALUE")); 
+                            bindingInfo.setInfoDisplayName((String) bindingInfoTreeItem[0].getData("INFODISPLAYNAME"));
+                        }
+                    }
+                }
+                shell.close();
+            }
+        });
+        
+    }
+
+    private void makeBindingInfoGroup(Group bindingInfoGroup) {
+        FormLayout layout = new FormLayout();
+        bindingInfoGroup.setLayout(layout);
+        
+        bindingInfoTree = new Tree(bindingInfoGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION );
+
+        bindingInfoTree.setLinesVisible(true);
+        //dialogTree.setHeaderVisible(true);
+        
+        FormData data = new FormData(150, 300);
+        data.top = new FormAttachment(0, 2);
+        data.left = new FormAttachment(0, 0);
+        data.right = new FormAttachment(100, 0);
+        data.bottom = new FormAttachment(100, 0);
+        bindingInfoTree.setLayoutData(data);
+        
+        bindingInfoGroup.layout();
+        
+        bindingInfoTree.addMouseListener(new MouseAdapter() {
+            public void mouseUp(MouseEvent e) {
+                setVisibleToOkButton();
+            }
+        });
+    }
+
+    private void makeWidgetTreeGroup(Group widgetTreeGroup) {
+        FormLayout layout = new FormLayout();
+        widgetTreeGroup.setLayout(layout);
+        
+        widgetTree = new Tree(widgetTreeGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION );
+        
+        FormData data = new FormData(250, 300);
+        data.top = new FormAttachment(0, 2);
+        data.left = new FormAttachment(0, 0);
+        data.right = new FormAttachment(100, 0);
+        data.bottom = new FormAttachment(100, 0);
+        widgetTree.setLayoutData(data);
+        
+        makeTreeItems(widgetTree);
+        widgetTreeGroup.layout();
+        
+        widgetTree.addMouseListener(new MouseAdapter() {
+            public void mouseUp(MouseEvent e) {
+                Point point = new Point(e.x, e.y);
+                final TreeItem treeItem = widgetTree.getItem(point);
+                makeBindingInfoList(treeItem);
+                setVisibleToOkButton();
+            }
+        });
+    }
+    
+    private void setVisibleToOkButton() {
+        boolean enable = false;
+        if ((widgetTree.getSelection() != null) && (widgetTree.getSelection().length > 0)) {
+            if ((bindingInfoTree.getSelection() != null) && (bindingInfoTree.getSelection().length > 0)) {
+                enable = true;
+            }
+        }
+        okButton.setEnabled(enable);
+    }
+
+    private void makeBindingInfoList(TreeItem treeItem) {
+        if (treeItem == null) {
+            widgetTree.deselectAll();
+            return;
+        }
+        Part part = (Part) treeItem.getData("PART");
+        if (part == null) {
+            return;
+        }
+        
+        if (bindingInfoTree == null) {
+            return;
+        }
+        
+        bindingInfoTree.removeAll();
+        
+        if (part.getPartDescriptor().getPropertyDescriptor(BuilderConstants.ATTRIBUTE_DATA_BIND) == null) {
+            return;
+        }
+        
+        List<ConstantDescriptor> list =
+                part.getPartDescriptor().getPropertyDescriptor(BuilderConstants.ATTRIBUTE_DATA_BIND)
+                        .getTypeDescriptor().getAvailableConstant();
+        
+        if ((list == null) || (list.size() <= 0)) {
+            return;
+        }
+        for (int i = 0; i < list.size(); i++) {
+            TreeItem subItem = new TreeItem(bindingInfoTree, SWT.NONE);
+            final String value = list.get(i).getValue();
+            final String displayName = list.get(i).getDisplayName();
+            subItem.setData("INFOVALUE", value);
+            if ((displayName != null) && (!displayName.isEmpty())) {
+                subItem.setText(value + "[" + displayName + "]");
+                subItem.setData("INFODISPLAYNAME", displayName);
+            } else {
+                subItem.setText(value);
+            }
+        }
+    }
+
+    private void makeTreeItems(Tree widgetTree) {
+        List<PageData> pageData = dataBindingPage.getPageDesigner().getAppManager().getPages();
+        List<Part> childParts = null;
+        
+        for (int i = 0; i < pageData.size(); i++) {
+            childParts = pageData.get(i).getRootPart().getChildren();
+            makeSubWidgetList(null, childParts);
+        }
+    }
+
+    private void makeSubWidgetList(TreeItem parentItem, List<Part> childParts) {
+        if (childParts.size() == 0) {
+            return;
+        }
+        
+        TreeItem subItem;
+        for (int i = 0; i < childParts.size(); i++) {
+            if (parentItem == null) {
+                subItem = new TreeItem(widgetTree, SWT.NONE);
+            } else {
+                subItem = new TreeItem(parentItem, SWT.NONE);
+            }
+            subItem.setText(childParts.get(i).getIdPropertyValue() + " <" + childParts.get(i).getPartDescriptor().getDisplayName()+ ">");
+            subItem.setData("PART", childParts.get(i));
+            String iconPath = childParts.get(i).getPartDescriptor().getIcon16();
+            Image image = ResourceManager.getImage(BuilderConstants.ICON_DIR, iconPath);
+            subItem.setImage(image);
+            if ((dataBindingPage.getSelectedPart() != null) && (childParts.get(i).equals(dataBindingPage.getSelectedPart()))) {
+                subItem.setExpanded(true);
+                widgetTree.setSelection(subItem);
+                makeBindingInfoList(subItem);
+            }
+            
+            List<Part> subPart = childParts.get(i).getChildren();
+            makeSubWidgetList(subItem, subPart);
+        }
+        
+    }
+
+    
+}
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/model/BindingInfo.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/model/BindingInfo.java
new file mode 100644 (file)
index 0000000..961cf67
--- /dev/null
@@ -0,0 +1,28 @@
+package org.tizen.webuibuilder.ui.views.databinding.model;
+
+import org.tizen.webuibuilder.model.Part;
+
+public class BindingInfo {
+    private Part targetPart;
+    private String infoValue;
+    private String infoDisplayName;
+    
+    public Part getTargetPart() {
+        return targetPart;
+    }
+    public void setTargetPart(Part targetPart) {
+        this.targetPart = targetPart;
+    }
+    public String getInfoValue() {
+        return infoValue;
+    }
+    public void setInfoValue(String infoValue) {
+        this.infoValue = infoValue;
+    }
+    public String getInfoDisplayName() {
+        return infoDisplayName;
+    }
+    public void setInfoDisplayName(String infoDisplayName) {
+        this.infoDisplayName = infoDisplayName;
+    }
+}
\ No newline at end of file
index cfca1c3..41f0238 100644 (file)
@@ -2,11 +2,16 @@
 
 package org.tizen.webuibuilder.ui.views.nscreen;
 
+import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.gef.commands.Command;
 import org.eclipse.swt.SWT;
@@ -28,11 +33,9 @@ import org.tizen.webuibuilder.model.nscreen.Device;
 import org.tizen.webuibuilder.model.nscreen.DeviceManager;
 import org.tizen.webuibuilder.model.nscreen.NScreenModel;
 import org.tizen.webuibuilder.model.nscreen.NScreenModel.NScreenType;
+import org.tizen.webuibuilder.ui.views.databinding.actions.EditDataSourceAction;
 import org.tizen.webuibuilder.ui.views.nscreen.command.NScreenDisableCommand;
 import org.tizen.webuibuilder.ui.views.nscreen.command.NScreenEnableCommand;
-import org.tizen.webuibuilder.ui.views.nscreen.command.NScreenLinkCutCommand;
-import org.tizen.webuibuilder.ui.views.nscreen.command.NScreenLinkDownCommand;
-import org.tizen.webuibuilder.ui.views.nscreen.command.NScreenLinkUpCommand;
 import org.tizen.webuibuilder.ui.views.nscreen.command.NScreenMoveDownCommand;
 import org.tizen.webuibuilder.ui.views.nscreen.command.NScreenMoveUpCommand;
 
@@ -324,18 +327,18 @@ public class NScreenItem extends Composite {
     }
 
     public void LinkCutAction() {
-//        Command command = new NScreenLinkCutCommand(this);
-//        parent.getNScreenPageModel().getPageDesigner().getCommandStack().execute(command);
+        // Command command = new NScreenLinkCutCommand(this);
+        // parent.getNScreenPageModel().getPageDesigner().getCommandStack().execute(command);
     }
 
     public void LinkUpAction() {
-//        Command command = new NScreenLinkUpCommand(this);
-//        parent.getNScreenPageModel().getPageDesigner().getCommandStack().execute(command);
+        // Command command = new NScreenLinkUpCommand(this);
+        // parent.getNScreenPageModel().getPageDesigner().getCommandStack().execute(command);
     }
 
     public void LinkDownAction() {
-//        Command command = new NScreenLinkDownCommand(this);
-//        parent.getNScreenPageModel().getPageDesigner().getCommandStack().execute(command);
+        // Command command = new NScreenLinkDownCommand(this);
+        // parent.getNScreenPageModel().getPageDesigner().getCommandStack().execute(command);
     }
 
     public void redrawItem() {
@@ -406,15 +409,19 @@ public class NScreenItem extends Composite {
     }
 
     public void deleteFile() {
-        String cssFolderPath = parent.getNScreenPageModel().getAppManager().getCssFolder();
-        String filePath = cssFolderPath + IPath.SEPARATOR + getFileName();
-        File newCSSFile = new File(filePath);
-
-        if (newCSSFile.exists()) {
-            newCSSFile.delete();
+        IProject project =
+                parent.getNScreenPageModel().getAppManager().getProjectManager().getProject();
+        IFile ifile = project.getFile(getFileName());
+        
+        try {
+            ifile.delete(true, null);
+        } catch (CoreException e) {
+            e.printStackTrace();
         }
 
-        parent.getNScreenPageModel().getPageData().removeCssFileByPath(filePath);
+        String cssFolderPath = parent.getNScreenPageModel().getAppManager().getCssFolder();
+        String cssFilePath = cssFolderPath + IPath.SEPARATOR + getFileName();
+        parent.getNScreenPageModel().getPageData().removeCssFileByPath(cssFilePath);
     }
 
     public void copyFile(NScreenItem source) {
@@ -422,7 +429,6 @@ public class NScreenItem extends Composite {
         String targetFileName = getFileName();
 
         String filePath = parent.getNScreenPageModel().getAppManager().getCssFolder();
-        // CssFile sourceCssFile = new CssFile(filePath + IPath.SEPARATOR + sourceFileName);
         File sourceFile = new File(filePath + IPath.SEPARATOR + sourceFileName);
         File targetFile = new File(filePath + IPath.SEPARATOR + targetFileName);
         parent.getNScreenPageModel().getPageData()
@@ -434,17 +440,19 @@ public class NScreenItem extends Composite {
     }
 
     public void createFile() {
+        IProject project =
+                parent.getNScreenPageModel().getAppManager().getProjectManager().getProject();
         String filePath = parent.getNScreenPageModel().getAppManager().getCssFolder();
         CssFile cssFile = new CssFile(filePath + IPath.SEPARATOR + getFileName());
-        File newCSSFile = new File(filePath + IPath.SEPARATOR + getFileName());
-
+        IFile ifile = project.getFile(getFileName());
         try {
-            if (!newCSSFile.exists()) {
-                File dir = newCSSFile.getParentFile();
-                dir.mkdirs();
-                newCSSFile.createNewFile();
+            if (ifile.exists()) {
+                ifile.delete(true, null);
             }
-        } catch (IOException e) {
+            byte[] bytes = new byte[0];
+            InputStream source = new ByteArrayInputStream(bytes);
+            ifile.create(source, IResource.FORCE, null);
+        } catch (CoreException e) {
             e.printStackTrace();
         }
 
index 47a2a89..da0b234 100644 (file)
@@ -116,11 +116,13 @@ public class NScreenPage extends Page {
 
                 List<Device> devices = DeviceManager.getDeviceManager().getDevices();
                 Device device = null;
-                String profile = mNScreenPageModel.getAppManager().getPlatform();
+                String profile = mNScreenPageModel.getAppManager().getPlatform().toLowerCase();
                 if (profile.contains("mobile")) {
                     device = devices.get(1);
                 } else if (profile.contains("wearable")) {
                     device = devices.get(0);
+                } else {
+                    device = devices.get(1);
                 }
                 commonHistory.setModelName(model.getName());
                 commonHistory.setLastResolution(device.getDisplayName());
index 02e2a59..edda270 100644 (file)
@@ -10,9 +10,13 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.ServerSocket;
 import java.net.Socket;
+import java.util.Iterator;
+import java.util.Map.Entry;
 
 import org.eclipse.swt.graphics.Image;
+import org.tizen.common.ui.view.console.ConsoleManager;
 import org.tizen.webuibuilder.BuilderConstants;
+import org.tizen.webuibuilder.model.css.CssSelector;
 import org.tizen.webuibuilder.model.nscreen.NScreenModel;
 import org.tizen.webuibuilder.model.nscreen.NScreenModel.NScreenType;
 import org.tizen.webuibuilder.model.nscreen.NScreenModel.Orientation;
@@ -21,9 +25,14 @@ import org.tizen.webuibuilder.utility.ResourceManager;
 
 public class NScreenUtil {
     private static boolean logEnabled = false;
+    private static ConsoleManager console;
 
     public static void enableNScreenLog(boolean enabled) {
         logEnabled = enabled;
+
+        if (logEnabled && null == console) {
+            console = new ConsoleManager("NScreen view", false);
+        }
     }
 
     public static boolean isLogEnabled() {
@@ -32,6 +41,7 @@ public class NScreenUtil {
 
     public static void nscreen_log(String log) {
         if (logEnabled) {
+            console.println("[NSCREEN_LOG] " + log);
             System.out.println("[NSCREEN_LOG] " + log);
         }
     }
@@ -207,4 +217,31 @@ public class NScreenUtil {
         }
         return null;
     }
+
+    public static String selectorCodeGen(CssSelector selector) {
+        StringBuilder css = new StringBuilder();
+        css.append(selector.getSelectorName());
+        css.append(BuilderConstants.SPACE);
+        css.append(BuilderConstants.OPEN_CURLY_BRACKET);
+        css.append(BuilderConstants.NEW_LINE);
+        Iterator<Entry<String, String>> properties = selector.getProperties().iterator();
+
+        while (properties.hasNext()) {
+            // Generates property.
+            Entry<String, String> property = properties.next();
+            css.append(BuilderConstants.TAB);
+            css.append(property.getKey());
+            css.append(BuilderConstants.SPACE);
+            css.append(BuilderConstants.COLON);
+            css.append(BuilderConstants.SPACE);
+            css.append(property.getValue());
+            css.append(BuilderConstants.SEMICOLON);
+            css.append(BuilderConstants.NEW_LINE);
+        }
+        css.append(BuilderConstants.CLOSE_CURLY_BRACKET);
+        css.append(BuilderConstants.NEW_LINE);
+
+        return css.toString();
+    }
+
 }
index bf89254..fb32332 100644 (file)
 
 package org.tizen.webuibuilder.ui.views.pages;
 
+import java.util.List;
+
 import org.eclipse.draw2d.ColorConstants;
 import org.eclipse.gef.EditDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.RootEditPart;
 import org.eclipse.gef.ui.actions.ActionRegistry;
 import org.eclipse.gef.ui.parts.SelectionSynchronizer;
 import org.eclipse.jface.action.IAction;
@@ -32,6 +36,8 @@ import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.IActionBars;
 import org.eclipse.ui.actions.ActionFactory;
 import org.eclipse.ui.part.Page;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.tizen.webuibuilder.model.app.AppEvent;
 import org.tizen.webuibuilder.model.app.AppManager;
 import org.tizen.webuibuilder.model.app.IAppListener;
@@ -50,6 +56,7 @@ public class PagesPage extends Page implements IAppListener,
        private SelectionSynchronizer selectionSyncronizer;
        // actions
        private ActionRegistry actionRegistry;
+       private static Logger logger = LoggerFactory.getLogger(PagesPage.class);
 
        public PagesPage(SelectionSynchronizer selectionSyncronizer,
                        EditDomain editDomain, ActionRegistry actionRegistry) {
@@ -182,9 +189,23 @@ public class PagesPage extends Page implements IAppListener,
         */
        @Override
        public void pageRemoved(PageDataSetEvent e) {
-               Object model = appManager.getPageDataSet().getBaseRootPart();
+           RootEditPart rootEditPart = viewer.getRootEditPart();
+           List<?> children = rootEditPart.getChildren();
+           EditPart a = (EditPart) children.get(0);
+
+           
+           Object model = appManager.getPageDataSet().getBaseRootPart();
                viewer.setContents(model);
                
+               int index = 0;
+               if(e.getIndex() == 0) {
+                       index = 1;
+               } else {
+                       index = e.getIndex() - 1;
+               }
+                       
+               viewer.select((EditPart) a.getChildren().get(index));
+               
        }
 
        /*
index cde7f6b..037ccf5 100644 (file)
@@ -58,6 +58,9 @@ public class PagesViewContextMenu extends ContextMenu {
 
         action = getAction(ActionFactory.REDO.getId());
         menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action);
+        
+        action = getAction(WebUIBuilderActionConstants.DELETE_PAGE);
+        menu.appendToGroup(GEFActionConstants.GROUP_REST, action);
 
         action = getAction(WebUIBuilderActionConstants.NEW_PAGE);
         menu.appendToGroup(GEFActionConstants.GROUP_REST, action);
index 07f2203..6756d65 100644 (file)
@@ -207,7 +207,7 @@ public class PropertiesPage extends Page implements IPropertySheetPage, IPartLis
                 case STYLE:
                     CssStyleTab styleTab =
                             new CssStyleTab(tabFolder, commandStack,
-                                            descriptorManager.getCssDescriptor(),
+                                            descriptorManager.getCssDescriptor(), pageData,
                                             pageData.getCurrentCssFile(), goingBridge);
                     // temp end
                     pageData.addPageListener(styleTab);
index c42818c..41d1222 100644 (file)
@@ -502,8 +502,8 @@ public class ClipMethod extends Method {
                 }
             } else if (value.toLowerCase().contains("auto")) {
                 // do nothing !!
-                Logger logger = LoggerFactory.getLogger(getClass());
-                logger.debug("Do nothing on setViewData");
+//                Logger logger = LoggerFactory.getLogger(getClass());
+//                logger.debug("Do nothing on setViewData");
             }
         }
     }
@@ -541,22 +541,28 @@ public class ClipMethod extends Method {
                 setViewData(key, value);
             } else if (key.equals(CLIP_WIDTH)) {
                 if (!originWidth.isDisposed() && !rightTextEditor.getLabel().isDisposed()) {
-                    if (Integer.parseInt(originWidth.getText()) == Integer.parseInt(rightTextEditor
-                            .getLabel().getText())) {
+                    if (originWidth.getText().equals(rightTextEditor.getLabel().getText())) {
                         rightTextEditor.setLabel(getRealValue(value));
-                        // setClipValue();
                     }
+//                    if (Integer.parseInt(originWidth.getText()) == Integer.parseInt(rightTextEditor
+//                            .getLabel().getText())) {
+//                        rightTextEditor.setLabel(getRealValue(value));
+//                        // setClipValue();
+//                    }
                     originWidth.setText(getRealValue(value));
                 } else {
                     return;
                 }
             } else if (key.equals(CLIP_HEIGHT)) {
                 if (!originHeight.isDisposed() && !bottomTextEditor.getLabel().isDisposed()) {
-                    if (Integer.parseInt(originHeight.getText()) == Integer
-                            .parseInt(bottomTextEditor.getLabel().getText())) {
+                    if (originHeight.getText().equals(bottomTextEditor.getLabel().getText())) {
                         bottomTextEditor.setLabel(getRealValue(value));
-                        // setClipValue();
                     }
+//                    if (Integer.parseInt(originHeight.getText()) == Integer
+//                            .parseInt(bottomTextEditor.getLabel().getText())) {
+//                        bottomTextEditor.setLabel(getRealValue(value));
+//                        // setClipValue();
+//                    }
                     originHeight.setText(getRealValue(value));
                 } else {
                     return;
index 2373280..69cd920 100644 (file)
@@ -475,11 +475,13 @@ public class MetricsMethod extends Method {
         createPaddingSection();
         createContentSection();
 
-        position.addMouseTrackListener(createCurrentPositionListener(null, position, margin));
-        margin.addMouseTrackListener(createCurrentPositionListener(position, margin, border));
-        border.addMouseTrackListener(createCurrentPositionListener(position, border, padding));
-        padding.addMouseTrackListener(createCurrentPositionListener(position, padding, content));
-        content.addMouseTrackListener(createCurrentPositionListener(position, content, null));
+        
+        composite.addMouseTrackListener(createCurrentPositionListener(null));
+        position.addMouseTrackListener(createCurrentPositionListener(position));
+        margin.addMouseTrackListener(createCurrentPositionListener(margin));
+        border.addMouseTrackListener(createCurrentPositionListener(border));
+        padding.addMouseTrackListener(createCurrentPositionListener(padding));
+        content.addMouseTrackListener(createCurrentPositionListener(content));
 
         return composite;
     }
@@ -491,7 +493,7 @@ public class MetricsMethod extends Method {
      *            parent {@link Composite}
      */
     private void createPositionSection(Composite parent) {
-        position = new Composite(parent, SWT.CENTER | SWT.BORDER);
+        position = new Composite(parent, SWT.BORDER);
         position.setLayout(new FormLayout());
         position.setBackgroundMode(SWT.INHERIT_FORCE);
 
@@ -566,7 +568,7 @@ public class MetricsMethod extends Method {
      * This method creates a margin section of the 'Metrics component'.
      */
     private void createMarginSection() {
-        margin = new Composite(position, SWT.CENTER | SWT.BORDER);
+        margin = new Composite(position, SWT.BORDER);
         margin.setLayout(new FormLayout());
         margin.setBackgroundMode(SWT.INHERIT_FORCE);
 
@@ -625,7 +627,7 @@ public class MetricsMethod extends Method {
      * This method creates a border section of the 'Metrics component'.
      */
     private void createBorderSection() {
-        border = new Composite(margin, SWT.CENTER | SWT.BORDER);
+        border = new Composite(margin, SWT.BORDER);
         border.setLayout(new FormLayout());
         border.setBackgroundMode(SWT.INHERIT_FORCE);
 
@@ -684,7 +686,7 @@ public class MetricsMethod extends Method {
      * This method creates a padding section of the 'Metrics component'.
      */
     private void createPaddingSection() {
-        padding = new Composite(border, SWT.CENTER | SWT.BORDER);
+        padding = new Composite(border, SWT.BORDER);
         padding.setLayout(new FormLayout());
         padding.setBackgroundMode(SWT.INHERIT_FORCE);
 
@@ -744,7 +746,7 @@ public class MetricsMethod extends Method {
      * This method creates a content section of the 'Metrics component'.
      */
     private void createContentSection() {
-        content = new Composite(padding, SWT.CENTER | SWT.BORDER);
+        content = new Composite(padding, SWT.BORDER);
         content.setLayout(new FormLayout());
         content.setBackgroundMode(SWT.INHERIT_FORCE);
 
@@ -1029,46 +1031,40 @@ public class MetricsMethod extends Method {
      *            child {@link Composite}
      * @return a {@link MouseTrackListener}
      */
-    private MouseTrackListener createCurrentPositionListener(final Composite parent,
-                                                             final Composite i,
-                                                             final Composite child) {
+    private MouseTrackListener createCurrentPositionListener(final Composite composite) {
         MouseTrackListener listener = new MouseTrackListener() {
 
             @Override
             public void mouseEnter(MouseEvent e) {
-                if (parent != null) {
-                    parent.setBackground(null);
+                if (composite != null && !composite.isDisposed()) {
+                    composite.setBackground(SELECTED_COLOR);
                 }
 
-                if (child != null) {
-                    child.setBackground(DEFAULT_COLOR);
-                }
-                i.setBackground(SELECTED_COLOR);
             }
 
             @Override
             public void mouseExit(MouseEvent e) {
-                i.setBackground(DEFAULT_COLOR);
-                // boolean isChild = false;
-                // Point p = new Point(e.x, e.y);
-                //
-                // for (Control control : composite.getChildren()) {
-                // if (control instanceof Label || control instanceof Text) {
-                // if (!(control.getBounds().contains(p))) {
-                // isChild = false;
-                // } else {
-                // isChild = true;
-                // break;
-                // }
-                // } else if (control instanceof Composite){
-                // i.setBackground(null);
-                // return;
-                // }
-                // }
-                //
-                // if (!isChild) {
-                // i.setBackground(null);
-                // }
+                getDisplay().asyncExec(new Runnable() {
+
+                    @Override
+                    public void run() {
+                        if (!position.getBackground().equals(DEFAULT_COLOR)) {
+                            position.setBackground(DEFAULT_COLOR);
+                        }
+                        if (!margin.getBackground().equals(DEFAULT_COLOR)) {
+                            margin.setBackground(DEFAULT_COLOR);
+                        }
+                        if (!border.getBackground().equals(DEFAULT_COLOR)) {
+                            border.setBackground(DEFAULT_COLOR);
+                        }
+                        if (!padding.getBackground().equals(DEFAULT_COLOR)) {
+                            padding.setBackground(DEFAULT_COLOR);
+                        }
+                        if (!content.getBackground().equals(DEFAULT_COLOR)) {
+                            content.setBackground(DEFAULT_COLOR);
+                        }
+                    }
+                });
             }
 
             @Override
index 6878006..d5227f8 100644 (file)
@@ -23,6 +23,7 @@
 
 package org.tizen.webuibuilder.ui.views.properties.method;
 
+import java.text.DecimalFormat;
 import java.util.List;
 
 import org.eclipse.swt.SWT;
@@ -501,9 +502,11 @@ public class ScaleMethod extends Method {
     }
     
     private String convertFloatString(String value) {
-        int intValue = Integer.parseInt(value);
-        float opacityValue = (float) intValue / 100;
-        return String.format("%.2f", opacityValue);
+//        int intValue = Integer.parseInt(value);
+//        float opacityValue = (float) intValue / 100;
+//     return String.format("%.2f", opacityValue);
+       DecimalFormat format = new DecimalFormat("#.###");
+       return format.format(Double.parseDouble(value) / 100);
     }
     
     @Override
index b4a422f..0fb24ea 100644 (file)
@@ -26,8 +26,6 @@ package org.tizen.webuibuilder.ui.views.properties.style;
 import java.util.Collection;
 
 import org.eclipse.gef.commands.CommandStack;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.tizen.webuibuilder.BuilderConstants;
 import org.tizen.webuibuilder.bridge.DesignerGoingBridge;
 import org.tizen.webuibuilder.gef.commands.CreateCssSelectorCommand;
@@ -38,13 +36,16 @@ import org.tizen.webuibuilder.model.IPartListener;
 import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.model.PartEvent;
 import org.tizen.webuibuilder.model.WidgetValidator;
+import org.tizen.webuibuilder.model.css.CssEvent;
 import org.tizen.webuibuilder.model.css.CssFile;
 import org.tizen.webuibuilder.model.css.CssSelector;
 import org.tizen.webuibuilder.model.css.CssStyle;
+import org.tizen.webuibuilder.model.css.ICssListener;
 import org.tizen.webuibuilder.model.css.ICssSelectorListener;
 import org.tizen.webuibuilder.model.css.NewCssEvent;
 import org.tizen.webuibuilder.model.css.descriptors.CssDescriptor;
 import org.tizen.webuibuilder.model.css.descriptors.CssPropertyDescriptor;
+import org.tizen.webuibuilder.model.page.PageData;
 import org.tizen.webuibuilder.ui.views.properties.method.IValueChangeListener;
 import org.tizen.webuibuilder.ui.views.properties.method.Method;
 import org.tizen.webuibuilder.ui.views.properties.method.MethodEvent;
@@ -53,7 +54,7 @@ import org.tizen.webuibuilder.ui.views.properties.method.MethodEvent;
 /**
  * Delegater class for {@link CssStyleTab}.
  */
-public class CssStyleEventDelegater implements ICssSelectorListener, IValueChangeListener, IPartListener {
+public class CssStyleEventDelegater implements ICssSelectorListener, IValueChangeListener, IPartListener, ICssListener {
 
     private CssStyleTab styleTab;
     private CommandStack commandStack;
@@ -61,6 +62,7 @@ public class CssStyleEventDelegater implements ICssSelectorListener, IValueChang
     private CssDescriptor cssDescriptor;
     private CssFile cssFile;
     private CssSelector selector;
+    private PageData pageData;
 
     /**
      * Constructs a new instance of this class given its {@link CommandStack},
@@ -74,10 +76,11 @@ public class CssStyleEventDelegater implements ICssSelectorListener, IValueChang
      *            a {@link CssStyle}
      */
     public CssStyleEventDelegater(CommandStack commandStack, CssDescriptor cssDescriptor,
-            CssStyleTab styleTab, DesignerGoingBridge goingBridge) {
+            CssStyleTab styleTab, PageData pageData, DesignerGoingBridge goingBridge) {
         this.styleTab = styleTab;
         this.commandStack = commandStack;
         this.cssDescriptor = cssDescriptor;
+        this.pageData = pageData;
         this.goingBridge = goingBridge;
     }
 
@@ -190,7 +193,7 @@ public class CssStyleEventDelegater implements ICssSelectorListener, IValueChang
 
                 Part part = styleTab.getModel();
                 SetCssStyleCommand command =
-                        new SetCssStyleCommand(cssFile, part, selector, key, value);
+                        new SetCssStyleCommand(pageData, part, selector.getSelectorName(), key, value);
                 commandStack.execute(command);
             }
         }
@@ -232,20 +235,11 @@ public class CssStyleEventDelegater implements ICssSelectorListener, IValueChang
             return;
         } else {
             CreateCssSelectorCommand command =
-                    new CreateCssSelectorCommand(cssFile, styleTab.getModel(), selectorName);
+                    new CreateCssSelectorCommand(pageData, styleTab.getModel(), selectorName);
             commandStack.execute(command);
         }
     }
 
-    public void addCssSelector(CssSelector selector) {
-        if (selector == null) {
-            return;
-        } else {
-            CreateCssSelectorCommand command =
-                    new CreateCssSelectorCommand(cssFile, styleTab.getModel(), selector);
-            commandStack.execute(command);
-        }
-    }
 
     public void removeCssSelector(CssSelector selector) {
         if (selector == null) {
@@ -320,7 +314,30 @@ public class CssStyleEventDelegater implements ICssSelectorListener, IValueChang
 
     @Override
     public void needRefresh(PartEvent event) {
+    }
+
+    @Override
+    public void cssSelectorAdded(CssEvent event) {
         // TODO Auto-generated method stub
-        styleTab.refreshPositionMethods();
+        
+    }
+
+    @Override
+    public void cssSelectorRemoved(CssEvent event) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void cssPropertyChanged(CssEvent event) {
+        String key = event.getPropertyKey();
+        if (key != null) {
+            String value = event.getPropertyValue();
+            refreshStyleTab(key, value);
+        }
+    }
+
+    @Override
+    public void needRefresh(CssEvent event) {
     }
 }
index fd6cc55..583c1a3 100644 (file)
@@ -68,6 +68,7 @@ import org.tizen.webuibuilder.model.descriptors.PropertyConditionDescriptor;
 import org.tizen.webuibuilder.model.descriptors.TypeDescriptor;
 import org.tizen.webuibuilder.model.descriptors.TypeDescriptor.Types;
 import org.tizen.webuibuilder.model.page.IPageDataListener;
+import org.tizen.webuibuilder.model.page.PageData;
 import org.tizen.webuibuilder.model.page.PageDataEvent;
 import org.tizen.webuibuilder.ui.views.properties.CategoryComposite;
 import org.tizen.webuibuilder.ui.views.properties.PropertiesConstant;
@@ -163,13 +164,13 @@ public class CssStyleTab extends PropertiesTabItem implements IPageDataListener
      *            a {@link CssFile}
      */
     public CssStyleTab(CTabFolder tabFolder, CommandStack commandStack,
-            CssDescriptor cssDescriptor, CssFile cssFile, DesignerGoingBridge goingBridge) {
+            CssDescriptor cssDescriptor,  PageData pageData, CssFile cssFile, DesignerGoingBridge goingBridge) {
         super(tabFolder, SWT.NONE, TabIndex.STYLE.getIndex(), goingBridge);
         setText(PropertiesConstant.STYLE);
         this.commandStack = commandStack;
         this.cssDescriptor = cssDescriptor;
 
-        cssDelegater = new CssStyleEventDelegater(commandStack, cssDescriptor, this, goingBridge);
+        cssDelegater = new CssStyleEventDelegater(commandStack, cssDescriptor, this, pageData, goingBridge);
         animDelegater = new CssStyleAnimationEventDelegater(commandStack, this);
 
         setCssFile(cssFile);
@@ -360,27 +361,29 @@ public class CssStyleTab extends PropertiesTabItem implements IPageDataListener
             /* TODO Log */
             cssDelegater.setCssFile(cssFile);
             setDefaultSelector();
-            removeListeners();
-            addListeners();
             return true;
         } else {
             return false;
         }
     }
 
-    /**
-     * addListeners
-     */
-    private void addListeners() {
+    
+    private void addModelListener() {
         Part model = getModel();
         if (model != null) {
             model.addCssListener(animDelegater);
             model.addPartListener(cssDelegater);
-//            model.addCssListener(cssDelegater);
-
-            addCssListener();
+            model.addCssListener(cssDelegater);
+        }
+    }
+    
+    private void removeModelListener() {
+        Part model = getModel();
+        if (model != null) {
+            model.removeCssListener(animDelegater);
+            model.removePartListener(cssDelegater);
+            model.removeCssListener(cssDelegater);
         }
-
     }
 
     /**
@@ -400,21 +403,6 @@ public class CssStyleTab extends PropertiesTabItem implements IPageDataListener
     }
 
     /**
-     * removeListeners
-     */
-    private void removeListeners() {
-        Part model = getModel();
-        if (model != null) {
-            model.removeCssListener(animDelegater);
-            model.removePartListener(cssDelegater);
-//            model.removeCssListener(cssDelegater);
-        }
-
-        removeCssListener();
-
-    }
-
-    /**
      * removeCssListener
      */
     private void removeCssListener() {
@@ -438,7 +426,8 @@ public class CssStyleTab extends PropertiesTabItem implements IPageDataListener
      */
     @Override
     public void dispose() {
-        removeListeners();
+        removeModelListener();
+        removeCssListener();
         clear();
         noContent.dispose();
         multiContent.dispose();
@@ -467,8 +456,11 @@ public class CssStyleTab extends PropertiesTabItem implements IPageDataListener
             clip.setInitialData(getModel());
 
         setDefaultSelector();
-        removeListeners();
-        addListeners();
+        removeModelListener();
+        addModelListener();
+        
+//        removeListeners();
+//        addListeners();
 
         // delegater.setModel(models);
     }
@@ -515,8 +507,6 @@ public class CssStyleTab extends PropertiesTabItem implements IPageDataListener
 
         // CSS Delegater
         cssDelegater.setCssSelector(currentSelector);
-        removeListeners();
-        addListeners();
         
 //        if (cssCategory != null && !cssCategory.isDisposed()) {
 //            cssCategory.setSelector(selectorName);    
@@ -676,32 +666,32 @@ public class CssStyleTab extends PropertiesTabItem implements IPageDataListener
     }
     
     public void refreshPositionMethods() {
-        Part model = getModel();
-        if (model.getWidgetPosition() != null) {
-            String width , height;
-            width = model.getWidgetPosition().width + "px";
-            height = model.getWidgetPosition().height + "px";
-            
-            if (checkMethod(widthMethod)) {
-                widthMethod.refreshValue(widthMethod.getMethodName(), width);    
-            } 
-            
-            if (checkMethod(heightMethod)) {
-                heightMethod.refreshValue(heightMethod.getMethodName(), height);    
-            }
-            
-            if (checkMethod(metrics)) {
-                metrics.setInitialData(model);
-            }
-            
-            if (checkMethod(clip)) { 
-                clip.setInitialData(model);
-            }
-            
-            for (CategoryComposite category : categories) {
-                category.refreshBrief();
-            }
-        } 
+//        Part model = getModel();
+//        if (model.getWidgetPosition() != null) {
+//            String width , height;
+//            width = model.getWidgetPosition().width + "px";
+//            height = model.getWidgetPosition().height + "px";
+//            
+//            if (checkMethod(widthMethod)) {
+//                widthMethod.refreshValue(widthMethod.getMethodName(), width);    
+//            } 
+//            
+//            if (checkMethod(heightMethod)) {
+//                heightMethod.refreshValue(heightMethod.getMethodName(), height);    
+//            }
+//            
+//            if (checkMethod(metrics)) {
+//                metrics.setInitialData(model);
+//            }
+//            
+//            if (checkMethod(clip)) { 
+//                clip.setInitialData(model);
+//            }
+//            
+//            for (CategoryComposite category : categories) {
+//                category.refreshBrief();
+//            }
+//        } 
     }
     
     private boolean checkMethod(Method method) {
@@ -1485,6 +1475,9 @@ public class CssStyleTab extends PropertiesTabItem implements IPageDataListener
     public void pageChanged(PageDataEvent e) {
         if (setCssFile(e.getPage().getCurrentCssFile())) {
             refresh();
+            removeCssListener();
+            addCssListener();
+//            addListeners();
         }
 
     }
index 8c06391..f396b41 100644 (file)
@@ -32,7 +32,8 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
 public class DomUtil {
-       
+
+       public static final String BODY_ELEMENT = "//body";
 
        /**
         * @param doc
@@ -76,6 +77,16 @@ public class DomUtil {
        targetBodyNode.appendChild(pageNode);
     }
     
+    public static void insertBeforePageNode(Document targetDocument, String xpath, Node pageNode, Node refPageNode) {
+       Node targetBodyNode = getBodyNode(targetDocument, xpath);
+       
+       if(targetBodyNode == null) {
+               return;
+       }
+       
+       targetBodyNode.insertBefore(pageNode, refPageNode);
+    }
+    
     public static void removePageNode(Document targetDocument, String xpath, Node pageNode) {
        Node targetBodyNode = getBodyNode(targetDocument, xpath);
        
index 9e1b5cd..655a0ad 100644 (file)
@@ -1,3 +1,21 @@
+* 0.1.437
+- [Title] update version.
+== yonghwan.jeon <yonghwan82.jeon@samsung.com> 2014-05-19
+* 0.1.436
+- [Title] update version.
+== yonghwan.jeon <yonghwan82.jeon@samsung.com> 2014-05-19
+* 0.1.435
+- [Title] Remove duplicate pageView code in TizeIDE perspective.
+== yonghwan.jeon <yonghwan82.jeon@samsung.com> 2014-05-17
+* 0.1.434
+- [Title] Fix CssSelector managing on Part
+== nakyoung2.choi <nakyoung2.choi@samsung.com> 2014-05-17
+* 0.1.433
+- [Title] Modify QT library path in MACOS.
+== yonghwan.jeon <yonghwan82.jeon@samsung.com> 2014-05-16
+* 0.1.432
+- [Title] update version
+== yonghwan.jeon <yonghwan82.jeon@samsung.com> 2014-05-16
 * 0.1.431
 - [Title] update version
 == yonghwan.jeon <yonghwan82.jeon@samsung.com> 2014-05-15
index 6cb29a7..f848b5c 100644 (file)
@@ -1,5 +1,5 @@
 Package : web-ui-builder-eplugin
-Version :0.1.431
+Version :0.1.437
 OS : ubuntu-32
 Build-host-os : ubuntu-32
 Maintainer : Hoon Kang <h245.kang@samsung.com>
@@ -11,7 +11,7 @@ Source : web-ui-builder-eplugin
 Description : 
 
 Package : web-ui-builder-eplugin
-Version :0.1.431
+Version :0.1.437
 OS : ubuntu-64
 Build-host-os : ubuntu-64
 Maintainer : Hoon Kang <h245.kang@samsung.com>
@@ -23,7 +23,7 @@ Source : web-ui-builder-eplugin
 Description : 
 
 Package : web-ui-builder-eplugin
-Version :0.1.431
+Version :0.1.437
 OS : windows-32
 Build-host-os : ubuntu-32
 Maintainer : Hoon Kang <h245.kang@samsung.com>
@@ -35,7 +35,7 @@ Source : web-ui-builder-eplugin
 Description :
 
 Package : web-ui-builder-eplugin
-Version :0.1.431
+Version :0.1.437
 OS : windows-64
 Build-host-os : ubuntu-64
 Maintainer : Hoon Kang <h245.kang@samsung.com>
@@ -47,7 +47,7 @@ Source : web-ui-builder-eplugin
 Description :
 
 Package : web-ui-builder-eplugin
-Version :0.1.431
+Version :0.1.437
 OS : macos-64
 Build-host-os : ubuntu-64
 Maintainer : Hoon Kang <h245.kang@samsung.com>