PL-10666 Desktop TokenList loses captions for the add/clear buttons while switching inline/simple/position settings

This commit is contained in:
Daniil Tsarev 2018-04-13 13:08:56 +04:00
parent 9d1f5c5073
commit 83ac757194

View File

@ -117,17 +117,25 @@ public class DesktopTokenList extends DesktopAbstractField<JPanel> implements To
// stub // stub
protected String lookupInputPrompt; protected String lookupInputPrompt;
protected String addButtonCaption;
protected String clearButtonCaption;
public DesktopTokenList() { public DesktopTokenList() {
rootPanel = new TokenListImpl(); rootPanel = new TokenListImpl();
impl = rootPanel.getImpl(); impl = rootPanel.getImpl();
addButton = new DesktopButton();
Messages messages = AppBeans.get(Messages.NAME); Messages messages = AppBeans.get(Messages.NAME);
addButton.setCaption(messages.getMessage(TokenList.class, "actions.Add"));
addButton = new DesktopButton();
addButtonCaption = messages.getMessage(TokenList.class, "actions.Add");
addButton.setCaption(addButtonCaption);
clearButton = new DesktopButton(); clearButton = new DesktopButton();
clearButton.setCaption(messages.getMessage(TokenList.class, "actions.Clear"));
clearButtonCaption = messages.getMessage(TokenList.class, "actions.Clear");
clearButton.setCaption(clearButtonCaption);
lookupPickerField = new DesktopLookupPickerField(); lookupPickerField = new DesktopLookupPickerField();
lookupPickerField.addValueChangeListener(lookupSelectListener); lookupPickerField.addValueChangeListener(lookupSelectListener);
@ -487,6 +495,7 @@ public class DesktopTokenList extends DesktopAbstractField<JPanel> implements To
@Override @Override
public void setAddButtonCaption(String caption) { public void setAddButtonCaption(String caption) {
addButtonCaption = caption;
addButton.setCaption(caption); addButton.setCaption(caption);
} }
@ -507,6 +516,7 @@ public class DesktopTokenList extends DesktopAbstractField<JPanel> implements To
@Override @Override
public void setClearButtonCaption(String caption) { public void setClearButtonCaption(String caption) {
clearButtonCaption = caption;
clearButton.setCaption(caption); clearButton.setCaption(caption);
} }
@ -852,7 +862,7 @@ public class DesktopTokenList extends DesktopAbstractField<JPanel> implements To
@Override @Override
public String getCaption() { public String getCaption() {
return addButton.getCaption(); return addButtonCaption;
} }
@Override @Override
@ -1043,7 +1053,7 @@ public class DesktopTokenList extends DesktopAbstractField<JPanel> implements To
clearButton.setAction(new AbstractAction("actions.Clear") { clearButton.setAction(new AbstractAction("actions.Clear") {
@Override @Override
public String getCaption() { public String getCaption() {
return clearButton.getCaption(); return clearButtonCaption;
} }
@Override @Override