diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java b/designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java index 90dc364b4..f90f59c8c 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java @@ -19,6 +19,7 @@ import com.fr.report.stable.LayerReportAttr; import com.fr.report.worksheet.WorkSheet; import com.fr.stable.ProductConstants; +import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JLabel; @@ -32,7 +33,6 @@ 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; @@ -75,12 +75,60 @@ public class ReportEnginePane extends BasicBeanPane { outReportEnginePane.setPreferredSize(new Dimension(600, 370)); JPanel reportEnginePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); this.add(outReportEnginePane, BorderLayout.NORTH); + 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.setSelected(false); + clientPagingpanel.add(clientPaging); + 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 SelectActionListener(clientPaging, outPagingEngineSelectPane)); + pagingEngineSelectPane.add(createPagingEngineRadioPanel()); + 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)); + JPanel pageQueryBoxPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + pageQueryBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fixed_Line_Paging")); + pageQueryBox.setSelected(false); + pageQueryBoxPanel.add(pageQueryBox); + engineXSettingPane.add(pageQueryBoxPanel); + pageQueryPane = createPageQueryPane(); + pageQueryBox.addActionListener(new SelectActionListener(pageQueryBox, 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); 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)); + outAdvicePane.add(createAdvicePane()); + } + + private JPanel createPageQueryPane() { + double p = TableLayout.PREFERRED; + double rowSize[] = {p, p}; + double columnSize[] = {p, p}; + countPerPageEditor = new IntegerEditor(new Integer(30)); + countPerPageEditor.setPreferredSize(new Dimension(120,20)); + countPerPageEditor.setEnabled(false); + Component[][] components = {{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_LayerPageReport_Count_PerPage") + ":"), countPerPageEditor}}; + JPanel pageQueryPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + pageQueryPane.setBorder(BorderFactory.createEmptyBorder(5, 15, 0, 0)); + return pageQueryPane; + } + + private JPanel createAdvicePane(){ 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)); @@ -105,40 +153,10 @@ public class ReportEnginePane extends BasicBeanPane { } } }); + return advicePane; + } - 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(){ - - @Override - public void actionPerformed(ActionEvent e) { - if (clientPaging.isSelected()){ - pageQueryBox.setEnabled(true); - }else{ - pageQueryBox.setEnabled(false); - } - - } - }); - clientPaging.setSelected(false); - clientPagingpanel.add(clientPaging); - 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); - } - } - }); + private JPanel createPagingEngineRadioPanel(){ 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(); @@ -155,67 +173,10 @@ public class ReportEnginePane extends BasicBeanPane { lineEngine } }; - 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); - pageQueryBoxPanel.add(pageQueryBox); - engineXSettingPane.add(pageQueryBoxPanel); - pageQueryPane = createPageQueryPane(); - pageQueryBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - if (pageQueryBox.isSelected()) { - pageQueryPane.setVisible(true); - } else { - pageQueryPane.setVisible(false); - } - } - }); - 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() { - double p = TableLayout.PREFERRED; - double rowSize[] = {p, p}; - double columnSize[] = {p, p}; - countPerPageEditor = new IntegerEditor(new Integer(30)); - countPerPageEditor.setPreferredSize(new Dimension(120,20)); - countPerPageEditor.setEnabled(false); - Component[][] components = {{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_LayerPageReport_Count_PerPage") + ":"), countPerPageEditor}}; - JPanel pageQueryPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - pageQueryPane.setBorder(BorderFactory.createEmptyBorder(5, 15, 0, 0)); - return pageQueryPane; + newEngine.addActionListener(new SelectActionListener(newEngine, outEngineXSettingPane)); + lineEngine.addActionListener(new SelectActionListener(lineEngine, outEngineXSettingPane)); + return pagingEngineRadioPanel; } @Override @@ -233,7 +194,6 @@ public class ReportEnginePane extends BasicBeanPane { if (clientPaging.isSelected()){ outPagingEngineSelectPane.setVisible(true); } -// showDataNumber.setSelected(ob.isShowDataNumber()); countPerPageEditor.setValue(new Integer(ob.getCountPerPage())); if (ob.isPageQuery()) { pageQueryBox.setSelected(true); @@ -282,7 +242,6 @@ public class ReportEnginePane extends BasicBeanPane { } public void setDefaultAttr(){ clientPaging.setSelected(false); -// showDataNumber.setSelected(false); countPerPageEditor.setValue(new Integer(30)); countPerPageEditor.setEnabled(false); pageQueryBox.setSelected(false); @@ -290,5 +249,22 @@ public class ReportEnginePane extends BasicBeanPane { radioButtons.get(0).setSelected(false); radioButtons.get(1).setSelected(false); } + + private class SelectActionListener implements ActionListener { + private AbstractButton source; + private JPanel target; + private SelectActionListener(AbstractButton source, JPanel target){ + this.source = source; + this.target = target; + } + @Override + public void actionPerformed(ActionEvent e) { + if (source.isSelected()){ + target.setVisible(true); + }else { + target.setVisible(false); + } + } + } }