[SRADA-950] Fix the cut word in feature dialog.
authorjoon.c.baek <joon.c.baek@samsung.com>
Fri, 22 Jul 2016 07:33:29 +0000 (16:33 +0900)
committergihun chang <gihun.chang@samsung.com>
Fri, 22 Jul 2016 08:21:03 +0000 (17:21 +0900)
Change-Id: I4aa175629d48e53e42572785d3447964e72c51d6
Signed-off-by: joon.c.baek <joon.c.baek@samsung.com>
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomFeatureToggleButtonRenderer.java

index a463aa3..1eeb848 100644 (file)
@@ -181,16 +181,20 @@ public class DACustomFeatureToggleButtonRenderer extends DACustomButtonRenderer
                        // TODO: Hardcorded layout value should be replaced to symbol
                        x = 22 + 70 + 28; y = 30 + 10 + 9;
                        int pixSize = gc.getFontMetrics().getAverageCharWidth();
-                       int index = 0;
-                       int beginIndex = 0;
-                       int endIndex = 0;
+                       int index = 0, prevIndex = -1, beginIndex = 0, endIndex = 0;
 
                        for(char Char : text.toCharArray()){
                                index++;
-                               if((index - endIndex) * pixSize > textRect.width - 140){  /// need to re calculate "textRect.width - 200" its rect size for description.
-                                       endIndex = index;
-                                       dispText.add(text.substring(beginIndex, endIndex));
-                                       beginIndex = index;
+                               if (Char == ' ') {
+                                       if ((index - beginIndex) * pixSize > textRect.width - 140) {
+                                               endIndex = prevIndex;
+                                               dispText.add(text.substring(beginIndex, endIndex));
+                                               beginIndex = endIndex+1;
+                                               prevIndex = index - 1;
+                                       }
+                                       else {
+                                               prevIndex = index - 1;
+                                       }
                                }
                        }
                        if(index > endIndex){