DATABIND: Add the binding property for a list item 43/20643/2
authorjaeyeol lee <jaeyeol148.lee@samsung.com>
Sun, 11 May 2014 05:26:31 +0000 (14:26 +0900)
committerjaeyeol lee <jaeyeol148.lee@samsung.com>
Sun, 11 May 2014 05:28:49 +0000 (14:28 +0900)
Change-Id: Ia654acdbfab51d94e2e27dbc085ff7bb58ad9ca1
Signed-off-by: jaeyeol lee <jaeyeol148.lee@samsung.com>
org.tizen.webuibuilder/res/descriptors/Tizen-web-ui-fw/tizen.types.xml
org.tizen.webuibuilder/src/org/tizen/webuibuilder/BuilderConstants.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/policies/DesignerXYLayoutEditPolicy.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/DataBindingPage.java

index 57a9414..99a662e 100644 (file)
        </type>
 
        <type id="attrtext@databinding">
-               <constant value="attr" displayName="form"/>
-               <constant value="attr" displayName="for"/>
                <constant value="text" displayName=""/>
+               <constant value="attr" displayName="for"/>
+               <constant value="attr" displayName="form"/>
        </type>
 </types>
\ No newline at end of file
index 7106683..4563853 100644 (file)
@@ -253,6 +253,7 @@ public class BuilderConstants {
        // DataBinding
        public static final String DATABINDINGVIEW_DEFAULT_MESSAGE = "Data-Binding view is not available."; //$NON-NLS-1$
        public static final String DATABINDING_ARRAYITEM_VALUE_PREFIX = "$data."; //$NON-NLS-1$
+       public static final String DATABINDING_ARRAYITEM_VALUE_SUFFIX = ", attr: { 'data-index': $index }"; //$NON-NLS-1$
        public static final String DATABINDING_TYPE_STATIC = "Static"; //$NON-NLS-1$
        public static final String DATABINDING_TYPE_REMOTECALL = "Remote Call"; //$NON-NLS-1$
        
index 47ccfab..c14a2ce 100644 (file)
@@ -192,7 +192,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(property2, displayName, value, str);
+                                    final String info = makeInfoString(targetPart, property2, displayName, value, str);
                                     command =
                                             new SetPartPropertyCommand(targetPart, BuilderConstants.ATTRIBUTE_DATA_BIND,
                                                                        info);
@@ -219,7 +219,7 @@ public class DesignerXYLayoutEditPolicy extends HoverViewerXYLayoutEditPolicy {
     }
 
     
-    private String makeInfoString(PartProperty property2, String displayName, String value, String str) {
+    private String makeInfoString(Part targetPart, PartProperty property2, String displayName, String value, String str) {
         String string = "";
         
         if ((str != null) && (!str.isEmpty())) {
@@ -232,17 +232,21 @@ public class DesignerXYLayoutEditPolicy extends HoverViewerXYLayoutEditPolicy {
             }
             
             if ((displayName != null) && (!displayName.isEmpty())) {
-                bindingInfos.put(value+"-"+displayName, property2.getValue());
+                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 {
-                string = value + ": " + property2.getValue();
+                if (targetPart.getDescriptorId().equals("tizen.listitem")) {
+                    string = value + ": " + property2.getValue() + BuilderConstants.DATABINDING_ARRAYITEM_VALUE_SUFFIX;
+                } else {
+                    string = value + ": " + property2.getValue();
+                }
             }
         }
         
index 316977e..479a37c 100644 (file)
@@ -314,6 +314,7 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
                             if (parentPropertyValue != null) {
                                 addInfoTableItem(part, parentPropertyValue, part.getIdPropertyValue(),
                                                  key);
+                                break;
                             }
                         } else {
                             addInfoTableItem(part, modelValue, part.getIdPropertyValue(), key);
@@ -920,15 +921,19 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
             Part part = (Part) tableItem.getData("PART");
             String tableTypeValue = tableItem.getText(2);
             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) {
-                        if ((tableTypeValue != null) && (bindingType.toString().equals(tableTypeValue))) {
-                            bindingInfos.remove(bindingType);
-                            removeInfoTableItem(part, DataBindingTooltipParser.makeStringFromMap(bindingInfos));
+                if (part.getDescriptorId().equals("tizen.listitem")) {
+                    removeInfoTableItem(part, "");
+                } else {
+                    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) {
+                            if ((tableTypeValue != null) && (bindingType.toString().equals(tableTypeValue))) {
+                                bindingInfos.remove(bindingType);
+                                removeInfoTableItem(part, DataBindingTooltipParser.makeStringFromMap(bindingInfos));
+                            }
                         }
                     }
                 }