// 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
}
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);
}
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);
}
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();
}
public void setItemFontColor(Color itemFontColor) {
this.itemFontColor = itemFontColor;
}
+
+ public boolean isShowSelectedText() {
+ return showSelectedText;
+ }
+
+ public void setShowSelectedText(boolean showSelectedText) {
+ this.showSelectedText = showSelectedText;
+ }
}