Browse Source

Merge pull request #10442 in DESIGN/design from release/11.0 to bugfix/11.0

* commit '7dd12510148f19ff66a6874acf94c4f6fd42647e':
  REPORT-79296 报表引擎属性显示不全 【问题原因】未考虑i8n英文环境下的Label自动换行 【改动思路】将涉及到的Label自动换行处理,略修改了原代码创建panel的布局方式,实际显示效果无变化。 【Review建议】
  REPORT-82110 设计器取色bug 【问题原因】取色器ColorPicker取色是基于截屏后读取颜色的,因此需确保弹出框全部关闭后截屏。 【改动思路】1、取色前添加hidePopupMenu的操作 2、使用invokeLater确保异步任务执行完成后截屏 3、为规避REPORT-25645的macOS适配问题,新增hidePopupMenu4PickColor的方法 【Review建议】
  REPORT-82110 设计器取色bug 【问题原因】取色器ColorPicker取色是基于截屏后读取颜色的,因此需确保弹出框全部关闭后截屏。 【改动思路】1、取色前添加hidePopupMenu的操作 2、使用invokeLater确保异步任务执行完成后截屏 3、为避免REPORT-25645的macOS适配问题,新增hidePopupMenu4PickColor的方法 【Review建议】
bugfix/11.0
superman 2 years ago
parent
commit
0a88a8666c
  1. 10
      designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java
  2. 11
      designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java
  3. 79
      designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java

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

@ -67,16 +67,10 @@ public class ColorPicker extends JDialog implements ActionListener {
hideCursor(); hideCursor();
// 如果要求实时变化,确保先关闭弹窗,再截屏 // 如果要求实时变化,确保先关闭弹窗,再截屏
// 主要针对"图案"选项卡中的"前景"、"背景"
if (this.setColorRealTime) { if (this.setColorRealTime) {
colorSelectable.setColor(Color.WHITE); // setColor 可以关闭弹窗 colorSelectable.setColor(Color.WHITE); // setColor 可以关闭弹窗
try { // REPORT-82110 确保关闭所有弹窗后截屏
Thread.sleep(100); // 等待弹窗关闭 SwingUtilities.invokeLater(colorPickerPanel :: captureScreen);
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
}
colorPickerPanel.captureScreen();
} }
} }

11
designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java

@ -153,12 +153,23 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
popupWin = null; popupWin = null;
} }
/**
* 取色器取色时隐藏弹出框与另一个hide的区别是无需经过macOS的判断以规避REPORT-25645的mac适配bug
*/
public void hidePopupMenu4PickColor() {
if (popupWin != null) {
popupWin.setVisible(false);
}
popupWin = null;
}
private ColorControlWindow getColorControlWindow() { private ColorControlWindow getColorControlWindow() {
//find parant. //find parant.
if (this.popupWin == null) { if (this.popupWin == null) {
this.popupWin = new ColorControlWindow(this.isCanBeNull(), UIToolbarColorButton.this) { this.popupWin = new ColorControlWindow(this.isCanBeNull(), UIToolbarColorButton.this) {
@Override @Override
protected void colorChanged() { protected void colorChanged() {
hidePopupMenu4PickColor();
UIToolbarColorButton.this.setColor(this.getColor()); UIToolbarColorButton.this.setColor(this.getColor());
} }

79
designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java

@ -12,12 +12,14 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import com.fr.report.stable.LayerReportAttr; import com.fr.report.stable.LayerReportAttr;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import javax.swing.AbstractButton; import javax.swing.AbstractButton;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup; import javax.swing.ButtonGroup;
@ -26,13 +28,11 @@ import javax.swing.JLayeredPane;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JRadioButton; import javax.swing.JRadioButton;
import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -86,7 +86,7 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
outAdvicePane.add(createAdvicePane()); outAdvicePane.add(createAdvicePane());
} }
private JPanel createReportEnginePane(){ private JPanel createReportEnginePane() {
JPanel reportEnginePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); JPanel reportEnginePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
JPanel clientPagingPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel clientPagingPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
clientPaging = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Enable_Client_Page")); clientPaging = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Enable_Client_Page"));
@ -102,7 +102,7 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
return reportEnginePane; return reportEnginePane;
} }
private JPanel createPagingEngineSelectPane(){ private JPanel createPagingEngineSelectPane() {
engineSettingPane = new JLayeredPane(); engineSettingPane = new JLayeredPane();
engineSettingPane.setPreferredSize(new Dimension(570, 240)); engineSettingPane.setPreferredSize(new Dimension(570, 240));
engineSettingPane.setBounds(0, 0, 570, 240); engineSettingPane.setBounds(0, 0, 570, 240);
@ -121,8 +121,8 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
/** /**
* 目前先屏蔽后面新引擎显示页码再加上相关代码 * 目前先屏蔽后面新引擎显示页码再加上相关代码
* */ */
private void createEngineXSettingPane(){ private void createEngineXSettingPane() {
outEngineXSettingPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_New_Engine")); outEngineXSettingPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_New_Engine"));
outEngineXSettingPane.setBounds(0, 0, 570, 240); outEngineXSettingPane.setBounds(0, 0, 570, 240);
JPanel engineXSettingPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); JPanel engineXSettingPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
@ -146,7 +146,7 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
outEngineXSettingPane.add(engineXSettingPane); outEngineXSettingPane.add(engineXSettingPane);
} }
private void createLineEngineSettingPane(){ private void createLineEngineSettingPane() {
outLineEngineSettingPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Line_Engine")); outLineEngineSettingPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Line_Engine"));
outLineEngineSettingPane.setBounds(0, 0, 570, 240); outLineEngineSettingPane.setBounds(0, 0, 570, 240);
JPanel lineEngineSettingPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); JPanel lineEngineSettingPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
@ -166,9 +166,9 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
outLineEngineSettingPane.add(lineEngineSettingPane); outLineEngineSettingPane.add(lineEngineSettingPane);
} }
private JPanel createTipPane(String tipText){ private JPanel createTipPane(String tipText) {
JPanel tipPane = new JPanel(); JPanel tipPane = new JPanel();
UILabel tip = new UILabel(tipText, SwingConstants.LEFT); UILabel tip = FRWidgetFactory.createLineWrapLabel(tipText, 420);
tip.setForeground(new Color(128, 128, 128)); tip.setForeground(new Color(128, 128, 128));
tipPane.add(tip); tipPane.add(tip);
return tipPane; return tipPane;
@ -184,20 +184,19 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
return pageQueryPane; return pageQueryPane;
} }
private JPanel createAdvicePane(){ private JPanel createAdvicePane() {
JPanel advicePane = new JPanel(new BorderLayout()); JPanel advicePane = new JPanel(FRGUIPaneFactory.create1ColumnGridLayout());
FRExplainLabel topExplainLabel = new FRExplainLabel(Toolkit.i18nText("Fine-Design_Report_Report_Engine_Warnning_Info")); // 上侧文字
advicePane.add(topExplainLabel, BorderLayout.NORTH); UILabel topExplainLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Report_Report_Engine_Warnning_Info"), 480);
topExplainLabel.setForeground(new Color(0, 0, 0)); topExplainLabel.setForeground(new Color(0, 0, 0));
FlowLayout flowLayout = new FlowLayout(FlowLayout.LEADING); advicePane.add(topExplainLabel);
flowLayout.setHgap(0); // 下侧文字及链接
flowLayout.setVgap(0); JPanel adviceDownPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
JPanel adviceDownPane = new JPanel(flowLayout); advicePane.add(adviceDownPane);
advicePane.add(adviceDownPane, BorderLayout.CENTER); UILabel downExplainLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Report_Detail_Reference"));
FRExplainLabel downExplainLabel = new FRExplainLabel(Toolkit.i18nText("Fine-Design_Report_Report_Detail_Reference"));
adviceDownPane.add(downExplainLabel); adviceDownPane.add(downExplainLabel);
downExplainLabel.setForeground(new Color(0, 0, 0)); downExplainLabel.setForeground(new Color(0, 0, 0));
JLabel helper = new FRExplainLabel( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help")); JLabel helper = new FRExplainLabel(Toolkit.i18nText("Fine-Design_Report_Community_Help"));
helper.setForeground(new Color(1, 159, 222)); helper.setForeground(new Color(1, 159, 222));
adviceDownPane.add(helper); adviceDownPane.add(helper);
helper.addMouseListener(new MouseAdapter() { helper.addMouseListener(new MouseAdapter() {
@ -213,7 +212,7 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
return advicePane; return advicePane;
} }
private JPanel createPagingEngineRadioPanel(){ private JPanel createPagingEngineRadioPanel() {
UIRadioButton newEngine = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_New_Engine"), true); UIRadioButton newEngine = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_New_Engine"), true);
UIRadioButton lineEngine = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Line_Engine"), false); UIRadioButton lineEngine = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Line_Engine"), false);
ButtonGroup buttonGroup = new ButtonGroup(); ButtonGroup buttonGroup = new ButtonGroup();
@ -225,7 +224,7 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
double[] rowSize = {p}; double[] rowSize = {p};
double[] columnSize = {p, p, p, p, p}; double[] columnSize = {p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[] { new Component[]{
newEngine, newEngine,
lineEngine lineEngine
} }
@ -243,7 +242,7 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
@Override @Override
public void populateBean(LayerReportAttr ob) { public void populateBean(LayerReportAttr ob) {
if (ob == null){ if (ob == null) {
setDefaultAttr(); setDefaultAttr();
return; return;
} }
@ -252,14 +251,14 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
engineSettingPane.setVisible(true); engineSettingPane.setVisible(true);
radioButtons.get(0).setSelected(ob.getEngineState() == LayerReportAttr.ENGINE_X); radioButtons.get(0).setSelected(ob.getEngineState() == LayerReportAttr.ENGINE_X);
radioButtons.get(1).setSelected(ob.getEngineState() == LayerReportAttr.LINE_ENGINE); radioButtons.get(1).setSelected(ob.getEngineState() == LayerReportAttr.LINE_ENGINE);
if (ob.getEngineState() == LayerReportAttr.ENGINE_X){ if (ob.getEngineState() == LayerReportAttr.ENGINE_X) {
engineSettingPane.moveToFront(outEngineXSettingPane); engineSettingPane.moveToFront(outEngineXSettingPane);
outEngineXSettingPane.setVisible(true); outEngineXSettingPane.setVisible(true);
outLineEngineSettingPane.setVisible(false); outLineEngineSettingPane.setVisible(false);
engineXCountPerPageEditor.setValue(new Integer(ob.getCountPerPage())); engineXCountPerPageEditor.setValue(new Integer(ob.getCountPerPage()));
engineXPageQueryBox.setSelected(ob.isPageQuery()); engineXPageQueryBox.setSelected(ob.isPageQuery());
engineXPageQueryPane.setVisible(ob.isPageQuery()); engineXPageQueryPane.setVisible(ob.isPageQuery());
}else { } else {
engineSettingPane.moveToFront(outLineEngineSettingPane); engineSettingPane.moveToFront(outLineEngineSettingPane);
outEngineXSettingPane.setVisible(false); outEngineXSettingPane.setVisible(false);
outLineEngineSettingPane.setVisible(true); outLineEngineSettingPane.setVisible(true);
@ -275,16 +274,16 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
//这里注意一下怎么更新的,后续可能存在判断为空的调用,从而对老引擎造成影响。 //这里注意一下怎么更新的,后续可能存在判断为空的调用,从而对老引擎造成影响。
LayerReportAttr attr = new LayerReportAttr(); LayerReportAttr attr = new LayerReportAttr();
attr.setClientPaging(clientPaging.isSelected()); attr.setClientPaging(clientPaging.isSelected());
for (int i = 0; i < radioButtons.size(); i++){ for (int i = 0; i < radioButtons.size(); i++) {
if (radioButtons.get(i).isSelected()){ if (radioButtons.get(i).isSelected()) {
attr.setEngineState(i); attr.setEngineState(i);
} }
} }
if (attr.getEngineState() == LayerReportAttr.ENGINE_X){ if (attr.getEngineState() == LayerReportAttr.ENGINE_X) {
attr.setEnableRowCount(rowCountBox.isSelected()); attr.setEnableRowCount(rowCountBox.isSelected());
attr.setCountPerPage(engineXCountPerPageEditor.getValue().intValue()); attr.setCountPerPage(engineXCountPerPageEditor.getValue().intValue());
attr.setPageQuery(engineXPageQueryBox.isSelected()); attr.setPageQuery(engineXPageQueryBox.isSelected());
}else { } else {
attr.setPageQuery(lineEnginePageQueryBox.isSelected()); attr.setPageQuery(lineEnginePageQueryBox.isSelected());
attr.setCountPerPage(lineEngineCountPerPageEditor.getValue()); attr.setCountPerPage(lineEngineCountPerPageEditor.getValue());
} }
@ -304,7 +303,8 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
} }
} }
} }
public void setDefaultAttr(){
public void setDefaultAttr() {
clientPaging.setSelected(false); clientPaging.setSelected(false);
lineEngineCountPerPageEditor.setValue(30); lineEngineCountPerPageEditor.setValue(30);
lineEnginePageQueryBox.setSelected(false); lineEnginePageQueryBox.setSelected(false);
@ -315,26 +315,29 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
private class SelectActionListener implements ActionListener { private class SelectActionListener implements ActionListener {
private AbstractButton source; private AbstractButton source;
private JPanel target; private JPanel target;
private SelectActionListener(AbstractButton source, JPanel target){
private SelectActionListener(AbstractButton source, JPanel target) {
this.source = source; this.source = source;
this.target = target; this.target = target;
} }
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (source.isSelected()){ if (source.isSelected()) {
target.setVisible(true); target.setVisible(true);
}else { } else {
target.setVisible(false); target.setVisible(false);
} }
} }
} }
private class EngineSelectActionListener implements ActionListener{ private class EngineSelectActionListener implements ActionListener {
private AbstractButton source; private AbstractButton source;
private JLayeredPane target; private JLayeredPane target;
private JPanel showTarget; private JPanel showTarget;
private JPanel notShowTarget; private JPanel notShowTarget;
private EngineSelectActionListener(AbstractButton source, JLayeredPane target, JPanel showTarget, JPanel notShowTarget){
private EngineSelectActionListener(AbstractButton source, JLayeredPane target, JPanel showTarget, JPanel notShowTarget) {
this.source = source; this.source = source;
this.target = target; this.target = target;
this.showTarget = showTarget; this.showTarget = showTarget;
@ -344,15 +347,15 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
/** /**
* 由于屏蔽了新引擎设置由于新引擎设置界面是空的行式引擎的设置界面会显示出来因此每次界面转换时将不需要显示的界面屏蔽 * 由于屏蔽了新引擎设置由于新引擎设置界面是空的行式引擎的设置界面会显示出来因此每次界面转换时将不需要显示的界面屏蔽
* 不需要屏蔽新引擎设置时就不需要showTarget.setVisible(true);notShowTarget.setVisible(false);这两行代码了 * 不需要屏蔽新引擎设置时就不需要showTarget.setVisible(true);notShowTarget.setVisible(false);这两行代码了
* **/ **/
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (source.isSelected()){ if (source.isSelected()) {
target.setVisible(true); target.setVisible(true);
showTarget.setVisible(true); showTarget.setVisible(true);
notShowTarget.setVisible(false); notShowTarget.setVisible(false);
target.moveToFront(showTarget); target.moveToFront(showTarget);
}else { } else {
target.setVisible(false); target.setVisible(false);
} }
} }

Loading…
Cancel
Save