Browse Source

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

Merge in DESIGN/design from ~YYMING/design:release/10.0 to release/10.0

* commit '5ab88bc56c0061fd424526220aaedf75e6d1704c':
  REPORT-39642 设计器菜单栏-服务器-预定义样式-格式修改错误
feature/big-screen
Yyming 4 years ago
parent
commit
f5b365a788
  1. 46
      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

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

@ -45,7 +45,7 @@ import java.util.Date;
*/ */
public class FormatPane extends BasicPane { public class FormatPane extends BasicPane {
private static final long serialVersionUID = 724330854437726751L; private static final long serialVersionUID = 724330854437726751L;
private Format format; private Format format;
private UILabel sampleLabel; //preview label. private UILabel sampleLabel; //preview label.
private UIRadioButton nullRadioButton; private UIRadioButton nullRadioButton;
@ -59,14 +59,14 @@ public class FormatPane extends BasicPane {
//content pane. //content pane.
private UITextField patternTextField = null; private UITextField patternTextField = null;
private JList patternList = null; private JList patternList = null;
/** /**
* Constructor. * Constructor.
*/ */
public FormatPane() { public FormatPane() {
this.initComponents(); this.initComponents();
} }
public UILabel getSampleLabel() { public UILabel getSampleLabel() {
return sampleLabel; return sampleLabel;
} }
@ -74,7 +74,7 @@ public class FormatPane extends BasicPane {
public void setSampleLabel(UILabel sampleLabel) { public void setSampleLabel(UILabel sampleLabel) {
this.sampleLabel = sampleLabel; this.sampleLabel = sampleLabel;
} }
protected void initComponents() { protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
@ -172,7 +172,7 @@ public class FormatPane extends BasicPane {
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style");
} }
/** /**
* Populate * Populate
*/ */
@ -185,17 +185,17 @@ public class FormatPane extends BasicPane {
} else { } else {
if (format instanceof DecimalFormat) { if (format instanceof DecimalFormat) {
checkDecimalFormat(); checkDecimalFormat();
} else if (format instanceof SimpleDateFormat) { } else if (format instanceof SimpleDateFormat) {
//date and time //date and time
checkDateFormat(); checkDateFormat();
} else if (format instanceof TextFormat) { } else if (format instanceof TextFormat) {
//Text //Text
this.textRadioButton.setSelected(true); this.textRadioButton.setSelected(true);
this.applyRadioActionListener(this.textRadioButton); this.applyRadioActionListener(this.textRadioButton);
} }
} }
} }
private void checkDateFormat() { private void checkDateFormat() {
String pattern = ((SimpleDateFormat) format).toPattern(); String pattern = ((SimpleDateFormat) format).toPattern();
if(pattern == null) { if(pattern == null) {
@ -276,7 +276,7 @@ public class FormatPane extends BasicPane {
} }
} }
} }
/** /**
* 百分比面板 * 百分比面板
*/ */
@ -296,7 +296,7 @@ public class FormatPane extends BasicPane {
/** /**
* 是否属于数组中的列表样式 * 是否属于数组中的列表样式
* *
* @param stringArray 格式数组 * @param stringArray 格式数组
* @param pattern 输入的格式 * @param pattern 输入的格式
* @return 返回在数组中的位置 * @return 返回在数组中的位置
@ -323,7 +323,7 @@ public class FormatPane extends BasicPane {
} }
return FormatField.getInstance().getFormat(getFormatContents(), text); return FormatField.getInstance().getFormat(getFormatContents(), text);
} }
private int getFormatContents(){ private int getFormatContents(){
if (nullRadioButton.isSelected()) if (nullRadioButton.isSelected())
return FormatContents.NULL; return FormatContents.NULL;
@ -335,7 +335,7 @@ public class FormatPane extends BasicPane {
return FormatContents.PERCENT; return FormatContents.PERCENT;
else if (scientificRadioButton.isSelected()) else if (scientificRadioButton.isSelected())
return FormatContents.SCIENTIFIC; return FormatContents.SCIENTIFIC;
else if (dateRadioButton.isSelected()) else if (dateRadioButton.isSelected())
return FormatContents.DATE; return FormatContents.DATE;
else if (timeRadioButton.isSelected()) else if (timeRadioButton.isSelected())
return FormatContents.TIME; return FormatContents.TIME;
@ -380,7 +380,7 @@ public class FormatPane extends BasicPane {
ActionEvent evt = new ActionEvent(radioButton, 100, ""); ActionEvent evt = new ActionEvent(radioButton, 100, "");
this.radioActionListener.actionPerformed(evt); this.radioActionListener.actionPerformed(evt);
} }
/** /**
* Radio selection listener. * Radio selection listener.
*/ */
@ -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);
} }
@ -459,7 +465,7 @@ public class FormatPane extends BasicPane {
} }
return contents; return contents;
} }
/** /**
* text pattern document listener. * text pattern document listener.
*/ */
@ -477,7 +483,7 @@ public class FormatPane extends BasicPane {
refreshPreviewLabel(); refreshPreviewLabel();
} }
}; };
/** /**
* Pattern list selection listener. * Pattern list selection listener.
*/ */
@ -487,5 +493,5 @@ public class FormatPane extends BasicPane {
patternTextField.setText((String) patternList.getSelectedValue()); patternTextField.setText((String) patternList.getSelectedValue());
} }
}; };
} }

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