|
|
|
@ -14,11 +14,9 @@ import com.fr.design.gui.itextfield.UITextField;
|
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
import com.fr.general.FRFont; |
|
|
|
|
import com.fr.general.GeneralContext; |
|
|
|
|
import com.fr.general.IOUtils; |
|
|
|
|
import com.fr.report.stable.WorkSheetAttr; |
|
|
|
|
import com.fr.report.worksheet.WorkSheet; |
|
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
|
import com.fr.stable.ColumnRow; |
|
|
|
|
import com.fr.stable.Constants; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
@ -39,12 +37,10 @@ import java.awt.Graphics;
|
|
|
|
|
import java.awt.GridLayout; |
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
public class ReportColumnsPane extends BasicPane{ |
|
|
|
|
public static final int ROW = 0; |
|
|
|
|
public static final int COLUMN = 1; |
|
|
|
|
private static final List<String> LOCALE_LANGUAGE = ArrayUtils.toList(new String[]{"en"}); |
|
|
|
|
private int rowOrColumn; |
|
|
|
|
private boolean isRepeate; |
|
|
|
|
|
|
|
|
@ -62,7 +58,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Columns_Repeat_Row"), |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Columns_Repeat_Column") |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final String FONT_NAME = "simsun"; |
|
|
|
|
private static final int FONT_SIZE = 14; |
|
|
|
|
|
|
|
|
@ -91,7 +87,6 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
|
|
|
|
|
JPanel north = new JPanel(new BorderLayout()) { |
|
|
|
|
@Override |
|
|
|
|
public void paint(Graphics g) { |
|
|
|
|
super.paint(g); |
|
|
|
|
super.paintBorder(g); |
|
|
|
@ -127,7 +122,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
this.add(north, BorderLayout.NORTH); |
|
|
|
|
this.add(createRowColumnPane(), BorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ActionListener onOffListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
@ -225,7 +220,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
sampleLablePane.add(cPane); |
|
|
|
|
return sampleLablePane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ActionListener rowChangeListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
@ -238,7 +233,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ActionListener colChangeListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
@ -280,7 +275,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
RowMaxOrSetPane.add(setRowRadioPane); |
|
|
|
|
return RowMaxOrSetPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ActionListener toXBtnListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
@ -293,7 +288,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ActionListener maxBtnListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
@ -315,39 +310,27 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column_Area")); |
|
|
|
|
rowPane.setBorder(explainBorder); |
|
|
|
|
rowPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5,13)); |
|
|
|
|
// Yvan: REPORT-37398 判断设计器语言是否为英文
|
|
|
|
|
if (LOCALE_LANGUAGE.contains(GeneralContext.getLocale().getLanguage())) { |
|
|
|
|
// 如果是英文,需要为这个panel设置更大的height,否则显示不全
|
|
|
|
|
rowPane.setPreferredSize(new Dimension(500,135)); |
|
|
|
|
} else { |
|
|
|
|
// 其它语言环境下也需要将height调高一点点,因为后面将组件分块了,如果不调整height会造成上下间距不等
|
|
|
|
|
rowPane.setPreferredSize(new Dimension(500,90)); |
|
|
|
|
} |
|
|
|
|
// 将组件分成两块,分别装在各自的JPanel中,然后把两个JPanel添加到rowPane中,第二个JPanel放不下时会自动换行
|
|
|
|
|
// 左边的JPanel:分栏数据
|
|
|
|
|
JPanel multiData = new JPanel(); |
|
|
|
|
multiData.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column_Data") + ":")); |
|
|
|
|
rowPane.setPreferredSize(new Dimension(500,80)); |
|
|
|
|
rowPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column_Data") + ":")); |
|
|
|
|
repeatColDataTextField = new UITextField(); |
|
|
|
|
repeatColDataTextField.setPreferredSize(new Dimension(107,24)); |
|
|
|
|
multiData.add(repeatColDataTextField); |
|
|
|
|
multiData.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": A2:D5 ")); |
|
|
|
|
// 右边的JPanel:复制行序列
|
|
|
|
|
JPanel copyRowSequence = new JPanel(); |
|
|
|
|
rowPane.add(repeatColDataTextField); |
|
|
|
|
rowPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": A2:D5 ")); |
|
|
|
|
copyLabel = new UILabel(REPORT_COLUMN_RAPEAT[rowOrColumn] + ":"); |
|
|
|
|
copyRowSequence.add(copyLabel); |
|
|
|
|
rowPane.add(copyLabel); |
|
|
|
|
|
|
|
|
|
copyTitleTextField = new UITextField(); |
|
|
|
|
copyTitleTextField.setPreferredSize(new Dimension(107,24)); |
|
|
|
|
copyRowSequence.add(copyTitleTextField); |
|
|
|
|
copyRowSequence.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": 1,2-3,5,18")); |
|
|
|
|
// 添加JPanel
|
|
|
|
|
rowPane.add(multiData); |
|
|
|
|
rowPane.add(copyRowSequence); |
|
|
|
|
rowPane.add(copyTitleTextField); |
|
|
|
|
rowPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": 1,2-3,5,18")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return rowPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 从worksheetAttr中populate数据给界面 |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param attr 当前ElementCase的worksheet属性 |
|
|
|
|
* @param rowCount 总行数 |
|
|
|
|
* @param colCount 总列数 |
|
|
|
@ -372,7 +355,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
colOrRowConvert(); |
|
|
|
|
checkEnable(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* populate列分栏数据 |
|
|
|
|
*/ |
|
|
|
@ -393,7 +376,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
this.maxNumberSpinner.setEnabled(true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* populate行分栏 |
|
|
|
|
*/ |
|
|
|
@ -417,7 +400,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 从worksheet中populate数据 |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param worksheet 当前worksheet |
|
|
|
|
*/ |
|
|
|
|
public void populate(WorkSheet worksheet) { |
|
|
|
@ -439,11 +422,11 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
private void setValueText(WorkSheetAttr attr, int rowCount, int colCount, UITextField repeatColDataTextField, |
|
|
|
|
UITextField copyTitleTextField, UICheckBox showBlankCheckBox) { |
|
|
|
|
int startRow,endRow = -1,startColumn,endColumn = -1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(attr.getStartIndex() == -1 && attr.getEndIndex() == -1){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (attr.getDirection() == ROW) { |
|
|
|
|
startRow = attr.getStartIndex(); |
|
|
|
|
endRow = attr.getEndIndex() == -1 ? rowCount - 1 : attr.getEndIndex(); |
|
|
|
@ -455,13 +438,13 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
startColumn = attr.getStartIndex(); |
|
|
|
|
endColumn = attr.getEndIndex() == -1 ? colCount - 1 : attr.getEndIndex(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
repeatColDataTextField.setText(ColumnRow.valueOf(startColumn, startRow).toString() +":" |
|
|
|
|
+ ColumnRow.valueOf(endColumn, endRow).toString()); |
|
|
|
|
copyTitleTextField.setText(attr.getIndexsToCopy()); |
|
|
|
|
showBlankCheckBox.setSelected(attr.isShowBlank()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* update行数据 |
|
|
|
|
*/ |
|
|
|
@ -480,7 +463,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* update列数据 |
|
|
|
|
*/ |
|
|
|
@ -499,7 +482,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* update数据给WorksheetAttr |
|
|
|
|
* |
|
|
|
@ -508,8 +491,8 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
if (!isRepeate) { |
|
|
|
|
attr.setDirection(Constants.NONE); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch (rowOrColumn) { |
|
|
|
|
case ROW: |
|
|
|
|
updateRow(attr); |
|
|
|
@ -527,7 +510,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* update数据给worksheet |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param worksheet 当前worksheet |
|
|
|
|
*/ |
|
|
|
|
public void update(WorkSheet worksheet) { |
|
|
|
@ -544,7 +527,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 从界面中赋值给WorkSheetAttr |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param attr 报表分栏属性 |
|
|
|
|
* @param repeatColDataTextField 从哪行开始复制 |
|
|
|
|
* @param copyTitleTextField 复制列序列 |
|
|
|
@ -577,7 +560,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
attr.setIndexsToCopy(copyTitleTextField.getText()); |
|
|
|
|
attr.setShowBlank(showBlankCheckBox.isSelected()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 判断输入是否合法 |
|
|
|
@ -588,7 +571,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
if(StringUtils.isEmpty(repeatText)){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean valid = true; |
|
|
|
|
if(!repeatText.matches("[a-zA-Z]+[0-9]+[:][a-zA-Z]+[0-9]+")){ |
|
|
|
|
valid = false; |
|
|
|
|