From b62c3399515767af7b81119dabca7234f2373845 Mon Sep 17 00:00:00 2001 From: "Richard.Fang" Date: Fri, 26 Jul 2024 18:50:45 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-127436=E3=80=90NewUI=E3=80=91=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E6=A0=B7=E5=BC=8F=E7=BF=BB=E6=96=B0-?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=9B=B8=E5=85=B3/=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E9=85=8D=E7=BD=AE/=E6=95=B0=E6=8D=AE=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fine/theme/utils/FineUIStyle.java | 1 + .../data/datapane/TreeTableDataDictPane.java | 99 +++--- .../connect/DatabaseConnectionPane.java | 12 +- .../data/datapane/connect/JNDIDefPane.java | 116 ++++--- .../data/datapane/preview/PreviewLabel.java | 7 +- .../tabledatapane/ClassTableDataPane.java | 58 ++-- .../tabledatapane/EmbeddedTableDataPane.java | 6 +- .../tabledatapane/FileTableDataPane.java | 298 +++++++++--------- .../FileTableDataSmallHeightPane.java | 9 +- .../tabledatapane/FileTableDataSmallPane.java | 9 +- .../tabledatapane/MultiTDTableDataPane.java | 82 +++-- .../AbstractTemplateServerSettingPane.java | 24 +- .../java/com/fr/design/dialog/BasicPane.java | 27 +- .../gui/frpane/EditingStringListPane.java | 96 +++--- .../fr/design/gui/ilable/FRExplainLabel.java | 5 +- .../fr/design/parameter/ParameterPane.java | 42 +-- .../com/fr/design/report/WatermarkPane.java | 165 +++++----- .../design/report/WatermarkSettingPane.java | 2 +- .../fr/design/report/fit/BaseFitAttrPane.java | 47 ++- .../design/report/fit/FormFitConfigPane.java | 25 +- .../design/report/fit/NewFitPreviewPane.java | 3 +- .../report/fit/ReportFitConfigPane.java | 51 ++- .../com/fr/design/utils/gui/GUICoreUtils.java | 11 +- .../com/fr/design/widget/IconDefinePane.java | 30 +- .../fine/theme/icon/toolbar/clearStash.svg | 3 + .../theme/icon/toolbar/clearStash_disable.svg | 3 + .../fine/theme/icon/toolbar/customButton.svg | 10 + .../icon/toolbar/customButton_disable.svg | 10 + .../fine/theme/icon/toolbar/dataVerify.svg | 3 + .../theme/icon/toolbar/dataVerify_disable.svg | 3 + .../com/fine/theme/icon/toolbar/email.svg | 3 + .../fine/theme/icon/toolbar/email_disable.svg | 3 + .../com/fine/theme/icon/toolbar/move_up.svg | 11 +- .../theme/icon/toolbar/move_up_disable.svg | 11 +- .../fine/theme/icon/toolbar/page_first.svg | 3 + .../theme/icon/toolbar/page_first_disable.svg | 3 + .../com/fine/theme/icon/toolbar/page_last.svg | 3 + .../theme/icon/toolbar/page_last_disbale.svg | 3 + .../com/fine/theme/icon/toolbar/page_navi.svg | 3 + .../theme/icon/toolbar/page_navi_disable.svg | 3 + .../com/fine/theme/icon/toolbar/page_next.svg | 3 + .../theme/icon/toolbar/page_next_disable.svg | 3 + .../fine/theme/icon/toolbar/page_previous.svg | 3 + .../icon/toolbar/page_previous_disable.svg | 3 + .../fine/theme/icon/toolbar/printApplet.svg | 3 + .../icon/toolbar/printApplet_disable.svg | 3 + .../com/fine/theme/icon/toolbar/printPdf.svg | 6 + .../theme/icon/toolbar/printPdf_disable.svg | 6 + .../fine/theme/icon/toolbar/printPreview.svg | 10 + .../icon/toolbar/printPreview_disable.svg | 10 + .../fine/theme/icon/toolbar/printerOffset.svg | 10 + .../icon/toolbar/printerOffset_disable.svg | 10 + .../com/fine/theme/icon/toolbar/scale.svg | 3 + .../fine/theme/icon/toolbar/scale_disable.svg | 3 + .../fine/theme/light/ui/fine_light.icon.json | 14 + .../light/ui/laf/FineLightLaf.properties | 4 + .../fr/design/i18n/dimension_zh.properties | 4 +- .../design/javascript/ListenerEditPane.java | 26 +- .../com/fr/design/report/ExcelExportPane.java | 94 +++--- .../fr/design/report/ExportUniversalPane.java | 23 +- .../com/fr/design/report/ImageExportPane.java | 76 ++--- .../com/fr/design/report/PDFExportPane.java | 30 +- .../com/fr/design/report/PageSetupPane.java | 278 +++++++--------- .../design/report/ReportExportAttrPane.java | 29 +- .../com/fr/design/report/WordExportPane.java | 81 ++--- .../report/mobile/AppFitBrowserPane.java | 22 +- .../report/mobile/AppFitPreviewPane.java | 20 +- .../report/mobile/MobileOthersPane.java | 17 +- .../report/mobile/MobileRadioGroupPane.java | 36 +-- .../report/mobile/MobileToolBarPane.java | 21 +- .../report/mobile/ReportMobileAttrPane.java | 31 +- .../ReportMobileTemplateSettingsPane.java | 53 ++-- .../com/fr/design/webattr/CommonPane.java | 50 ++- .../fr/design/webattr/DragToolBarPane.java | 64 ++-- .../EditReportServerParameterPane.java | 30 +- .../com/fr/design/webattr/EditToolBar.java | 252 ++++++++------- .../fr/design/webattr/ErrorTemplatePane.java | 58 ++-- .../java/com/fr/design/webattr/EventPane.java | 27 +- .../fr/design/webattr/PageToolBarPane.java | 86 +++-- .../fr/design/webattr/PageWebSettingPane.java | 68 ++-- .../webattr/ReportServerPrinterPane.java | 4 +- .../fr/design/webattr/ReportWebAttrPane.java | 34 +- .../webattr/ReportWebWidgetConstants.java | 115 ++++--- .../fr/design/webattr/ServerFitAttrPane.java | 10 +- .../fr/design/webattr/ServerPrinterPane.java | 90 +++--- .../com/fr/design/webattr/SettingToolBar.java | 31 +- .../com/fr/design/webattr/ToolBarButton.java | 10 +- .../fr/design/webattr/ToolBarDragPane.java | 148 +++++---- .../com/fr/design/webattr/ToolBarPane.java | 3 +- .../fr/design/webattr/ViewToolBarPane.java | 70 ++-- .../fr/design/webattr/ViewWebSettingPane.java | 19 +- .../com/fr/design/webattr/WebCssPane.java | 48 +-- .../java/com/fr/design/webattr/WebJsPane.java | 77 ++--- .../com/fr/design/webattr/WebSettingPane.java | 94 +++--- .../fr/design/webattr/WriteToolBarPane.java | 78 +++-- .../design/webattr/WriteWebSettingPane.java | 58 ++-- .../AbstractNativePrintSettingPane.java | 211 ++++++------- .../GlobalNativePrintSettingPane.java | 76 ++--- .../NoClientPrintSettingPane.java | 75 ++--- .../printsettings/PageMarginSettingPane.java | 43 +-- .../printsettings/PrintSettingPane.java | 27 +- .../ReportNativePrintSettingPane.java | 5 +- 102 files changed, 2218 insertions(+), 1981 deletions(-) create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/clearStash.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/clearStash_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/customButton.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/customButton_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/dataVerify.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/dataVerify_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/email.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/email_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_first.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_first_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_last.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_last_disbale.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_navi.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_navi_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_next.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_next_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_previous.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_previous_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/printApplet.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/printApplet_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPdf.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPdf_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPreview.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPreview_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/printerOffset.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/printerOffset_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/scale.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/toolbar/scale_disable.svg diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java index 4cf5637d94..155ffa7731 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java @@ -29,6 +29,7 @@ public interface FineUIStyle { String BUTTON_TAB_ACTION = "tabAction"; String LABEL_BOLD = "boldLabel"; String LABEL_TIP = "tipLabel"; + String LABEL_WARNING_TIP = "warningTipLabel"; String PLAIN_BUTTON = "plainButton"; String TOGGLE_GROUP = "inToggleGroup"; String COMPACT_BUTTON = "compactButton"; diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataDictPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataDictPane.java index 175ddbfda3..910a4c00c2 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataDictPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataDictPane.java @@ -1,6 +1,8 @@ package com.fr.design.data.datapane; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.data.impl.RecursionTableData; +import com.fr.design.constants.LayoutConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.preview.PreviewLabel; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; @@ -18,19 +20,21 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JPanel; -import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.Component; -import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + public class TreeTableDataDictPane extends BasicPane implements Previewable { private UILabel selectTableDataLabel; @@ -54,23 +58,28 @@ public class TreeTableDataDictPane extends BasicPane implements Previewable { } public TreeTableDataDictPane(String treeName) { - this.setLayout(new BorderLayout(5, 30)); - this.setBorder(BorderFactory.createEmptyBorder(20, 20, 0, 0)); - selectTableDataLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_TableData_Select_One") + " :"); + this.setLayout(new BorderLayout()); + this.setBorder(new ScaledEmptyBorder(10,10,10,10)); + //请选择一个数据集 + selectTableDataLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_TableData_Select_One") ); setTableDataNameComboBox(treeName); - tableDataNameComboBox.setPreferredSize(new Dimension(180, 20)); - JPanel tableFlowPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); - tableFlowPane.add(selectTableDataLabel); - tableFlowPane.add(tableDataNameComboBox); tableDataNameComboBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { tdChange(true); } }); - tableFlowPane.add(new PreviewLabel(this)); - this.add(tableFlowPane, BorderLayout.NORTH); + JPanel tableFlowPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + tableFlowPane.add(row(LayoutConstants.HGAP_LARGE, + cell(selectTableDataLabel).weight(0.12), + row(LayoutConstants.HGAP_LARGE, + cell(tableDataNameComboBox).weight(0.9), + cell(new PreviewLabel(this)).weight(0.1) + ).weight(0.3), + flex(0.58) + ).getComponent()); + + //中心面板 JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(centerPane, BorderLayout.CENTER); parentMarkRadio = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Build_Tree_Accord_Parent_Marked_Filed"), true); lengthMarkRadio = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Build_Tree_Accord_Marked_Filed_Length")); parentMarkRadio.addItemListener(new ItemListener() { @@ -95,45 +104,44 @@ public class TreeTableDataDictPane extends BasicPane implements Previewable { markButtonGroup.add(parentMarkRadio); markButtonGroup.add(lengthMarkRadio); - originFieldDependsOnParentLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Original_Marked_Filed") + " :", SwingConstants.RIGHT); - parentFieldLabel = new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parent_Marked_Field") + " :", SwingConstants.RIGHT); - treeDataFieldLabel1 = new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Data_Field") + " :", SwingConstants.RIGHT); - originFieldDependsOnLengthLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Original_Marked_Filed") + " :", SwingConstants.RIGHT); - treeDataFieldLabel2 = new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Data_Field") + " :", SwingConstants.RIGHT); + //原始标记字段 + originFieldDependsOnParentLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Original_Marked_Filed")); + //父标记字段 + parentFieldLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parent_Marked_Field")); + treeDataFieldLabel1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Data_Field")); + originFieldDependsOnLengthLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Original_Marked_Filed")); + treeDataFieldLabel2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Data_Field")); -// originFieldDependsOnParentPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[] {new OldColumnIndexEditor(com.fr.design.i18n.Toolkit.i18nText("Columns"))}); -// parentFieldPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[] {new OldColumnIndexEditor(com.fr.design.i18n.Toolkit.i18nText("Columns"))}); -// originFieldDependsOnLengthPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[] {new OldColumnIndexEditor(com.fr.design.i18n.Toolkit.i18nText("Columns"))}); originFieldDependsOnParentPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); parentFieldPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); originFieldDependsOnLengthPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); - makeParentEnable(); - JPanel p1 = createCenterFlowZeroGapBorderPane(originFieldDependsOnParentLabel, originFieldDependsOnParentPane); - JPanel p2 = createCenterFlowZeroGapBorderPane(parentFieldLabel, parentFieldPane); - JPanel border1 = new JPanel(); - border1.setLayout(new BorderLayout(0, 10)); - border1.add(p1, BorderLayout.NORTH); - border1.add(p2, BorderLayout.CENTER); - JPanel p4 = createCenterFlowZeroGapBorderPane(originFieldDependsOnLengthLabel, originFieldDependsOnLengthPane); - JPanel border2 = new JPanel(); - border2.setLayout(new BorderLayout(0, 20)); - border2.add(p4, BorderLayout.NORTH); + //树数据集面板 + centerPane.add(column(10, + cell(parentMarkRadio), + row(LayoutConstants.HGAP_LARGE, + cell(originFieldDependsOnParentLabel).weight(0.12), + cell(originFieldDependsOnParentPane).weight(0.3), + flex(0.58) + ), + row(LayoutConstants.HGAP_LARGE, + cell(parentFieldLabel).weight(0.12), + cell(parentFieldPane).weight(0.3), + flex(0.58) + ), + cell(lengthMarkRadio), + row(LayoutConstants.HGAP_LARGE, + cell(originFieldDependsOnLengthLabel).weight(0.12), + cell(originFieldDependsOnLengthPane).weight(0.3), + flex(0.58) + ) + ).getComponent()); - JPanel xx = FRGUIPaneFactory.createBorderLayout_S_Pane(); - xx.add(parentMarkRadio, BorderLayout.NORTH); - xx.add(border1, BorderLayout.CENTER); - JPanel xxx = FRGUIPaneFactory.createBorderLayout_S_Pane(); - xxx.add(lengthMarkRadio, BorderLayout.NORTH); - xxx.add(border2, BorderLayout.CENTER); - JPanel buildTreePanel = new JPanel(new BorderLayout(5, 30)); - buildTreePanel.add(xx, BorderLayout.NORTH); - buildTreePanel.add(xxx, BorderLayout.CENTER); - centerPane.add(buildTreePanel, BorderLayout.NORTH); - JPanel previewPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); + //预览 + JPanel previewPanel = new JPanel(new BorderLayout()); UIButton treeDataPreviewButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); - previewPanel.add(treeDataPreviewButton); + previewPanel.add(treeDataPreviewButton, BorderLayout.WEST); treeDataPreviewButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -163,7 +171,8 @@ public class TreeTableDataDictPane extends BasicPane implements Previewable { PreviewTablePane.previewTableData(rtd); } }); - centerPane.add(previewPanel, BorderLayout.CENTER); + + this.add(column(LayoutConstants.VERTICAL_GAP, cell(tableFlowPane),cell(centerPane), cell(previewPanel)).getComponent()); } protected void setTableDataNameComboBox(String treeName) { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 821c3fd482..370ce5219e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -69,8 +69,10 @@ import java.net.URI; import java.util.concurrent.ExecutionException; import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.fix; import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; /** * Database Connection pane. @@ -280,9 +282,13 @@ public abstract class DatabaseConnectionPane jndiMap = new HashMap(); @@ -66,57 +68,51 @@ public class JNDIDefPane extends JPanel { private JDialog otherAttrDialog; public JNDIDefPane() { - this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); - this.setBorder(UITitledBorder.createBorderWithTitle("JNDI" + ":")); - JPanel innerthis = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - this.add(innerthis); - // NorthPane - JPanel nContentPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - innerthis.add(nContentPane); - nContentPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_JNDI_Name") + ":")); - jndiNameTextField = new UITextField(20); - nContentPane.add(jndiNameTextField, BorderLayout.NORTH); - - // CenterPane - JPanel outcenterPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Context")); - innerthis.add(outcenterPane); - JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); - outcenterPane.add(centerPane); + this.setLayout(new BorderLayout()); + jndiNameTextField = new UITextField(20); JNDIFactoryComboBox = new UIComboBox(new String[] { "", "weblogic.jndi.WLInitialContextFactory", "com.ibm.websphere.naming.WsnInitialContextFactory", "org.jboss.naming.HttpNamingContextFactory", "org.jnp.interfaces.NamingContextFactory", "com.caucho.burlap.BurlapContextFactory", }); JNDIFactoryComboBox.setEditable(true); - JNDIFactoryComboBox.addActionListener(jndiListener); - JNDIFactoryComboBox.setPreferredSize(new Dimension(30, JNDIFactoryComboBox.getPreferredSize().height + 2)); - - // ContextPane - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = { p, p, p, p }; - double[] columnSize = { f, f }; - Component[][] comps = { { new UILabel("INITIAL_CONTEXT_FACTORY:", SwingConstants.RIGHT), JNDIFactoryComboBox }, - { new UILabel("PROVIDER_URL:", SwingConstants.RIGHT), PROVIDER_URL_TF }, { new UILabel("SECURITY_PRINCIPAL:", SwingConstants.RIGHT), SECURITY_PRINCIPAL_TF }, - { new UILabel("SECURITY_CREDENTIALS:", SwingConstants.RIGHT), SECURITY_CREDENTIALS_TF } }; - centerPane.add(TableLayoutHelper.createCommonTableLayoutPane(comps, rowSize, columnSize, 2)); - - // ActionLabel - JPanel actionPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.add(actionPane); - actionPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 6)); - + JNDIFactoryComboBox.setPreferredSize(FineUIScale.scale(new Dimension(30, JNDIFactoryComboBox.getPreferredSize().height + 2))); + + // 上下文 + JPanel contextPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + contextPane.add(column(LayoutConstants.VERTICAL_GAP, + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel("INITIAL_CONTEXT_FACTORY")).weight(0.35), cell(JNDIFactoryComboBox).weight(0.65)), + row(LayoutConstants.HORIZONTAL_GAP,cell(new UILabel("PROVIDER_URL")).weight(0.35), cell(PROVIDER_URL_TF).weight(0.65)), + row(LayoutConstants.HORIZONTAL_GAP,cell(new UILabel("SECURITY_PRINCIPAL")).weight(0.35), cell(SECURITY_PRINCIPAL_TF).weight(0.65)), + row(LayoutConstants.HORIZONTAL_GAP,cell(new UILabel("SECURITY_CREDENTIALS")).weight(0.35), cell(SECURITY_CREDENTIALS_TF).weight(0.65)) + ).getComponent()); + + //其他属性 + JPanel otherAttributePanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); ActionLabel actionLabel = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Other_Attributes")); - actionPane.add(actionLabel, BorderLayout.EAST); actionLabel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { + //其他属性弹窗 JDialog wDialog = createJDialog(); wDialog.setVisible(true); } }); + otherAttributePanel.add(actionLabel, BorderLayout.EAST); + //注意描述 + JPanel jndiDesPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + jndiDesPanel.add(new JScrollPane(new FRExplainLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_JNDI_DES"))), BorderLayout.WEST); + //JNDI面板 + JPanel centerPanel = column(LayoutConstants.VERTICAL_GAP, + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_JNDI_Name"))).weight(0.15), cell(jndiNameTextField).weight(0.85)), + row(cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Context"))).weight(0.15), cell(contextPane).weight(0.85)), + cell(otherAttributePanel), + cell(jndiDesPanel) + ).getComponent(); + this.add(wrapComponentWithTitle(centerPanel,"JNDI")); + } - // South Description - UILabel explainLabe11l = new FRExplainLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_JNDI_DES")); - innerthis.add(new JScrollPane(explainLabe11l)); + private JPanel getTopAlignLabelPane(String labelText) { + return column(LayoutConstants.VERTICAL_GAP, cell(new UILabel(labelText))) + .with(it -> it.setBorder(new ScaledEmptyBorder(2,0,0,0))).getComponent(); } public void populate(JNDIDatabaseConnection jndiDatabase) { @@ -216,21 +212,23 @@ public class JNDIDefPane extends JPanel { class OtherAttrPane extends BasicPane { public OtherAttrPane() { // JPanel northFlowPane - JPanel northFlowPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - this.add(northFlowPane, BorderLayout.NORTH); - + JPanel northFlowPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + northFlowPane.setBorder(new ScaledEmptyBorder(10,10,10,10)); // ContextPane - double f = TableLayout.FILL; - double[] rowSize = { f, f, f, f, f, f, f, f, f, f, f }; - double[] columnSize = { f, f }; - Component[][] comps = { { new UILabel("OBJECT_FACTORIES:", SwingConstants.RIGHT), OBJECT_FACTORIES_TF }, - { new UILabel("STATE_FACTORIES:", SwingConstants.RIGHT), STATE_FACTORIES_TF }, { new UILabel("URL_PKG_PREFIXES:", SwingConstants.RIGHT), URL_PKG_PREFIXES_TF }, - { new UILabel("DNS_URL:", SwingConstants.RIGHT), DNS_URL_TF }, { new UILabel("AUTHORITATIVE:", SwingConstants.RIGHT), AUTHORITATIVE_TF }, - { new UILabel("BATCHSIZE:", SwingConstants.RIGHT), BATCHSIZE_TF }, { new UILabel("REFERRAL:", SwingConstants.RIGHT), REFERRAL_TF }, - { new UILabel("SECURITY_PROTOCOL:", SwingConstants.RIGHT), SECURITY_PROTOCOL_TF }, - { new UILabel("SECURITY_AUTHENTICATION:", SwingConstants.RIGHT), SECURITY_AUTHENTICATION_TF }, { new UILabel("LANGUAGE:", SwingConstants.RIGHT), LANGUAGE_TF }, - { new UILabel("APPLET:", SwingConstants.RIGHT), APPLET_TF } }; - northFlowPane.add(TableLayoutHelper.createCommonTableLayoutPane(comps, rowSize, columnSize, 2)); + northFlowPane.add(column(LayoutConstants.VERTICAL_GAP, + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel("OBJECT_FACTORIES")).weight(0.35), cell(OBJECT_FACTORIES_TF)).weight(0.65), + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel("STATE_FACTORIES")).weight(0.35), cell(STATE_FACTORIES_TF)).weight(0.65), + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel("URL_PKG_PREFIXES")).weight(0.35), cell(URL_PKG_PREFIXES_TF)).weight(0.65), + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel("DNS_URL")).weight(0.35), cell(DNS_URL_TF)).weight(0.65), + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel("AUTHORITATIVE")).weight(0.35), cell(AUTHORITATIVE_TF)).weight(0.65), + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel("BATCHSIZE")).weight(0.35), cell(BATCHSIZE_TF)).weight(0.65), + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel("REFERRAL")).weight(0.35), cell(REFERRAL_TF)).weight(0.65), + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel("SECURITY_PROTOCOL")).weight(0.35), cell(SECURITY_PROTOCOL_TF)).weight(0.65), + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel("SECURITY_AUTHENTICATION")).weight(0.35), cell(SECURITY_AUTHENTICATION_TF)).weight(0.65), + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel("LANGUAGE")).weight(0.35), cell(LANGUAGE_TF)).weight(0.65), + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel("APPLET")).weight(0.35), cell(APPLET_TF)).weight(0.65) + ).getComponent()); + this.add(northFlowPane, BorderLayout.NORTH); } @Override diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewLabel.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewLabel.java index 4fa695fd21..48df699015 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewLabel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewLabel.java @@ -5,7 +5,8 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; import com.fr.design.gui.ibutton.UIButton; @@ -16,7 +17,7 @@ public class PreviewLabel extends UIButton { Previewable previewable; public PreviewLabel(Previewable previewable) { - super(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); + super(new LazyIcon("preview")); this.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); this.setCursor(new Cursor(Cursor.HAND_CURSOR)); this.previewable = previewable; @@ -27,7 +28,7 @@ public class PreviewLabel extends UIButton { PreviewLabel.this.previewable.preview(); } }); - this.setPreferredSize(new Dimension(24, 20)); + this.setPreferredSize(FineUIScale.scale(new Dimension(24, 24))); } public static interface Previewable { diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java index e2f7efc70b..04bda940c0 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java @@ -1,7 +1,9 @@ package com.fr.design.data.tabledata.tabledatapane; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.Parameter; import com.fr.data.impl.ClassTableData; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; @@ -11,8 +13,6 @@ import com.fr.design.gui.itableeditorpane.UITableEditAction; import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.general.IOUtils; import com.fr.script.Calculator; import com.fr.stable.ParameterProvider; @@ -23,35 +23,29 @@ import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Dialog; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + public class ClassTableDataPane extends AbstractTableDataPane { private UITextField classNameTextField; private UITableEditorPane editorPane; public ClassTableDataPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); - - // TableLayout - double p = TableLayout.PREFERRED; - - double[] rowSize = {p, p, p, p}; - double[] columnSize = {p, p}; - //Reportlet. - JPanel reportletNamePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); - classNameTextField = new UITextField(36); - reportletNamePane.add(classNameTextField); + this.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); + //类名 + classNameTextField = new UITextField(); UIButton browserButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); - browserButton.setPreferredSize(new Dimension( - browserButton.getPreferredSize().width, - classNameTextField.getPreferredSize().height)); - reportletNamePane.add(browserButton); + browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, classNameTextField.getPreferredSize().height)); browserButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { final ClassNameSelectPane bPane = new ClassNameSelectPane(); @@ -69,15 +63,26 @@ public class ClassTableDataPane extends AbstractTableDataPane { } }); - Component[][] components = { - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Class_Name") + ":"), reportletNamePane}, - {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_The_Class_Must_Implement_The_Interface") + "\"com.fr.data.Tabledata\"")}, - {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Example") + ":\"com.fr.data.impl.ArrayTableData\"")}, - {null,new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Class_Location_Description", StableUtils.pathJoin(ProjectConstants.WEBINF_NAME, ProjectConstants.CLASSES_NAME)))} - }; - JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + JPanel tipPanel = column(LayoutConstants.VERTICAL_GAP, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_The_Class_Must_Implement_The_Interface") + "\"com.fr.data.Tabledata\"")), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Example") + ":\"com.fr.data.impl.ArrayTableData\"")), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Class_Location_Description", StableUtils.pathJoin(ProjectConstants.WEBINF_NAME, ProjectConstants.CLASSES_NAME)))) + ).getComponent(); + + JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + northPane.add(column(LayoutConstants.VERTICAL_GAP, + row(LayoutConstants.HGAP_LARGE, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Class_Name"))).weight(0.12), + row(LayoutConstants.HGAP_LARGE, + cell(classNameTextField).weight(0.85), + cell(browserButton).weight(0.15) + ).weight(0.58), + flex(0.3) + ), + row(LayoutConstants.HGAP_LARGE, flex(0.12), cell(tipPanel).weight(0.88)) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0,10, 0))).getComponent()); this.add(northPane, BorderLayout.NORTH); - this.add(initSouthPanel(), BorderLayout.SOUTH); + this.add(initSouthPanel(), BorderLayout.CENTER); } private JPanel initSouthPanel() { JPanel jpanel = new JPanel(); @@ -95,7 +100,6 @@ public class ClassTableDataPane extends AbstractTableDataPane { }, " " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_TableData_Default_Para")); jpanel.add(editorPane, BorderLayout.CENTER); - return jpanel; } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java index 731816243e..90de902a9a 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java @@ -1,5 +1,6 @@ package com.fr.design.data.tabledata.tabledatapane; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.data.impl.EmbeddedTableData; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -52,7 +53,8 @@ public class EmbeddedTableDataPane extends AbstractTableDataPane { private static final int TEXT = 0; private static final int EXCEL = 1; @@ -104,8 +108,6 @@ public class FileTableDataPane extends AbstractTableDataPane { private UIButton testConnection; private XMLNodeTree xmlNodeTree; private Parameter[] params; - private JPanel filePath; - private XMLNodeTreePane nodeTreePane; private UICheckBox needColumnNameCheckBox;// 第一行是否作为标题 private UIRadioButton tableDismemberRadioButton;// 制表符 @@ -116,41 +118,32 @@ public class FileTableDataPane extends AbstractTableDataPane { private UICheckBox ignoreOneMoreDelimiterCheckBox;// 连续分隔符是否作为单一 private UIComboBox charsetComboBox; private UILabel encodeLabel; - private UILabel dismenberLabel; private UILabel keyPointLaber; private ExpandMutableTreeNode selectedNode = null; private ExpandMutableTreeNode finalSelectedNode = null; - private ArrayList xmlColumnsList = new ArrayList(); - private static final int SETPANELWIDTH = 337; - private static final int WIDTH = 317; - private static final int HEIGHT = 453; - private static final int GAP = 23; - + private static final double LOCAL_WIDTH_RATIO = 0.62; + private static final double URL_WIDTH_RATIO = 0.56; public FileTableDataPane() { - this(SETPANELWIDTH, WIDTH, HEIGHT, GAP); + this(LOCAL_WIDTH_RATIO, URL_WIDTH_RATIO); } - public FileTableDataPane(int setPanelWidth, int width, int height, int gap) { - this.setLayout(new BorderLayout(gap, 0)); - JPanel northPanel = new JPanel(new BorderLayout()); - JPanel type = new JPanel(); - type.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_File_Type") + ":")); + public FileTableDataPane(double localWidthRatio, double urlWidthRatio) { + this.setLayout(new BorderLayout()); + this.setBorder(new ScaledEmptyBorder(10,10,10,10)); + //文件类型 + JPanel fileType = new JPanel(new BorderLayout()); String[] item = {"TXT", "Excel", "XML"}; fileTypeComboBox = new UIComboBox(item); - fileTypeComboBox.setPreferredSize(new Dimension(100, 20)); - type.add(fileTypeComboBox); - northPanel.add(type, BorderLayout.WEST); + fileType.add(row(LayoutConstants.HGAP_LARGE, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_File_Type"))).weight(0.12), + cell(fileTypeComboBox).weight(0.18), + flex(0.7) + ).getComponent()); - // 最上面的pane,文件选择 - JPanel centerPanel = new JPanel(); - centerPanel.setPreferredSize(new Dimension(522, 200)); - centerPanel.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File_Address"))); - addToCenterPanel(centerPanel); - - // 下面的pane,参数面板 + //参数面板 ParameterTableModel model = new ParameterTableModel() { @Override public UITableEditAction[] createAction() { @@ -158,65 +151,75 @@ public class FileTableDataPane extends AbstractTableDataPane { } }; editorPane = new UITableEditorPane(model); - editorPane.setPreferredSize(new Dimension(355, 130)); - centerPanel.add(editorPane, BorderLayout.SOUTH); - - JPanel southPanel = new JPanel(new BorderLayout()); - JPanel setPanel = new JPanel(); - southPanel.add(setPanel, BorderLayout.CENTER); - setPanel.setPreferredSize(new Dimension(setPanelWidth, 460)); - setPanel.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"))); - JPanel controlPane = textSetPanel(width, height); - setPanel.add(controlPane, BorderLayout.NORTH); - fileTypeComboBox.addActionListener(getFileTypeListener(setPanel, width, height)); - - this.add(northPanel, BorderLayout.NORTH); - this.add(centerPanel, BorderLayout.CENTER); - this.add(southPanel, BorderLayout.EAST); + editorPane.setBorder(new ScaledEmptyBorder(0,0,0,10)); + editorPane.setPreferredSize(FineUIScale.scale(new Dimension(-1, 150))); + + //左侧文件地址pane + JPanel leftPanel = new JPanel(new BorderLayout()); + leftPanel.add(column( + LayoutConstants.VERTICAL_GAP, + cell(getCenterPanel(localWidthRatio, urlWidthRatio)), + cell(editorPane) + ).getComponent()); + //右侧设定pane + JPanel rightPanel = new JPanel(new BorderLayout()); + rightPanel.setBorder(new ScaledEmptyBorder(0,0,0,10)); + rightPanel.add(getTextSetPanel()); + fileTypeComboBox.addActionListener(getFileTypeListener(rightPanel)); + + //文件数据集整体布局,服务器数据集/模板数据集下的文件数据集,创建文件数据集,三处面板通用布局 + this.add(column(LayoutConstants.VERTICAL_GAP, + cell(fileType), + row(20, + cell(wrapComponentWithTitle(leftPanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File_Address"))).weight(0.5), + cell(wrapComponentWithTitle(rightPanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"))).weight(0.5) + ) + ).getComponent()); } - private void addToCenterPanel(JPanel centerPanel) { - localFileRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Local_File") + ":", true); - urlFileRadioButton = new UIRadioButton("URL:", false); + /** + * 文件地址上方的面板-文件选择 + * @return + */ + private JPanel getCenterPanel(double localWidthRatio, double urlWidthRatio) { + // 本地文件/URL + localFileRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Local_File"), true); + urlFileRadioButton = new UIRadioButton("URL", false); ButtonGroup bg = new ButtonGroup(); bg.add(localFileRadioButton); bg.add(urlFileRadioButton); localFileRadioButton.addActionListener(radioActionListener); urlFileRadioButton.addActionListener(radioActionListener); - urlFileRadioButton.setForeground(new Color(143, 142, 139)); - localFileRadioButton.setForeground(Color.black); localText = new UITextField(); - localText.setPreferredSize(new Dimension(195, 20)); urlText = new UITextField(); - urlText.setPreferredSize(new Dimension(195, 20)); urlText.setEditable(false); + // 选择按钮 chooseFile = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Selection")); chooseFile.addActionListener(chooseFileListener); - + // 测试连接按钮 testConnection = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Test_Connection")); testConnection.setEnabled(false); - testConnection.addActionListener(testConnectionListener);// 测试连接按钮 - - JPanel textPanel = new JPanel(new GridLayout(2, 1, 15, 15)); - JPanel textFieldPanel = new JPanel(new GridLayout(2, 1, 15, 15)); - JPanel buttonPanel = new JPanel(new GridLayout(2, 1, 15, 15)); - textPanel.add(localFileRadioButton); - textPanel.add(urlFileRadioButton); - textFieldPanel.add(localText); - textFieldPanel.add(urlText); - buttonPanel.add(chooseFile); - buttonPanel.add(testConnection); - filePath = FRGUIPaneFactory.createBorderLayout_S_Pane(); - filePath.add(textPanel, BorderLayout.WEST); - filePath.add(textFieldPanel, BorderLayout.CENTER); - filePath.add(buttonPanel, BorderLayout.EAST); - centerPanel.add(filePath, BorderLayout.NORTH); - - // 中间的pane,提示信息 + testConnection.addActionListener(testConnectionListener); + // 提示信息 String tipContent = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Parameter") + "reportlets/excel/FineReport${abc}." + "txt" + "
" + "http://192.168.100.120:8080/XXServer/Report/excel${abc}.jsp
" + "  "; tips = new UILabel(tipContent); - centerPanel.add(tips, BorderLayout.CENTER); + return column( + LayoutConstants.VERTICAL_GAP, + row( + LayoutConstants.HGAP_LARGE, + cell(localFileRadioButton).weight(0.25), + cell(localText).weight(localWidthRatio), + cell(chooseFile).weight(0.75 - localWidthRatio) + ), + row( + LayoutConstants.HGAP_LARGE, + cell(urlFileRadioButton).weight(0.25), + cell(urlText).weight(urlWidthRatio), + cell(testConnection).weight(0.75 - urlWidthRatio) + ), + cell(tips).weight(1) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0,0,0,10))).getComponent(); } private ActionListener testConnectionListener = new ActionListener() { @@ -249,7 +252,7 @@ public class FileTableDataPane extends AbstractTableDataPane { } }; - private void previewPanel(JPanel jPanel) { + private JPanel getPreviewPanel() { JPanel previewPanel = new JPanel(new BorderLayout()); UIButton preview = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); preview.addActionListener(new ActionListener() { @@ -259,56 +262,33 @@ public class FileTableDataPane extends AbstractTableDataPane { } }); previewPanel.add(preview, BorderLayout.EAST); - jPanel.add(previewPanel, BorderLayout.SOUTH); + return previewPanel; } - private JPanel xmlSetPanel(int width, int height) { + /** + * XML设定Pane + * @return + */ + private JPanel getXmlSetPanel() { // xml设置pane - JPanel controlPane = new JPanel(); - JPanel northPane = new JPanel(new BorderLayout(8, 8)); - JPanel northTopPane = new JPanel(new BorderLayout(8, 8)); - JPanel southPane = new JPanel(new BorderLayout(8, 8)); - JPanel southTopPane = new JPanel(new BorderLayout(8, 8)); - controlPane.setLayout(new BorderLayout(8, 8)); - controlPane.setPreferredSize(new Dimension(width, height)); - JPanel comboboxPanel = new JPanel(new BorderLayout(8, 8)); - encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type") + ":"); + encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type")); encodingComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY); encodingComboBox.setSelectedIndex(4); - encodingComboBox.setPreferredSize(new Dimension(90, 20)); - - JPanel treeContainerPane = new JPanel(); - treeContainerPane.setLayout(new BorderLayout(8, 8)); - nodeTreePane = new XMLNodeTreePane(); - treeContainerPane.add(nodeTreePane, BorderLayout.CENTER); - - - comboboxPanel.add(encodeLabel, BorderLayout.WEST); - comboboxPanel.add(encodingComboBox, BorderLayout.CENTER); - - northPane.add(comboboxPanel, BorderLayout.EAST); - northTopPane.add(northPane, BorderLayout.WEST); - southTopPane.add(southPane, BorderLayout.WEST); - southTopPane.add(treeContainerPane, BorderLayout.CENTER); - controlPane.add(northTopPane, BorderLayout.NORTH); - controlPane.add(southTopPane, BorderLayout.CENTER); - previewPanel(controlPane); - return controlPane; + return column( + LayoutConstants.VGAP_MEDIUM, + row(LayoutConstants.HORIZONTAL_GAP, cell(encodeLabel).weight(0.2), cell(encodingComboBox).weight(0.8)), + cell(new XMLNodeTreePane()), + cell(getPreviewPanel()) + ).getComponent(); } - private JPanel excelSetPanel(int width, int height) { - // excel设置pane - int checkBoxWidth = width - EIGHT; - JPanel controlPane = new JPanel(); - JPanel northPane = new JPanel(new BorderLayout(8, 8)); - controlPane.setLayout(new BorderLayout()); - controlPane.setPreferredSize(new Dimension(width, height)); + /** + * Excel设定Pane + * @return + */ + private JPanel getExcelSetPanel() { needColumnNameCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FirstRow_IS_Column_Name"), false); - needColumnNameCheckBox.setPreferredSize(new Dimension(checkBoxWidth, 20)); - northPane.add(needColumnNameCheckBox, BorderLayout.EAST); - controlPane.add(northPane, BorderLayout.NORTH); - previewPanel(controlPane); - return controlPane; + return column(cell(needColumnNameCheckBox), cell(getPreviewPanel())).getComponent(); } private String getFilePathFromUrlOrLocal() { @@ -346,34 +326,21 @@ public class FileTableDataPane extends AbstractTableDataPane { // return (uri.matches("https*://.+|\\$\\{.+\\}.*")); } - private JPanel textSetPanel(int width, int height) { - // text设置pane - JPanel controlPane = new JPanel(); - controlPane.setLayout(new BorderLayout()); - controlPane.setPreferredSize(new Dimension(width, height)); - JPanel northPane = new JPanel(new BorderLayout(8, 8)); - addToNorthPane(northPane); - controlPane.add(northPane, BorderLayout.WEST); - previewPanel(controlPane); - return controlPane; - } - - private void addToNorthPane(JPanel northPane) { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] columnSize = {f, p, p}; - double[] rowSize = {B, B, B, B, B, B, B}; + /** + * TXT设定Pane + * @return + */ + private JPanel getTextSetPanel() { needColumnNameCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FirstRow_IS_Column_Name"), true); - dismenberLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dismenber") + ":"); tableDismemberRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Table_Dismember"), false); tableDismemberRadioButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Table_Dismember")); spaceDismenberRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Space"), true); spaceDismenberRadioButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Space")); commaDismenberRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Comma_Dismenber"), false); commaDismenberRadioButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Comma_Dismenber")); - otherDismenberRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Other") + ":", false); + otherDismenberRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Other"), false); otherDismenberRadioButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Other")); - otherDismenberTextField = new UITextField(8); + otherDismenberTextField = new UITextField(); otherDismenberTextField.setEditable(false); otherDismenberRadioButton.addChangeListener(new ChangeListener() { @Override @@ -392,18 +359,34 @@ public class FileTableDataPane extends AbstractTableDataPane { bg2.add(otherDismenberRadioButton); ignoreOneMoreDelimiterCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Series_Dismenber_As_Single"), true); UIComponentUtils.setLineWrap(ignoreOneMoreDelimiterCheckBox); - encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type") + ":"); + //编码类型 + encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type")); charsetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY); - Component[][] comps = { - {encodeLabel, charsetComboBox, null}, - {needColumnNameCheckBox, null, null}, - {dismenberLabel, tableDismemberRadioButton, null}, - {null, spaceDismenberRadioButton, null}, - {null, commaDismenberRadioButton, null}, - {null, otherDismenberRadioButton, otherDismenberTextField}, - {ignoreOneMoreDelimiterCheckBox, null, null} - }; - northPane.add(TableLayoutHelper.createTableLayoutPane(comps, rowSize, columnSize), BorderLayout.EAST); + //分隔符选项 + JPanel separatorOptionsPanel = column( + LayoutConstants.VERTICAL_GAP, + cell(tableDismemberRadioButton), + cell(spaceDismenberRadioButton), + cell(commaDismenberRadioButton), + row(cell(otherDismenberRadioButton).weight(0.2), cell(otherDismenberTextField).weight(0.8)) + ).getComponent(); + //TXT设定主要面板 + JPanel txtCenterPane = column( + LayoutConstants.VERTICAL_GAP, + row(10, cell(encodeLabel).weight(0.2), cell(charsetComboBox).weight(0.8)), + cell(needColumnNameCheckBox), + row(10, + cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dismenber"))).weight(0.2), + cell(separatorOptionsPanel).weight(0.8) + ), + cell(ignoreOneMoreDelimiterCheckBox) + ).getComponent(); + return column(cell(txtCenterPane), cell(getPreviewPanel())).getComponent(); + } + + private JPanel getTopAlignLabelPane(String labelText) { + return column(LayoutConstants.VERTICAL_GAP, cell(new UILabel(labelText))) + .with(it-> it.setBorder(new ScaledEmptyBorder(2,0,0,0))).getComponent(); } private ActionListener radioActionListener = new ActionListener() { @@ -480,24 +463,24 @@ public class FileTableDataPane extends AbstractTableDataPane { return suffixToString; } - private ActionListener getFileTypeListener(final JPanel setPanel, final int width, final int height) { + private ActionListener getFileTypeListener(final JPanel rightPanel) { ActionListener fileTypeListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - setPanel.removeAll(); + rightPanel.removeAll(); localText.setText(""); urlText.setText(""); if (fileTypeComboBox.getSelectedIndex() == XML) { - setPanel.add(xmlSetPanel(width, height), BorderLayout.NORTH); + rightPanel.add(getXmlSetPanel()); } else if (fileTypeComboBox.getSelectedIndex() == EXCEL) { - setPanel.add(excelSetPanel(width, height), BorderLayout.NORTH); + rightPanel.add(getExcelSetPanel()); } else { - setPanel.add(textSetPanel(width, height), BorderLayout.NORTH); + rightPanel.add(getTextSetPanel()); } String tipContent = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Parameter") + "reportlets/excel/FineReport${abc}." + getFileSuffixToString() + "
" + "http://192.168.100.120:8080/XXServer/Report/excel${abc}.jsp
" + "  "; tips.setText(tipContent); - setPanel.revalidate(); + rightPanel.revalidate(); } }; @@ -507,7 +490,7 @@ public class FileTableDataPane extends AbstractTableDataPane { private class RefreshAction extends UITableEditAction { public RefreshAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); + this.setSmallIcon(new LazyIcon("refresh")); } @Override @@ -818,9 +801,10 @@ public class FileTableDataPane extends AbstractTableDataPane { JPanel toolbarPanel = new JPanel(new BorderLayout()); this.setLayout(new BorderLayout()); xmlNodeTree = new XMLNodeTree(); + xmlNodeTree.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); this.add(new JScrollPane(xmlNodeTree)); - keyPointLaber = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Key_Point") + ":"); + keyPointLaber = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Key_Point")); refreshAction = new RefreshParameterAction(); ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(refreshAction); @@ -840,7 +824,7 @@ public class FileTableDataPane extends AbstractTableDataPane { public RefreshParameterAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Refresh")); this.setMnemonic('r'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); + this.setSmallIcon(new LazyIcon("refresh")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataSmallHeightPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataSmallHeightPane.java index 4ce5da98d6..06963c3810 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataSmallHeightPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataSmallHeightPane.java @@ -9,11 +9,10 @@ package com.fr.design.data.tabledata.tabledatapane; */ public class FileTableDataSmallHeightPane extends FileTableDataPane{ //wikky:文件数据集在模板数据集下面的界面参数。 - private static final int SETPANELWIDTH = 265; - private static final int WIDTH = 245; - private static final int HEIGHT = 475; - private static final int GAP = 13; + private static final double LOCAL_WIDTH_RATIO = 0.58; + private static final double URL_WIDTH_RATIO = 0.51; + public FileTableDataSmallHeightPane(){ - super(SETPANELWIDTH,WIDTH,HEIGHT,GAP); + super(LOCAL_WIDTH_RATIO, URL_WIDTH_RATIO); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataSmallPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataSmallPane.java index b81d2b904e..0c33c054af 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataSmallPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataSmallPane.java @@ -9,11 +9,10 @@ package com.fr.design.data.tabledata.tabledatapane; */ public class FileTableDataSmallPane extends FileTableDataPane{ //wikky:文件数据集在服务器数据集下面的界面参数。 - private static final int SETPANELWIDTH = 265; - private static final int WIDTH = 245; - private static final int HEIGHT = 436; - private static final int GAP = 13; + private static final double LOCAL_WIDTH_RATIO = 0.59; + private static final double URL_WIDTH_RATIO = 0.52; + public FileTableDataSmallPane(){ - super(SETPANELWIDTH,WIDTH,HEIGHT,GAP); + super(LOCAL_WIDTH_RATIO, URL_WIDTH_RATIO); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java index 66674f166a..33c1377496 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java @@ -1,9 +1,13 @@ package com.fr.design.data.tabledata.tabledatapane; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.*; import com.fr.data.impl.ConditionTableData; import com.fr.data.impl.MultiTDTableData; import com.fr.data.impl.UnionTableData; +import com.fr.design.constants.LayoutConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; @@ -39,6 +43,10 @@ import java.util.Iterator; import java.util.List; import java.util.Map.Entry; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + public class MultiTDTableDataPane extends AbstractTableDataPane { private static final int MAX_LENTH_OF_DATASET = 130; //关联数据集面板最大显示的数据集长度,超出这个长度显示数据集名称+“...” @@ -52,28 +60,25 @@ public class MultiTDTableDataPane extends AbstractTableDataPane stringTableDataWrapperEntry : resMap.entrySet()) { TableDataWrapper tableDataWrappe = stringTableDataWrapperEntry.getValue(); @@ -103,7 +110,6 @@ public class MultiTDTableDataPane extends AbstractTableDataPane MAX_LENTH_OF_DATASET) { @@ -299,25 +298,40 @@ public class MultiTDTableDataPane extends AbstractTableDataPane it.setBorder(new ScaledEmptyBorder(0,10,0,0))).getComponent(); this.setLayout(new BorderLayout()); - this.add(buttonPane, BorderLayout.NORTH); this.contentPane = getContentPane(); - this.add(contentPane, BorderLayout.CENTER); + this.add(column(cell(buttonPane), cell(contentPane)).getComponent()); } /** diff --git a/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java b/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java index 5b77b9571a..a15e6335cc 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java +++ b/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java @@ -1,6 +1,9 @@ package com.fr.design.dialog; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.common.annotations.Open; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.DesignSizeI18nManager; @@ -17,6 +20,9 @@ import java.awt.Dimension; import java.awt.Frame; import java.awt.Window; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + @Open public abstract class BasicPane extends JPanel { @@ -299,16 +305,19 @@ public abstract class BasicPane extends JPanel { private PropertyChangeAdapter changeListener; public NamePane(BasicPane bPane) { - this.setLayout(new BorderLayout(4, 4)); - - nameTextField = new UITextField(30); - Name = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Name") + ":"); - JPanel northPane = new JPanel(new BorderLayout(4, 4)); - northPane.add(Name, BorderLayout.WEST); - northPane.add(nameTextField, BorderLayout.CENTER); - northPane.add(showfield = new UILabel(" "), BorderLayout.EAST); + this.setLayout(new BorderLayout()); + nameTextField = new UITextField(); + Name = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Name")); + JPanel northPane = new JPanel(new BorderLayout()); + northPane.setBorder(new ScaledEmptyBorder(0,10,0,10)); + northPane.add(row( + LayoutConstants.HGAP_LARGE, + cell(Name).weight(0.12), + cell(nameTextField).weight(0.58), + cell(showfield = new UILabel(" ")).weight(0.3) + ).getComponent()); showfield.setForeground(new Color(204, 0, 1)); - showfield.setPreferredSize(new Dimension(220, showfield.getPreferredSize().height)); + showfield.setPreferredSize(FineUIScale.scale(new Dimension(220, showfield.getPreferredSize().height))); this.add(northPane, BorderLayout.NORTH); this.centerPane = bPane; this.add(bPane, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/EditingStringListPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/EditingStringListPane.java index ebe6abb672..b3815f2240 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/EditingStringListPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/EditingStringListPane.java @@ -1,27 +1,24 @@ package com.fr.design.gui.frpane; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.JListUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; -import javax.swing.DefaultListCellRenderer; -import javax.swing.DefaultListModel; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.ListSelectionModel; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import java.awt.BorderLayout; -import java.awt.Component; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -29,13 +26,15 @@ import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.*; + public abstract class EditingStringListPane extends BasicBeanPane> { private static final long serialVersionUID = 1L; private DefaultListModel model; private JList jlist; private UIButton addButton; - private UIButton editButton; + private UIButton modifyButton; private UIButton removeButton; private UIButton moveUpButton; private UIButton moveDownButton; @@ -43,6 +42,11 @@ public abstract class EditingStringListPane extends BasicBeanPane> public EditingStringListPane() { super(); this.setLayout(FRGUIPaneFactory.createBorderLayout()); + //按钮 + JPanel buttonPane = initButtonPane(); + buttonPane.setBorder(new ScaledEmptyBorder(0,0,10,0)); + this.add(buttonPane, BorderLayout.NORTH); + //列表 model = new DefaultListModel(); jlist = new JList(model); jlist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); @@ -56,34 +60,43 @@ public abstract class EditingStringListPane extends BasicBeanPane> } }); - - addButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add")); - editButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Modify")); - removeButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); - moveUpButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Up")); - moveDownButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Down")); - - JPanel eastPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - eastPane.add(editButton); - eastPane.add(removeButton); - eastPane.add(moveUpButton); - eastPane.add(moveDownButton); - this.add(GUICoreUtils.createBorderPane(eastPane, BorderLayout.NORTH), BorderLayout.EAST); - - JPanel centerPane = new JPanel(new BorderLayout(0, 5)); - this.add(centerPane, BorderLayout.CENTER); - JPanel northcenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - northcenterPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); - northcenterPane.add(addButton, BorderLayout.EAST); - centerPane.add(northcenterPane, BorderLayout.NORTH); - centerPane.add(new JScrollPane(jlist), BorderLayout.CENTER); - + jlist.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); + JScrollPane scrollPane = new JScrollPane(jlist); + scrollPane.setPreferredSize(FineUIScale.scale(new Dimension(620,350))); + scrollPane.setBorder(new FineRoundBorder()); + this.add(scrollPane, BorderLayout.CENTER); + //统一加按钮事件 this.addListener(); - this.addButton.setEnabled(false); this.checkEnableState(); } + private JPanel initButtonPane() { + addButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add"), new LazyIcon("add")); + addButton.setDisabledIcon(new LazyIcon("add").disabled()); + + modifyButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Modify"), new LazyIcon("edit")); + modifyButton.setDisabledIcon(new LazyIcon("edit").disabled()); + + removeButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), new LazyIcon("remove")); + removeButton.setDisabledIcon(new LazyIcon("remove").disabled()); + + moveUpButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Up"), new LazyIcon("move_up")); + moveUpButton.setDisabledIcon(new LazyIcon("move_up").disabled()); + + moveDownButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Down"), new LazyIcon("move_down")); + moveDownButton.setDisabledIcon(new LazyIcon("move_down").disabled()); + + return row(LayoutConstants.HORIZONTAL_GAP, + flex(), + cell(addButton), + cell(modifyButton), + cell(removeButton), + cell(moveUpButton), + cell(moveDownButton) + ).getComponent(); + } + private void addListener() { addListener1(); @@ -119,7 +132,6 @@ public abstract class EditingStringListPane extends BasicBeanPane> private void addListener1() { addButton.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent e) { String newvalue = getAddOrEditString(); @@ -133,7 +145,7 @@ public abstract class EditingStringListPane extends BasicBeanPane> } } }); - editButton.addActionListener(new ActionListener() { + modifyButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -152,9 +164,9 @@ public abstract class EditingStringListPane extends BasicBeanPane> Object selected = jlist.getSelectedValue(); if (selected != null) { int re = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(EditingStringListPane.this), - Toolkit.i18nText("Fine-Design_Basic_Sure_To_Delete") + selected.toString() + "?", - Toolkit.i18nText("Fine-Design_Basic_Dialog_Prompt"), - JOptionPane.OK_CANCEL_OPTION); + Toolkit.i18nText("Fine-Design_Basic_Sure_To_Delete") + selected.toString() + "?", + Toolkit.i18nText("Fine-Design_Basic_Dialog_Prompt"), + JOptionPane.OK_CANCEL_OPTION); if (re == JOptionPane.OK_OPTION) { JListUtils.removeSelectedListItems(jlist); } @@ -174,7 +186,7 @@ public abstract class EditingStringListPane extends BasicBeanPane> private void setEditEnabled(boolean enabled) { this.removeButton.setEnabled(enabled); - this.editButton.setEnabled(enabled); + this.modifyButton.setEnabled(enabled); this.moveUpButton.setEnabled(enabled); this.moveDownButton.setEnabled(enabled); } diff --git a/designer-base/src/main/java/com/fr/design/gui/ilable/FRExplainLabel.java b/designer-base/src/main/java/com/fr/design/gui/ilable/FRExplainLabel.java index d0c5f4a496..e4224535c3 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilable/FRExplainLabel.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilable/FRExplainLabel.java @@ -1,10 +1,9 @@ package com.fr.design.gui.ilable; -import java.awt.Color; +import com.fine.theme.utils.FineUIStyle; import javax.swing.Icon; import javax.swing.ImageIcon; -import com.fr.design.gui.ilable.UILabel; public class FRExplainLabel extends UILabel { @@ -19,6 +18,6 @@ public class FRExplainLabel extends UILabel { private void init(){ setIcon(icon); - setForeground(new Color(255, 0, 0)); + FineUIStyle.setStyle(this, FineUIStyle.LABEL_WARNING_TIP); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParameterPane.java b/designer-base/src/main/java/com/fr/design/parameter/ParameterPane.java index 063a685d80..340f9a5232 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParameterPane.java +++ b/designer-base/src/main/java/com/fr/design/parameter/ParameterPane.java @@ -1,18 +1,21 @@ package com.fr.design.parameter; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.Parameter; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Component; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; public class ParameterPane extends BasicBeanPane { @@ -34,27 +37,24 @@ public class ParameterPane extends BasicBeanPane { } protected void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setLayout(new BorderLayout()); + //名字 nameTextField = new UITextField(10); nameTextField.setEditable(false); - - JPanel textFieldPanel=FRGUIPaneFactory.createBorderLayout_S_Pane(); - textFieldPanel.add(nameTextField,BorderLayout.CENTER); - + //默认值 valueEditor = ValueEditorPaneFactory.createBasicValueEditorPane(); - // richer:要排列显示的控件 - Component[][] components = {{null}, - { null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":"),textFieldPanel }, - { null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Default_Value") + ":"),valueEditor } - }; - double p =TableLayout.PREFERRED; - double f =TableLayout.FILL; - double[] rowSize = {p, p, p, p}; - double[] columnSize = {p, p, f, p, p}; - - JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane( - components, rowSize, columnSize, 20, 10); + JPanel centerPane = column(LayoutConstants.VERTICAL_GAP, + row(20, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":")).weight(0.1), + cell(nameTextField).weight(0.8), + flex(0.1)), + row(20, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Default_Value") + ":")).weight(0.1), + cell(valueEditor).weight(0.8), + flex(0.1)) + ).getComponent(); + centerPane.setBorder(new ScaledEmptyBorder(0, 20, 0, 0)); this.add(centerPane, BorderLayout.CENTER); } diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java index e06046e079..bab3f73d9c 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java @@ -1,7 +1,14 @@ package com.fr.design.report; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; import com.fr.base.iofile.attr.WatermarkAttr; +import com.fr.design.border.FineBorderFactory; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.editor.editor.FormulaEditor; import com.fr.design.gui.icombobox.UIComboBox; @@ -12,25 +19,14 @@ import com.fr.design.gui.ispinner.UnsignedIntUISpinner; import com.fr.design.gui.style.FRFontPane; 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.style.color.NewColorSelectPane; -import com.fr.design.utils.gui.GUICoreUtils; -import javax.swing.BorderFactory; -import javax.swing.SwingConstants; -import javax.swing.JComponent; -import javax.swing.JPanel; +import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import javax.swing.JDialog; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; -import java.awt.Dimension; -import java.awt.BorderLayout; -import java.awt.Color; +import java.awt.*; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.ItemEvent; @@ -39,8 +35,13 @@ import java.awt.event.MouseListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.FocusAdapter; -import java.awt.Dialog; -import java.awt.FlowLayout; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; /** @@ -57,7 +58,7 @@ public class WatermarkPane extends BasicPane { private UIComboBox fontSizeComboBox; //横向间距 private UISpinner horizontalGapSpinner; - //横向间距 + //纵向间距 private UISpinner verticalGapSpinner; // 文字颜色 private NewColorSelectPane colorPane; @@ -69,7 +70,7 @@ public class WatermarkPane extends BasicPane { //纵向间距最小值 public static final int VERTICAL_GAP_MIX = 50; - private static final Dimension SPINNER_DIMENSION = new Dimension(75, 20); + private JPanel leftPane; public WatermarkPane() { initComponents(); @@ -77,26 +78,45 @@ public class WatermarkPane extends BasicPane { private void initComponents() { message = new UILabel(); - this.setBorder(BorderFactory.createEmptyBorder(4, 4, -5, 4)); this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(contentPane, BorderLayout.CENTER); - - // 预览 - JPanel leftPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - contentPane.add(leftPane, BorderLayout.CENTER); - leftPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Style_Preview"), null)); + //左侧预览面板 JPanel previewPaneWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); - leftPane.add(previewPaneWrapper, BorderLayout.CENTER); - previewPaneWrapper.setBorder(BorderFactory.createEmptyBorder(2, 8, 4, 8)); + //预览外边框,宽度跟随全局权重 + previewPaneWrapper.setBorder(new FineRoundBorder()); + previewPaneWrapper.setPreferredSize(FineUIScale.scale(new Dimension(-1,415))); + previewPaneWrapper.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); watermarkPreviewPane = new WatermarkPreviewPane(); + watermarkPreviewPane.setOpaque(false); previewPaneWrapper.add(watermarkPreviewPane, BorderLayout.CENTER); - - // 设置 - JPanel rightPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - contentPane.add(rightPane, BorderLayout.EAST); - rightPane.add(initRightPane(), BorderLayout.NORTH); + leftPane = column( + LayoutConstants.VGAP_SMALL, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Style_Preview"))), + cell(previewPaneWrapper) + ).getComponent(); + + // 分割线 + JPanel separatorLine = new JPanel(); + separatorLine.setBorder(FineBorderFactory.createDefaultUnderlineBorder()); + + //在预览与配置外创建一个大的外边框并设置边距 + JPanel innerPanel = row( + LayoutConstants.HORIZONTAL_GAP, + cell(leftPane).weight(0.55), + cell(wrapComponentWithTitle(getRightPane(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Config"))).weight(0.45) + ).with(it -> it.setBorder(new ScaledEmptyBorder(10,10,10,10))).getComponent(); + JPanel outerPanel = new JPanel(new BorderLayout()); + outerPanel.setBorder(new FineRoundBorder()); + outerPanel.setBackground(FineUIUtils.getUIColor("fill.gray", "defaultBorderColor")); + outerPanel.add(innerPanel); + + // 分割线下方,左侧预览,右侧配置 + JPanel centerPanel = column(LayoutConstants.VERTICAL_GAP, + cell(separatorLine), + cell(outerPanel) + ).getComponent(); + centerPanel.setBorder(new ScaledEmptyBorder(0, 10, 0, 10)); + this.add(centerPanel, BorderLayout.CENTER); } public void populate(WatermarkAttr watermark) { @@ -129,60 +149,59 @@ public class WatermarkPane extends BasicPane { this.formulaPane = formulaPane; } - protected UIScrollPane initRightPane() { + /** + * 配置Pane + * @return + */ + protected JPanel getRightPane() { + // 文字 formulaPane = new FormulaEditor(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula")); + // 字号 fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); fontSizeComboBox.setEditable(true); + + //水印间距 horizontalGapSpinner = new UnsignedIntUISpinner(100, Integer.MAX_VALUE, 1, 200); verticalGapSpinner = new UnsignedIntUISpinner(50, Integer.MAX_VALUE, 1, 100); - horizontalGapSpinner.setPreferredSize(SPINNER_DIMENSION); - verticalGapSpinner.setPreferredSize(SPINNER_DIMENSION); - message.setBorder(BorderFactory.createEmptyBorder(8, 5, 0, 0)); //失去焦点时要判断是否要弹出提示 horizontalGapSpinner.getTextField().addFocusListener( createFocusListener4GapNumberField(horizontalGapSpinner, HORIZONTAL_GAP_MIX, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Horizontal_Gap_Over_Warning"))); verticalGapSpinner.getTextField().addFocusListener(createFocusListener4GapNumberField(verticalGapSpinner, VERTICAL_GAP_MIX, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Vertical_Gap_Over_Warning"))); - //next 按钮 释放时也要判断是否要弹出提示 horizontalGapSpinner.getNextButton().addMouseListener(createMouseListener4GapNextButton(horizontalGapSpinner, HORIZONTAL_GAP_MIX, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Horizontal_Gap_Over_Warning"))); verticalGapSpinner.getNextButton().addMouseListener(createMouseListener4GapNextButton(verticalGapSpinner, VERTICAL_GAP_MIX, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Vertical_Gap_Over_Warning"))); - - JPanel fontSizeTypePane = new JPanel(new BorderLayout(10, 0)); - fontSizeTypePane.add(fontSizeComboBox, BorderLayout.CENTER); - - //水印间距面板 - JPanel watermarkGapPane = new JPanel(new BorderLayout(10, 0)); - JPanel jp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 10, 0); - jp.add(horizontalGapSpinner); - jp.add(verticalGapSpinner); - watermarkGapPane.add(jp, BorderLayout.CENTER); - - JPanel watermarkGapTipsPane = new JPanel(new BorderLayout()); - JPanel tipsJp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 10, 0); - tipsJp.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), SwingConstants.CENTER)); - tipsJp.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"), SwingConstants.CENTER)); - watermarkGapTipsPane.add(tipsJp, BorderLayout.CENTER); - + //水印间距提示居中布局 + JPanel watermarkGapTipsPane = row(LayoutConstants.HGAP_LARGE, + flex(0.15), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"))).weight(0.2), + flex(0.3), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"))).weight(0.2), + flex(0.15) + ).getComponent(); + //水印间距排列 + JPanel watermarkGapPane = column( + row(LayoutConstants.HGAP_LARGE, + cell(horizontalGapSpinner).weight(0.5), + cell(verticalGapSpinner).weight(0.5) + ), + cell(watermarkGapTipsPane) + ).getComponent(); + // 颜色选择器 colorPane = new NewColorSelectPane(false); - JPanel colorLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - colorLabelPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Text_Color")), BorderLayout.NORTH); - - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p}; - double[] columnSize = {p, MAX_WIDTH}; - - JPanel rightContentPane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{ - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Watermark_Text")), formulaPane}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Size")), fontSizeTypePane}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Watermark_Gap")), watermarkGapPane}, - {null, watermarkGapTipsPane}, - {colorLabelPane, colorPane}, - }, rowSize, columnSize, 10); - rightContentPane.setBorder(BorderFactory.createEmptyBorder(15, 12, 10, 12)); - - UIScrollPane configPane = new UIScrollPane(rightContentPane); - configPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Config"), null)); - return configPane; + // 配置面板排列布局 + JPanel rightContentPane = column(LayoutConstants.VERTICAL_GAP, + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Watermark_Text"))).weight(0.3), cell(formulaPane).weight(0.7)), + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Size"))).weight(0.3), cell(fontSizeComboBox).weight(0.7)), + row(cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Watermark_Gap"))).weight(0.3), cell(watermarkGapPane).weight(0.7)), + row(cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Text_Color"))).weight(0.3), cell(colorPane).weight(0.7)) + ).getComponent(); + rightContentPane.setOpaque(false); + return rightContentPane; + } + + private JPanel getTopAlignLabelPane(String labelText) { + return column(LayoutConstants.VERTICAL_GAP, cell(new UILabel(labelText))). + with(it -> it.setBorder(new ScaledEmptyBorder(2,0,0,0))).getComponent(); } protected void populateFontSize(int fontSize) { diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java index f3de6eef96..da5ee01db7 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java @@ -20,7 +20,7 @@ public class WatermarkSettingPane extends AbstractTemplateServerSettingPane { } private void initComponents() { - buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 8, 0, 0)); + //buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 8, 0, 0)); } @Override diff --git a/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java index 48d6a5686e..901f1b6010 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java @@ -1,12 +1,12 @@ package com.fr.design.report.fit; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.report.fit.provider.FitAttrModelProvider; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.report.fit.ReportFitAttr; import javax.swing.*; @@ -17,6 +17,8 @@ import java.util.Comparator; import java.util.Set; import java.util.stream.Collectors; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; import static com.fr.design.i18n.Toolkit.i18nText; public abstract class BaseFitAttrPane extends BasicBeanPane { @@ -26,26 +28,23 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { protected UIComboBox itemChoose; protected java.util.List fitAttrModelList = new ArrayList<>(); private ReportFitConfigPane fitConfigPane; - public FitAttrModel fitAttrModel; - private static final int BELOW_SET_COMPONENT_HSPACE = 8; - protected BaseFitAttrPane() { initFitAttrModel(); } private void initFitAttrModel() { + //旧决策报表 fitAttrModelList.add(new FrmFitAttrModel()); + //普通报表 fitAttrModelList.add(new CptFitAttrModel()); + //决策报表 fitAttrModelList.add(new AdaptiveFrmFitAttrModel()); - Set fitAttrModelProviders = ExtraDesignClassManager.getInstance().getArray(FitAttrModelProvider.XML_TAG); - for (FitAttrModelProvider fitAttrModelProvider : fitAttrModelProviders) { fitAttrModelList.add(fitAttrModelProvider); } - fitAttrModelList = fitAttrModelList.stream().sorted(Comparator.comparing(FitAttrModel::getPriority).reversed()).collect(Collectors.toList()); } @@ -55,6 +54,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { contentJPanel.remove(fitConfigPane); } this.fitConfigPane = fitAttrModel instanceof CptFitAttrModel ? new ReportFitConfigPane(fitAttrModel, true) : new FormFitConfigPane(fitAttrModel, true); + //添加自适应面板 contentJPanel.add(fitConfigPane); } @@ -82,34 +82,33 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { protected abstract String[] getItemNames(); protected void initComponents() { - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - contentJPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(false, FlowLayout.LEFT, 0, 0); - this.add(contentJPanel); + //添加以下设置 initItemChoose(); + //服务器配置-PC端自适应属性面板中需要添加提示 initPrompt(); + this.setLayout(new BorderLayout()); + this.add(contentJPanel); } - + /** + * 以下设置Pane + */ private void initItemChoose() { - JPanel chooseJPanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - ItemListener itemListener = getItemListener(); + belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); itemChoose = new UIComboBox(getItemNames()); + ItemListener itemListener = getItemListener(); itemChoose.addItemListener(itemListener); - belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); - JPanel hSpaceLabel = new JPanel(); - hSpaceLabel.setSize(BELOW_SET_COMPONENT_HSPACE, 0); - JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{ - belowSetLabel, hSpaceLabel, itemChoose}, FlowLayout.LEFT); - chooseJPanel.add(buttonPane); - chooseJPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); - contentJPanel.add(chooseJPanel); + //以下设置横向布局 + JPanel buttonPane = row(20, cell(belowSetLabel), cell(itemChoose)).getComponent(); + buttonPane.setBorder(new ScaledEmptyBorder(0,5,5,0)); + //整体面板添加‘以下设置Pane’ + contentJPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(false, FlowLayout.LEFT, 0, 0); + contentJPanel.setBorder(new ScaledEmptyBorder(5,10,5,10)); + contentJPanel.add(buttonPane); } - protected abstract ItemListener getItemListener(); - public void populate(ReportFitAttr reportFitAttr) { } diff --git a/designer-base/src/main/java/com/fr/design/report/fit/FormFitConfigPane.java b/designer-base/src/main/java/com/fr/design/report/fit/FormFitConfigPane.java index d88a3a16eb..acd8ee1f73 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/FormFitConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/FormFitConfigPane.java @@ -1,11 +1,12 @@ package com.fr.design.report.fit; +import com.fine.theme.utils.FineUIStyle; import com.fr.base.svg.SVGLoader; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.report.fit.menupane.FitRadioGroup; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; @@ -23,13 +24,16 @@ import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + public class FormFitConfigPane extends ReportFitConfigPane { private static final int ICON_OFFSET_X = 25; private static final int ICON_OFFSET_Y = 3; private static final int ICON_SIZE = 16; + //待调整 private static final Image HOVER_IMAGE = SVGLoader.load("/com/fr/design/icon/icon_ec_default_fit.svg"); private static final int DEFAULT_ITEM = 0; - private static final int CUSTOM_ITEM = 1; public FormFitConfigPane(FitAttrModel fitAttrModel) { @@ -41,12 +45,11 @@ public class FormFitConfigPane extends ReportFitConfigPane { } protected JPanel initECConfigPane() { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel jPanel = new JPanel(new BorderLayout()); if (fitAttrModel.getFitTypeNames().length != 0) { Component[] ecComponents = new Component[fitAttrModel.getFitTypeNames().length + 1]; initRadioGroup(ecConfigRadioGroup, fitAttrModel.getFitName(), fitAttrModel.getFitTypeNames(), ecComponents); - jPanel.add(createSubAttrPane(ecComponents), BorderLayout.CENTER); - jPanel.add(createTipPane(), BorderLayout.SOUTH); + jPanel.add(column(10, cell(createSubAttrPane(ecComponents)), cell(createTipPane())).getComponent()); } return jPanel; } @@ -79,7 +82,6 @@ public class FormFitConfigPane extends ReportFitConfigPane { UIPopupMenu uiPopupMenu = new UIPopupMenu() { @Override protected void paintBorder(Graphics g) { - } }; uiPopupMenu.setLayout(new BorderLayout(0, 0)); @@ -107,7 +109,6 @@ public class FormFitConfigPane extends ReportFitConfigPane { } else { hidePreviewPane(); } - } }); } @@ -138,13 +139,12 @@ public class FormFitConfigPane extends ReportFitConfigPane { } private JPanel createTipPane() { - JPanel jPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); + JPanel jPanel = new JPanel(new BorderLayout()); UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Form_PC_FIT_Config_Tip1")); - jPanel.add(label1); - label1.setForeground(Color.lightGray); + FineUIStyle.setStyle(label1, FineUIStyle.LABEL_TIP); UILabel label2 = new UILabel(Toolkit.i18nText("Fine-Design_Form_PC_FIT_Config_Tip2")); - jPanel.add(label2); - label2.setForeground(Color.lightGray); + FineUIStyle.setStyle(label2, FineUIStyle.LABEL_TIP); + jPanel.add(column(LayoutConstants.HORIZONTAL_GAP, cell(label1), cell(label2)).getComponent()); return jPanel; } @@ -159,5 +159,4 @@ public class FormFitConfigPane extends ReportFitConfigPane { protected void updateECConfigRadioGroup(ReportFitAttr reportFitAttr) { reportFitAttr.setFitStateInPC(ecConfigRadioGroup.getSelectRadioIndex()); } - } diff --git a/designer-base/src/main/java/com/fr/design/report/fit/NewFitPreviewPane.java b/designer-base/src/main/java/com/fr/design/report/fit/NewFitPreviewPane.java index 2bc69cedc7..36209972fc 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/NewFitPreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/NewFitPreviewPane.java @@ -1,5 +1,6 @@ package com.fr.design.report.fit; +import com.fine.theme.utils.FineUIScale; import com.fr.base.GraphHelper; import com.fr.general.FRFont; @@ -17,7 +18,7 @@ public class NewFitPreviewPane extends JPanel { private static final Color DEFAULT_PAINT_COLOR = Color.decode("#419BF9"); private static final int FIT_FONT_SIZE = 15; private static final int NO_FIT_FONT_SIZE = 10; - private static final Dimension NO_FIT_CONTAINER_DIMENSION = new Dimension(230, 80); + private static final Dimension NO_FIT_CONTAINER_DIMENSION = FineUIScale.scale(new Dimension(230, 80)); public NewFitPreviewPane(){ diff --git a/designer-base/src/main/java/com/fr/design/report/fit/ReportFitConfigPane.java b/designer-base/src/main/java/com/fr/design/report/fit/ReportFitConfigPane.java index 158089602f..20c2688392 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/ReportFitConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/ReportFitConfigPane.java @@ -1,5 +1,6 @@ package com.fr.design.report.fit; +import com.fine.theme.utils.FineUIScale; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.DesignSizeI18nManager; @@ -10,15 +11,16 @@ import com.fr.design.report.fit.menupane.FontRadioGroup; import com.fr.general.ComparatorUtils; import com.fr.report.fit.ReportFitAttr; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; import static com.fr.design.i18n.Toolkit.i18nText; public class ReportFitConfigPane extends JPanel { @@ -36,21 +38,24 @@ public class ReportFitConfigPane extends JPanel { } private void initComponent() { - JPanel contentJPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(false, FlowLayout.LEFT, 0, 0); - this.add(contentJPanel); fontRadioGroup = new FontRadioGroup(); ecConfigRadioGroup = new FitRadioGroup(); - contentJPanel.add(initAttrJPanel()); - contentJPanel.add(initPreviewJPanel()); + this.add(initContentPanel()); } - private JPanel initAttrJPanel() { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + private JPanel initContentPanel() { + //字体 Component[] fontComponents = new Component[3]; initRadioGroup(fontRadioGroup, i18nText("Fine-Designer_Fit-Font"), new String[]{i18nText("Fine-Designer_Fit"), i18nText("Fine-Designer_Fit-No")}, fontComponents); - jPanel.add(createSubAttrPane(fontComponents), BorderLayout.NORTH); - jPanel.add(initECConfigPane(), BorderLayout.CENTER); - return jPanel; + //预览区域 + previewJPanel = new NewFitPreviewPane(); + previewJPanel.setPreferredSize(FineUIScale.scale(new Dimension(300, 204))); + //面板布局 字体-(null/报表块/表格)-预览区域 + return column(10, + cell(createSubAttrPane(fontComponents)), + cell(initECConfigPane()), + cell(previewJPanel) + ).getComponent(); } protected JPanel initECConfigPane() { @@ -61,21 +66,14 @@ public class ReportFitConfigPane extends JPanel { return jPanel; } - protected JPanel createSubAttrPane(Component[] components) { double[] rowSize = new double[]{20}; double[] columnSize = new double[components.length]; - for (int i = 0; i < columnSize.length; i++) { - if (i == 0) { - columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth(); - } else { - columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.column").getWidth(); - } + for (int i = 1; i < columnSize.length; i++) { + columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.column").getWidth(); } - JPanel attrJPanel = TableLayoutHelper.createTableLayoutPane(new Component[][]{components}, rowSize, columnSize); - attrJPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); - return attrJPanel; + return row(cell(components[0]).weight(0.16),cell(attrJPanel).weight(0.84)).getComponent(); } protected void initRadioGroup(FitRadioGroup fitRadioGroup, String name, String[] options, Component[] components) { @@ -110,17 +108,6 @@ public class ReportFitConfigPane extends JPanel { previewJPanel.refreshPreview(fontRadioGroup.isFontFit(), FitType.parse(updateBean())); } - private JPanel initPreviewJPanel() { - JPanel wrapperPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - previewJPanel = new NewFitPreviewPane(); - wrapperPane.add(previewJPanel, BorderLayout.CENTER); - int leftIndent = globalConfig ? (int) DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth() : 0; - wrapperPane.setBorder(BorderFactory.createEmptyBorder(0, leftIndent, 0, 0)); - wrapperPane.setPreferredSize(new Dimension(300 + leftIndent, 204)); - return wrapperPane; - } - - public void populateBean(ReportFitAttr ob) { fontRadioGroup.selectIndexButton(ob.isFitFont() ? 0 : 1); populateECConfigRadioGroup(ob.fitStateInPC()); diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index 91661301f1..ba1c377965 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -16,6 +16,7 @@ import com.fr.data.util.function.SumFunction; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.border.UITitledBorder; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.DefaultValueAdjustProvider; import com.fr.design.gui.ibutton.UIButton; @@ -90,6 +91,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + // Noninstantiable utility class public final class GUICoreUtils { @@ -992,12 +996,7 @@ public final class GUICoreUtils { dynamicPane.setVisible(e.getStateChange() == visibleState); } }); - JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.add(checkBox, BorderLayout.NORTH); - JPanel dynamicPaneWrapper = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - dynamicPaneWrapper.add(dynamicPane); - panel.add(dynamicPaneWrapper, BorderLayout.CENTER); - return panel; + return column(LayoutConstants.VERTICAL_GAP, cell(checkBox), cell(dynamicPane)).getComponent(); } /** diff --git a/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java b/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java index 69805979ba..6aeddc1ae9 100644 --- a/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java @@ -1,5 +1,7 @@ package com.fr.design.widget; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; @@ -16,25 +18,29 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + public class IconDefinePane extends BasicPane { private UILabel showIconImageLable; private UIButton editIconButton; private UIButton removeIconButton; private String curIconName; + private Icon curIcon; public IconDefinePane() { - JPanel iconPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + /*JPanel iconPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - labelPane.setLayout(new /**/ FlowLayout(FlowLayout.LEFT, 20, 0)); + labelPane.setLayout(new *//**//* FlowLayout(FlowLayout.LEFT, 20, 0));*/ showIconImageLable = new UILabel(); - showIconImageLable.setPreferredSize(new Dimension(20, 20)); + //showIconImageLable.setPreferredSize(new Dimension(20, 20)); editIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); - JPanel iconButtonPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + /* JPanel iconButtonPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); labelPane.add(showIconImageLable); iconPane.add(labelPane, BorderLayout.WEST); iconPane.add(iconButtonPane, BorderLayout.EAST); - iconButtonPane.add(editIconButton); + iconButtonPane.add(editIconButton);*/ editIconButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -54,7 +60,7 @@ public class IconDefinePane extends BasicPane { }); removeIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Delete")); - iconButtonPane.add(removeIconButton); + //iconButtonPane.add(removeIconButton); removeIconButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { curIconName = null; @@ -62,9 +68,14 @@ public class IconDefinePane extends BasicPane { } }); - this.add(this.showIconImageLable); + /*this.add(this.showIconImageLable); this.add(this.editIconButton); this.add(this.removeIconButton); + */ + JPanel iconButtonPane = row(LayoutConstants.HORIZONTAL_GAP, cell(this.showIconImageLable), cell(this.editIconButton), cell(this.removeIconButton)).getComponent(); + iconButtonPane.setBorder(new ScaledEmptyBorder(0,0,0,0)); + this.setLayout(new BorderLayout()); + this.add(iconButtonPane, BorderLayout.CENTER); } @Override @@ -86,6 +97,11 @@ public class IconDefinePane extends BasicPane { setShowIconImage(); } + public void populateIcon(String iconName, Icon icon) { + this.curIconName = iconName; + showIconImageLable.setIcon(icon); + } + public String update() { return this.curIconName; } diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/clearStash.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/clearStash.svg new file mode 100644 index 0000000000..1c1214522d --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/clearStash.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/clearStash_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/clearStash_disable.svg new file mode 100644 index 0000000000..6d62bdb21a --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/clearStash_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/customButton.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/customButton.svg new file mode 100644 index 0000000000..af4281adf2 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/customButton.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/customButton_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/customButton_disable.svg new file mode 100644 index 0000000000..28c9902293 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/customButton_disable.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/dataVerify.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/dataVerify.svg new file mode 100644 index 0000000000..6cfda99d8a --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/dataVerify.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/dataVerify_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/dataVerify_disable.svg new file mode 100644 index 0000000000..6672c764ea --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/dataVerify_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/email.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/email.svg new file mode 100644 index 0000000000..13b48174b7 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/email.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/email_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/email_disable.svg new file mode 100644 index 0000000000..74499db085 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/email_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/move_up.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/move_up.svg index 1da5e45a17..df2a4fcb0a 100644 --- a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/move_up.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/move_up.svg @@ -1,3 +1,10 @@ - - + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/move_up_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/move_up_disable.svg index cae74fbe52..2b6c72634e 100644 --- a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/move_up_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/move_up_disable.svg @@ -1,3 +1,10 @@ - - + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_first.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_first.svg new file mode 100644 index 0000000000..ac5c1f0c12 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_first.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_first_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_first_disable.svg new file mode 100644 index 0000000000..f7e6a77895 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_first_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_last.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_last.svg new file mode 100644 index 0000000000..7f14b98388 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_last.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_last_disbale.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_last_disbale.svg new file mode 100644 index 0000000000..80384418da --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_last_disbale.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_navi.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_navi.svg new file mode 100644 index 0000000000..afc2ecb557 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_navi.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_navi_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_navi_disable.svg new file mode 100644 index 0000000000..365e6dc5fa --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_navi_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_next.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_next.svg new file mode 100644 index 0000000000..12c49708d8 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_next.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_next_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_next_disable.svg new file mode 100644 index 0000000000..f1ac806195 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_next_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_previous.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_previous.svg new file mode 100644 index 0000000000..37df1e9546 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_previous.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_previous_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_previous_disable.svg new file mode 100644 index 0000000000..e53a285ed6 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page_previous_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printApplet.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printApplet.svg new file mode 100644 index 0000000000..ddf8873655 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printApplet.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printApplet_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printApplet_disable.svg new file mode 100644 index 0000000000..4dd13115b8 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printApplet_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPdf.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPdf.svg new file mode 100644 index 0000000000..405640d101 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPdf.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPdf_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPdf_disable.svg new file mode 100644 index 0000000000..0044218667 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPdf_disable.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPreview.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPreview.svg new file mode 100644 index 0000000000..479384b117 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPreview.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPreview_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPreview_disable.svg new file mode 100644 index 0000000000..b3b7dce3df --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printPreview_disable.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printerOffset.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printerOffset.svg new file mode 100644 index 0000000000..90d01097be --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printerOffset.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printerOffset_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printerOffset_disable.svg new file mode 100644 index 0000000000..0eb451e6f1 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/printerOffset_disable.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/scale.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/scale.svg new file mode 100644 index 0000000000..fd9b1ba386 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/scale.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/scale_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/scale_disable.svg new file mode 100644 index 0000000000..d51fced4d0 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/scale_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json index 4e3213695b..cfcdb3c99a 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json @@ -179,7 +179,12 @@ "reportFit": "toolbar/reportFit.svg", "mobileAttr": "toolbar/mobileAttr.svg", "watermark": "toolbar/watermark.svg", + "dataVerify": "toolbar/dataVerify.svg", + "clearStash": "toolbar/clearStash.svg", "print": "toolbar/print.svg", + "printPdf": "toolbar/printPdf.svg", + "printApplet": "toolbar/printApplet.svg", + "printPreview": "toolbar/printPreview.svg", "pageSetup": "toolbar/pageSetup.svg", "reportHeader": "toolbar/reportHeader.svg", "reportFooter": "toolbar/reportFooter.svg", @@ -215,6 +220,15 @@ "workOrderCenter": "toolbar/workOrderCenter.svg", "actCenter": "toolbar/actCenter.svg", "sign": "toolbar/sign.svg", + "page_first": "toolbar/page_first.svg", + "page_next": "toolbar/page_next.svg", + "page_previous": "toolbar/page_previous.svg", + "page_last": "toolbar/page_last.svg", + "page_navi": "toolbar/page_navi.svg", + "email": "toolbar/email.svg", + "scale": "toolbar/scale.svg", + "printerOffset": "toolbar/printerOffset.svg", + "customButton": "toolbar/customButton.svg", "cellelement_small": "cellelement.svg", "forbid": "expand/forbid.svg", "horizontal_expand": "expand/horizontal.svg", diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index d20add6df5..1274335f8b 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -399,6 +399,7 @@ Label.tipColor = @BrandTipColor Label.borderColor = $defaultBorderColor Label.hyperLinkColor = #2576EF Label.strongHintColor = #FF0000 +Label.warningColor = #F1393C #---- HelpButton ---- @@ -1305,6 +1306,9 @@ CellOtherSetPane.height=$Component.defaultHeight [style]Label.tipLabel = \ foreground: $Label.tipColor +[style]Label.warningTipLabel = \ + foreground: $Label.warningColor + [style]Button.plainButton = \ border: null; \ background: null; \ diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties index 2a10d13c7f..e69042470d 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties @@ -9,7 +9,7 @@ com.fr.design.version.detail.label=450*30 com.fr.design.version.detail.dialog=600*500 com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20 com.fr.design.web.pane.text.field=450*20 -com.fr.design.actions.server.dialog=700*630 +com.fr.design.actions.server.dialog=660*600 com.fr.design.report.fit.templatePane.dialog=600*400 com.fr.design.report.fit.firstColumn=80*20 com.fr.design.report.fit.column=100*20 @@ -22,7 +22,7 @@ com.fr.design.ds.column.sort.pane=220*150 com.fr.design.sort.expand.header.pane=108*10 com.fr.design.plugin.remind.PluginInvalidateRemindDialog.dialog=600*500 com.fr.design.plugin.remind.PluginInvalidateRemindDialog.centerPane=580*369 -com.fr.design.report.WatermarkSettingPane=720*600 +com.fr.design.report.WatermarkSettingPane=660*600 com.fr.design.file.MultiTemplateTabPane.popUpMenu=170*65 com.fr.design.formula.FormulaPane=900*600 com.fr.design.formula.FormulaPaneWhenReserveFormula=900*600 diff --git a/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java b/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java index 0567078968..a2e948ac3c 100644 --- a/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java @@ -17,6 +17,7 @@ import com.fr.design.write.submit.DBManipulationPane; import com.fr.form.event.Listener; import com.fr.js.JavaScript; import com.fr.report.web.util.ReportEngineEventMapping; +import com.fr.web.core.cid.data.BrowserAccessDetail; import com.fr.write.JavaScriptResourceInfo; import javax.swing.BorderFactory; @@ -32,6 +33,11 @@ import java.util.Arrays; import java.util.List; import java.util.Set; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + public class ListenerEditPane extends BasicBeanPane { private UITextField nameText; private UIComboBox styleBox; @@ -66,10 +72,11 @@ public class ListenerEditPane extends BasicBeanPane { public void initComponents(String[] defaultArgs) { cards = new ArrayList<>(); this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); nameText = new UITextField(8); nameText.setEditable(false); - namePane.add(nameText, BorderLayout.WEST); + //namePane.add(nameText, BorderLayout.WEST); final List style = new ArrayList<>(Arrays.asList(JS, DBCOMMIT, CUSTOMACTION, EMAIL, MOBILEPOPUP)); styleBox = new UIComboBox(style.toArray()); boolean workbook = DesignerContext.getDesignerFrame().getSelectedJTemplate().isJWorkBook(); @@ -77,15 +84,14 @@ public class ListenerEditPane extends BasicBeanPane { style.add(EXPORT); } styleBox = new UIComboBox(style.toArray()); - namePane.add(styleBox); - namePane = GUICoreUtils.createFlowPane(new Component[]{ - new UILabel(" " + Toolkit.i18nText("Fine-Design_Report_Event_Name") + ":"), - nameText, - new UILabel(" " + Toolkit.i18nText("Fine-Design_Report_Event_Type") + ":"), - styleBox}, - FlowLayout.LEFT); - namePane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Event_Name_Type"))); - this.add(namePane, BorderLayout.NORTH); + //namePane.add(styleBox); + + JPanel eventName = row(10, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Name"))), cell(nameText)).getComponent(); + JPanel eventType = row(10, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Type"))), cell(styleBox)).getComponent(); + namePane = row(cell(eventName).weight(0.3), cell(eventType).weight(0.4), flex(0.3)).getComponent(); + + this.add(wrapComponentWithTitle(namePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Name_Type")), BorderLayout.NORTH); + card = new CardLayout(); hyperlinkPane = FRGUIPaneFactory.createCardLayout_S_Pane(); hyperlinkPane.setLayout(card); diff --git a/designer-realize/src/main/java/com/fr/design/report/ExcelExportPane.java b/designer-realize/src/main/java/com/fr/design/report/ExcelExportPane.java index e00b5e22a4..466e790f7b 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ExcelExportPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ExcelExportPane.java @@ -1,6 +1,9 @@ package com.fr.design.report; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIRadioButton; @@ -14,14 +17,15 @@ import com.fr.io.attr.ExcelExportAttr; import com.fr.stable.StringUtils; import javax.swing.AbstractButton; -import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JPanel; -import java.awt.Color; -import java.awt.Dimension; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.*; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + public class ExcelExportPane extends BasicPane { private UICheckBox isExportHidedRow; private UICheckBox isExportHidenColumn; @@ -48,81 +52,52 @@ public class ExcelExportPane extends BasicPane { } protected void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - JPanel outPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane("Excel" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportD_Excel_Export")); - JPanel outNorthPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Export_Setting")); - outNorthPane.setPreferredSize(new Dimension(580, 85)); - this.add(outPane); - outPane.add(outNorthPane); + this.setLayout(new BorderLayout()); isExportHidedRow = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportD_Export_Hided_Row")); isExportHidedRow.setSelected(false); - outNorthPane.add(isExportHidedRow); isExportHidenColumn = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportD_Export_Hided_Column")); isExportHidenColumn.setSelected(false); - outNorthPane.add(isExportHidenColumn); - // 内容保护 - JPanel outSouthPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Export_Content_Protect")); - outSouthPane.setPreferredSize(new Dimension(580, 280)); - outPane.add(outSouthPane); + JPanel exportSettingPane = column(LayoutConstants.VERTICAL_GAP, row(cell(isExportHidedRow)), row(cell(isExportHidenColumn))).getComponent(); + // 文件保护 fileProtect = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Export_File_Protect"), false); - outSouthPane.add(fileProtect); // 文件密码和密码框 passwordWritePane = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); - JPanel passwordWriteFlowPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); UILabel filePassword = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_File_Password")); - passwordWriteFlowPane.add(filePassword); passwordField = new UITextField(11); - passwordWriteFlowPane.add(passwordField); - passwordWritePane.add(passwordWriteFlowPane); fileProtect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - if (fileProtect.isSelected()) { - passwordWritePane.setVisible(true); - } else { - passwordWritePane.setVisible(false); - } + passwordWritePane.setVisible(fileProtect.isSelected()); } - }); - outSouthPane.add(passwordWritePane); + passwordWritePane.add(row(cell(filePassword), fix(5), cell(passwordField)) + .with(it->it.setBorder(new ScaledEmptyBorder(0,20,0,0))).getComponent()); + // 编辑保护 writeProtect = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Export_Write_Protect"), false); - outSouthPane.add(writeProtect); // 编辑保护勾选后展示的内容 writeProtectPane = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); - outSouthPane.add(writeProtectPane); // 工作表密码 workbookPassword = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sheet_Password"), true); - JPanel protectedWordPane =FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); protectedField = new UITextField(11); - protectedWordPane.add(workbookPassword); - protectedWordPane.add(protectedField); + // 仅限预览 onlyForPreview = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Export_Only_For_Preview")); - JPanel onlyForPreviewPane =FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - onlyForPreviewPane.add(onlyForPreview); wrapButtonsInButtonGroup(workbookPassword, onlyForPreview); - writeProtectPane.add(protectedWordPane); - writeProtectPane.add(onlyForPreviewPane); + writeProtectPane.add(column(LayoutConstants.VERTICAL_GAP, + row(cell(workbookPassword), fix(5), cell(protectedField)), + row(cell(onlyForPreview)) + ).with(it-> it.setBorder(new ScaledEmptyBorder(0,20,0,0) )).getComponent()); writeProtect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - if (writeProtect.isSelected()) { - writeProtectPane.setVisible(true); - } else { - writeProtectPane.setVisible(false); - } + writeProtectPane.setVisible(writeProtect.isSelected()); } }); // 导出水印 exportWaterMark = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Export_WaterMark"), false); - outSouthPane.add(exportWaterMark); - - JPanel tips = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(5, 5, 0); UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Export_WaterMark_Tips")); - uiLabel.setForeground(Color.GRAY); + FineUIStyle.setStyle(uiLabel, FineUIStyle.LABEL_TIP); ActionLabel actionLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Report_Export_WaterMark_Use"), UIConstants.FLESH_BLUE); actionLabel.addActionListener(new ActionListener() { @Override @@ -133,10 +108,31 @@ public class ExcelExportPane extends BasicPane { exportWaterMark.setSelected(true); } }); - tips.add(uiLabel); - tips.add(actionLabel); - outSouthPane.add(tips); + //内容保护 + JPanel contextProtectPane = column(LayoutConstants.VERTICAL_GAP, + cell(fileProtect), + cell(passwordWritePane), + cell(writeProtect), + cell(writeProtectPane), + cell(exportWaterMark), + row(cell(uiLabel), cell(actionLabel)) + ).getComponent(); + + JPanel centerPanel = column(LayoutConstants.VERTICAL_GAP, + row(20, + cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Setting"))), + cell(exportSettingPane).weight(1) + ), + row(20, + cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Content_Protect"))), + cell(contextProtectPane).weight(1) + ) + ).getComponent(); + this.add(wrapComponentWithTitle(centerPanel, "Excel" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportD_Excel_Export"))); + } + private JPanel getTopAlignLabelPane(String labelText) { + return column(LayoutConstants.VERTICAL_GAP, cell(new UILabel(labelText))).with(it-> it.setBorder(new ScaledEmptyBorder(2,0,0,0))).getComponent(); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java b/designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java index 9c07bd157b..baf77a48df 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java @@ -1,17 +1,18 @@ package com.fr.design.report; +import com.fine.theme.utils.FineUIUtils; import com.fr.base.CustomConfig; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.LocaleLinkProvider; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.io.attr.ReportExportAttr; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; -import javax.swing.BorderFactory; -import javax.swing.JPanel; +import java.awt.*; + +import static com.fine.swing.ui.layout.Layouts.*; /** * 通用 @@ -38,17 +39,15 @@ public class ExportUniversalPane extends BasicPane { private UICheckBox passwordSupportFormula; public ExportUniversalPane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - JPanel outerNorthPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Universal_Export_Config")); - JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); - JPanel passwordSupportPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); + this.setLayout(new BorderLayout()); passwordSupportFormula = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Universal_Export_Password_Support_Formula")); passwordSupportFormula.setSelected(false); - passwordSupportPane.add(passwordSupportFormula); - northPane.add(passwordSupportPane); - outerNorthPane.add(northPane); - this.add(outerNorthPane); + + this.add( + FineUIUtils.wrapComponentWithTitle((column(10, + cell(passwordSupportFormula) + ).getComponent()), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Universal_Export_Config"))); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/report/ImageExportPane.java b/designer-realize/src/main/java/com/fr/design/report/ImageExportPane.java index ba4eccb63a..09bb494aa0 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ImageExportPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ImageExportPane.java @@ -1,23 +1,22 @@ package com.fr.design.report; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.extension.FileExtension; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIRadioButton; 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.io.attr.ImageExportAttr; import com.fr.io.attr.ReportExportAttr; import javax.swing.AbstractButton; -import javax.swing.BorderFactory; import javax.swing.ButtonGroup; -import javax.swing.JComponent; import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; +import java.awt.*; + +import static com.fine.swing.ui.layout.Layouts.*; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; /** * 导出图片配置 @@ -49,40 +48,37 @@ public class ImageExportPane extends AbstractExportPane { public static final String GLOBAL_CONF = Toolkit.i18nText("Fine-Design_Image_Export_Setting"); public ImageExportPane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - JPanel globalTitlePane = FRGUIPaneFactory.createTitledBorderPane(GLOBAL_CONF); - JPanel outNorthPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Export_Setting")); - outNorthPane.setPreferredSize(new Dimension(580, 230)); + this.setLayout(new BorderLayout()); UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Tips")); - tipLabel.setForeground(Color.GRAY); - JPanel tipsTitlePane = new JPanel(); - tipsTitlePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - tipsTitlePane.setLayout(FRGUIPaneFactory.createBorderLayout()); - tipsTitlePane.add(tipLabel); - this.add(globalTitlePane); - globalTitlePane.add(outNorthPane); + FineUIStyle.setStyle(tipLabel, FineUIStyle.LABEL_TIP); initGlobalSettings(); - - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JComponent[][] comps = { - {new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Resolution") + ":"), this.globalResolutionBtnS, this.globalResolutionBtnM, this.globalResolutionBtnL}, - {new UILabel(Toolkit.i18nText("Fine-Design_Report_Format") + ":"), this.globalFormatJpg, null, this.globalFormatPng}, - {new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Rendering_Quality") + ":"), this.globalRenderQuality, null, this.globalRenderSpeed}, - {new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Typesetting") + ":"), this.templateThumbnail, null, this.templatePaging} - }; - centerPane.add( - TableLayoutHelper.createCommonTableLayoutPane( - comps, - new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, - new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, - GAP), - BorderLayout.CENTER); - centerPane.add(tipsTitlePane,BorderLayout.SOUTH); - outNorthPane.add(centerPane, BorderLayout.CENTER); + Component centerPane = column(LayoutConstants.VERTICAL_GAP, + row(cell(new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Resolution") + ":")).weight(0.4), + cell(this.globalResolutionBtnS).weight(0.4), + cell(this.globalResolutionBtnM).weight(0.4), + cell(this.globalResolutionBtnL).weight(0.4), + flex()), + row(cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Format") + ":")).weight(0.4), + cell(this.globalFormatJpg).weight(0.8), + cell(this.globalFormatPng).weight(0.4), + flex()), + row(cell(new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Rendering_Quality") + ":")).weight(0.4), + cell(this.globalRenderQuality).weight(0.8), + cell(this.globalRenderSpeed).weight(0.4), + flex()), + row(cell(new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Typesetting") + ":")).weight(0.4), + cell(this.templateThumbnail).weight(0.8), + cell(this.templatePaging).weight(0.4), + flex()), + cell(tipLabel) + ).getComponent(); + + this.add(wrapComponentWithTitle( + row(GAP, cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Setting"))), + cell(centerPane).weight(1) + ).getComponent(), com.fr.design.i18n.Toolkit.i18nText(GLOBAL_CONF))); } - private void initGlobalSettings() { globalResolutionBtnS = new UIRadioButton("96dpi"); globalResolutionBtnM = new UIRadioButton("192dpi", true); @@ -111,6 +107,10 @@ public class ImageExportPane extends AbstractExportPane { } } + private JPanel getTopAlignLabelPane(String labelText) { + return column(LayoutConstants.VERTICAL_GAP, cell(new UILabel(labelText))).with(it-> it.setBorder(new ScaledEmptyBorder(2,0,0,0))).getComponent(); + } + /** * 展示界面 */ diff --git a/designer-realize/src/main/java/com/fr/design/report/PDFExportPane.java b/designer-realize/src/main/java/com/fr/design/report/PDFExportPane.java index f8e5767478..09ea418948 100644 --- a/designer-realize/src/main/java/com/fr/design/report/PDFExportPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/PDFExportPane.java @@ -1,8 +1,10 @@ package com.fr.design.report; +import com.fine.theme.utils.FineUIUtils; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; @@ -11,10 +13,13 @@ import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; -import java.awt.Dimension; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.*; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + public class PDFExportPane extends BasicPane { private UICheckBox isNeedPassword; private UITextField passwordField; @@ -25,20 +30,9 @@ public class PDFExportPane extends BasicPane { } protected void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - JPanel outPane =FRGUIPaneFactory.createTopVerticalTitledBorderPane("PDF" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportD_Excel_Export")); - this.add(outPane); - // 内容保护 - JPanel outNorthPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Export_Content_Protect")); - outNorthPane.setPreferredSize(new Dimension(580, 100)); - outPane.add(outNorthPane); - + this.setLayout(new BorderLayout()); isNeedPassword = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_File_Password"), false); - JPanel passwordPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - passwordPane.add(isNeedPassword); - passwordWritePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - passwordPane.add(passwordWritePane); + passwordWritePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); passwordField = new UITextField(11); passwordWritePane.add(passwordField); isNeedPassword.addActionListener(new ActionListener() { @@ -46,8 +40,12 @@ public class PDFExportPane extends BasicPane { passwordWritePane.setVisible(isNeedPassword.isSelected()); } }); - outNorthPane.add(passwordPane); - } + Component contextProtectPane = row(20, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Content_Protect"))), + row(cell(isNeedPassword), fix(5), cell(passwordWritePane)) + ).getComponent(); + this.add(wrapComponentWithTitle(contextProtectPane, "PDF" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportD_Excel_Export"))); + } @Override protected String title4PopupWindow() { diff --git a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java index 3074bb009a..dcf09ef281 100644 --- a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java @@ -20,11 +20,11 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.*; - -import com.fr.design.gui.ispinner.ColumnRowSpinner; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.gui.frpane.FineTabbedPane; import com.fr.page.PaperSettingProvider; import com.fr.page.ReportSettingsProvider; -import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; @@ -59,6 +59,9 @@ import com.fr.stable.unit.INCH; import com.fr.stable.unit.MM; import com.fr.design.utils.gui.GUICoreUtils; +import static com.fine.swing.ui.layout.Layouts.*; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + /** * @author richer * @since 6.5.5 创建于2011-6-14 页面设置面板 @@ -74,14 +77,12 @@ public class PageSetupPane extends BasicPane { } private void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - UITabbedPane centerTabbedPane = new UITabbedPane(); - this.add(centerTabbedPane, BorderLayout.CENTER); - + this.setLayout(new BorderLayout()); pagePane = new PagePane(); otherPane = new OtherPane(); - centerTabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Page"), pagePane); - centerTabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Other"), otherPane); + FineTabbedPane tabbedPane = FineTabbedPane.builder().addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Page"), pagePane) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Other"), otherPane).build(); + this.add(tabbedPane, BorderLayout.CENTER); } @Override @@ -149,61 +150,39 @@ public class PageSetupPane extends BasicPane { private Report report; public PagePane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - JPanel defaultPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - this.add(defaultPane, BorderLayout.NORTH); - JPanel twoPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); - twoPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - JPanel orientationPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Page_Setup_Orientation")); - JPanel innerorientationPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); - orientationPane.add(innerorientationPane); - twoPane.add(orientationPane); - - JPanel portraitpanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + this.setLayout(new BorderLayout()); + + //方向 portraitRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Portrait")); portraitRadioButton.setMnemonic('t'); - portraitpanel.add(portraitRadioButton); - innerorientationPane.add(portraitpanel); portraitRadioButton.addActionListener(previewListener); - - JPanel landscapepanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); landscapeRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Landscape")); - innerorientationPane.add(landscapepanel); landscapeRadioButton.setMnemonic('L'); - landscapepanel.add(landscapeRadioButton); landscapeRadioButton.addActionListener(previewListener); ButtonGroup layoutButtonGroup = new ButtonGroup(); layoutButtonGroup.add(portraitRadioButton); layoutButtonGroup.add(landscapeRadioButton); - portraitRadioButton.setSelected(true); + JPanel orientationPane = column(LayoutConstants.VERTICAL_GAP, cell(portraitRadioButton), cell(landscapeRadioButton)).getComponent(); - JPanel spp = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); showPagePane = new ShowPagePane(); - spp.add(showPagePane); - defaultPane.add(spp); - defaultPane.add(twoPane); + Component spp = wrapComponentWithTitle( + row(cell(showPagePane), + flex()).getComponent(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview") + ); // paper size - JPanel paperSizePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Paper_Size")); - JPanel innerpaperSizePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); - paperSizePane.add(innerpaperSizePane); - defaultPane.add(paperSizePane); - - - predefinedRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Predefined") + ":"); + predefinedRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Predefined")); predefinedRadioButton.setMnemonic('P'); predefinedRadioButton.addActionListener(previewListener); - - customRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom") + ":"); + customRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom")); customRadioButton.setMnemonic('C'); customRadioButton.addActionListener(previewListener); predefinedComboBox = new UIComboBox(); - paperWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0)); ((JSpinner.DefaultEditor) paperWidthSpinner.getEditor()).getTextField().setColumns(7); paperHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0)); @@ -214,7 +193,6 @@ public class PageSetupPane extends BasicPane { txt = ((JSpinner.NumberEditor) paperHeightSpinner.getEditor()).getTextField(); ((NumberFormatter) txt.getFormatter()).setAllowsInvalid(false); - unitLabel = new UnitFieldPane.UnitLabel(Constants.UNIT_MM, paperHeightSpinner.getPreferredSize().height); String[] inch = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH")}; @@ -238,35 +216,28 @@ public class PageSetupPane extends BasicPane { Object[] tmpPaperSizeNameArray = ReportConstants.PaperSizeNameSizeArray[i]; predefinedComboBox.addItem(tmpPaperSizeNameArray[1]); } - - // tow radio buttons. - JPanel radioButtonPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - innerpaperSizePane.add(radioButtonPane); - - radioButtonPane.add(predefinedRadioButton); - radioButtonPane.add(predefinedComboBox); - ButtonGroup paperSizeRadioButtonGroup = new ButtonGroup(); paperSizeRadioButtonGroup.add(predefinedRadioButton); paperSizeRadioButtonGroup.add(customRadioButton); - // size and textfields. - JPanel paperSizeRightPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - innerpaperSizePane.add(paperSizeRightPane); - - paperSizeRightPane.add(customRadioButton); - paperSizeRightPane.add(paperWidthSpinner); - paperSizeRightPane.add(new UILabel("x")); - paperSizeRightPane.add(paperHeightSpinner); - paperSizeRightPane.add(switchInch); - + // tow radio buttons. + JPanel innerPaperSizePane = column(10, + row(10, cell(predefinedRadioButton), cell(predefinedComboBox).weight(0.8), flex()), + row(cell(customRadioButton), + fix(10), + cell(paperWidthSpinner).weight(0.4), + fix(5), + cell(new UILabel("x")), + fix(5), + cell(paperHeightSpinner).weight(0.4), + fix(5), + cell(switchInch).weight(0.4), + flex() + ) + ).getComponent(); + Component paperSizePane = wrapComponentWithTitle(innerPaperSizePane,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Paper_Size")); // peter:设置边距.. - JPanel outermarginPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Margin")); - JPanel marginPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_M_Pane(); - outermarginPane.add(marginPane); - twoPane.add(outermarginPane); - StringBuffer temp = new StringBuffer(); for (int i = 0; i < 11; i++) { temp.append(" "); @@ -275,70 +246,50 @@ public class PageSetupPane extends BasicPane { zeroMarginWarn.setForeground(Color.RED); // left - JPanel marginLeftPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); - marginPane.add(marginLeftPane); - - JPanel marginLeftTextPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - marginLeftPane.add(marginLeftTextPane); - marginLeftTextPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Top_Duplicate") + ":")); marginTopUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); - marginLeftTextPane.add(marginTopUnitFieldPane); - JPanel marginLeftUnitPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - marginLeftPane.add(marginLeftUnitPane); - marginLeftUnitPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bottom") + ":")); marginBottomUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); - marginLeftUnitPane.add(marginBottomUnitFieldPane); - - // right - JPanel marginRightPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); - marginPane.add(marginRightPane); + JPanel marginLeftPane = column(LayoutConstants.VERTICAL_GAP, + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Top_Duplicate") + ":")), cell(marginTopUnitFieldPane)), + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bottom") + ":")), cell(marginBottomUnitFieldPane)) + ).getComponent(); // peter:这个一个垂直的上下的字符panel. - JPanel marginRightTextPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - marginRightPane.add(marginRightTextPane); - marginRightTextPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Left") + ":")); marginLeftUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); - marginRightTextPane.add(marginLeftUnitFieldPane); - - JPanel marginRightUnitPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - marginRightPane.add(marginRightUnitPane); - marginRightUnitPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Right") + ":")); marginRightUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); - marginRightUnitPane.add(marginRightUnitFieldPane); + JPanel marginRightPane = column(LayoutConstants.VERTICAL_GAP, + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Left") + ":")), cell(marginLeftUnitFieldPane)), + row( cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Right") + ":")), cell(marginRightUnitFieldPane)) + ).getComponent(); marginTopUnitFieldPane.getTextField().addFocusListener(fa); marginBottomUnitFieldPane.getTextField().addFocusListener(fa); marginLeftUnitFieldPane.getTextField().addFocusListener(fa); marginRightUnitFieldPane.getTextField().addFocusListener(fa); + JPanel marginPane = row(24, cell(marginLeftPane), cell(marginRightPane), cell(zeroMarginWarn)).getComponent(); - marginPane.add(zeroMarginWarn); - - // header and footer - JPanel outhfHeightPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Height")); - JPanel hfHeightPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - defaultPane.add(outhfHeightPane); - outhfHeightPane.add(hfHeightPane); - - // header height. - JPanel headerHeightPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - hfHeightPane.add(headerHeightPane); - headerHeightPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Header") + ":")); + //方向-页边距 + JPanel twoPane = row(10, + cell(wrapComponentWithTitle(orientationPane,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Page_Setup_Orientation"))).weight(0.25), + cell(wrapComponentWithTitle(marginPane,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Margin"))).weight(0.8) + ).getComponent(); + //高度 headerUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); - headerHeightPane.add(headerUnitFieldPane); - - // footer height. - JPanel footerHeightPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - hfHeightPane.add(footerHeightPane); - footerHeightPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Footer") + ":")); - footerUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); - footerHeightPane.add(footerUnitFieldPane); + JPanel hfHeightPane = row( + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Header"))), cell(headerUnitFieldPane)), + fix(24), + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Footer"))), cell(footerUnitFieldPane)) + ).getComponent(); + Component heightPane = wrapComponentWithTitle(hfHeightPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Height")); // print gridlines. - JPanel printOptionPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - defaultPane.add(printOptionPane); - printOptionPane.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0)); + Component defaultPane = column(LayoutConstants.VERTICAL_GAP, cell(spp), cell(twoPane), cell(paperSizePane), cell(heightPane)).getComponent(); + + JPanel workPanel = new JPanel(new BorderLayout()); + workPanel.add(defaultPane); + workPanel.setBorder(new ScaledEmptyBorder(10,10,10,10)); + this.add(workPanel); } @Override @@ -387,11 +338,6 @@ public class PageSetupPane extends BasicPane { } }; - /** - * Populate - * - * @param reportSettings rpt settings. - */ public void populate(Report report, int unitType) { this.report = report; ReportSettingsProvider reportSettings = report.getReportSettings(); @@ -602,13 +548,11 @@ public class PageSetupPane extends BasicPane { * Create icon radio pane for Portrait and Landscape. */ private JPanel createIconRadioPane(Icon icon, UIRadioButton radioButton) { - JPanel iconRadioPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); -// iconRadioPane.setLayout(FRGUIPaneFactory.createCenterFlowLayout()); - iconRadioPane.add(new UILabel(icon)); - iconRadioPane.add(radioButton); - - return iconRadioPane; + return column( + cell(new UILabel(icon)), + cell(radioButton) + ).getComponent(); } /** @@ -881,80 +825,76 @@ public class PageSetupPane extends BasicPane { private UIRadioButton isShrinkToFit4Width; public OtherPane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - JPanel defaultPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - this.add(defaultPane, BorderLayout.NORTH); - - // page order - JPanel outpageOrderPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Page_Order")); - JPanel pageOrderPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); - outpageOrderPane.add(pageOrderPane); - defaultPane.add(outpageOrderPane); - + this.setLayout(new BorderLayout()); + // page order 分页顺序 Icon topBottomIcon = BaseUtils.readIcon("/com/fr/base/images/dialog/pagesetup/down.png"); topBottomRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Top_To_Bottom"),false,false); - pageOrderPane.add(FRGUIPaneFactory.createIconRadio_S_Pane(topBottomIcon, topBottomRadioButton)); topBottomRadioButton.setMnemonic('B'); Icon leftRightIcon = BaseUtils.readIcon("/com/fr/base/images/dialog/pagesetup/over.png"); leftRightRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Left_To_Right"), false, false); - pageOrderPane.add(FRGUIPaneFactory.createIconRadio_S_Pane(leftRightIcon, leftRightRadioButton)); leftRightRadioButton.setMnemonic('R'); - ButtonGroup pageOrderButtonGroup = new ButtonGroup(); pageOrderButtonGroup.add(topBottomRadioButton); pageOrderButtonGroup.add(leftRightRadioButton); - topBottomRadioButton.setSelected(true); - // center on page - JPanel outcenterOnPagePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Placement_Center_On_Page")); - JPanel centerOnPagePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - outcenterOnPagePane.add(centerOnPagePane); - defaultPane.add(outcenterOnPagePane); - + JPanel pageOrderPane = row( + cell(new UILabel(topBottomIcon)), + cell(topBottomRadioButton), + fix(20), + cell(new UILabel(leftRightIcon)), + cell(leftRightRadioButton) + ).getComponent(); + Component outPageOrderPane = wrapComponentWithTitle(pageOrderPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Page_Order")); + // center on page 居中方式 this.horizonalCenterCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Horizontally"), false, false); this.horizonalCenterCheckBox.setMnemonic('H'); this.verticalCenterCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Vertically"), false, false); this.verticalCenterCheckBox.setMnemonic('V'); + JPanel centerOnPagePane = row(LayoutConstants.HORIZONTAL_GAP, + cell(GUICoreUtils.createFlowPane(horizonalCenterCheckBox, FlowLayout.CENTER)), + cell(GUICoreUtils.createFlowPane(verticalCenterCheckBox, FlowLayout.CENTER)) + ).getComponent(); + Component outCenterOnPagePane = wrapComponentWithTitle(centerOnPagePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Placement_Center_On_Page")); - centerOnPagePane.add(GUICoreUtils.createFlowPane(horizonalCenterCheckBox, FlowLayout.CENTER)); - centerOnPagePane.add(GUICoreUtils.createFlowPane(verticalCenterCheckBox, FlowLayout.CENTER)); - - // first page number. - JPanel firstPaneNumberPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - defaultPane.add(firstPaneNumberPane); - - firstPaneNumberPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_First_Page_Number") + ": ")); + // first page number. 起始页码 // marks: 这个地方必须为大于零的整数 firstPageNumberSpinner = new UISpinner(1, Integer.MAX_VALUE, 1, 1); - firstPaneNumberPane.add(firstPageNumberSpinner); + JPanel firstPaneNumberPane = row(LayoutConstants.HORIZONTAL_GAP, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_First_Page_Number"))), + cell(firstPageNumberSpinner) + ).getComponent(); - defaultPane.add(Box.createVerticalStrut(4)); - - // print gridlines. - JPanel printOptionPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - defaultPane.add(printOptionPane); - printOptionPane.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0)); - - JPanel autoShrinkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - autoShrinkPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Shrink_To_Fit_Content"))); + // print gridlines. 根据单元格内容自动调整 isShrinkToFit4None = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No")); isShrinkToFit4Height = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Row_Height")); isShrinkToFit4Width = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Column_Width")); - ButtonGroup bp = new ButtonGroup(); - autoShrinkPane.add(isShrinkToFit4None); - autoShrinkPane.add(isShrinkToFit4Height); - autoShrinkPane.add(isShrinkToFit4Width); bp.add(isShrinkToFit4None); bp.add(isShrinkToFit4Height); bp.add(isShrinkToFit4Width); - - printOptionPane.add(autoShrinkPane); + JPanel autoShrinkPane = row(LayoutConstants.HORIZONTAL_GAP, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Shrink_To_Fit_Content"))), + cell(isShrinkToFit4None), + cell(isShrinkToFit4Height), + cell(isShrinkToFit4Width) + ).getComponent(); + + //整体布局 + JPanel defaultPane = column(LayoutConstants.HORIZONTAL_GAP, + cell(outPageOrderPane), + cell(outCenterOnPagePane), + cell(firstPaneNumberPane), + cell(autoShrinkPane) + ).getComponent(); + + JPanel workPanel = new JPanel(new BorderLayout()); + workPanel.add(defaultPane); + workPanel.setBorder(new ScaledEmptyBorder(10,10,10,10)); + this.add(workPanel); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java b/designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java index cd992c3fdf..9256e3e103 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java @@ -1,10 +1,11 @@ package com.fr.design.report; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicStorePane; import com.fr.design.dialog.BasicPane; import com.fr.design.fun.ExportAttrTabProvider; -import com.fr.design.gui.frpane.UITabbedPane; +import com.fr.design.gui.frpane.FineTabbedPane; import com.fr.design.i18n.Toolkit; import com.fr.io.attr.ReportExportAttr; @@ -15,7 +16,8 @@ import java.util.Set; public class ReportExportAttrPane extends BasicPane { - UITabbedPane uiTabbedPane; + FineTabbedPane uiTabbedPane; + FineTabbedPane.TabPaneBuilder tabPaneBuilder; private ExcelExportPane excelExportPane; private PDFExportPane pdfExportPane; private WordExportPane wordExportPane; @@ -23,31 +25,28 @@ public class ReportExportAttrPane extends BasicPane { private List> paneList; public ReportExportAttrPane() { - uiTabbedPane = new UITabbedPane(); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - exportUniversalPane = new ExportUniversalPane(); - uiTabbedPane.addTab(Toolkit.i18nText("Fine-Design_Report_Universal_Export"), exportUniversalPane); - excelExportPane = new ExcelExportPane(); - uiTabbedPane.addTab("Excel", excelExportPane); - pdfExportPane = new PDFExportPane(); - uiTabbedPane.addTab("PDF", pdfExportPane); - wordExportPane = new WordExportPane(); - uiTabbedPane.addTab("Word", wordExportPane); + this.setBorder(new ScaledEmptyBorder(10,10,10,10)); + tabPaneBuilder = FineTabbedPane.builder() + .addTab(Toolkit.i18nText("Fine-Design_Report_Universal_Export"), exportUniversalPane = new ExportUniversalPane()) + .addTab("Excel", excelExportPane = new ExcelExportPane()) + .addTab("PDF", pdfExportPane = new PDFExportPane()) + .addTab("Word", wordExportPane = new WordExportPane()); Set providers = ExtraDesignClassManager.getInstance().getArray(ExportAttrTabProvider.XML_TAG); paneList = new ArrayList<>(); initPane(new ImageExportPane()); for (ExportAttrTabProvider provider : providers) { BasicStorePane storePane = provider.toServiceComponent(); - uiTabbedPane.addTab(storePane.getTitle(), storePane); + tabPaneBuilder.addTab(storePane.getTitle(), storePane); paneList.add(storePane); } + uiTabbedPane = tabPaneBuilder.build(); this.add(uiTabbedPane); } private void initPane(BasicStorePane exportPane) { - uiTabbedPane.addTab(exportPane.getTitle(), exportPane); - paneList.add(exportPane); + tabPaneBuilder.addTab(new ImageExportPane().getTitle(), new ImageExportPane()); + paneList.add(new ImageExportPane()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/report/WordExportPane.java b/designer-realize/src/main/java/com/fr/design/report/WordExportPane.java index c252a4e627..849fe30b0c 100644 --- a/designer-realize/src/main/java/com/fr/design/report/WordExportPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/WordExportPane.java @@ -1,6 +1,9 @@ package com.fr.design.report; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIRadioButton; @@ -15,14 +18,16 @@ import com.fr.io.attr.WordExportAttr; import com.fr.stable.StringUtils; import javax.swing.AbstractButton; -import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JPanel; -import java.awt.Color; -import java.awt.Dimension; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.*; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + public class WordExportPane extends BasicPane { private UICheckBox isExportAsTable; // 编辑保护 @@ -43,46 +48,31 @@ public class WordExportPane extends BasicPane { } protected void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - JPanel outPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane("Word" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportD_Excel_Export")); - JPanel outNorthPane =FRGUIPaneFactory.createTopVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Export_Setting")); - outNorthPane.setPreferredSize(new Dimension(580, 110)); - this.add(outPane); - outPane.add(outNorthPane); + this.setLayout(new BorderLayout()); isExportAsTable = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Is_Need_Word_Adjust"), false); - MultilineLabel wordLineLabel = new MultilineLabel(); - wordLineLabel.setPreferredSize(new Dimension(560, 50)); wordLineLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alert_Word")); - wordLineLabel.setForeground(Color.GRAY); - - outNorthPane.add(isExportAsTable); - outNorthPane.add(wordLineLabel); - // 内容保护 - JPanel outSouthPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Export_Content_Protect")); - outSouthPane.setPreferredSize(new Dimension(580, 250)); - outPane.add(outSouthPane); + wordLineLabel.setForeground(Color.GRAY); + + JPanel exportSettingPane = new JPanel(new BorderLayout()); + exportSettingPane.add(column(LayoutConstants.VERTICAL_GAP, cell(isExportAsTable), cell(wordLineLabel)).getComponent()); // 编辑保护 writeProtect = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Export_Write_Protect"), false); - outSouthPane.add(writeProtect); // 编辑保护勾选后展示的内容 writeProtectPane = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); - outSouthPane.add(writeProtectPane); // 工作表密码 workbookPassword = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sheet_Password"), true); - JPanel protectedWordPane =FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); protectedField = new UITextField(11); - protectedWordPane.add(workbookPassword); - protectedWordPane.add(protectedField); + // 仅限预览 onlyForPreview = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Export_Only_For_Preview")); - JPanel onlyForPreviewPane =FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - onlyForPreviewPane.add(onlyForPreview); wrapButtonsInButtonGroup(workbookPassword, onlyForPreview); - writeProtectPane.add(protectedWordPane); - writeProtectPane.add(onlyForPreviewPane); + writeProtectPane.add(column(LayoutConstants.VERTICAL_GAP, + row(cell(workbookPassword), fix(5), cell(protectedField)), + row(cell(onlyForPreview)) + ).with(it-> it.setBorder(new ScaledEmptyBorder(0,20,0,0) )).getComponent()); + writeProtect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (writeProtect.isSelected()) { @@ -91,15 +81,11 @@ public class WordExportPane extends BasicPane { writeProtectPane.setVisible(false); } } - }); // 导出水印 exportWaterMark = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Export_WaterMark"), false); - outSouthPane.add(exportWaterMark); - - JPanel tips = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(5, 5, 0); UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Export_WaterMark_Tips")); - uiLabel.setForeground(Color.GRAY); + FineUIStyle.setStyle(uiLabel, FineUIStyle.LABEL_TIP); ActionLabel actionLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Report_Export_WaterMark_Use"), UIConstants.FLESH_BLUE); actionLabel.addActionListener(new ActionListener() { @Override @@ -110,16 +96,35 @@ public class WordExportPane extends BasicPane { exportWaterMark.setSelected(true); } }); - tips.add(uiLabel); - tips.add(actionLabel); - outSouthPane.add(tips); - } + //内容保护 + JPanel contextProtectPane = column(10, + cell(writeProtect), + cell(writeProtectPane), + cell(exportWaterMark), + row(cell(uiLabel), cell(actionLabel)) + ).getComponent(); + Component centerPanel = column(LayoutConstants.VERTICAL_GAP, + row(20, + cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Setting"))), + cell(exportSettingPane).weight(1) + ), + row(20, + cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Content_Protect"))), + cell(contextProtectPane).weight(1) + ) + ).getComponent(); + this.add(wrapComponentWithTitle(centerPanel, "Word" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportD_Excel_Export"))); + } @Override protected String title4PopupWindow() { return "WordExport"; } + private JPanel getTopAlignLabelPane(String labelText) { + return column(LayoutConstants.VERTICAL_GAP, cell(new UILabel(labelText))).with(it-> it.setBorder(new ScaledEmptyBorder(2,0,0,0))).getComponent(); + } + public void populate(WordExportAttr wordExportAttr) { if(wordExportAttr == null){ return; diff --git a/designer-realize/src/main/java/com/fr/design/report/mobile/AppFitBrowserPane.java b/designer-realize/src/main/java/com/fr/design/report/mobile/AppFitBrowserPane.java index 1d415d0b75..fc65465781 100644 --- a/designer-realize/src/main/java/com/fr/design/report/mobile/AppFitBrowserPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/mobile/AppFitBrowserPane.java @@ -1,5 +1,7 @@ package com.fr.design.report.mobile; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.mobile.MobileFitAttrState; import com.fr.design.beans.BasicBeanPane; import com.fr.design.layout.FRGUIPaneFactory; @@ -11,6 +13,9 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.*; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + /** * Created by 夏翔 on 2016/5/28. */ @@ -25,22 +30,23 @@ public class AppFitBrowserPane extends BasicBeanPane { public AppFitBrowserPane(){ initComponents(); - } + /** + * 自适应面板 + */ private void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); - JPanel fitOpsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.setLayout(new BorderLayout()); horizionPane = new MobileRadioGroupPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Horizontal")); verticalPane = new MobileRadioGroupPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Vertical")); ActionListener actionListener = getAppPreviewActionListener(); horizionPane.addActionListener(actionListener); verticalPane.addActionListener(actionListener); - fitOpsPane.add(horizionPane, BorderLayout.NORTH); - fitOpsPane.add(verticalPane, BorderLayout.SOUTH); - borderPane.add(fitOpsPane); - this.add(borderPane); + this.add( + wrapComponentWithTitle((column(10, + row(cell(horizionPane)), + row(cell(verticalPane)) + ).getComponent()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fit"))); } public void setAppFitPreviewPane(AppFitPreviewPane appFitPreviewPane) { diff --git a/designer-realize/src/main/java/com/fr/design/report/mobile/AppFitPreviewPane.java b/designer-realize/src/main/java/com/fr/design/report/mobile/AppFitPreviewPane.java index f0a61222a5..0be709496b 100644 --- a/designer-realize/src/main/java/com/fr/design/report/mobile/AppFitPreviewPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/mobile/AppFitPreviewPane.java @@ -1,5 +1,6 @@ package com.fr.design.report.mobile; +import com.fine.theme.utils.FineUIUtils; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ilable.UILabel; @@ -7,8 +8,12 @@ import com.fr.design.layout.FRGUIPaneFactory; import javax.swing.*; +import java.awt.*; import java.util.ArrayList; +import static com.fine.swing.ui.layout.Layouts.*; +import static com.fine.swing.ui.layout.Layouts.flex; + /** * Created by 夏翔 on 2016/5/28. */ @@ -44,18 +49,21 @@ public class AppFitPreviewPane extends BasicPane{ } private void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - JPanel outnorthPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); - this.add(outnorthPane); + this.setLayout(new BorderLayout()); horizontalImageLabel = new UILabel(); horizontalImageLabel.setIcon(cachedHorizonPreviewImage.get(1)); - outnorthPane.add(horizontalImageLabel); verticalImagelabel = new UILabel(); verticalImagelabel.setIcon(cachedVerticalPreviewImage.get(0)); - outnorthPane.add(verticalImagelabel); + this.add( + FineUIUtils.wrapComponentWithTitle((column(10, + row(10, + column(cell(horizontalImageLabel)), + column(cell(verticalImagelabel)), + flex() + )).getComponent()), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Preview"))); } public void refreshPreview(int[] index) { diff --git a/designer-realize/src/main/java/com/fr/design/report/mobile/MobileOthersPane.java b/designer-realize/src/main/java/com/fr/design/report/mobile/MobileOthersPane.java index 3948c26f3c..611d533063 100644 --- a/designer-realize/src/main/java/com/fr/design/report/mobile/MobileOthersPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/mobile/MobileOthersPane.java @@ -1,15 +1,14 @@ package com.fr.design.report.mobile; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.designer.IntervalConstants; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.mobile.MobileRadioCheckPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.report.mobile.ElementCaseMobileAttr; -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import java.awt.BorderLayout; +import static com.fine.swing.ui.layout.Layouts.*; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; /** * Created by plough on 2018/5/31. @@ -27,15 +26,11 @@ public class MobileOthersPane extends BasicBeanPane { private void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); - JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - contentPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L1, 0, 0)); + //其他:页面再现时刷新/允许双击缩放 appearRefreshCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Appear_Refresh")); - contentPane.add(appearRefreshCheckPane, BorderLayout.WEST); allowDoubleClickOrZoomCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr_Allow_Zoom")); - contentPane.add(allowDoubleClickOrZoomCheckPane, BorderLayout.CENTER); - borderPane.add(contentPane); - this.add(borderPane); + this.add(wrapComponentWithTitle(row(LayoutConstants.HORIZONTAL_GAP, cell(appearRefreshCheckPane), cell(allowDoubleClickOrZoomCheckPane)).getComponent(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Other"))); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/report/mobile/MobileRadioGroupPane.java b/designer-realize/src/main/java/com/fr/design/report/mobile/MobileRadioGroupPane.java index dd1a6dad79..422438ebd9 100644 --- a/designer-realize/src/main/java/com/fr/design/report/mobile/MobileRadioGroupPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/mobile/MobileRadioGroupPane.java @@ -1,5 +1,7 @@ package com.fr.design.report.mobile; +import com.fine.swing.ui.layout.Column; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.mobile.MobileFitAttrState; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIRadioButton; @@ -15,6 +17,8 @@ import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.*; + /** * Created by Administrator on 2016/5/16/0016. */ @@ -27,10 +31,6 @@ public class MobileRadioGroupPane extends BasicBeanPane{ } private void initComponents(String title) { - double p = TableLayout.PREFERRED; - double[] rowSize = {p}; - double[] columnSize = {p, p, p, p, p}; - IndexRadioButton horizonRadio = new IndexRadioButton(MobileFitAttrState.HORIZONTAL.description(), MobileFitAttrState.HORIZONTAL); horizonRadio.setSelected(true); IndexRadioButton verticalRadio = new IndexRadioButton(MobileFitAttrState.VERTICAL.description(), MobileFitAttrState.VERTICAL); @@ -38,19 +38,20 @@ public class MobileRadioGroupPane extends BasicBeanPane{ IndexRadioButton notFitRadio = new IndexRadioButton(MobileFitAttrState.NONE.description(), MobileFitAttrState.NONE); addToButtonGroup(horizonRadio, verticalRadio, notFitRadio, bidirectionalRadio); - - Component[][] components = new Component[][]{ - new Component[] { - new UILabel(title), - horizonRadio, - verticalRadio, - bidirectionalRadio, - notFitRadio - } - }; - JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); - this.add(fitOpsPane); + Component row = + row( + cell(new UILabel(title)), + fix(10), + cell(horizonRadio), + fix(5), + cell(verticalRadio), + fix(5), + cell(bidirectionalRadio), + fix(5), + cell(notFitRadio), + flex() + ).getComponent(); + this.add(row); } private void addToButtonGroup(IndexRadioButton... radios) { @@ -81,7 +82,6 @@ public class MobileRadioGroupPane extends BasicBeanPane{ return radioButtons.get(i).getRadioButtonIndex(); } } - return 0; } diff --git a/designer-realize/src/main/java/com/fr/design/report/mobile/MobileToolBarPane.java b/designer-realize/src/main/java/com/fr/design/report/mobile/MobileToolBarPane.java index 7a2d99a2b8..4bfcf2b0af 100644 --- a/designer-realize/src/main/java/com/fr/design/report/mobile/MobileToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/mobile/MobileToolBarPane.java @@ -1,5 +1,6 @@ package com.fr.design.report.mobile; +import com.fine.theme.utils.FineUIUtils; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.mobile.MobileRadioCheckPane; import com.fr.design.gui.ilable.UILabel; @@ -10,6 +11,8 @@ import com.fr.report.mobile.ElementCaseMobileAttr; import javax.swing.*; import java.awt.*; +import static com.fine.swing.ui.layout.Layouts.*; + /** * Created by 方磊 on 2016/11/8. */ @@ -25,20 +28,20 @@ public class MobileToolBarPane extends BasicBeanPane { } private void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); - JPanel toobarsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - + this.setLayout(new BorderLayout()); UILabel uiLabel = new UILabel("html5"); uiLabel.setBorder(BorderFactory.createEmptyBorder(5, 15, 10, 15)); zoomCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Zoom")); refreshCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Refresh")); - toobarsPane.add(uiLabel, BorderLayout.WEST); - toobarsPane.add(zoomCheckPane, BorderLayout.CENTER); - toobarsPane.add(refreshCheckPane, BorderLayout.EAST); - borderPane.add(toobarsPane); - this.add(borderPane); + this.add( + FineUIUtils.wrapComponentWithTitle((column(10, + row(cell(uiLabel)), + row(cell(zoomCheckPane)), + row(cell(refreshCheckPane)), + flex() + ).getComponent()), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_ToolBar"))); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/report/mobile/ReportMobileAttrPane.java b/designer-realize/src/main/java/com/fr/design/report/mobile/ReportMobileAttrPane.java index 668027f5f8..dff4ced413 100644 --- a/designer-realize/src/main/java/com/fr/design/report/mobile/ReportMobileAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/mobile/ReportMobileAttrPane.java @@ -1,12 +1,21 @@ package com.fr.design.report.mobile; +import com.fine.swing.ui.layout.Column; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.border.FineBorderFactory; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.report.mobile.ElementCaseMobileAttr; import javax.swing.*; +import java.awt.*; + +import static com.fine.swing.ui.layout.Layouts.*; + /** * Created by Administrator on 2016/5/12/0012. */ @@ -23,23 +32,19 @@ public class ReportMobileAttrPane extends BasicBeanPane{ } private void initComponents() { + this.setLayout(new BorderLayout()); AppFitPreviewPane appFitPreviewPane = new AppFitPreviewPane(); - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - JPanel jPanel = new JPanel(); - jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS)); - jPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - reportMobileTemplateSettingsPane = new ReportMobileTemplateSettingsPane(); - jPanel.add(reportMobileTemplateSettingsPane); - appFitBrowserPane = new AppFitBrowserPane(); appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane); - jPanel.add(appFitBrowserPane); - - jPanel.add(mobileOthersPane = new MobileOthersPane()); - - jPanel.add(appFitPreviewPane); - UIScrollPane scrollPane = new UIScrollPane(jPanel); + JPanel panel = new JPanel(new BorderLayout()); + panel.add(column(LayoutConstants.VERTICAL_GAP, + cell(reportMobileTemplateSettingsPane), + cell(appFitBrowserPane), + cell(mobileOthersPane = new MobileOthersPane()), + cell(appFitPreviewPane) + ).with(it -> it.setBorder(new ScaledEmptyBorder(10,10,10,10))).getComponent()); + UIScrollPane scrollPane = new UIScrollPane(panel); this.add(scrollPane); } diff --git a/designer-realize/src/main/java/com/fr/design/report/mobile/ReportMobileTemplateSettingsPane.java b/designer-realize/src/main/java/com/fr/design/report/mobile/ReportMobileTemplateSettingsPane.java index f1b00f19af..d89c2b900c 100644 --- a/designer-realize/src/main/java/com/fr/design/report/mobile/ReportMobileTemplateSettingsPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/mobile/ReportMobileTemplateSettingsPane.java @@ -1,18 +1,21 @@ package com.fr.design.report.mobile; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.designer.IntervalConstants; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.report.mobile.ElementCaseMobileAttr; import javax.swing.*; import java.awt.*; +import static com.fine.swing.ui.layout.Layouts.*; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + /** * Created by plough on 2018/1/8. */ @@ -25,51 +28,37 @@ public class ReportMobileTemplateSettingsPane extends BasicBeanPane it.setBorder(new ScaledEmptyBorder(10,10,10,10))).getComponent()); + this.add(workPanel); } public void populate(ReportWebAttr reportWebAttr) { diff --git a/designer-realize/src/main/java/com/fr/design/webattr/DragToolBarPane.java b/designer-realize/src/main/java/com/fr/design/webattr/DragToolBarPane.java index b79e19e13f..9a410b53d1 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/DragToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/DragToolBarPane.java @@ -1,5 +1,8 @@ package com.fr.design.webattr; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; @@ -7,27 +10,18 @@ import com.fr.form.ui.Widget; import com.fr.report.web.Location; import com.fr.report.web.ToolBarManager; -import javax.swing.DefaultListCellRenderer; -import javax.swing.DefaultListModel; -import javax.swing.DropMode; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.ListCellRenderer; -import javax.swing.SwingUtilities; -import javax.swing.TransferHandler; +import javax.swing.*; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; -import java.awt.Dimension; import java.awt.datatransfer.Transferable; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.awt.image.ImageObserver; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; /** * richer:拖拽ToolBar button以实现自定义工具栏.服务器配置那儿的 @@ -65,29 +59,45 @@ public class DragToolBarPane extends WidgetToolBarPane { toolbarButtonList.setDropMode(DropMode.ON_OR_INSERT); toolbarButtonList.setDragEnabled(true); toolbarButtonList.setTransferHandler(new FromTransferHandler()); - northToolBar = new ToolBarPane(); - northToolBar.setPreferredSize(new Dimension(ImageObserver.WIDTH, 26)); - northToolBar.setBackground(Color.lightGray); - southToolBar = new ToolBarPane(); - southToolBar.setPreferredSize(new Dimension(ImageObserver.WIDTH, 26)); - southToolBar.setBackground(Color.lightGray); + toolbarButtonList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + + //顶部工具栏 JPanel northContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + northToolBar = new ToolBarPane(); + northToolBar.setOpaque(false); + northToolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, UIManager.getColor("defaultBorderColor"))); SettingToolBar top = new SettingToolBar(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ToolBar_Top"), northToolBar); + top.setOpaque(false); northContentPane.add(top, BorderLayout.EAST); northContentPane.add(northToolBar, BorderLayout.CENTER); - northContentPane.setBackground(Color.lightGray); + northContentPane.setBorder(new ScaledEmptyBorder(4,0,4,0)); + northContentPane.setOpaque(false); + JPanel topToolbarPanel = new JPanel(new BorderLayout()); + topToolbarPanel.add(northContentPane); + topToolbarPanel.setBackground(FineUIUtils.getUIColor("Center.ZoneBorderColor", "defaultBorderColor")); + //底部工具栏 JPanel southContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + southToolBar = new ToolBarPane(); + southToolBar.setOpaque(false); + southToolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, UIManager.getColor("defaultBorderColor"))); SettingToolBar bottom = new SettingToolBar(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ToolBar_Bottom"), southToolBar); + bottom.setOpaque(false); southContentPane.add(bottom, BorderLayout.EAST); southContentPane.add(southToolBar, BorderLayout.CENTER); - southContentPane.setBackground(Color.lightGray); - JPanel movePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - movePane.add(northContentPane, BorderLayout.NORTH); - movePane.add(toolbarButtonList, BorderLayout.CENTER); - movePane.add(southContentPane, BorderLayout.SOUTH); + southContentPane.setBorder(new ScaledEmptyBorder(4,0,4,0)); + southContentPane.setOpaque(false); + JPanel bottomToolbarPanel = new JPanel(new BorderLayout()); + bottomToolbarPanel.add(southContentPane); + bottomToolbarPanel.setBackground(FineUIUtils.getUIColor("Center.ZoneBorderColor", "defaultBorderColor")); - // SplitPane + //整体工具栏图标面板 + JPanel movePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + movePane.add(column(1, + cell(topToolbarPanel), + cell(toolbarButtonList), + cell(bottomToolbarPanel) + ).getComponent()); this.add(new JScrollPane(movePane), BorderLayout.CENTER); JPanel buttonPane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); @@ -98,7 +108,6 @@ public class DragToolBarPane extends WidgetToolBarPane { southToolBar.removeButtonList(); southToolBar.repaint(); northToolBar.removeButtonList(); - if (defaultToolBar == null) { return; } @@ -121,6 +130,7 @@ public class DragToolBarPane extends WidgetToolBarPane { northToolBar.repaint(); } }); + buttonPane.add(removeButton); this.add(buttonPane, BorderLayout.SOUTH); } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java b/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java index 92885a3b3c..7aa80c8ade 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java @@ -7,8 +7,8 @@ import com.fr.base.ConfigManager; import com.fr.base.print.PrintSettingsAttrMark; import com.fr.config.PrintConfig; import com.fr.config.ServerPreferenceConfig; +import com.fr.design.gui.frpane.FineTabbedPane; import com.fr.design.gui.frpane.LoadingBasicPane; -import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.webattr.printsettings.GlobalNativePrintSettingPane; @@ -28,7 +28,7 @@ import java.awt.BorderLayout; */ public class EditReportServerParameterPane extends LoadingBasicPane { - private UITabbedPane tabbedPane; + private FineTabbedPane tabbedPane; private PageToolBarPane pagePane; private ViewToolBarPane viewPane; @@ -54,20 +54,22 @@ public class EditReportServerParameterPane extends LoadingBasicPane { JPanel defaultPane = container; defaultPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - //Tabbed Pane - tabbedPane = new UITabbedPane(); - defaultPane.add(tabbedPane, BorderLayout.CENTER); - - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_WEB_Pagination_Setting"), pagePane = new PageToolBarPane()); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_WEB_Write_Setting"), writePane = new WriteToolBarPane()); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Data_Analysis_Settings"), viewPane = new ViewToolBarPane()); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_Css"), cssPane = new WebCssPane()); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"), jsPane = new WebJsPane()); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Error_Handler_Template"), errorTemplatePane = new ErrorTemplatePane()); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_Setting"), printSettingPane = new PrintSettingPane(new GlobalNativePrintSettingPane())); + //服务器-服务器配置 + FineTabbedPane.TabPaneBuilder tabPaneBuilder = FineTabbedPane.builder() + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_WEB_Pagination_Setting"), pagePane = new PageToolBarPane()) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_WEB_Write_Setting"), writePane = new WriteToolBarPane()) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Data_Analysis_Settings"), viewPane = new ViewToolBarPane()) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_Css"), cssPane = new WebCssPane()) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"), jsPane = new WebJsPane()) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Error_Handler_Template"), errorTemplatePane = new ErrorTemplatePane()) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_Setting"), printSettingPane = new PrintSettingPane(new GlobalNativePrintSettingPane())); if (WorkContext.getCurrent().isRoot()) { - tabbedPane.addTab(Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"), serverFitAttrPane = new ServerFitAttrPane()); + tabPaneBuilder.addTab(Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"), serverFitAttrPane = new ServerFitAttrPane()); + tabbedPane = tabPaneBuilder.withTabLayout(new int[]{4,4}).withHeadRatio(0.8f).build(); + } else { + tabbedPane = tabPaneBuilder.withTabLayout(new int[]{3,4}).withHeadRatio(0.8f).build(); } + defaultPane.add(tabbedPane, BorderLayout.CENTER); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java index 17d411706e..56078062fe 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java @@ -1,9 +1,14 @@ package com.fr.design.webattr; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; -import com.fr.design.designer.IntervalConstants; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; @@ -20,13 +25,10 @@ import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.i18n.Toolkit; import com.fr.design.javascript.JavaScriptActionPane; 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.design.mainframe.JWorkBook; import com.fr.design.menu.ToolBarDef; import com.fr.design.style.background.BackgroundPane; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.IconDefinePane; import com.fr.form.ui.Button; import com.fr.form.ui.CustomToolBarButton; @@ -45,32 +47,23 @@ import com.fr.stable.StringUtils; import com.fr.widgettheme.util.WidgetThemeDesignerUtils; import com.fr.write.JavaScriptResourceInfo; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.DefaultListCellRenderer; -import javax.swing.DefaultListModel; -import javax.swing.ImageIcon; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.ListCellRenderer; -import javax.swing.SpinnerNumberModel; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Image; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import java.util.Set; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + public class EditToolBar extends BasicPane { private static final String EMAIL = "email"; @@ -102,9 +95,9 @@ public class EditToolBar extends BasicPane { lastButton = (ToolBarButton) list.getSelectedValue(); if (lastButton.getWidget() instanceof Button) { card.show(right, "button"); - bp.populate(lastButton.getWidget()); + bp.populate(lastButton.getWidget(), lastButton.getIcon()); } else { - bp.populate(lastButton.getWidget()); + bp.populate(lastButton.getWidget(), lastButton.getIcon()); card.show(right, "none"); } } @@ -140,51 +133,64 @@ public class EditToolBar extends BasicPane { * 初始化 */ public void initComponent() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel left = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.setLayout(new BorderLayout()); + //左侧按钮列表 + JPanel leftPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); listModel = new DefaultListModel(); list = new JList(listModel); list.setCellRenderer(render); - left.add(new JScrollPane(list), BorderLayout.CENTER); + list.addListSelectionListener(listSelectionListener); + list.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + list.setPreferredSize(FineUIScale.scale(new Dimension(-1, 380))); + leftPanel.add(list, BorderLayout.CENTER); + //添加外边框 + leftPanel.setBorder(new FineRoundBorder()); if (listModel.getSize() > 0) { list.setSelectedIndex(0); } - + //左侧按钮列表上方工具栏,上移-下移-删除 ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(new MoveUpItemAction()); toolbarDef.addShortCut(new MoveDownItemAction()); toolbarDef.addShortCut(new RemoveAction()); UIToolbar toolBar = ToolBarDef.createJToolBar(); toolbarDef.updateToolBar(toolBar); - left.add(toolBar, BorderLayout.NORTH); - + toolBar.setBackground(FineUIUtils.getUIColor("Center.ZoneBorderColor", "defaultBorderColor")); + leftPanel.add(toolBar, BorderLayout.NORTH); + //右侧表单按钮属性面板 right = FRGUIPaneFactory.createCardLayout_S_Pane(); card = new CardLayout(); right.setLayout(card); bp = new ButtonPane(); right.add("none", FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane()); right.add("button", bp); + right.setBorder(new ScaledEmptyBorder(0,10,0,0)); + JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftPanel, right); + splitPane.setDividerLocation(150); - JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, left, right); - // splitPane.setDividerLocation(left.getMinimumSize().width); - splitPane.setDividerLocation(120); - this.add(splitPane); - list.addListSelectionListener(listSelectionListener); - JPanel backgroundPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, 0, 0, 0); + //下方样式设置面板 + JPanel backgroundPane = new JPanel(new BorderLayout()); UIButton bgButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Background")); defaultCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default_Background")); bgButton.addActionListener(actioner); - backgroundPane.add(defaultCheckBox); - backgroundPane.add(bgButton); - JPanel bgPanel = new JPanel(); - bgPanel.add(defaultCheckBox); - bgPanel.add(bgButton); - backgroundPane.add(bgPanel); + + //添加按钮颜色面板默认不可见,控件显示增强开启才显示 + JPanel buttonColorGroupPane = createButtonColorGroup(); + buttonColorGroupPane.setVisible(false); + //样式设置面板布局,默认背景-按钮颜色 + backgroundPane.add(column(10, + row(10, cell(defaultCheckBox).weight(0.15), cell(bgButton).weight(0.2), flex(0.65)).weight(1), + cell(buttonColorGroupPane).weight(1) + ).getComponent()); + if(WidgetThemeDesignerUtils.enableWidgetEnhance()) { - backgroundPane.add(createButtonColorGroup()); + buttonColorGroupPane.setVisible(true); } - backgroundPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_ToolBar_Style_Setting"))); - this.add(backgroundPane, BorderLayout.SOUTH); + //样式设置面板设置标题 + JPanel styleSettingPane = new JPanel(new BorderLayout()); + styleSettingPane.add(wrapComponentWithTitle(backgroundPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_ToolBar_Style_Setting"))); + styleSettingPane.setBorder(new ScaledEmptyBorder(10, 0, 0, 0));; + this.add(column(cell(splitPane), cell(styleSettingPane)).getComponent()); } ListCellRenderer render = new DefaultListCellRenderer() { @@ -273,7 +279,7 @@ public class EditToolBar extends BasicPane { public MoveUpItemAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Up")); this.setMnemonic('U'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/up.png")); + this.setSmallIcon(new LazyIcon("move_up")); } /** @@ -304,7 +310,7 @@ public class EditToolBar extends BasicPane { public MoveDownItemAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Down")); this.setMnemonic('D'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/down.png")); + this.setSmallIcon(new LazyIcon("move_down")); } /** @@ -338,7 +344,7 @@ public class EditToolBar extends BasicPane { public class RemoveAction extends UpdateAction { public RemoveAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Delete")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/remove.png")); + this.setSmallIcon(new LazyIcon("clear")); } /** @@ -404,125 +410,120 @@ public class EditToolBar extends BasicPane { Set set = ExtraDesignClassManager.getInstance().getArray(ExportToolBarProvider.XML_TAG); exportToolBarProviders = set.toArray(new ExportToolBarProvider[set.size()]); this.setLayout(FRGUIPaneFactory.createBorderLayout()); + //'设置表单按钮属性'面板 JPanel north = FRGUIPaneFactory.createBorderLayout_S_Pane(); icon = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Icon")); text = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Text")); - - north.add(icon, BorderLayout.NORTH); - north.add(text, BorderLayout.CENTER); - - nameField = new UITextField(8); + nameField = new UITextField(); iconPane = new IconDefinePane(); javaScriptPane = JavaScriptActionPane.createDefault(); - - double p = TableLayout.PREFERRED; - double rowSize[] = {p, p}; - double columnSize[] = {p, p}; - - Component[][] coms = new Component[][]{{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Printer_Alias") + ":"), nameField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Icon") + ":"), iconPane}}; - - JPanel nameIconPane = TableLayoutHelper.createTableLayoutPane(coms, rowSize, columnSize); - - north.add(nameIconPane, BorderLayout.SOUTH); - - north.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Form_Button_Property"))); + JPanel nameIconPane = column(LayoutConstants.VERTICAL_GAP, + //显示按钮图标,显示按钮名称 + row(LayoutConstants.HORIZONTAL_GAP, cell(icon), cell(text)), + //控件别名 + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Printer_Alias"))), + cell(nameField)), + //控件图标 + row(LayoutConstants.HORIZONTAL_GAP, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Icon"))), + cell(iconPane)) + ).getComponent(); + nameIconPane.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); + north.add(wrapComponentWithTitle(nameIconPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Form_Button_Property")), BorderLayout.SOUTH); this.add(north, BorderLayout.NORTH); - JPanel none = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + + //不同图标额外的设置表单按钮属性面板 centerPane = FRGUIPaneFactory.createCardLayout_S_Pane(); card = new CardLayout(); centerPane.setLayout(card); - centerPane.add(CUSTOM, getCustomPane()); - centerPane.add(EXPORT, getExport()); - centerPane.add(EMAIL, getEmail()); - centerPane.add(NONE, none); - centerPane.add(getCpane(), APPEND_COUNT); - centerPane.add(getSubmitPane(), SUBMIT); + centerPane.add(CUSTOM, wrapComponentWithTitle(getCustomPane(), com.fr.design.i18n.Toolkit.i18nText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit") + "JS"))); + centerPane.add(EXPORT, wrapComponentWithTitle(getExport(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Form_Button_Property"))); + centerPane.add(EMAIL, wrapComponentWithTitle(getEmail(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Form_Button_Property"))); + centerPane.add(NONE, FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane()); + centerPane.add(APPEND_COUNT, column(LayoutConstants.VERTICAL_GAP,cell(getAppendCountPane())).getComponent()); + centerPane.add(SUBMIT, wrapComponentWithTitle(getSubmitPane(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Form_Button_Property"))); Set extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG); for (ExtraButtonToolBarProvider provider : extraButtonSet) { provider.updateCenterPane(centerPane); } - this.add(centerPane, BorderLayout.CENTER); } - + /** + * 自定义按钮Pane + * @return + */ private JPanel getCustomPane() { - JPanel customPane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); - + JPanel customPane = new JPanel(new BorderLayout()); button = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_User_Defined_Event")); - customPane.add(button); - customPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit") + "JS", null)); + customPane.add(row(cell(button).weight(0.2), flex(0.8)).getComponent()); button.addActionListener(l); return customPane; } + /** + * 导出Pane + * @return + */ private JPanel getExport() { - JPanel export = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - // export.setLayout(new BoxLayout(export, BoxLayout.Y_AXIS)); + JPanel export = FRGUIPaneFactory.createBorderLayout_S_Pane(); pdf = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Output_PDF")); excelP = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Output_Excel_Page")); excelO = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Output_Excel_Simple")); excelS = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Output_Excel_Sheet")); word = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Output_Word")); image = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Image")); - export.add(pdf); - export.add(Box.createVerticalStrut(2)); - export.add(excelP); - export.add(Box.createVerticalStrut(2)); - export.add(excelO); - export.add(Box.createVerticalStrut(2)); - export.add(excelS); - export.add(Box.createVerticalStrut(2)); - export.add(word); - export.add(Box.createVerticalStrut(2)); - export.add(image); + export.add(column(10, cell(pdf), cell(excelP), cell(excelO), cell(excelS), cell(word), cell(image)).getComponent()); for (int i = 0; i < ArrayUtils.getLength(exportToolBarProviders); i++) { export = exportToolBarProviders[i].updateCenterPane(export); } - - export.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Form_Button_Property"), null)); return export; } + /** + * 邮件Pane + * @return + */ private JPanel getEmail() { - JPanel email = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + JPanel email = FRGUIPaneFactory.createBorderLayout_S_Pane(); customConsignee = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Custom_Consignee")); consigneeByDepartment = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Consignee_By_Department")); consigneeByRole = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Consignee_By_Role")); - email.add(customConsignee); - email.add(Box.createVerticalStrut(2)); - email.add(consigneeByDepartment); - email.add(Box.createVerticalStrut(2)); - email.add(consigneeByRole); - email.add(Box.createVerticalStrut(2)); - - email.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Form_Button_Property"), null)); + email.add(column(LayoutConstants.VERTICAL_GAP, + cell(customConsignee), + cell(consigneeByDepartment), + cell(consigneeByRole) + ).getComponent()); return email; } - private JPanel getCpane() { - JPanel appendCountPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); + /** + * 插入记录Pane + * @return + */ + private JPanel getAppendCountPane() { + JPanel appendCountPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); count = new UIBasicSpinner(new SpinnerNumberModel(1, 0, Integer.MAX_VALUE, 1)); - UILabel countLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Add_Row_Column_Numbers") + ":"); - JPanel cpane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - cpane.add(countLabel); - cpane.add(count); - appendCountPane.add(cpane); - return cpane; + UILabel countLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Add_Row_Column_Numbers")); + appendCountPane.add(row(LayoutConstants.HORIZONTAL_GAP, cell(countLabel), cell(count)).getComponent()); + return appendCountPane; } - + /** + * 提交Pane + * @return + */ private JPanel getSubmitPane() { isVerify = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Verify_Data_Verify")); failSubmit = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Verify_Fail_Still_Submit")); isCurSheet = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Only_Submit_Current_Sheet")); - JPanel submitPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - submitPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Form_Button_Property"), null)); - submitPane.add(isVerify); - submitPane.add(failSubmit); - submitPane.add(isCurSheet); isVerify.addActionListener(actionListener); + JPanel submitPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + submitPane.add(column(LayoutConstants.VERTICAL_GAP, + cell(isVerify), + cell(failSubmit), + cell(isCurSheet) + ).getComponent()); return submitPane; } @@ -567,11 +568,11 @@ public class EditToolBar extends BasicPane { * * @param widget 对应组件 */ - public void populate(Widget widget) { + public void populate(Widget widget, Icon icon) { this.widget = widget; card.show(centerPane, "none"); if (widget instanceof Button) { - populateDefault(); + populateDefault(icon); } if (widget instanceof Export) { populateExport(); @@ -640,12 +641,13 @@ public class EditToolBar extends BasicPane { this.isCurSheet.setSelected(submit.isOnlySubmitSelect()); } - private void populateDefault() { + private void populateDefault(Icon icon) { Button button = (Button) widget; this.icon.setSelected(button.isShowIcon()); this.text.setSelected(button.isShowText()); this.nameField.setText(button.getText()); - this.iconPane.populate(((Button) widget).getIconName()); + //this.iconPane.populate(((Button) widget).getIconName()); + this.iconPane.populateIcon(((Button) widget).getIconName(), icon); } /** @@ -739,11 +741,7 @@ public class EditToolBar extends BasicPane { super.setSelectedIndex(newSelectedIndex, fireChanged); } }; - bgColorButtonGroup.setPreferredSize(new Dimension(135, bgColorButtonGroup.getPreferredSize().height)); - JPanel headPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(IntervalConstants.INTERVAL_L5, 0); - headPane.add(headLabel); - headPane.add(bgColorButtonGroup); - headPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L2, 0, 0)); - return headPane; + bgColorButtonGroup.setPreferredSize(FineUIScale.scale(new Dimension(135, bgColorButtonGroup.getPreferredSize().height))); + return row(10, cell(headLabel).weight(0.15), cell(bgColorButtonGroup).weight(0.3), flex(0.55)).getComponent(); } } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ErrorTemplatePane.java b/designer-realize/src/main/java/com/fr/design/webattr/ErrorTemplatePane.java index 20ff40f5fb..3cddcde2dc 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ErrorTemplatePane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ErrorTemplatePane.java @@ -1,47 +1,43 @@ package com.fr.design.webattr; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Component; - +import static com.fine.swing.ui.layout.Layouts.*; public class ErrorTemplatePane extends BasicBeanPane { private UITextField templateField = null; public ErrorTemplatePane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); - - this.templateField = new UITextField(36); - - // TableLayout - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p}; - double[] columnSize = {p, p}; - - JPanel reportletNamePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - reportletNamePane.add(this.templateField); - - Component[][] components = { - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Path") + ":"), reportletNamePane}, - - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Parameters") + ":"), null}, - {new UILabel("message" + ":"), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Verify_Message"))}, - {new UILabel("charset" + ":"), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Server_Charset"))}, - {new UILabel("exception" + ":"), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Exception_Stack_Trace"))} - }; - JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - - this.add(northPane, BorderLayout.NORTH); + this.setLayout(new BorderLayout()); + this.templateField = new UITextField(); + JPanel northPane = column(LayoutConstants.VERTICAL_GAP, + row(LayoutConstants.HORIZONTAL_GAP, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Path"))), + cell(this.templateField).weight(1) + ), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Parameters"))), + row( + cell(new UILabel("message" + ":")), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Verify_Message"))) + ), + row( + cell(new UILabel("charset" + ":")), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Server_Charset"))) + ), + row( + cell(new UILabel("exception" + ":")), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Exception_Stack_Trace"))) + ) + ).getComponent(); + northPane.setBorder(new ScaledEmptyBorder(10,10,10,10)); + this.add(northPane); } @Override @@ -59,6 +55,4 @@ public class ErrorTemplatePane extends BasicBeanPane { public String updateBean() { return this.templateField.getText(); } - - } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EventPane.java b/designer-realize/src/main/java/com/fr/design/webattr/EventPane.java index ff4e4296db..5f3d43cf5c 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EventPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EventPane.java @@ -1,7 +1,11 @@ package com.fr.design.webattr; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.design.actions.UpdateAction; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itoolbar.UIToolbar; @@ -32,6 +36,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + /** * richer:调用该类并且对事件名字国际化时需要严格按照"FR-Engine_Event_事件名"来进行命名 */ @@ -53,14 +60,8 @@ public class EventPane extends BasicPane { int len = eventName.length; this.eventName = Arrays.copyOf(eventName, len); this.setLayout(FRGUIPaneFactory.createBorderLayout()); - listModel = new DefaultListModel(); - eventList = new JList(listModel); -// eventList.setFixedCellHeight(20); - eventList.setCellRenderer(render); - eventList.addMouseListener(editListener); - this.add(new UIScrollPane(eventList), BorderLayout.CENTER); + //按钮栏 addAction = new AddMenuDef(this.eventName); - editAction = new EditAction(); removeAction = new RemoveAction(); ToolBarDef def = new ToolBarDef(); @@ -69,8 +70,16 @@ public class EventPane extends BasicPane { def.addShortCut(removeAction); UIToolbar toolBar = ToolBarDef.createJToolBar(); def.updateToolBar(toolBar); - toolBar.setPreferredSize(new Dimension(toolBar.getWidth(), 26)); - this.add(toolBar, BorderLayout.NORTH); + //列表 + listModel = new DefaultListModel(); + eventList = new JList(listModel); + eventList.setCellRenderer(render); + eventList.addMouseListener(editListener); + eventList.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); + JScrollPane scrollPane = new UIScrollPane(eventList); + scrollPane.setBorder(new FineRoundBorder()); + //让事件设置列表铺满,有特殊设置在外层调用处修改 + this.add(column(LayoutConstants.VGAP_SMALL, cell(toolBar), cell(scrollPane).weight(1)).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java b/designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java index 783bc0e6a3..cdf103c95e 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java @@ -1,7 +1,10 @@ package com.fr.design.webattr; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.ConfigManager; import com.fr.config.Configuration; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.core.WidgetOption; @@ -11,8 +14,6 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.form.event.Listener; import com.fr.general.ComparatorUtils; @@ -28,7 +29,6 @@ import com.fr.design.i18n.Toolkit; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.InputMethodEvent; @@ -44,6 +44,12 @@ import javax.swing.ButtonGroup; import javax.swing.JPanel; import javax.swing.SwingUtilities; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapBoldLabelWithUnderline; + public class PageToolBarPane extends AbstractEditToolBarPane { private UIRadioButton centerRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Center_Display")); @@ -59,7 +65,6 @@ public class PageToolBarPane extends AbstractEditToolBarPane { private UICheckBox isPageFixedRowBox; private UITextField pageFixedRowCountTextField; - private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92); private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]*$|^0"); //固定行数分页,每页最多500行,最少1行数据 @@ -68,14 +73,13 @@ public class PageToolBarPane extends AbstractEditToolBarPane { public PageToolBarPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(new ScaledEmptyBorder(10,10,10,10)); ButtonGroup buttonGroup = new ButtonGroup(); leftRadioButton.setSelected(true); buttonGroup.add(centerRadioButton); buttonGroup.add(leftRadioButton); - JPanel buttonPane = new JPanel(FRGUIPaneFactory.createBoxFlowLayout()); - buttonPane.add(centerRadioButton); - buttonPane.add(leftRadioButton); + isShowAsImageBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Is_Paint_Page")); isAutoScaleBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_IS_Auto_Scale")); isTDHeavyBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_IS_TD_HEAVY_EXPORT"), false); @@ -87,56 +91,68 @@ public class PageToolBarPane extends AbstractEditToolBarPane { } }); editToolBarButton.addActionListener(editBtnListener); - JPanel editToolBarButtonPanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - editToolBarButtonPanel.add(editToolBarButton); isUseToolBarCheckBox.setSelected(true); isUseToolBarCheckBox.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent e) { editToolBarButton.setEnabled(isUseToolBarCheckBox.isSelected()); } }); - double p = TableLayout.PREFERRED; - - pageFixedRowCountTextField = new UITextField(5); + pageFixedRowCountTextField = new UITextField(); pageFixedRowCountTextField.setText("30"); pageFixedRowCountTextField.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Page_Fixed_Row_Count_Tip")); - pageFixedRowCountTextField.addKeyListener(rowCountKeyListener); pageFixedRowCountTextField.addInputMethodListener(rowCountInputMethodListener); - UILabel linesPerPageLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Rows_Per_Page") + ":"); - Component[][] rowCountTextFieldComponents = {{linesPerPageLabel,pageFixedRowCountTextField}}; - JPanel linesPerPagePane = TableLayoutHelper.createTableLayoutPane(rowCountTextFieldComponents, new double[]{p}, new double[]{p,p}); UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Page_Fixed_Row_Tip")); - tipLabel.setForeground(TIPS_FONT_COLOR); - - double[] columnSize = {p, p, p, p}; - double[] rowSize = {p, p, p, p, p}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Show_Location") + ":", UILabel.RIGHT), buttonPane, null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_PageSetup_Page") + ":", UILabel.RIGHT), isShowAsImageBox, isAutoScaleBox, isTDHeavyBox}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Paging_Settings") + ":", UILabel.RIGHT), isPageFixedRowBox, linesPerPagePane, null}, - new Component[]{null, tipLabel, null, null}, - new Component[]{isUseToolBarCheckBox, editToolBarButtonPanel, null, null} - }; + FineUIStyle.setStyle(tipLabel, FineUIStyle.LABEL_TIP); - JPanel northPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - this.add(northPanel, BorderLayout.NORTH); + JPanel northPanel = column(LayoutConstants.VERTICAL_GAP, + //报表显示位置:居中展示-左展示 + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Location"))).weight(0.15), + cell(centerRadioButton).weight(0.2), + cell(leftRadioButton).weight(0.15), + flex(0.5) + ), + //页面:以图片方式显示-iframe嵌入时自动缩放-重方式输出格子 + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Page"))).weight(0.15), + cell(isShowAsImageBox).weight(0.2), + cell(isAutoScaleBox).weight(0.25), + cell(isTDHeavyBox).weight(0.2), + flex(0.2) + ), + //分页设置:按行分页-每页显示行数 + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Paging_Settings"))).weight(0.15), + cell(isPageFixedRowBox).weight(0.2), + cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Rows_Per_Page"))).weight(0.15), + cell(pageFixedRowCountTextField).weight(0.2), + flex(0.3) + ), + //提示 + cell(tipLabel), + //使用工具栏-编辑 + row(LayoutConstants.HORIZONTAL_GAP, cell(isUseToolBarCheckBox), cell(editToolBarButton)) + ).getComponent(); + //事件编辑 + JPanel eventPanel = new JPanel(new BorderLayout()); eventPane = new EventPane(new WebPage().supportedEvents()); - JPanel center = FRGUIPaneFactory.createBorderLayout_S_Pane(); - center.add(eventPane, BorderLayout.CENTER); + UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Editing_Listeners")); + wrapBoldLabelWithUnderline(label); + eventPanel.add(column(LayoutConstants.VGAP_SMALL, cell(label), cell(eventPane).weight(1)).getComponent()); + + this.add(column(LayoutConstants.VERTICAL_GAP, + cell(northPanel), + cell(eventPanel).weight(1) + ).getComponent()); + //wei : 默认没config.xml的情况下,就有默认工具栏 ToolBarManager toolBarManager = ToolBarManager.createDefaultToolBar(); toolBarManager.setToolBarLocation(Location.createTopEmbedLocation()); this.toolBarManagers = new ToolBarManager[]{toolBarManager}; - - this.add(center, BorderLayout.CENTER); } - + @Override protected WidgetOption[] getToolBarInstance() { return ReportWebWidgetConstants.getPageToolBarInstance(); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java index 1a3d323e9f..d73beaaecc 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java @@ -1,14 +1,13 @@ package com.fr.design.webattr; +import com.fine.theme.utils.FineUIStyle; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.general.ComparatorUtils; import com.fr.report.web.ToolBarManager; import com.fr.report.web.WebPage; @@ -27,11 +26,15 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.ButtonGroup; import javax.swing.JPanel; -import java.awt.Component; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + public class PageWebSettingPane extends WebSettingPane { private UIRadioButton centerRadioButton; private UIRadioButton leftRadioButton; @@ -40,7 +43,6 @@ public class PageWebSettingPane extends WebSettingPane { private UICheckBox isTDHeavyBox; private UICheckBox isPageFixedRowBox; private UITextField pageFixedRowCountTextField; - private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92); private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]*$|^0"); private static final String DEFAULT_ROW_COUNT = "30"; @@ -52,6 +54,10 @@ public class PageWebSettingPane extends WebSettingPane { super(); } + /** + * 模板-模板Web属性-分页预览设置中其余设置面板,通用部分在父类绘制 + * @return + */ @Override protected JPanel createOtherSetPane() { centerRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Center_Display")); @@ -60,9 +66,7 @@ public class PageWebSettingPane extends WebSettingPane { leftRadioButton.setSelected(true); buttonGroup.add(centerRadioButton); buttonGroup.add(leftRadioButton); - JPanel buttonpane = new JPanel(FRGUIPaneFactory.createBoxFlowLayout()); - buttonpane.add(centerRadioButton); - buttonpane.add(leftRadioButton); + isShowAsImageBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Is_Paint_Page")); isAutoScaleBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_IS_Auto_Scale")); isTDHeavyBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_IS_TD_HEAVY_EXPORT"), false); @@ -74,9 +78,7 @@ public class PageWebSettingPane extends WebSettingPane { } }); - double p = TableLayout.PREFERRED; - - pageFixedRowCountTextField = new UITextField(5); + pageFixedRowCountTextField = new UITextField(); pageFixedRowCountTextField.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Page_Fixed_Row_Count_Tip")); pageFixedRowCountTextField.addKeyListener(new KeyAdapter() { @Override @@ -101,23 +103,35 @@ public class PageWebSettingPane extends WebSettingPane { } }); - UILabel linesPerPageLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Rows_Per_Page") + ":"); - Component[][] rowCountTextFieldComponents = {{linesPerPageLabel,pageFixedRowCountTextField}}; - JPanel linesPerPagePane = TableLayoutHelper.createTableLayoutPane(rowCountTextFieldComponents, new double[]{p}, new double[]{p,p}); UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Page_Fixed_Row_Tip")); - tipLabel.setForeground(TIPS_FONT_COLOR); - - double[] columnSize = {p, p, p, p}; - double[] rowSize = {p, p, p, p}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Location") + ":", UILabel.RIGHT), buttonpane, null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Page") + ":", UILabel.RIGHT), isShowAsImageBox, isAutoScaleBox, isTDHeavyBox}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Paging_Settings") + ":", UILabel.RIGHT), isPageFixedRowBox, linesPerPagePane, null}, - new Component[]{null, tipLabel, null, null} - - }; - - return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + FineUIStyle.setStyle(tipLabel, FineUIStyle.LABEL_TIP); + + //其余设置面板布局 + return column(LayoutConstants.VERTICAL_GAP, + //报表显示位置 + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Location"))).weight(0.15), + cell(centerRadioButton).weight(0.2), + cell(leftRadioButton).weight(0.15), + flex(0.5) + ), + //页面 + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Page"))).weight(0.15), + cell(isShowAsImageBox).weight(0.2), + cell(isAutoScaleBox).weight(0.25), + cell(isTDHeavyBox).weight(0.2), + flex(0.2) + ), + //分页设置 + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Paging_Settings"))).weight(0.15), cell(isPageFixedRowBox).weight(0.2), + cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Rows_Per_Page"))).weight(0.15), + cell(pageFixedRowCountTextField).weight(0.2), + flex(0.3) + ), + //提示 + cell(tipLabel) + ).getComponent(); } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ReportServerPrinterPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ReportServerPrinterPane.java index 8a519df3cf..389af156c6 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ReportServerPrinterPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ReportServerPrinterPane.java @@ -4,9 +4,9 @@ package com.fr.design.webattr; -import javax.swing.BorderFactory; import javax.swing.JPanel; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.report.web.Printer; /** @@ -23,7 +23,7 @@ public class ReportServerPrinterPane extends JPanel { protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(6, 2, 4, 2)); + this.setBorder(new ScaledEmptyBorder(10,10,10,10)); serverPrinterPane = new ServerPrinterPane(); this.add(serverPrinterPane); } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ReportWebAttrPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ReportWebAttrPane.java index c8cef4ff96..17254cc5ca 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ReportWebAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ReportWebAttrPane.java @@ -3,8 +3,8 @@ */ package com.fr.design.webattr; +import com.fr.design.gui.frpane.FineTabbedPane; import com.fr.design.gui.frpane.LoadingBasicPane; -import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.style.background.BackgroundPane; import com.fr.design.style.background.BackgroundPane4Browser; @@ -19,19 +19,13 @@ import java.awt.*; */ public class ReportWebAttrPane extends LoadingBasicPane { private ReportWebAttr reportWebAttr; - - private UITabbedPane tabbedPane; private CommonPane commonPane; private ReportServerPrinterPane serverPrintPane; - private PageWebSettingPane pageWeb; private WriteWebSettingPane writeWeb; private ViewWebSettingPane viewWeb; - private BackgroundPane backgroundPane; - protected WebCssPane cssPane; - protected WebJsPane jsPane; @@ -39,20 +33,20 @@ public class ReportWebAttrPane extends LoadingBasicPane { protected synchronized void initComponents(JPanel container) { JPanel defaultPane = container; defaultPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - - //Tabbed Pane - tabbedPane = new UITabbedPane(); + //模板-模板Web属性 + FineTabbedPane tabbedPane = FineTabbedPane.builder() + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic"), commonPane = new CommonPane()) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Printer(Server)"), serverPrintPane = new ReportServerPrinterPane()) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Pagination_Setting"), pageWeb = new PageWebSettingPane()) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Write_Setting"), writeWeb = new WriteWebSettingPane()) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Data_Analysis_Settings"), viewWeb = new ViewWebSettingPane()) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Browser_Background"), backgroundPane = new BackgroundPane4Browser()) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Import_Css"), cssPane = new WebCssPane()) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Import_JavaScript"), jsPane = new WebJsPane()) + .withTabLayout(new int[]{4, 4}) + .withHeadRatio(0.8f) + .build(); defaultPane.add(tabbedPane, BorderLayout.CENTER); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic"), commonPane = new CommonPane()); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Printer(Server)"), serverPrintPane = new ReportServerPrinterPane()); - - tabbedPane.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Pagination_Setting"), pageWeb = new PageWebSettingPane()); - tabbedPane.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Write_Setting"), writeWeb = new WriteWebSettingPane()); - tabbedPane.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Data_Analysis_Settings"), viewWeb = new ViewWebSettingPane()); - - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Browser_Background"), backgroundPane = new BackgroundPane4Browser()); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Import_Css"), cssPane = new WebCssPane()); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Import_JavaScript"), jsPane = new WebJsPane()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ReportWebWidgetConstants.java b/designer-realize/src/main/java/com/fr/design/webattr/ReportWebWidgetConstants.java index ebfb53b80c..466f55e4d2 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ReportWebWidgetConstants.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ReportWebWidgetConstants.java @@ -1,5 +1,6 @@ package com.fr.design.webattr; +import com.fine.theme.icon.LazyIcon; import com.fr.base.BaseUtils; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOptionFactory; @@ -38,7 +39,6 @@ import com.fr.report.web.button.write.ImportExcelData; import com.fr.report.web.button.write.ShowCellValue; import com.fr.report.web.button.write.StashButton; import com.fr.report.web.button.write.Submit; -import com.fr.report.web.button.write.SubmitForcibly; import com.fr.report.web.button.write.Verify; public class ReportWebWidgetConstants { @@ -61,8 +61,8 @@ public class ReportWebWidgetConstants { } // 提交按钮 - public static final WidgetOption SUBMIT = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Utils_Submit"), BaseUtils.readIcon("/com/fr/web/images/save.png"), - Submit.class); + public static final WidgetOption SUBMIT = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Utils_Submit"), + BaseUtils.readIcon("/com/fr/web/images/save.png"), Submit.class); // flash打印按钮 public static final WidgetOption FLASHPRINT = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Utils_Print[Client]"), @@ -70,102 +70,119 @@ public class ReportWebWidgetConstants { // appletprint public static final WidgetOption APPLETPRINT = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Applet_Print"), - BaseUtils.readIcon("/com/fr/web/images/appletPrint.png"), AppletPrint.class); + new LazyIcon("printApplet"), AppletPrint.class); // PDF导出 - public static final WidgetOption PDF = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_ReportServerP_PDF"), BaseUtils.readIcon("/com/fr/web/images/pdf.png"), - PDF.class); + public static final WidgetOption PDF = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_ReportServerP_PDF"), + new LazyIcon("pdfFile"), PDF.class); // 客户端PDF打印 public static final WidgetOption PDFPRINT = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Utils_Print[Client]"), - BaseUtils.readIcon("/com/fr/web/images/pdfPrint.png"), PDFPrint.class); - + new LazyIcon("printPdf"), PDFPrint.class); // 邮件发送 - public static final WidgetOption EMAIL = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Email"), BaseUtils.readIcon("/com/fr/web/images/email.png"), Email.class); - public static final WidgetOption PRINTPREVIEW = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PrintP_Print_Preview"), - BaseUtils.readIcon("/com/fr/web/images/preview.png"), PrintPreview.class); + public static final WidgetOption EMAIL = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Email"), + new LazyIcon("email"), Email.class); + // 打印预览 + public static final WidgetOption PRINTPREVIEW = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PrintP_Print_Preview"), + new LazyIcon("printPreview"), PrintPreview.class); // 导出成Excel 分页导出 public static final WidgetOption EXCELP = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Excel_Page"), - BaseUtils.readIcon("/com/fr/web/images/excel.png"), ExcelP.class); + new LazyIcon("excel_import"), ExcelP.class); // 导出成Excel 原样导出 public static final WidgetOption EXCELO = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Excel_Simple"), - BaseUtils.readIcon("/com/fr/web/images/excel.png"), ExcelO.class); + new LazyIcon("excel_import"), ExcelO.class); // 导出成Excel 分页分Sheet导出 public static final WidgetOption EXCELS = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Excel_Page_To_Sheet"), - BaseUtils.readIcon("/com/fr/web/images/excel.png"), ExcelS.class); + new LazyIcon("excel_import"), ExcelS.class); // 导出成Word - public static final WidgetOption WORD = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Word"), BaseUtils.readIcon("/com/fr/web/images/word.png"), Word.class); + public static final WidgetOption WORD = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Word"), + new LazyIcon("wordFile"), Word.class); + // 页面设置 - public static final WidgetOption PAGESETUP = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Page_Setup"), BaseUtils.readIcon("/com/fr/web/images/pageSetup.png"), PageSetup.class); + public static final WidgetOption PAGESETUP = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Page_Setup"), + new LazyIcon("pageSetup"), PageSetup.class); // 导出 - public static final WidgetOption EXPORT = WidgetOptionFactory - .createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Export"), BaseUtils.readIcon("/com/fr/web/images/export.png"), Export.class); + public static final WidgetOption EXPORT = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Export"), + new LazyIcon("export"), Export.class); // 当前页/总页数 public static final WidgetOption PAGENAVI = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Page_Navi_Text"), - BaseUtils.readIcon("/com/fr/web/images/pageNumber.png"), PageNavi.class); + new LazyIcon("page_navi"), PageNavi.class); // 首页 - public static final WidgetOption FIRST = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_ReportServerP_First"), BaseUtils.readIcon("/com/fr/web/images/first.png"), - First.class); + public static final WidgetOption FIRST = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_ReportServerP_First"), + new LazyIcon("page_first"), First.class); // 末页 - public static final WidgetOption LAST = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_ReportServerP_Last"), BaseUtils.readIcon("/com/fr/web/images/last.png"), - Last.class); + public static final WidgetOption LAST = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_ReportServerP_Last"), + new LazyIcon("page_last"), Last.class); // 前一页 public static final WidgetOption PREVIOUS = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_ReportServerP_Previous"), - BaseUtils.readIcon("/com/fr/web/images/previous.png"), Previous.class); + new LazyIcon("page_previous"), Previous.class); // 后一页 - public static final WidgetOption NEXT = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_ReportServerP_Next"), BaseUtils.readIcon("/com/fr/web/images/next.png"), - Next.class); - public static final WidgetOption SCALE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Enlarge_Or_Reduce"), BaseUtils.readIcon("/com/fr/web/images/scale.png"), - Scale.class); - - public static final WidgetOption NEW_PRINT = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Print"), BaseUtils.readIcon("/com/fr/web/images/print.png"), NewPrint.class); - public static final WidgetOption PRINT = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Print_Compatible"), BaseUtils.readIcon("/com/fr/web/images/print.png"), Print.class); + public static final WidgetOption NEXT = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_ReportServerP_Next"), + new LazyIcon("page_next"), Next.class); + //缩放 + public static final WidgetOption SCALE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Enlarge_Or_Reduce"), + new LazyIcon("scale"), Scale.class); + // 打印 + public static final WidgetOption NEW_PRINT = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Print"), + new LazyIcon("print"), NewPrint.class); + // 打印兼容 + public static final WidgetOption PRINT = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Print_Compatible"), + new LazyIcon("print"), Print.class); + + //插入记录 public static final WidgetOption APPENDCOLUMNROW = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Insert_Record"), BaseUtils.readIcon("/com/fr/web/images/appendRow.png"), AppendColumnRow.class); + //删除记录 public static final WidgetOption DELETECOLUMNROW = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Delete_Record"), BaseUtils.readIcon("/com/fr/web/images/deleteRow.png"), DeleteColumnRow.class); - public static final WidgetOption VERIFY = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Verify_Data_Verify"), BaseUtils.readIcon("/com/fr/web/images/verify.png"), - Verify.class); - public static final WidgetOption SUBMITFORCIBLY = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Submit_Forcibly"), - BaseUtils.readIcon("/com/fr/web/images/save2.png"), SubmitForcibly.class); - // show cell value + //数据校验 + public static final WidgetOption VERIFY = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Verify_Data_Verify"), + new LazyIcon("dataVerify"), Verify.class); + + // show cell value 显示单元格值 public static final WidgetOption SHOWCELLVALUE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Show_Cell_Value"), BaseUtils.readIcon("/com/fr/web/images/showValue.png"), ShowCellValue.class); - // import excel data + // import excel data 导入excel public static final WidgetOption IMPORTEXCELDATA = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Import_Excel_Data"), - BaseUtils.readIcon("/com/fr/web/images/excel.png"), ImportExcelData.class); + new LazyIcon("excel_import"), ImportExcelData.class); + //自定义导入excel public static final WidgetOption IMPORTEXCELDATA_CUSTOMIZED = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Utils_Import_Excel_Data_Customized"), - BaseUtils.readIcon("/com/fr/web/images/excel.png"), CustomizeImportExcelData.class); + new LazyIcon("excel_import"), CustomizeImportExcelData.class); + // 打印机偏移设置 - public static final WidgetOption SETPRINTEROFFSET = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_SetPrinterOffset"), BaseUtils.readIcon("/com/fr/web/images/pianyi.png"), SetPrinterOffset.class); + public static final WidgetOption SETPRINTEROFFSET = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_SetPrinterOffset"), + new LazyIcon("printerOffset"), SetPrinterOffset.class); - public static final WidgetOption CUSTOM_BUTTON = WidgetOptionFactory - .createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Custom_Form_Button"), CustomToolBarButton.class); + //自定义按钮 + public static final WidgetOption CUSTOM_BUTTON = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Custom_Form_Button"), + new LazyIcon("customButton"), CustomToolBarButton.class); // 数据暂存 public static final WidgetOption WRITESTASH = WidgetOptionFactory .createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine-Write_Stash"), BaseUtils.readIcon("/com/fr/web/images/edit/stash.png"), StashButton.class); + // 数据清空 - public static final WidgetOption WRITESTASHCLEAR = WidgetOptionFactory - .createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine-Write_Clear"), BaseUtils.readIcon("/com/fr/web/images/edit/clearstash.png"), ClearStashedButton.class); - //Excel导入 + public static final WidgetOption WRITESTASHCLEAR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine-Write_Clear"), + new LazyIcon("clearStash"), ClearStashedButton.class); + + //Excel导入_多次 public static final WidgetOption IMPORTEXCEL= WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Excel_Import_Repeat"), - BaseUtils.readIcon("/com/fr/web/images/excel.png"), ExcelImport.class); + new LazyIcon("excel_import"), ExcelImport.class); //Excel导入_覆盖 public static final WidgetOption IMPORTEXCEL_COVER= WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Excel_Import_Cover"), - BaseUtils.readIcon("/com/fr/web/images/excel.png"), ImExcelCover.class); + new LazyIcon("excel_import"), ImExcelCover.class); //Excel导入_清空 public static final WidgetOption IMPORTEXCEL_CLEAN= WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Excel_Import_Clean"), - BaseUtils.readIcon("/com/fr/web/images/excel.png"), ImExcelClean.class); + new LazyIcon("excel_import"), ImExcelClean.class); //Excel导入_增量 public static final WidgetOption IMPORTEXCEL_APPEND= WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Excel_Import_Append"), - BaseUtils.readIcon("/com/fr/web/images/excel.png"), ImExcelAppend.class); + new LazyIcon("excel_import"), ImExcelAppend.class); } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java index 059d9ad64d..4e2245bb44 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java @@ -1,5 +1,7 @@ package com.fr.design.webattr; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.config.Configuration; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; @@ -11,7 +13,7 @@ import com.fr.report.fit.ReportFitConfig; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; -import java.awt.Color; +import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; @@ -78,10 +80,14 @@ public class ServerFitAttrPane extends BaseFitAttrPane { }; } + /** + * 服务器配置-PC端自适应属性面板中需要添加提示 + */ @Override protected void initPrompt() { UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Designer_Fit_Attr_Pane_Hint")); - uiLabel.setForeground(Color.lightGray); + FineUIStyle.setStyle(uiLabel, FineUIStyle.LABEL_TIP); + uiLabel.setBorder(new ScaledEmptyBorder(5, 5, 5, 0)); contentJPanel.add(uiLabel); } } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ServerPrinterPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ServerPrinterPane.java index ef4dc97dca..fe45a9c54d 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ServerPrinterPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ServerPrinterPane.java @@ -3,7 +3,10 @@ */ package com.fr.design.webattr; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; @@ -11,12 +14,10 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.GeneralUtils; import com.fr.report.web.Printer; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultListModel; import javax.swing.JList; @@ -27,8 +28,7 @@ import javax.swing.JToolBar; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import java.awt.BorderLayout; -import java.awt.Dimension; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -36,6 +36,8 @@ import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.*; + public class ServerPrinterPane extends BasicPane { private JList printerList; @@ -52,38 +54,28 @@ public class ServerPrinterPane extends BasicPane { } protected void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(6, 2, 4, 2)); - + this.setLayout(new BorderLayout()); //Kevin Wang: 为左侧打印机添加五个图形形式的按钮 JToolBar toolbar = new JToolBar(); - this.add(toolbar, BorderLayout.NORTH); - - Dimension preferDimension = new Dimension(24, 24); - addButton = new UIButton(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); + addButton = new UIButton(new LazyIcon("add")); addButton.addActionListener(addActionListener); addButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add"));//"add" - addButton.setPreferredSize(preferDimension); - editButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/edit.png")); + editButton = new UIButton(new LazyIcon("edit")); editButton.addActionListener(editActionListener); editButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit"));//"edit" - editButton.setPreferredSize(preferDimension); - removeButton = new UIButton(BaseUtils.readIcon("/com/fr/base/images/cell/control/remove.png")); + removeButton = new UIButton(new LazyIcon("remove")); removeButton.addActionListener(this.removeActionListener); removeButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"));//"remove" - removeButton.setPreferredSize(preferDimension); - moveUpButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/up.png")); + moveUpButton = new UIButton(new LazyIcon("move_up")); moveUpButton.addActionListener(this.moveUpActionListener); moveUpButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Up"));//"moveUp" - moveUpButton.setPreferredSize(preferDimension); - moveDownButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/down.png")); + moveDownButton = new UIButton(new LazyIcon("move_down")); moveDownButton.addActionListener(this.moveDownActionListener); moveDownButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Down"));//"moveDown" - moveDownButton.setPreferredSize(preferDimension); toolbar.add(addButton); toolbar.add(editButton); @@ -93,11 +85,12 @@ public class ServerPrinterPane extends BasicPane { printerList = new JList(new DefaultListModel()); printerList.addListSelectionListener(printerSelectionListener); + printerList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + JScrollPane printerListScrollPane = new JScrollPane(printerList); + printerListScrollPane.setBorder(new FineRoundBorder()); //shark:双击printerlist也可以编辑 printerList.addMouseListener(mouseClickedListener); - this.add(new JScrollPane(printerList), BorderLayout.CENTER); - - // + this.add(column(cell(toolbar), cell(printerListScrollPane).weight(1)).getComponent()); this.checkButtonEnabled(); } @@ -105,7 +98,7 @@ public class ServerPrinterPane extends BasicPane { protected String title4PopupWindow() { return "printer"; } - + private void checkButtonEnabled() { this.editButton.setEnabled(false); this.removeButton.setEnabled(false); @@ -126,7 +119,7 @@ public class ServerPrinterPane extends BasicPane { } } } - + ActionListener addActionListener = new ActionListener(){ public void actionPerformed(ActionEvent evt){ final PrintersPane printersPane = new PrintersPane(); @@ -139,13 +132,13 @@ public class ServerPrinterPane extends BasicPane { defaultListModel.addElement(newPrintName); printerList.setSelectedIndex(defaultListModel.size() - 1); } - } - }); + } + }); printerDialog.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Add_Printer") + "..."); printerDialog.setVisible(true); } }; - + ActionListener editActionListener = new ActionListener(){ public void actionPerformed(ActionEvent evt){ editPrinterList(); @@ -230,7 +223,7 @@ public class ServerPrinterPane extends BasicPane { checkButtonEnabled(); } }; - + MouseAdapter mouseClickedListener = new MouseAdapter(){ @Override public void mouseClicked(MouseEvent e){ @@ -253,14 +246,14 @@ public class ServerPrinterPane extends BasicPane { if (StringUtils.isNotBlank(newPrintName)) { DefaultListModel defaultListModel = (DefaultListModel) printerList.getModel(); - + //shark 把该列删除 再在原位置插入新列 相当于替换 - defaultListModel.remove(index); - defaultListModel.add(index, newPrintName); + defaultListModel.remove(index); + defaultListModel.add(index, newPrintName); printerList.setSelectedIndex(index); } - } - }); + } + }); printersPane.populate(printerList.getSelectedValue().toString()); printerDialog.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Edit_Printer") + "..."); printerDialog.setVisible(true); @@ -287,7 +280,7 @@ public class ServerPrinterPane extends BasicPane { public Printer update() { Printer printer = new Printer(); - + List serverPrinterList = new ArrayList(); DefaultListModel defaultListModel = (DefaultListModel) this.printerList.getModel(); @@ -304,7 +297,7 @@ public class ServerPrinterPane extends BasicPane { } else { printer.setPrinters(null); } - + return printer; } @@ -315,25 +308,24 @@ public class ServerPrinterPane extends BasicPane { this.initComponents(); } - protected void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(20, 5, 0, 0)); - JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - centerPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Printer") + ":"), BorderLayout.WEST); - + this.setLayout(new BorderLayout()); DefaultComboBoxModel printerComboModel = new DefaultComboBoxModel(); - printerCombo = new UIComboBox(printerComboModel); - centerPane.add(printerCombo); - + //添加打印机面板 + JPanel centerPane = column( + flex(), + row(LayoutConstants.HORIZONTAL_GAP, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Printer") + ":")), + cell(printerCombo).weight(1) + ), + flex() + ).getComponent(); // populate printer list. String[] serverPrinterList = GeneralUtils.getSystemPrinterNameArray(); - for (int d = 0; d < serverPrinterList.length; d++) { printerComboModel.addElement(serverPrinterList[d]); } - this.add(centerPane); } @@ -354,7 +346,7 @@ public class ServerPrinterPane extends BasicPane { protected boolean isShowHelpButton() { return false; } - + @Override protected String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Printer"); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/SettingToolBar.java b/designer-realize/src/main/java/com/fr/design/webattr/SettingToolBar.java index 5a97f75eff..75c17326e8 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/SettingToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/SettingToolBar.java @@ -1,40 +1,49 @@ package com.fr.design.webattr; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.Icon; import javax.swing.JPanel; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.row; + public class SettingToolBar extends JPanel { - private Icon setIcon = BaseUtils.readIcon("com/fr/design/images/toolbarbtn/toolbarbtnsetting.png"); - private Icon delIcon = BaseUtils.readIcon("com/fr/design/images/toolbarbtn/toolbarbtnclear.png"); + private Icon setIcon = new LazyIcon("tool_config"); + private Icon delIcon = new LazyIcon("clear"); private UIButton setButton; private UIButton delButton; private ToolBarPane toolBarPane; public SettingToolBar(String name,ToolBarPane toolBarPane) { - super(); -// this.setBackground(Color.lightGray); - this.add(new UILabel(name)); + super(new BorderLayout()); this.toolBarPane = toolBarPane; - setButton = GUICoreUtils.createTransparentButton(setIcon, setIcon, setIcon); + setButton = new UIButton(setIcon); setButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit_Button_ToolBar")); setButton.setAction(new SetAction()); - delButton = GUICoreUtils.createTransparentButton(delIcon, delIcon, delIcon); + + delButton = new UIButton(delIcon); delButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Remove_Button_ToolBar")); delButton.setAction(new DelAction()); - this.add(setButton); - this.add(delButton); + + this.add(row(LayoutConstants.HGAP_LARGE, + fix(LayoutConstants.HGAP_LARGE), + cell(new UILabel(name)), + cell(setButton), + cell(delButton) + ).getComponent()); } public void setEnabled(boolean b) { diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarButton.java b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarButton.java index 5e61682d87..0bc3bfea43 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarButton.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarButton.java @@ -1,6 +1,5 @@ package com.fr.design.webattr; -import com.fr.base.BaseUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.DesignerContext; @@ -8,8 +7,6 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.core.WidgetOption; import com.fr.form.ui.Widget; -import com.fr.form.ui.WidgetInfoConfig; -import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; @@ -27,7 +24,7 @@ public class ToolBarButton extends UIButton implements MouseListener { public ToolBarButton(String text, Icon icon, Widget widget) { super(text, icon); this.widget = widget; - if (widget instanceof com.fr.form.ui.Button) { + /*if (widget instanceof com.fr.form.ui.Button) { com.fr.form.ui.Button button = (com.fr.form.ui.Button) widget; String iconName = button.getIconName(); if (StringUtils.isNotEmpty(iconName)) { @@ -36,7 +33,9 @@ public class ToolBarButton extends UIButton implements MouseListener { setIcon(new ImageIcon(iimage)); } } - } + }*/ + //直接设置Icon图标 + setIcon(icon); this.addMouseListener(this); setMargin(new Insets(0, 0, 0, 0)); } @@ -79,7 +78,6 @@ public class ToolBarButton extends UIButton implements MouseListener { this.no = no; } - protected void paintBorder(Graphics g) { this.setBorderType(UIButton.NORMAL_BORDER); super.paintBorder(g); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java index 868475b524..9d978a8c21 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java @@ -1,11 +1,15 @@ package com.fr.design.webattr; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; @@ -16,26 +20,20 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.GraphDrawHelper; import com.fr.stable.StringUtils; -import javax.swing.Icon; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.ListSelectionModel; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumnModel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.awt.image.ImageObserver; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + /** * 新的拖拽ToolBar button以实现自定义工具栏 报表web设置那儿的.应该不叫ToolBarDragPane,因为实际没有提供drag功能 * @@ -48,9 +46,13 @@ public class ToolBarDragPane extends WidgetToolBarPane { private int row = 7; private DefaultTableModel toolbarButtonTableModel; private JTable layoutTable; - private UICheckBox isUseToolBarCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Use_ToolBar") + ":"); // 是否使用工具栏 - private boolean isEnabled; + //是否使用工具栏 + private UICheckBox isUseToolBarCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Use_ToolBar")); + private boolean isEnabled; + /** + * 工具栏Pane + */ public ToolBarDragPane() { WidgetOption[] options = ExtraDesignClassManager.getInstance().getWebWidgetOptions(); if(options != null){ @@ -59,10 +61,14 @@ public class ToolBarDragPane extends WidgetToolBarPane { } toolbarButtonTableModel = new TableModel(row ,COLUMN); this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel north = FRGUIPaneFactory.createBorderLayout_S_Pane(); - UIButton defaultButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Restore_Default")); - // 恢复默认按钮 - defaultButton.addActionListener(new ActionListener() { + + //工具栏上方面板 + JPanel northPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + isUseToolBarCheckBox.setSelected(true); + northPanel.add(isUseToolBarCheckBox, BorderLayout.WEST); + //恢复默认按钮 + UIButton defaultButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Restore_Default")); + defaultButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { northToolBar.removeButtonList(); northToolBar.removeAll(); @@ -78,26 +84,30 @@ public class ToolBarDragPane extends WidgetToolBarPane { ToolBarDragPane.this.repaint(); } }); + northPanel.add(defaultButton, BorderLayout.EAST); - north.add(isUseToolBarCheckBox, BorderLayout.WEST); - JPanel aa = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); - aa.add(defaultButton); - north.add(aa, BorderLayout.CENTER); - this.add(north, BorderLayout.NORTH); - + //顶部工具栏 + JPanel northContentPane = new JPanel(new BorderLayout()); northToolBar = new ToolBarPane(); - northToolBar.setPreferredSize(new Dimension(ImageObserver.WIDTH, 26)); -// northToolBar.setBackground(Color.lightGray); - - UIButton topButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/arrow/arrow_up.png")); - topButton.setBorder(null); - // topButton.setMargin(null); - topButton.setOpaque(false); + northToolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, UIManager.getColor("defaultBorderColor"))); + northToolBar.setOpaque(false); + SettingToolBar top = new SettingToolBar(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ToolBar_Top"), northToolBar); + top.setOpaque(false); + northContentPane.add(northToolBar, BorderLayout.CENTER); + northContentPane.add(top, BorderLayout.EAST); + northContentPane.setOpaque(false); + northContentPane.setBorder(new ScaledEmptyBorder(4,0,4,0)); + JPanel topToolbarPanel = new JPanel(new BorderLayout()); + topToolbarPanel.add(northContentPane); + topToolbarPanel.setBackground(FineUIUtils.getUIColor("Center.ZoneBorderColor", "defaultBorderColor")); + + //移入顶部工具栏按钮 + UIButton topButton = new UIButton(new LazyIcon("move_up")); + topButton.setOpaque(false); topButton.setContentAreaFilled(false); topButton.setFocusPainted(false); topButton.setRequestFocusEnabled(false); topButton.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent e) { if (isSelectedtable()) { @@ -113,15 +123,26 @@ public class ToolBarDragPane extends WidgetToolBarPane { } } }); - UIButton downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/arrow/arrow_down.png")); - downButton.setBorder(null); + + //图标列表面板,增加外边距 + initLayoutTable(); + JPanel innerTablePanel = new JPanel(new BorderLayout()); + innerTablePanel.add(layoutTable); + innerTablePanel.setOpaque(false); + innerTablePanel.setBorder(new ScaledEmptyBorder(4,4,4,4)); + JPanel buttonTablePanel = new JPanel(new BorderLayout()); + buttonTablePanel.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); + buttonTablePanel.setBorder(new FineRoundBorder()); + buttonTablePanel.add(innerTablePanel); + + //移入底部工具栏按钮 + UIButton downButton = new UIButton(new LazyIcon("move_down")); downButton.setMargin(null); downButton.setOpaque(false); downButton.setContentAreaFilled(false); downButton.setFocusPainted(false); downButton.setRequestFocusEnabled(false); downButton.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent e) { if (isSelectedtable()) { @@ -138,48 +159,44 @@ public class ToolBarDragPane extends WidgetToolBarPane { } }); - initLayoutTable(); - - JPanel center = FRGUIPaneFactory.createBorderLayout_S_Pane(); -// center.setBackground(Color.WHITE); - center.add(topButton, BorderLayout.NORTH); - JPanel small = FRGUIPaneFactory.createBorderLayout_S_Pane(); -// small.setBackground(Color.WHITE); - small.add(new UILabel(StringUtils.BLANK), BorderLayout.NORTH); - small.add(layoutTable, BorderLayout.CENTER); - center.add(small, BorderLayout.CENTER); - center.add(downButton, BorderLayout.SOUTH); - southToolBar = new ToolBarPane(); - southToolBar.setPreferredSize(new Dimension(ImageObserver.WIDTH, 26)); -// southToolBar.setBackground(Color.lightGray); - JPanel movePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JPanel northContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - SettingToolBar top = new SettingToolBar(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ToolBar_Top"), northToolBar); - northContentPane.add(top, BorderLayout.EAST); - northContentPane.add(northToolBar, BorderLayout.CENTER); -// northContentPane.setBackground(Color.lightGray); - + //底部工具栏 JPanel southContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + southToolBar = new ToolBarPane(); + southToolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, UIManager.getColor("defaultBorderColor"))); + southToolBar.setOpaque(false); SettingToolBar bottom = new SettingToolBar(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ToolBar_Bottom"), southToolBar); + bottom.setOpaque(false); southContentPane.add(bottom, BorderLayout.EAST); southContentPane.add(southToolBar, BorderLayout.CENTER); -// southContentPane.setBackground(Color.lightGray); + southContentPane.setOpaque(false); + southContentPane.setBorder(new ScaledEmptyBorder(4,0,4,0)); + JPanel bottomToolbarPanel = new JPanel(new BorderLayout()); + bottomToolbarPanel.add(southContentPane); + bottomToolbarPanel.setBackground(FineUIUtils.getUIColor("Center.ZoneBorderColor", "defaultBorderColor")); - movePane.add(northContentPane, BorderLayout.NORTH); - movePane.add(center, BorderLayout.CENTER); - movePane.add(southContentPane, BorderLayout.SOUTH); - - this.add(new JScrollPane(movePane), BorderLayout.CENTER); - isUseToolBarCheckBox.setSelected(true); + //工具栏面板center布局:顶部工具栏-上移动按钮-图标面板-下移动按钮-底部工具栏 + JPanel movePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + movePane.add(column(1, + cell(topToolbarPanel), + cell(topButton), + cell(buttonTablePanel), + cell(downButton), + cell(bottomToolbarPanel) + ).getComponent()); + //工具栏整体面板 + this.add(column(LayoutConstants.VERTICAL_GAP, cell(northPanel), cell(new JScrollPane(movePane))).getComponent()); } + /** + * 图标列表 + */ private void initLayoutTable() { layoutTable = new JTable(toolbarButtonTableModel); layoutTable.setDefaultRenderer(Object.class, tableRenderer); layoutTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); layoutTable.setColumnSelectionAllowed(false); layoutTable.setRowSelectionAllowed(false); -// layoutTable.setBackground(Color.WHITE); + layoutTable.setOpaque(false); layoutTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1 && !(SwingUtilities.isRightMouseButton(e)) && isEnabled) { @@ -280,6 +297,7 @@ public class ToolBarDragPane extends WidgetToolBarPane { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + this.setOpaque(false); if (value instanceof WidgetOption) { WidgetOption nameOption = (WidgetOption)value; diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java index ef228699f6..747d0a2b75 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java @@ -13,7 +13,7 @@ import com.fr.report.web.annotation.OldPrintMethod; import javax.swing.BorderFactory; import javax.swing.SwingUtilities; import javax.swing.TransferHandler; -import java.awt.Component; +import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.event.MouseAdapter; @@ -55,6 +55,7 @@ public class ToolBarPane extends BasicBeanPane { public void initComponent() { this.addMouseListener(listener); this.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); + this.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2)); this.setTransferHandler(new ToolBarHandler(TransferHandler.COPY)); this.setBorder(BorderFactory.createTitledBorder("")); } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ViewToolBarPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ViewToolBarPane.java index c396538dd4..f6bdc7e193 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ViewToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ViewToolBarPane.java @@ -1,7 +1,9 @@ package com.fr.design.webattr; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.ConfigManager; import com.fr.config.Configuration; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.core.WidgetOption; @@ -9,7 +11,6 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.event.Listener; import com.fr.report.web.Location; @@ -27,24 +28,25 @@ import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapBoldLabelWithUnderline; + public class ViewToolBarPane extends AbstractEditToolBarPane { private EventPane eventPane; - + private UICheckBox isUseToolBarCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Use_ToolBar")); private UIButton editToolBarButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); - private UILabel showListenersLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Editing_Listeners") + ":"); + private UILabel showListenersLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Editing_Listeners")); private UICheckBox sortCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Sort_Sort")); private UICheckBox conditonFilterBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Selection_Filter")); private UICheckBox listFilterBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_List_Filter")); - + public ViewToolBarPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel allPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); - - this.add(allPanel, BorderLayout.CENTER); - JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - allPanel.add(northPane, BorderLayout.NORTH); - editToolBarButton.addActionListener(editBtnListener); + this.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); + editToolBarButton.addActionListener(editBtnListener); isUseToolBarCheckBox.setSelected(true); isUseToolBarCheckBox.addActionListener(new ActionListener() { @Override @@ -56,25 +58,35 @@ public class ViewToolBarPane extends AbstractEditToolBarPane { sortCheckBox.setSelected(false); conditonFilterBox.setSelected(false); listFilterBox.setSelected(false); - northPane.add(GUICoreUtils.createFlowPane(new Component[]{sortCheckBox, conditonFilterBox, listFilterBox}, FlowLayout.LEFT, 6)); - northPane.add(GUICoreUtils.createFlowPane(new Component[] {isUseToolBarCheckBox, editToolBarButton}, FlowLayout.LEFT)); - northPane.add(GUICoreUtils.createFlowPane(showListenersLabel, FlowLayout.LEFT)); + JPanel northPanel = column(LayoutConstants.VERTICAL_GAP, + row(LayoutConstants.HORIZONTAL_GAP, cell(sortCheckBox), cell(conditonFilterBox), cell(listFilterBox)), + row(LayoutConstants.HORIZONTAL_GAP, cell(isUseToolBarCheckBox), cell(editToolBarButton)) + ).getComponent(); + + //事件编辑 + JPanel eventPanel = new JPanel(new BorderLayout()); eventPane = new EventPane(new WebView().supportedEvents()); - JPanel center = FRGUIPaneFactory.createBorderLayout_S_Pane(); - center.add(eventPane, BorderLayout.CENTER); - allPanel.add(center, BorderLayout.CENTER); + wrapBoldLabelWithUnderline(showListenersLabel); + eventPanel.add(column(LayoutConstants.VGAP_SMALL, cell(showListenersLabel), cell(eventPane).weight(1)).getComponent()); + + //整体布局 + this.add(column(LayoutConstants.VERTICAL_GAP, + cell(northPanel), + cell(eventPanel).weight(1) + ).getComponent()); + //wei : 默认没config.xml的情况下,就有默认工具栏 ToolBarManager toolBarManager = ToolBarManager.createDefaultViewToolBar(); toolBarManager.setToolBarLocation(Location.createTopEmbedLocation()); this.toolBarManagers = new ToolBarManager[] {toolBarManager}; } - + @Override public void setEnabled(boolean isEnabled) { super.setEnabled(isEnabled); - + this.eventPane.setEnabled(isEnabled); - + this.isUseToolBarCheckBox.setEnabled(isEnabled); this.sortCheckBox.setEnabled(isEnabled); this.conditonFilterBox.setEnabled(isEnabled); @@ -82,7 +94,7 @@ public class ViewToolBarPane extends AbstractEditToolBarPane { this.editToolBarButton.setEnabled(isEnabled && isUseToolBarCheckBox.isSelected()); this.showListenersLabel.setEnabled(isEnabled); } - + @Override protected String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Data_Analysis_Settings"); @@ -132,9 +144,9 @@ public class ViewToolBarPane extends AbstractEditToolBarPane { return webView; } - /** - * 编辑服务器工具栏窗格 - */ + /** + * 编辑服务器工具栏窗格 + */ @Override public void editServerToolBarPane() { final ViewToolBarPane serverPageToolBarPane = new ViewToolBarPane(); @@ -144,7 +156,7 @@ public class ViewToolBarPane extends AbstractEditToolBarPane { } BasicDialog serverPageDialog = serverPageToolBarPane.showWindow(SwingUtilities.getWindowAncestor(ViewToolBarPane.this)); serverPageDialog.addDialogActionListener(new DialogActionAdapter() { - + @Override public void doOk() { Configurations.update(new Worker() { @@ -163,12 +175,12 @@ public class ViewToolBarPane extends AbstractEditToolBarPane { } }); serverPageDialog.setVisible(true); - + } - @Override - protected WidgetOption[] getToolBarInstance() { - return ReportWebWidgetConstants.getViewToolBarInstance(); - } + @Override + protected WidgetOption[] getToolBarInstance() { + return ReportWebWidgetConstants.getViewToolBarInstance(); + } } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ViewWebSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ViewWebSettingPane.java index 1d91f0d911..8cc054a80c 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ViewWebSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ViewWebSettingPane.java @@ -4,18 +4,20 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.report.web.ToolBarManager; import com.fr.report.web.WebView; import com.fr.web.attr.ReportWebAttr; import javax.swing.*; -import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + public class ViewWebSettingPane extends WebSettingPane { private UICheckBox sortCheckBox; private UICheckBox conditionFilterBox; @@ -25,17 +27,24 @@ public class ViewWebSettingPane extends WebSettingPane { super(); } + /** + * 模板-模板Web属性-数据分析设置中其余设置面板,通用部分在父类绘制 + * @return + */ @Override protected JPanel createOtherSetPane() { sortCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Sort_Sort")); conditionFilterBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Selection_Filter")); listFilterBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_List_Filter")); - sortCheckBox.setSelected(true); conditionFilterBox.setSelected(true); listFilterBox.setSelected(true); - return GUICoreUtils.createFlowPane(new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_ViewPreview") + ":"), - sortCheckBox, conditionFilterBox, listFilterBox}, FlowLayout.LEFT, 6); + return row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_ViewPreview"))).weight(0.15), + cell(sortCheckBox).weight(0.15), + cell(conditionFilterBox).weight(0.15), + cell(listFilterBox).weight(0.15), + flex(0.4) + ).getComponent(); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java index 7dcd3e21b2..465f9c6b96 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java @@ -1,5 +1,8 @@ package com.fr.design.webattr; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.EditingStringListPane; import com.fr.design.gui.ibutton.UIButton; @@ -16,57 +19,59 @@ import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.web.attr.ReportWebAttr; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.*; + public class WebCssPane extends BasicPane { private UITextField localText; UIButton chooseFile; private EditingStringListPane centerPane; public WebCssPane() { - this.setLayout(new BorderLayout(0, 20)); - this.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); - - JPanel outnorth = new JPanel(new BorderLayout(0, 5)); - JPanel northPane = new JPanel(new FlowLayout(FlowLayout.LEFT,8,0)); + this.setLayout(new BorderLayout()); + this.setBorder(new ScaledEmptyBorder(10,10,10,10)); + + //磁盘文件 localText = new UITextField(); localText.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.web.pane.text.field")); localText.setEditable(false); chooseFile = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Selection")); - chooseFile.setPreferredSize(new Dimension(75, 23)); chooseFile.addActionListener(chooseFileListener); - northPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Disk_File") + ":"), FlowLayout.LEFT); - northPane.add(localText, FlowLayout.CENTER); - northPane.add(chooseFile, FlowLayout.RIGHT); - outnorth.add(northPane,BorderLayout.NORTH); - UILabel infor = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CSS_Warning", - ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBAPP_NAME)); - infor.setForeground(new Color(207, 42, 39)); - outnorth.add(infor,BorderLayout.CENTER); - this.add(outnorth, BorderLayout.NORTH); - centerPane = new EditingStringListPane() { + //红色提示信息 + UILabel info = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CSS_Warning", + ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBAPP_NAME)); + FineUIStyle.setStyle(info, FineUIStyle.LABEL_WARNING_TIP); + centerPane = new EditingStringListPane() { @Override protected void selectedChanged(String selected) { localText.setText(selected); checkEnableState(); } - @Override protected String getAddOrEditString() { return localText.getText(); } }; - this.add(centerPane, BorderLayout.CENTER); + + JPanel workPanel = new JPanel(new BorderLayout()); + workPanel.add(column(LayoutConstants.VERTICAL_GAP, + row(LayoutConstants.VERTICAL_GAP, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Disk_File"))), + cell(localText).weight(0.8), + cell(chooseFile) + ), + cell(info), + cell(centerPane) + ).getComponent()); + this.add(workPanel); } private ActionListener chooseFileListener = new ActionListener() { @@ -122,6 +127,5 @@ public class WebCssPane extends BasicPane { String a = valueList.get(i); reportWebAttr.addCSSImport(a); } - } } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java index 7b371802b6..09ff19b977 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java @@ -1,5 +1,8 @@ package com.fr.design.webattr; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.frpane.EditingStringListPane; @@ -19,15 +22,12 @@ import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.web.attr.ReportWebAttr; -import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -40,6 +40,8 @@ import java.net.URLConnection; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.*; + public class WebJsPane extends BasicPane { private UITextField localText; private UITextField urlText; @@ -48,15 +50,15 @@ public class WebJsPane extends BasicPane { private EditingStringListPane editingPane; UIButton chooseFile; UIButton testConnection; - UILabel infor1; - UILabel infor2; + UILabel info1; + UILabel info2; public WebJsPane() { - this.setLayout(new BorderLayout(0, 20)); - this.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); + this.setLayout(new BorderLayout()); + this.setBorder(new ScaledEmptyBorder(10,10,10,10)); - localFileRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Disk_File") + ":", true); - urlFileRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Url_Location")+ ":", false); + localFileRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Disk_File"), true); + urlFileRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Url_Location"), false); ButtonGroup bg = new ButtonGroup(); bg.add(localFileRadioButton); bg.add(urlFileRadioButton); @@ -85,38 +87,24 @@ public class WebJsPane extends BasicPane { testConnection.setPreferredSize(chooseFile.getPreferredSize()); } - createNorthPane(); - createEditingPane(); } private void createNorthPane() { - JPanel outnorth = new JPanel(new BorderLayout(0, 5)); - JPanel firstnorth = new JPanel(new BorderLayout(0, 5)); - JPanel northPane = new JPanel(new FlowLayout(FlowLayout.LEFT,7,0)); - northPane.add(localFileRadioButton); - northPane.add(localText); - northPane.add(chooseFile); - firstnorth.add(northPane,BorderLayout.NORTH); - infor1 = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1", - ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBAPP_NAME)); - infor1.setForeground(new Color(207, 42, 39)); - firstnorth.add(infor1,BorderLayout.CENTER); - - JPanel secondnorth = new JPanel(new BorderLayout(0, 5)); - JPanel centerPane = new JPanel(new FlowLayout(FlowLayout.LEFT,7,0)); - centerPane.add(urlFileRadioButton); - centerPane.add(urlText); - centerPane.add(testConnection); - secondnorth.add(centerPane,BorderLayout.NORTH); - infor2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING2", ProjectConstants.WEBAPP_NAME)); - infor2.setForeground(new Color(207, 42, 39)); - secondnorth.add(infor2,BorderLayout.CENTER); - - outnorth.add(firstnorth,BorderLayout.NORTH); - outnorth.add(secondnorth,BorderLayout.CENTER); - this.add(outnorth, BorderLayout.NORTH); + info1 = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1", ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBAPP_NAME)); + FineUIStyle.setStyle(info1, FineUIStyle.LABEL_WARNING_TIP); + info2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING2", ProjectConstants.WEBAPP_NAME)); + FineUIStyle.setStyle(info2, FineUIStyle.LABEL_WARNING_TIP); + JPanel outNorth = column(LayoutConstants.VERTICAL_GAP, + row(LayoutConstants.HORIZONTAL_GAP, cell(localFileRadioButton), cell(localText).weight(0.8), cell(chooseFile)), + cell(info1), + row(LayoutConstants.HORIZONTAL_GAP, cell(urlFileRadioButton), cell(urlText).weight(0.8), cell(testConnection)), + cell(info2) + ).getComponent(); + JPanel workPanel = new JPanel(new BorderLayout()); + workPanel.add(outNorth); + this.add(workPanel, BorderLayout.NORTH); } private void createEditingPane() { @@ -130,7 +118,7 @@ public class WebJsPane extends BasicPane { if (url.matches("^[a-zA-z]+://.+js")) { return url; } else { - FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(WebJsPane.this), com.fr.design.i18n.Toolkit.i18nText("Add_JS_warning")); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(WebJsPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add_JS_warning")); return ""; } } @@ -153,6 +141,10 @@ public class WebJsPane extends BasicPane { checkEnableState(); } }; + + JPanel workPanel = new JPanel(new BorderLayout()); + editingPane.setBorder(new ScaledEmptyBorder(10,0,0,0)); + workPanel.add(editingPane); this.add(editingPane, BorderLayout.CENTER); } @@ -162,7 +154,6 @@ public class WebJsPane extends BasicPane { } private ActionListener chooseFileListener = new ActionListener() { - @Override public void actionPerformed(ActionEvent e) { FILEChooserPane fileChooser = FILEChooserPane.getInstance(false, false, true, @@ -191,7 +182,7 @@ public class WebJsPane extends BasicPane { public void actionPerformed(ActionEvent arg0) { String uri = urlText.getText(); if (!uri.matches("^[a-zA-z]+://.+js")) { - FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(WebJsPane.this), com.fr.design.i18n.Toolkit.i18nText("Add_JS_warning")); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(WebJsPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add_JS_warning")); return; } InputStream in = null; @@ -224,14 +215,14 @@ public class WebJsPane extends BasicPane { localRadioSelectAction(); urlFileRadioButton.setForeground(new Color(143, 142, 139)); localFileRadioButton.setForeground(Color.black); - infor1.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1", ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBAPP_NAME)); - infor2.setText(" "); + info1.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1", ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBAPP_NAME)); + info2.setText(" "); } else if (urlFileRadioButton.isSelected()) { urlRadioSelectAction(); localFileRadioButton.setForeground(new Color(143, 142, 139)); urlFileRadioButton.setForeground(Color.black); - infor2.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING2", ProjectConstants.WEBAPP_NAME)); - infor1.setText(" "); + info2.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING2", ProjectConstants.WEBAPP_NAME)); + info1.setText(" "); } if (StringUtils.isEmpty(urlText.getText()) && StringUtils.isEmpty(localText.getText())) { editingPane.setAddEnabled(false); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WebSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WebSettingPane.java index 59b0d2316e..c39aa988c4 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WebSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WebSettingPane.java @@ -1,13 +1,14 @@ package com.fr.design.webattr; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.border.FineBorderFactory; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.form.event.Listener; import com.fr.report.web.ToolBarManager; @@ -22,6 +23,11 @@ import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapBoldLabelWithUnderline; + public abstract class WebSettingPane extends BasicBeanPane { private static final String[] CHOOSEITEM = new String[] { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), @@ -37,52 +43,58 @@ public abstract class WebSettingPane extends BasicBeanPane private static final int ZERO = 0; private static final long LONGZERO = 0L; + /** + * 模板-模板Web属性-分页预览设置/填报页面设置/数据分析设置通用面板 + */ public WebSettingPane() { - JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 6)); + //以下设置 choseComboBox = new UIComboBox(CHOOSEITEM); choseComboBox.addItemListener(itemListener); - buttonPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Blow_Set") + ":")); - buttonPane.add(choseComboBox); + JPanel buttonPane = row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Blow_Set"))).weight(0.15), + cell(choseComboBox).weight(0.85) + ).getComponent(); + + //工具栏 dragToolBarPane = new ToolBarDragPane(); dragToolBarPane.setDefaultToolBar(getDefaultToolBarManager(), getToolBarInstance()); - JPanel eventpanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - eventpanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Set") + ':'), BorderLayout.NORTH); - eventPane = new EventPane(getEventNames()); - eventpanel.add(eventPane, BorderLayout.CENTER); - - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] columnSize = {f}; - - JPanel othersetpane = createOtherSetPane(); - JPanel panel ; - if (othersetpane != null) { - - Component[][] components = new Component[][]{ - new Component[]{buttonPane}, - new Component[]{othersetpane}, - new Component[]{dragToolBarPane}, - new Component[]{eventpanel} - }; - double[] rowSize1 = { p,p,p,f }; - - panel = TableLayoutHelper.createTableLayoutPane(components,rowSize1,columnSize); + //事件设置 + JPanel eventPanel = new JPanel(new BorderLayout()); + eventPane = new EventPane(getEventNames()); + UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Set")); + wrapBoldLabelWithUnderline(label); + eventPanel.add(column(LayoutConstants.VGAP_SMALL, cell(label), cell(eventPane)).getComponent()); + + //其余设置面板,不同页面中分别绘制 + JPanel otherSetPane = createOtherSetPane(); + + //横向分割线 + JPanel separatorLine = new JPanel(); + separatorLine.setBorder(FineBorderFactory.createDefaultUnderlineBorder()); + separatorLine.setPreferredSize(FineUIScale.scale(new Dimension(1, 1))); + + //整体布局 + JPanel panel = new JPanel(new BorderLayout()); + panel.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); + if (otherSetPane != null) { + panel.add(column(LayoutConstants.VERTICAL_GAP, + cell(buttonPane), + cell(otherSetPane), + cell(separatorLine), + cell(dragToolBarPane), + cell(eventPanel) + ).getComponent()); } else { - Component[][] components = new Component[][]{ - new Component[]{buttonPane}, - new Component[]{dragToolBarPane}, - new Component[]{eventpanel} - }; - double[] rowSize2 = { p,p,f }; - - panel = TableLayoutHelper.createTableLayoutPane(components,rowSize2,columnSize); + panel.add(column(LayoutConstants.VERTICAL_GAP, + cell(buttonPane), + cell(separatorLine), + cell(dragToolBarPane), + cell(eventPanel) + ).getComponent()); } - - this.setLayout(new BorderLayout()); - - UIScrollPane scrollPane = new UIScrollPane(panel); - this.add(scrollPane, BorderLayout.CENTER); + this.setLayout(new BorderLayout()); + this.add(new UIScrollPane(panel)); } ItemListener itemListener = new ItemListener() { diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java index a2e0c53c2f..35bc1b081d 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java @@ -1,9 +1,11 @@ package com.fr.design.webattr; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.ConfigManager; import com.fr.config.Configuration; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.core.WidgetOption; @@ -14,7 +16,6 @@ import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.event.Listener; import com.fr.report.web.Location; @@ -35,6 +36,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapBoldLabelWithUnderline; + public class WriteToolBarPane extends AbstractEditToolBarPane { private EventPane eventPane; private UICheckBox colorBox; @@ -45,66 +52,90 @@ public class WriteToolBarPane extends AbstractEditToolBarPane { private UILabel sheetShowLocationLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sheet_Label_Page_Display_Position")); private UIRadioButton centerRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Center_Display")); private UIRadioButton leftRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Left_Display")); - private UILabel rptShowLocationLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Location") + ":", UILabel.LEFT); + private UILabel rptShowLocationLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Location")); private UICheckBox isUseToolBarCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Use_ToolBar")); private UIButton editToolBarButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); - private UILabel showListenersLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Editing_Listeners") + ":"); + private UILabel showListenersLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Editing_Listeners")); private UICheckBox unloadCheck; private UICheckBox showWidgets; private UICheckBox isAutoStash;//自动暂存 public WriteToolBarPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel allPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); - this.add(allPanel, BorderLayout.CENTER); - JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); - allPanel.add(northPane, BorderLayout.NORTH); + this.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); //sheet标签页显示位置 ButtonGroup sheetButtonGroup = new ButtonGroup(); bottomRadioButton.setSelected(true); sheetButtonGroup.add(topRadioButton); sheetButtonGroup.add(bottomRadioButton); - northPane.add(GUICoreUtils.createFlowPane(new Component[]{sheetShowLocationLabel, topRadioButton, bottomRadioButton}, FlowLayout.LEFT)); + JPanel sheetPane = row(LayoutConstants.HORIZONTAL_GAP, + cell(sheetShowLocationLabel), + cell(topRadioButton), + cell(bottomRadioButton)).getComponent(); //Sean:报表显示位置 ButtonGroup rptButtonGroup = new ButtonGroup(); leftRadioButton.setSelected(true); rptButtonGroup.add(leftRadioButton); rptButtonGroup.add(centerRadioButton); - northPane.add(GUICoreUtils.createFlowPane(new Component[]{rptShowLocationLabel, centerRadioButton, leftRadioButton}, FlowLayout.LEFT)); - - colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background") + ":"); + JPanel showLocPane = row(LayoutConstants.HORIZONTAL_GAP, + cell(rptShowLocationLabel), + cell(centerRadioButton), + cell(leftRadioButton) + ).getComponent(); + + //当前编辑行背景设置 + colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background")); colorBox.setSelected(false); colorBox.addActionListener(colorListener); - colorButton = new UINoThemeColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png")); - northPane.add(GUICoreUtils.createFlowPane(new Component[]{colorBox, colorButton}, FlowLayout.LEFT)); + colorButton = new UINoThemeColorButton(new LazyIcon("background")); + JPanel backgroundPane = row(cell(colorBox), fix(LayoutConstants.HGAP_SMALL), cell(colorButton)).getComponent(); + //勾选框 unloadCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unload_Check")); unloadCheck.setSelected(true); - showWidgets = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Show_Widgets")); showWidgets.setSelected(false); isAutoStash = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Write_Auto_Stash")); isAutoStash.setSelected(false); - northPane.add(GUICoreUtils.createFlowPane(new Component[]{unloadCheck, showWidgets, isAutoStash}, FlowLayout.LEFT)); + JPanel unloadCheckPane = row(LayoutConstants.HORIZONTAL_GAP, + cell(unloadCheck), + cell(showWidgets), + cell(isAutoStash) + ).getComponent(); + + JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); + northPane.add(sheetPane); + northPane.add(showLocPane); + northPane.add(backgroundPane); + northPane.add(unloadCheckPane); + //工具栏编辑 editToolBarButton.addActionListener(editBtnListener); isUseToolBarCheckBox.setSelected(true); isUseToolBarCheckBox.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent e) { editToolBarButton.setEnabled(isUseToolBarCheckBox.isSelected()); } }); - northPane.add(GUICoreUtils.createFlowPane(new Component[]{isUseToolBarCheckBox, editToolBarButton}, FlowLayout.LEFT)); - northPane.add(new UILabel()); - northPane.add(GUICoreUtils.createFlowPane(showListenersLabel, FlowLayout.LEFT)); + + JPanel northPanel = column(LayoutConstants.VERTICAL_GAP, + cell(northPane), + row(LayoutConstants.HORIZONTAL_GAP, cell(isUseToolBarCheckBox), cell(editToolBarButton)) + ).getComponent(); + + //事件编辑 + JPanel eventPanel = new JPanel(new BorderLayout()); eventPane = new EventPane(new WebWrite().supportedEvents()); - JPanel center = FRGUIPaneFactory.createBorderLayout_S_Pane(); - center.add(eventPane, BorderLayout.CENTER); - allPanel.add(center, BorderLayout.CENTER); + wrapBoldLabelWithUnderline(showListenersLabel); + eventPanel.add(column(LayoutConstants.VGAP_SMALL, cell(showListenersLabel), cell(eventPane).weight(1)).getComponent()); + + this.add(column(LayoutConstants.VERTICAL_GAP, + cell(northPanel), + cell(eventPanel).weight(1) + ).getComponent()); //wei : 默认没config.xml的情况下,就有默认工具栏 ToolBarManager toolBarManager = ToolBarManager.createDefaultWriteToolBar(); toolBarManager.setToolBarLocation(Location.createTopEmbedLocation()); @@ -112,7 +143,6 @@ public class WriteToolBarPane extends AbstractEditToolBarPane { } private ActionListener editBtnListener = new ActionListener() { - public void actionPerformed(ActionEvent e) { final DragToolBarPane dragToolbarPane = new DragToolBarPane(); dragToolbarPane.setDefaultToolBar(ToolBarManager.createDefaultWriteToolBar(), getToolBarInstance()); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java index dd93281acd..294116e60b 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java @@ -1,14 +1,14 @@ package com.fr.design.webattr; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.report.web.ToolBarManager; import com.fr.report.web.WebWrite; @@ -16,13 +16,15 @@ import com.fr.stable.Constants; import com.fr.web.attr.ReportWebAttr; import javax.swing.*; -import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + public class WriteWebSettingPane extends WebSettingPane { private UICheckBox colorBox; private UIColorButton colorButton; @@ -40,47 +42,63 @@ public class WriteWebSettingPane extends WebSettingPane { super(); } + /** + * 模板-模板Web属性-填报页面设置中其余设置面板,通用部分在父类绘制 + * @return + */ @Override protected JPanel createOtherSetPane() { - colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Background_Of_Current_Row") + ":"); - colorBox.setSelected(true); - colorButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png")); - colorBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - colorButton.setEnabled(colorBox.isSelected()); - } - - }); - JPanel backgroundPane = GUICoreUtils.createFlowPane(new Component[]{colorBox, colorButton}, FlowLayout.LEFT); - //sheet标签页显示位置 topRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Top")); bottomRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bottom")); - sheetShowLocationLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sheet_Label_Page_Display_Position"), UILabel.LEFT); + sheetShowLocationLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sheet_Label_Page_Display_Position")); ButtonGroup buttonGroup = new ButtonGroup(); bottomRadioButton.setSelected(true); buttonGroup.add(topRadioButton); buttonGroup.add(bottomRadioButton); - JPanel sheetPane = GUICoreUtils.createFlowPane(new Component[]{sheetShowLocationLabel, topRadioButton, bottomRadioButton}, FlowLayout.LEFT); + JPanel sheetPane = row(LayoutConstants.HORIZONTAL_GAP, + cell(sheetShowLocationLabel), + cell(topRadioButton), + cell(bottomRadioButton)).getComponent(); //Sean: 报表显示位置since 706 - rptShowLocationLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Location") + ":", UILabel.LEFT); + rptShowLocationLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Location")); centerRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Center_Display")); leftRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Left_Display")); ButtonGroup rptShowButtonGroup = new ButtonGroup(); leftRadioButton.setSelected(true); rptShowButtonGroup.add(centerRadioButton); rptShowButtonGroup.add(leftRadioButton); - JPanel showLocPane = GUICoreUtils.createFlowPane(new Component[]{rptShowLocationLabel, centerRadioButton, leftRadioButton}, FlowLayout.LEFT); + JPanel showLocPane = row(LayoutConstants.HORIZONTAL_GAP, + cell(rptShowLocationLabel), + cell(centerRadioButton), + cell(leftRadioButton) + ).getComponent(); + + //填报当前编辑行背景设置 + colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Background_Of_Current_Row")); + colorBox.setSelected(true); + colorButton = new UIColorButton(new LazyIcon("background")); + colorBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + colorButton.setEnabled(colorBox.isSelected()); + } + }); + JPanel backgroundPane = row(cell(colorBox), cell(colorButton)).getComponent(); + //勾选设置 unloadCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unload_Check")); unloadCheck.setSelected(true); - showWidgets = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Show_Widgets")); showWidgets.setSelected(false); isAutoStash = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Write_Auto_Stash")); isAutoStash.setSelected(false); - JPanel unloadCheckPane = GUICoreUtils.createFlowPane(new Component[]{unloadCheck, showWidgets, isAutoStash}, FlowLayout.LEFT); + JPanel unloadCheckPane = row(LayoutConstants.HORIZONTAL_GAP, + cell(unloadCheck), + cell(showWidgets), + cell(isAutoStash) + ).getComponent(); + JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); northPane.add(sheetPane); northPane.add(showLocPane); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java index 2ff9d41800..6fe41a0d01 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java @@ -1,8 +1,11 @@ package com.fr.design.webattr.printsettings; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.PaperSize; import com.fr.base.Utils; import com.fr.base.print.NativePrintAttr; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; @@ -12,8 +15,6 @@ import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.report.UnitFieldPane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; @@ -24,15 +25,12 @@ import com.fr.stable.StringUtils; import javax.print.DocFlavor; import javax.print.PrintService; import javax.print.PrintServiceLookup; -import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.SpinnerNumberModel; import java.awt.BorderLayout; import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.ItemEvent; @@ -42,6 +40,12 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + /** * Created by plough on 2018/3/5. */ @@ -82,37 +86,40 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { } private void initComponents() { - JPanel printPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - JPanel northPane = getHeaderPane(); - printPane.add(northPane, BorderLayout.NORTH); - - centerPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default_Settings")); - centerPane.add(getNativePrintMainSettingPane()); - - printPane.add(centerPane, BorderLayout.CENTER); - + //默认配置 + initCenterPane(); + JPanel printPane = column(LayoutConstants.VERTICAL_GAP, + cell(getHeaderPane()), + cell(wrapComponentWithTitle(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default_Settings"))) + ).getComponent(); this.setLayout(new BorderLayout()); this.add(printPane, BorderLayout.CENTER); } + /** + * 打印设置-本地软件打印-headerPane + * @return + */ private JPanel getHeaderPane() { - UILabel tipDownload = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Native_Print_Need_Client")); - + UILabel tipDownload = new UILabel("Fine-Design_Report_Tip_Native_Print_Need_Client"); + FineUIStyle.setStyle(tipDownload, FineUIStyle.LABEL_TIP); // 打印时需要打印设置窗口 showDialogCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Show_Print_Setting_Window_When_Printing")); - showDialogCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); - UILabel showDialogCheckTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Settings")); - JPanel showDialogCheckPane = GUICoreUtils.createFlowPane(new Component[]{ - showDialogCheck, showDialogCheckTip}, FlowLayout.LEFT); + UILabel showDialogTip = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Settings")); + FineUIStyle.setStyle(showDialogTip, FineUIStyle.LABEL_TIP); + JPanel showDialogCheckPane = row(LayoutConstants.VERTICAL_GAP, + cell(showDialogCheck), + cell(showDialogTip) + ).getComponent(); // 打印需要指定 sheet needSelectSheetCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Need_Select_Sheet_When_Printing")); - needSelectSheetCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); - UILabel needSelectSheetCheckTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Invalid_In_Page_View")); - JPanel needSelectSheetCheckPane = GUICoreUtils.createFlowPane(new Component[]{ - needSelectSheetCheck, needSelectSheetCheckTip}, FlowLayout.LEFT); - + UILabel needSelectSheetTip = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Invalid_In_Page_View")); + FineUIStyle.setStyle(needSelectSheetTip, FineUIStyle.LABEL_TIP); + JPanel needSelectSheetCheckPane = row(LayoutConstants.VERTICAL_GAP, + cell(needSelectSheetCheck), + cell(needSelectSheetTip) + ).getComponent(); return createHeaderPane(tipDownload, showDialogCheckPane, needSelectSheetCheckPane); } @@ -166,62 +173,58 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { }; } - private JPanel getNativePrintMainSettingPane() { + /** + * 打印设置-本地软件打印-默认配置Pane + */ + private void initCenterPane() { // 打印机 - String[] printerArray = getAllPrinterNames(); - printerComboBox = new UIComboBox(printerArray); - printerComboBox.setPreferredSize(new Dimension(200, printerComboBox.getPreferredSize().height)); - JPanel printerPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - printerPane.add(printerComboBox); - + printerComboBox = new UIComboBox(getAllPrinterNames()); // 份数 copySpinner = new UIBasicSpinner(new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1)); - GUICoreUtils.setColumnForSpinner(copySpinner, 5); - JPanel copyPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - copyPane.add(copySpinner); - + // 页码标签 + JPanel printAreaLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + printAreaLabelPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Page_Number")), BorderLayout.NORTH); + printAreaLabelPane.setBorder(new ScaledEmptyBorder(2,0,0,0)); // 继承页面纸张设置 - inheritPagePaperSettingCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Inherit_Page_Paper_Setting")); + inheritPagePaperSettingCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Inherit_Page_Paper_Setting")); JPanel paperSettingPane = getPaperSettingPane(); JPanel paperSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(inheritPagePaperSettingCheck, paperSettingPane, true); - // 继承页面布局设置 inheritPageLayoutSettingCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Inherit_Page_Layout_Setting")); JPanel layoutSettingPane = getLayoutSettingPane(); JPanel layoutSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(inheritPageLayoutSettingCheck, layoutSettingPane, true); - - // 页码标签 - UILabel printAreaLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Page_Number") + ":"); - JPanel printAreaLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - printAreaLabelPane.add(printAreaLabel, BorderLayout.NORTH); - printAreaLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); - // 边距 inheritPageMarginSettingCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Inherit_Page_Margin_Setting")); pageMarginSettingPane = new PageMarginSettingPane(); - pageMarginSettingPane.setBorder(BorderFactory.createEmptyBorder(10, -10, 0, 0)); JPanel pageMarginCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(inheritPageMarginSettingCheck, pageMarginSettingPane, true); - // 缩放 fitPaperSizeCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_To_Fit_Paper_Size")); JPanel scalePane = getScalePane(); - scalePane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); JPanel scaleCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(fitPaperSizeCheck, scalePane, true); - - // TableLayout - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p, p, p}; - double[] columnSize = {60, p}; - Component[][] components = { - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Printer") + ":"), printerPane}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Copy_Number") + ":"), copyPane}, - {printAreaLabelPane, getPrintAreaPane()}, - {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Paper") + ":"), paperSettingCheckPane}, - {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout") + ":"), layoutSettingCheckPane}, - {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Margin") + ":"), pageMarginCheckPane}, - {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_EnlargeOrReduce") + ":"), scaleCheckPane}, - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15); + // 整体布局 + centerPane = column(LayoutConstants.VERTICAL_GAP, + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Printer"))).weight(0.1), + cell(printerComboBox).weight(0.35), + flex(0.55)), + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Copy_Number"))).weight(0.1), + cell(copySpinner).weight(0.15), + flex(0.75)), + row(cell(printAreaLabelPane).weight(0.1), + cell(getPrintAreaPane()).weight(0.7), + flex(0.2)), + row(cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Paper"))).weight(0.1), + cell(paperSettingCheckPane).weight(0.5), + flex(0.4)), + row(cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"))).weight(0.1), + cell(layoutSettingCheckPane).weight(0.2), + flex(0.7)), + row(cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Margin"))).weight(0.1), + cell(pageMarginCheckPane).weight(0.5), + flex(0.4)), + row(cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_EnlargeOrReduce"))).weight(0.1), + cell(scaleCheckPane).weight(0.3), + flex(0.6)) + ).getComponent(); } private String[] getAllPrinterNames() { @@ -273,34 +276,24 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { } }); - // 下拉框 - JPanel comboPanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - comboPanel.add(predefinedPaperSizeComboBox); - comboPanel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0)); - customPaperSizePane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_M_Pane(); // 宽度设置 - JPanel customWidthPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - customWidthPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Designer_Width") + ":")); customWidthFieldPane = new UnitFieldPane(Constants.UNIT_MM); customWidthFieldPane.setUnitValue(DEFAULT_PAPERSIZE.getWidth()); - customWidthPane.add(customWidthFieldPane); // 高度设置 - JPanel customHeightPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - customHeightPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Height") + ":")); customHeightFieldPane = new UnitFieldPane(Constants.UNIT_MM); customHeightFieldPane.setUnitValue(DEFAULT_PAPERSIZE.getHeight()); - customHeightPane.add(customHeightFieldPane); - - customPaperSizePane.add(customWidthPane); - customPaperSizePane.add(customHeightPane); - customPaperSizePane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); - - JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.add(comboPanel, BorderLayout.NORTH); - panel.add(customPaperSizePane, BorderLayout.CENTER); - - return panel; + customPaperSizePane = row(LayoutConstants.HORIZONTAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Designer_Width") + ":")), + cell(customWidthFieldPane) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Height") + ":")), + cell(customHeightFieldPane) + ) + ).getComponent(); + return column(10, cell(predefinedPaperSizeComboBox), cell(customPaperSizePane)).getComponent(); } private void updateCustomPaperSizeArea() { @@ -309,23 +302,19 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { } private JPanel getLayoutSettingPane() { - JPanel layoutSettingPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - layoutSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); portraitRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Portrait")); - portraitRadioButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); landscapeRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Landscape")); - layoutSettingPane.add(portraitRadioButton); - layoutSettingPane.add(landscapeRadioButton); - ButtonGroup layoutButtonGroup = new ButtonGroup(); layoutButtonGroup.add(portraitRadioButton); layoutButtonGroup.add(landscapeRadioButton); - portraitRadioButton.setSelected(true); - return layoutSettingPane; + return row(10, cell(portraitRadioButton), cell(landscapeRadioButton)).getComponent(); } - // 页码范围 + /** + * 页码范围 + * @return + */ private JPanel getPrintAreaPane() { allPageRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_All_Pages")); currentPageRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Current_Page")); @@ -363,17 +352,12 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { doublePrintComboBox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_HF_Odd_Page")); doublePrintComboBox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_HF_Even_Page")); - // TableLayout - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p}; - double[] columnSize = {p, p, p}; - Component[][] components = { - {allPageRadioButton, null, null}, - {currentPageRadioButton, null, null}, - {customPageRadioButton, specifiedAreaField, areaFieldTip}, - {doublePrintRadioButton, doublePrintComboBox, new JPanel()} - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 8); + return column(LayoutConstants.VERTICAL_GAP, + cell(allPageRadioButton), + cell(currentPageRadioButton), + row(cell(customPageRadioButton).weight(0.1), cell(specifiedAreaField).weight(0.3), cell(areaFieldTip).weight(0.1)), + row(cell(doublePrintRadioButton).weight(0.1),cell(doublePrintComboBox).weight(0.3), flex(0.1)) + ).getComponent(); } private JPanel getScalePane() { @@ -381,25 +365,12 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { scalePercentField.setMaxIntegerLength(3); scalePercentField.setMaxDecimalLength(0); scalePercentField.setMaxValue(200); - - UILabel percent = new UILabel("%"); - - // TableLayout - double p = TableLayout.PREFERRED; - double[] rowSize = {p}; - double[] columnSize = {p, p}; - Component[][] components = { - {scalePercentField, percent} - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); + return row(cell(scalePercentField), cell(new UILabel("%"))).getComponent(); } // 返回包含一个标签的 panel,标签始终位于 panel 顶部 JPanel getTopAlignLabelPane(String labelText) { - JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - labelPane.add(new UILabel(labelText), BorderLayout.NORTH); - labelPane.add(new JPanel(), BorderLayout.CENTER); - return labelPane; + return column(LayoutConstants.VERTICAL_GAP, cell(new UILabel(labelText))).getComponent(); } public void populate(NativePrintAttr nativePrintAttr) { diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java index 7b3643899a..becbe926d3 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java @@ -1,46 +1,41 @@ package com.fr.design.webattr.printsettings; import com.fr.base.print.NativePrintAttr; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UIIntNumberField; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.Component; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 本地打印设置面板——全局 * Created by plough on 2018/10/31. */ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane { - private static final int PRINT_PORT_FIELD_COLUMNS = 8; - // 服务器配置面板特有的组件 private UICheckBox defaultDownloadUrlCheck; // 采用默认的软件下载地址 private UITextField customUrlFieldWin; private UITextField customUrlFieldMac; private UINumberField printPortField; // 打印软件端口号 - @Override JPanel createHeaderPane(Component... comps) { Component[] allComps = new Component[comps.length + 1]; System.arraycopy(comps, 0, allComps, 0, comps.length); allComps[comps.length] = getExtraSettingPane(); - - JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(allComps); - headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0)); - return headerPane; + return GUICoreUtils.createHeaderLayoutPane(allComps); } - @Override protected void extraUpdate(NativePrintAttr nativePrintAttr) { if (defaultDownloadUrlCheck.isSelected()) { @@ -61,56 +56,35 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane printPortField.setValue(nativePrintAttr.getPrintPort()); } - // 服务器配置中,特有的设置面板 + /** + * 服务器配置中,特有的设置面板 + * @return + */ private JPanel getExtraSettingPane() { // 软件下载地址 defaultDownloadUrlCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); JPanel downloadUrlSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(defaultDownloadUrlCheck, getCustomUrlSettingPane(), true); - downloadUrlSettingCheckPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - JPanel downloadTipPane = getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url") + ": "); - downloadTipPane.setBorder(BorderFactory.createEmptyBorder(0, 0, -6, 0)); - + JPanel downloadUrlTitle = getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url")); // 打印软件端口号 - UILabel printPortTip = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Native_Print_Port") + ": "); - JPanel printPortFiledPane = getPrintPortFieldPane(); - - // TableLayout - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] columnSize = {p, p}; - Component[][] components = { - { - downloadTipPane, downloadUrlSettingCheckPane - }, { - printPortTip, printPortFiledPane - } - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); - } - - private JPanel getPrintPortFieldPane() { + UILabel printPortTip = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Native_Print_Port")); printPortField = new UIIntNumberField(); printPortField.setMaxValue(NativePrintAttr.MAX_PRINT_PORT_VALUE); - printPortField.setColumns(PRINT_PORT_FIELD_COLUMNS); - JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - panel.add(printPortField); - return panel; + return column(LayoutConstants.VERTICAL_GAP, + row(cell(downloadUrlTitle).weight(0.25), cell(downloadUrlSettingCheckPane).weight(0.75)), + row(cell(printPortTip).weight(0.25), cell(printPortField).weight(0.25), flex(0.5)) + ).getComponent(); } + /** + * 自定义软件下载地址Pane + * @return + */ private JPanel getCustomUrlSettingPane() { customUrlFieldWin = new UITextField(20); customUrlFieldMac = new UITextField(20); - - // TableLayout - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] columnSize = {60, p}; - Component[][] components = { - {new UILabel("windows: "), customUrlFieldWin}, - {new UILabel("macOS: "), customUrlFieldMac} - }; - JPanel urlSettingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10); - urlSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); - return urlSettingPane; + return column(LayoutConstants.VERTICAL_GAP, + row(cell(new UILabel("windows")).weight(0.2), cell(customUrlFieldWin).weight(0.6), flex(0.2)).weight(1), + row(cell(new UILabel("macOS")).weight(0.2), cell(customUrlFieldMac).weight(0.6), flex(0.2)).weight(1) + ).getComponent(); } } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java index a5ed35a697..465d594394 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java @@ -1,21 +1,24 @@ package com.fr.design.webattr.printsettings; +import com.fine.theme.utils.FineUIStyle; import com.fr.base.print.NoClientPrintAttr; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.FlowLayout; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + + /** * 零客户端打印设置面板 * Created by plough on 2018/3/5. @@ -34,60 +37,48 @@ public class NoClientPrintSettingPane extends JPanel { } private void initComponents() { - JPanel printPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - printPane.add(createHeaderPane(), BorderLayout.NORTH); - initCenterPane(); - printPane.add(centerPane, BorderLayout.CENTER); - + JPanel printPane = column(LayoutConstants.VERTICAL_GAP, + cell(createHeaderPane()), + cell(wrapComponentWithTitle(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default_Settings"))) + ).getComponent(); this.setLayout(new BorderLayout()); this.add(printPane, BorderLayout.CENTER); } + /** + * 打印设置-零客户端打印-默认配置 + */ private void initCenterPane() { - centerPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default_Settings")); - inheritPageMarginSettingCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Inherit_Page_Margin_Setting")); pageMarginSettingPane = new PageMarginSettingPane(); - pageMarginSettingPane.setBorder(BorderFactory.createEmptyBorder(10, -10, 0, 0)); JPanel pageMarginCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(inheritPageMarginSettingCheck, pageMarginSettingPane, true); - - // TableLayout - double p = TableLayout.PREFERRED; - double[] rowSize = {p}; - double[] columnSize = {60, p}; - Component[][] components = { - {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Margin") + ":"), pageMarginCheckPane} - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15); - - centerPane.add(panel); + centerPane = row(LayoutConstants.HORIZONTAL_GAP, + cell(getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Margin"))), + cell(pageMarginCheckPane)).getComponent(); } + /** + * 打印设置-零客户端打印-headerPane + * @return + */ private JPanel createHeaderPane() { + //打印时可设置打印边距 setMarginWhenPrintCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Set_Margin_When_Printing")); - setMarginWhenPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); - UILabel marginTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Print_Margin")); - JPanel setMarginWhenPrintPane = GUICoreUtils.createFlowPane(new Component[] { - setMarginWhenPrintCheck, marginTip}, FlowLayout.LEFT); - + UILabel setMarginWhenPrintTip = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Print_Margin")); + FineUIStyle.setStyle(setMarginWhenPrintTip, FineUIStyle.LABEL_TIP); ieQuietPrintCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_No_Print_Settings_In_IE")); - ieQuietPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - + //针式打印优化 needlePrinterOptimizeCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Needle_Printer_Optimize")); - needlePrinterOptimizeCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); - UILabel needleTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Needle_Printer_Optimize_Tip")); - JPanel needlePrinterOptimizePane = GUICoreUtils.createFlowPane(new Component[] { - needlePrinterOptimizeCheck, needleTip}, FlowLayout.LEFT); - - JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(setMarginWhenPrintPane, ieQuietPrintCheck, needlePrinterOptimizePane); - headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 12, 0)); - return headerPane; + UILabel needlePrinterOptimizeTip = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Needle_Printer_Optimize_Tip")); + FineUIStyle.setStyle(needlePrinterOptimizeTip, FineUIStyle.LABEL_TIP); + return column(LayoutConstants.VERTICAL_GAP, + row(LayoutConstants.HORIZONTAL_GAP, cell(setMarginWhenPrintCheck), cell(setMarginWhenPrintTip)), + cell(ieQuietPrintCheck), + row(LayoutConstants.HORIZONTAL_GAP, cell(needlePrinterOptimizeCheck), cell(needlePrinterOptimizeTip)) + ).getComponent(); } - - private void initListeners() { setMarginWhenPrintCheck.addItemListener(new ItemListener() { @Override diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PageMarginSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PageMarginSettingPane.java index 1742a2b02a..feef4c9b03 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PageMarginSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PageMarginSettingPane.java @@ -1,8 +1,8 @@ package com.fr.design.webattr.printsettings; import com.fr.base.Margin; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.report.UnitFieldPane; import com.fr.stable.Constants; @@ -10,6 +10,10 @@ import com.fr.stable.Constants; import javax.swing.JPanel; import java.awt.BorderLayout; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; + /** * Created by plough on 2018/3/5. */ @@ -23,40 +27,25 @@ public class PageMarginSettingPane extends JPanel { initComponents(); } private void initComponents() { - // 页边距设置面板 - JPanel marginPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_M_Pane(); // left - JPanel marginLeftPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); - marginPane.add(marginLeftPane); - - JPanel marginLeftTextPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - marginLeftPane.add(marginLeftTextPane); - marginLeftTextPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Top_Duplicate") + ":")); marginTopUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); - marginLeftTextPane.add(marginTopUnitFieldPane); - JPanel marginLeftUnitPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - marginLeftPane.add(marginLeftUnitPane); - marginLeftUnitPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bottom") + ":")); marginBottomUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); - marginLeftUnitPane.add(marginBottomUnitFieldPane); - - // right - JPanel marginRightPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); - marginPane.add(marginRightPane); + JPanel marginLeftPane = column(LayoutConstants.VERTICAL_GAP, + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Top_Duplicate") + ":")), cell(marginTopUnitFieldPane)), + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bottom") + ":")), cell(marginBottomUnitFieldPane)) + ).getComponent(); // peter:这个一个垂直的上下的字符panel. - JPanel marginRightTextPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - marginRightPane.add(marginRightTextPane); - marginRightTextPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Left") + ":")); marginLeftUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); - marginRightTextPane.add(marginLeftUnitFieldPane); - - JPanel marginRightUnitPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - marginRightPane.add(marginRightUnitPane); - marginRightUnitPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Right") + ":")); marginRightUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); - marginRightUnitPane.add(marginRightUnitFieldPane); + JPanel marginRightPane = column(LayoutConstants.VERTICAL_GAP, + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Left") + ":")), cell(marginLeftUnitFieldPane)), + row( cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Right") + ":")), cell(marginRightUnitFieldPane)) + ).getComponent(); + JPanel marginPane = row(LayoutConstants.HORIZONTAL_GAP, + cell(marginLeftPane), + cell(marginRightPane)).getComponent(); this.setLayout(new BorderLayout()); this.add(marginPane, BorderLayout.CENTER); } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java index 883a0801fd..f5cf1effb5 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java @@ -1,22 +1,24 @@ package com.fr.design.webattr.printsettings; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.print.PrintSettingsAttrMark; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; -import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.CardLayout; -import java.awt.Component; -import java.awt.FlowLayout; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; + /** * Created by plough on 2018/3/1. */ @@ -39,19 +41,11 @@ public class PrintSettingPane extends BasicPane { } private void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel allPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); - this.add(allPanel, BorderLayout.CENTER); - JPanel north = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); - allPanel.add(north, BorderLayout.NORTH); ButtonGroup buttonGroup = new ButtonGroup(); noClientPrintRadioButton.setSelected(true); buttonGroup.add(noClientPrintRadioButton); buttonGroup.add(nativePrintRadioButton); - noClientPrintRadioButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 50)); - JPanel radioGroupPane = GUICoreUtils.createFlowPane(new Component[] { - noClientPrintRadioButton, nativePrintRadioButton}, FlowLayout.LEFT, 0, 0); - north.add(radioGroupPane); + JPanel north = row(LayoutConstants.HORIZONTAL_GAP, cell(noClientPrintRadioButton), cell(nativePrintRadioButton)).getComponent(); noClientPrintSettingPane = new NoClientPrintSettingPane(); printCard = new CardLayout(); @@ -60,11 +54,12 @@ public class PrintSettingPane extends BasicPane { printPane.add(noClientPrintRadioButton.getText(), noClientPrintSettingPane); UIScrollPane scrollPane = new UIScrollPane(nativePrintSettingPane); - scrollPane.setBorder(null); printPane.add(nativePrintRadioButton.getText(), scrollPane); - north.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - allPanel.add(printPane, BorderLayout.CENTER); + JPanel allPanel = column(LayoutConstants.VERTICAL_GAP, cell(north), cell(printPane)).getComponent(); + allPanel.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.add(allPanel, BorderLayout.CENTER); } private void initListener() { diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java index 87853a7a38..c33b13c094 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java @@ -2,7 +2,6 @@ package com.fr.design.webattr.printsettings; import com.fr.design.utils.gui.GUICoreUtils; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.Component; @@ -13,8 +12,6 @@ import java.awt.Component; public class ReportNativePrintSettingPane extends AbstractNativePrintSettingPane { @Override JPanel createHeaderPane(Component... comps) { - JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(comps); - headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 12, 0)); - return headerPane; + return GUICoreUtils.createHeaderLayoutPane(comps); } }