Combo Widget : modify image combo button 54/30154/1
authorheeyoung <heeyoung1008.hwang@samsung.com>
Wed, 12 Nov 2014 05:48:27 +0000 (14:48 +0900)
committerheeyoung <heeyoung1008.hwang@samsung.com>
Wed, 12 Nov 2014 05:48:27 +0000 (14:48 +0900)
Change-Id: I46a22d52720814d150ee7cc7d6d5c80d9dd3e9c3
Signed-off-by: heeyoung <heeyoung1008.hwang@samsung.com>
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomCombo.java

index 3ea7863..d4e81f4 100644 (file)
@@ -98,6 +98,7 @@ public class DACustomCombo extends Canvas {
        // combo button
        private int state = STATE_NORMAL; // 0 normal 1 hover 2 push 3 disable
        protected DACustomButtonAttribute attr;
+       private boolean showSelectedText = true;
        private IDACustomButtonRenderer comboRenderer = new DACustomComboRenderer();
 
        // arrow button
@@ -388,7 +389,6 @@ public class DACustomCombo extends Canvas {
                }
 
                getRects().clear();
-               Logger.debug("rects clear and add new rects. count is :" + boundSize);
                for (int i = 0; i < boundSize; i++) {
                        Rectangle r = new Rectangle(2, 2 + i * height, shellWidth - 2, height);
                        getRects().add(r);
@@ -460,8 +460,12 @@ public class DACustomCombo extends Canvas {
        }
 
        public void upEvent() {
-               if (getItems().size() > 0) {
-                       setText(getItems().get(itemIndex + selection));
+               if (isShowSelectedText()) {
+                       if (getItems().size() > 0) {
+                               setText(getItems().get(itemIndex + selection));
+                       }
+               } else if (null != attr.getText()) {
+                       setText(attr.getText());
                } else {
                        setText(DAWidgetConstants.EMPTY_STRING);
                }
@@ -608,9 +612,11 @@ public class DACustomCombo extends Canvas {
 
        public void select(int index) {
                selection = index;
-               String text = items.get(itemIndex + selection);
-               attr.setText(text);
-               this.setToolTipText(text);
+               if (isShowSelectedText()) {
+                       String text = items.get(itemIndex + selection);
+                       attr.setText(text);
+                       this.setToolTipText(text);
+               }
                redraw();
        }
 
@@ -937,4 +943,12 @@ public class DACustomCombo extends Canvas {
        public void setItemFontColor(Color itemFontColor) {
                this.itemFontColor = itemFontColor;
        }
+
+       public boolean isShowSelectedText() {
+               return showSelectedText;
+       }
+
+       public void setShowSelectedText(boolean showSelectedText) {
+               this.showSelectedText = showSelectedText;
+       }
 }