Browse Source

REPORT-39642 设计器菜单栏-服务器-预定义样式-格式修改错误

feature/big-screen
Yyming 4 years ago
parent
commit
219b1574e0
  1. 10
      designer-base/src/main/java/com/fr/design/style/FormatPane.java
  2. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

10
designer-base/src/main/java/com/fr/design/style/FormatPane.java

@ -393,6 +393,7 @@ public class FormatPane extends BasicPane {
patternTextField.setEditable(true); patternTextField.setEditable(true);
patternList.setEnabled(true); patternList.setEnabled(true);
int contents = getContents(source); int contents = getContents(source);
String[] patternArray = FormatField.getInstance().getFormatArray(contents); String[] patternArray = FormatField.getInstance().getFormatArray(contents);
@ -407,6 +408,7 @@ public class FormatPane extends BasicPane {
//maybe need to select the first item. //maybe need to select the first item.
String text = patternTextField.getText(); String text = patternTextField.getText();
if (hasPattenText(text, patternModel)) { if (hasPattenText(text, patternModel)) {
String pattern = null; String pattern = null;
if (format instanceof DecimalFormat) { if (format instanceof DecimalFormat) {
@ -418,6 +420,10 @@ public class FormatPane extends BasicPane {
if (pattern != null) { if (pattern != null) {
patternList.setSelectedValue(pattern, true); patternList.setSelectedValue(pattern, true);
if (patternList.getSelectedIndex() == -1) {
//patten不在下拉框里面
patternList.setSelectedIndex(0);
}
} else { } else {
patternList.setSelectedIndex(0); patternList.setSelectedIndex(0);
} }
@ -426,13 +432,13 @@ public class FormatPane extends BasicPane {
}; };
private boolean hasPattenText (String text, DefaultListModel patternModel) { private boolean hasPattenText (String text, DefaultListModel patternModel) {
return (text == null || text.length() <= 0) && patternModel.size() > 0; return StringUtils.isEmpty(text) && patternModel.size() > 0;
} }
private void setPatternTextEnable() { private void setPatternTextEnable() {
patternTextField.setEnabled(false); patternTextField.setEnabled(false);
patternTextField.setEditable(false); patternTextField.setEditable(false);
patternTextField.setText(""); patternTextField.setText(StringUtils.EMPTY);
patternList.setEnabled(false); patternList.setEnabled(false);
} }

2
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

@ -61,7 +61,7 @@ public class StylePane extends UIComboBoxPane<Style> {
@Override @Override
protected List<FurtherBasicBeanPane<? extends Style>> initPaneList() { protected List<FurtherBasicBeanPane<? extends Style>> initPaneList() {
List<FurtherBasicBeanPane<? extends Style>> paneList = new ArrayList<FurtherBasicBeanPane<? extends Style>>(); List<FurtherBasicBeanPane<? extends Style>> paneList = new ArrayList<>();
paneList.add(customStylePane = new CustomStylePane()); paneList.add(customStylePane = new CustomStylePane());
paneList.add(predefinedStylePane = new PredefinedStylePane()); paneList.add(predefinedStylePane = new PredefinedStylePane());
return paneList; return paneList;

Loading…
Cancel
Save