|
|
|
@ -14,6 +14,7 @@ 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; |
|
|
|
@ -41,6 +42,7 @@ import java.awt.event.ActionListener;
|
|
|
|
|
public class ReportColumnsPane extends BasicPane{ |
|
|
|
|
public static final int ROW = 0; |
|
|
|
|
public static final int COLUMN = 1; |
|
|
|
|
private static final String LOCALE_LANGUAGE_EN = "en"; |
|
|
|
|
private int rowOrColumn; |
|
|
|
|
private boolean isRepeate; |
|
|
|
|
|
|
|
|
@ -58,7 +60,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; |
|
|
|
|
|
|
|
|
@ -87,6 +89,7 @@ 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); |
|
|
|
@ -122,7 +125,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) { |
|
|
|
@ -220,7 +223,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
sampleLablePane.add(cPane); |
|
|
|
|
return sampleLablePane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ActionListener rowChangeListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
@ -233,7 +236,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ActionListener colChangeListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
@ -275,7 +278,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
RowMaxOrSetPane.add(setRowRadioPane); |
|
|
|
|
return RowMaxOrSetPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ActionListener toXBtnListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
@ -288,7 +291,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ActionListener maxBtnListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
@ -310,27 +313,39 @@ 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)); |
|
|
|
|
rowPane.setPreferredSize(new Dimension(500,80)); |
|
|
|
|
rowPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column_Data") + ":")); |
|
|
|
|
// Yvan: REPORT-37398 判断设计器语言是否为英文
|
|
|
|
|
if (StringUtils.equals(GeneralContext.getLocale().getLanguage(), LOCALE_LANGUAGE_EN)) { |
|
|
|
|
// 如果是英文,需要为这个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") + ":")); |
|
|
|
|
repeatColDataTextField = new UITextField(); |
|
|
|
|
repeatColDataTextField.setPreferredSize(new Dimension(107,24)); |
|
|
|
|
rowPane.add(repeatColDataTextField); |
|
|
|
|
rowPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": A2:D5 ")); |
|
|
|
|
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(); |
|
|
|
|
copyLabel = new UILabel(REPORT_COLUMN_RAPEAT[rowOrColumn] + ":"); |
|
|
|
|
rowPane.add(copyLabel); |
|
|
|
|
|
|
|
|
|
copyRowSequence.add(copyLabel); |
|
|
|
|
copyTitleTextField = new UITextField(); |
|
|
|
|
copyTitleTextField.setPreferredSize(new Dimension(107,24)); |
|
|
|
|
rowPane.add(copyTitleTextField); |
|
|
|
|
rowPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": 1,2-3,5,18")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
return rowPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 从worksheetAttr中populate数据给界面 |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param attr 当前ElementCase的worksheet属性 |
|
|
|
|
* @param rowCount 总行数 |
|
|
|
|
* @param colCount 总列数 |
|
|
|
@ -355,7 +370,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
colOrRowConvert(); |
|
|
|
|
checkEnable(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* populate列分栏数据 |
|
|
|
|
*/ |
|
|
|
@ -376,7 +391,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
this.maxNumberSpinner.setEnabled(true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* populate行分栏 |
|
|
|
|
*/ |
|
|
|
@ -400,7 +415,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 从worksheet中populate数据 |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param worksheet 当前worksheet |
|
|
|
|
*/ |
|
|
|
|
public void populate(WorkSheet worksheet) { |
|
|
|
@ -422,11 +437,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(); |
|
|
|
@ -438,13 +453,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行数据 |
|
|
|
|
*/ |
|
|
|
@ -463,7 +478,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* update列数据 |
|
|
|
|
*/ |
|
|
|
@ -482,7 +497,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* update数据给WorksheetAttr |
|
|
|
|
* |
|
|
|
@ -491,8 +506,8 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
if (!isRepeate) { |
|
|
|
|
attr.setDirection(Constants.NONE); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch (rowOrColumn) { |
|
|
|
|
case ROW: |
|
|
|
|
updateRow(attr); |
|
|
|
@ -510,7 +525,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* update数据给worksheet |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param worksheet 当前worksheet |
|
|
|
|
*/ |
|
|
|
|
public void update(WorkSheet worksheet) { |
|
|
|
@ -527,7 +542,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 从界面中赋值给WorkSheetAttr |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param attr 报表分栏属性 |
|
|
|
|
* @param repeatColDataTextField 从哪行开始复制 |
|
|
|
|
* @param copyTitleTextField 复制列序列 |
|
|
|
@ -560,7 +575,7 @@ public class ReportColumnsPane extends BasicPane{
|
|
|
|
|
attr.setIndexsToCopy(copyTitleTextField.getText()); |
|
|
|
|
attr.setShowBlank(showBlankCheckBox.isSelected()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 判断输入是否合法 |
|
|
|
@ -571,7 +586,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; |
|
|
|
|