Browse Source

REPORT-37398 非中文设计器-英文下,报表分栏显示不全

主要修改:
1. bug原因是英文环境下一行放不下太多组件,所以被挤掉了,解决办法是增加判断,当系统语言是英文,就增大界面的高度,并将组件按照需求分块,分别用JPanel装起来,这样当第二个JPanel放不下就会自动换行,不会出现显示不全的问题
2. 由于将组件分块了,所以其他语言环境下,界面的高度也需要进行微调
3. 修改了一些代码规范问题
feature/big-screen
Yvan 4 years ago
parent
commit
52175cdf48
  1. 11
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  2. 2
      designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java
  3. 35
      designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java

11
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -1206,15 +1206,4 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
super.whenClose();
reportComposite.doRemoveAction();
}
/**
* 更新滚动条的值(主要是为了重置滚动条里的BoundedRangeModel的extent值)使滚动条的宽度随着界面缩放而变化
*/
protected void updateScrollValue() {
ElementCasePane elementCasePane = reportComposite.centerCardPane.editingComponet.elementCasePane;
DynamicScrollBar verticalScrollBar = (DynamicScrollBar) elementCasePane.getVerticalScrollBar();
DynamicScrollBar horizontalScrollBar = (DynamicScrollBar) elementCasePane.getHorizontalScrollBar();
verticalScrollBar.setValue(verticalScrollBar.getValue());
horizontalScrollBar.setValue(horizontalScrollBar.getValue());
}
}

2
designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java

@ -88,8 +88,6 @@ public class ReportComponentComposite extends JComponent implements RemoveListen
value = value < MIN ? MIN : value;
int resolution = (int) (ScreenResolution.getScreenResolution() * value / HUND);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
//更新滚动条值,使之随着界面缩放
parent.updateScrollValue();
}
};

35
designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java

@ -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;
@ -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);
@ -310,21 +313,33 @@ 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;
}

Loading…
Cancel
Save