Browse Source

REPORT-59567:报表引擎界面按交互修改

research/11.0
fly.li 3 years ago
parent
commit
57e2141894
  1. 154
      designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java

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

@ -7,22 +7,39 @@ import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.FRExplainLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.report.core.ReportUtils;
import com.fr.report.stable.LayerReportAttr;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ProductConstants;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Label;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
@ -36,6 +53,9 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
private UICheckBox clientPaging;
private UICheckBox showDataNumber;
private UICheckBox pageQueryBox;
private JPanel outPagingEngineSelectPane;
private JPanel outEngineXSettingPane;
private JPanel pageQueryPane;
private IntegerEditor countPerPageEditor;
private WorkSheet worksheet;
private List<JRadioButton> radioButtons = new ArrayList<>(2);
@ -51,11 +71,42 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel outlayerReportPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Report_Engine_Attribute"));
JPanel layerReportPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
this.add(outlayerReportPane);
outlayerReportPane.add(layerReportPane);
JPanel outReportEnginePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Report_Engine_Attribute"));
outReportEnginePane.setPreferredSize(new Dimension(600, 370));
JPanel reportEnginePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
this.add(outReportEnginePane, BorderLayout.NORTH);
JPanel outAdvicePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advice"));
this.add(outAdvicePane, BorderLayout.SOUTH);
outAdvicePane.setPreferredSize(new Dimension(600, 150));
JPanel advicePane = new JPanel(new BorderLayout());
outAdvicePane.add(advicePane);
FRExplainLabel topExplainLabel = new FRExplainLabel(Toolkit.i18nText("Fine-Design_Report_Report_Engine_Warnning_Info"));
advicePane.add(topExplainLabel, BorderLayout.NORTH);
topExplainLabel.setForeground(new Color(0, 0, 0));
FlowLayout flowLayout = new FlowLayout(FlowLayout.LEADING);
flowLayout.setHgap(0);
flowLayout.setVgap(0);
JPanel adviceDownPane = new JPanel(flowLayout);
advicePane.add(adviceDownPane, BorderLayout.CENTER);
FRExplainLabel downExplainLabel = new FRExplainLabel(Toolkit.i18nText("Fine-Design_Report_Report_Detail_Reference"));
adviceDownPane.add(downExplainLabel);
downExplainLabel.setForeground(new Color(0, 0, 0));
JLabel helper = new FRExplainLabel( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"));
helper.setForeground(new Color(1, 159, 222));
adviceDownPane.add(helper);
helper.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("standard.doc", ProductConstants.WEBSITE_URL)));
} catch (IOException | URISyntaxException ex) {
FineLoggerFactory.getLogger().error("io exception or not find website", ex);
}
}
});
outReportEnginePane.add(reportEnginePane);
JPanel clientPagingpanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
clientPaging = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Enable_Client_Page"));
clientPaging.addActionListener(new ActionListener(){
@ -72,60 +123,86 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
});
clientPaging.setSelected(false);
clientPagingpanel.add(clientPaging);
layerReportPane.add(clientPagingpanel);
UIRadioButton newEngine = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_New_Engine"), true);
reportEnginePane.add(clientPagingpanel);
outPagingEngineSelectPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Paging_Engine_Select"));
outPagingEngineSelectPane.setPreferredSize(new Dimension(600, 300));
reportEnginePane.add(outPagingEngineSelectPane);
JPanel pagingEngineSelectPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
outPagingEngineSelectPane.add(pagingEngineSelectPane);
outPagingEngineSelectPane.setVisible(false);
clientPaging.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (clientPaging.isSelected()) {
outPagingEngineSelectPane.setVisible(true);
} else {
outPagingEngineSelectPane.setVisible(false);
}
}
});
UIRadioButton newEngine = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_New_Engine"), false);
UIRadioButton lineEngine = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Line_Engine"), false);
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(newEngine);
buttonGroup.add(lineEngine);
radioButtons.add(newEngine);
radioButtons.add(lineEngine);
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {p, p, p, p, p};
Component[][] components = new Component[][]{
new Component[] {
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Page_Engine_Select")),
newEngine,
lineEngine
}
};
JPanel pagingEngineRadioPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
layerReportPane.add(pagingEngineRadioPanel);
JPanel infoPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attention"));
FRExplainLabel label = new FRExplainLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Layer_Report_Warnning_Info"));
label.setPreferredSize(new Dimension(label.getPreferredSize().width, LABEL_HEIGHT));
infoPane.add(label);
layerReportPane.add(infoPane);
JPanel showDataNumberPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
showDataNumber = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Data_Total_Number"));
showDataNumber.setSelected(false);
showDataNumberPanel.add(showDataNumber);
layerReportPane.add(showDataNumberPanel);
JPanel pagingEngineRadioPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
pagingEngineSelectPane.add(pagingEngineRadioPanel);
outEngineXSettingPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_New_Engine"));
outEngineXSettingPane.setVisible(false);
pagingEngineSelectPane.add(outEngineXSettingPane);
JPanel engineXSettingPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
outEngineXSettingPane.add(engineXSettingPane);
outEngineXSettingPane.setPreferredSize(new Dimension(570, 240));
newEngine.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (newEngine.isSelected()) {
outEngineXSettingPane.setVisible(true);
} else {
outEngineXSettingPane.setVisible(false);
}
}
});
lineEngine.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (lineEngine.isSelected()) {
outEngineXSettingPane.setVisible(true);
} else {
outEngineXSettingPane.setVisible(false);
}
}
});
JPanel pageQueryBoxPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
pageQueryBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fixed_Line_Paging"));
pageQueryBox.setSelected(false);
pageQueryBox.setEnabled(false);
pageQueryBoxPanel.add(pageQueryBox);
layerReportPane.add(pageQueryBoxPanel);
engineXSettingPane.add(pageQueryBoxPanel);
pageQueryPane = createPageQueryPane();
pageQueryBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (pageQueryBox.isSelected()) {
countPerPageEditor.setEnabled(true);
pageQueryPane.setVisible(true);
} else {
countPerPageEditor.setEnabled(false);
pageQueryPane.setVisible(false);
}
}
});
JPanel pageQueryPane = createPageQueryPane();
layerReportPane.add(pageQueryPane);
pageQueryPane.setVisible(false);
engineXSettingPane.add(pageQueryPane);
JPanel tipPane = new JPanel();
UILabel tip = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Report_Engine_tip"), SwingConstants.LEFT);
tipPane.add(tip);
engineXSettingPane.add(tipPane);
}
private JPanel createPageQueryPane() {
@ -153,7 +230,10 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
return;
}
clientPaging.setSelected(ob.isClientPaging());
showDataNumber.setSelected(ob.isShowDataNumber());
if (clientPaging.isSelected()){
outPagingEngineSelectPane.setVisible(true);
}
// showDataNumber.setSelected(ob.isShowDataNumber());
countPerPageEditor.setValue(new Integer(ob.getCountPerPage()));
if (ob.isPageQuery()) {
pageQueryBox.setSelected(true);
@ -162,8 +242,14 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
pageQueryBox.setSelected(false);
countPerPageEditor.setEnabled(false);
}
if (pageQueryBox.isSelected()){
pageQueryPane.setVisible(true);
}
radioButtons.get(0).setSelected(ob.getEngineState() == LayerReportAttr.ENGINE_X ? true : false);
radioButtons.get(1).setSelected(ob.getEngineState() == LayerReportAttr.LINE_ENGINE ? true : false);
//有一个默认值,一定会显示分页选项界面
outEngineXSettingPane.setVisible(true);
}
@Override
@ -196,12 +282,12 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
}
public void setDefaultAttr(){
clientPaging.setSelected(false);
showDataNumber.setSelected(false);
// showDataNumber.setSelected(false);
countPerPageEditor.setValue(new Integer(30));
countPerPageEditor.setEnabled(false);
pageQueryBox.setSelected(false);
pageQueryBox.setEnabled(false);
radioButtons.get(0).setSelected(true);
radioButtons.get(0).setSelected(false);
radioButtons.get(1).setSelected(false);
}
}

Loading…
Cancel
Save