diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java b/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java new file mode 100644 index 0000000000..11d7137ec4 --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java @@ -0,0 +1,155 @@ +package com.fine.theme.utils; + +import com.fine.swing.ui.layout.Column; +import com.fine.swing.ui.layout.Layouts; +import com.fine.swing.ui.layout.Row; +import com.fine.swing.ui.layout.Spacer; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.collections.combination.Pair; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static com.fine.swing.ui.layout.Layouts.cell; + +/** + * 设计器典型布局构建器 + * + * @author Levy.Xie + * @since 11.0 + * Created on 2024/05/08 + */ +public class FineLayoutBuilder { + + /** + * 创建标准行列表格布局,行内元素均匀分布 + * + * @param elePerRow 每行元素数 + * @param rowSpacing 行内间距 + * @param colSpacing 列内间距 + * @param componentList 组件 + * @return 表格面板 + */ + public static Column createCommonTableLayout(int elePerRow, int rowSpacing, int colSpacing, List componentList) { + int rowNum = componentList.size() / elePerRow + 1; + Iterator iterator = componentList.iterator(); + + Column column = new Column(); + column.setSpacing(colSpacing); + + Row currentRow; + for (int i = 0; i < rowNum; i++) { + currentRow = new Row(); + currentRow.setSpacing(rowSpacing); + for (int j = 0; j < elePerRow; j++) { + Layouts.populate(currentRow, cell( + iterator.hasNext() ? iterator.next() : new Spacer(1) + ).weight(1)); + } + column.add(currentRow); + } + return column; + } + + /** + * 兼容TableLayout配置项,生成网格布局面板 + * + * @param colSpacing 间距 + * @param components 组件二维数组,内部每个一维数组均为行内组件,一维数组元素需与weight严格对应 + * @param weight 行内权重列表,形如[0.4,0.6] 即首个元素占比0.4,第二个元素占比0.6 + * @return 面板 + */ + public static JPanel compatibleTableLayout(int colSpacing, Component[][] components, double[] weight) { + Column column = new Column(); + column.setSpacing(colSpacing); + try { + for (Component[] componentArray : components) { + Row row = new Row(); + List visibleComponents = Arrays.stream(componentArray) + .filter(com -> com != null && com.isVisible()).collect(Collectors.toList()); + if (visibleComponents.size() >= 1) { + // 仅当存在可见组件时处理布局 + dealWithVisibleComponents(weight, column, componentArray, row, visibleComponents); + } + } + return asBorderLayoutWrapped(column); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, "[Designer] create layout failed."); + } + return new JPanel(); + } + + private static void dealWithVisibleComponents(double[] weight, Column column, Component[] value, Row row, List components) { + if (components.size() == 1 && value[0] != null) { + // 仅存在首个元素,则该元素自适应占满整行 + Layouts.populate(row, cell(components.get(0)).weight(1)); + } else { + // 其他场景,按权重分配布局,以适配原TableLayout形式 + for (int j = 0; j < value.length; j++) { + Component component = value[j]; + if (component == null) { + component = new Spacer(1); + } + Layouts.populate(row, cell(component).weight(weight[j])); + } + } + column.add(row); + } + + /** + * 创建竖向排列的扩展面板列表 + * + * @param spacing 间距 + * @param elements 面板元素,含标题、面板 + * @return 竖向排列面板 + */ + @SafeVarargs + public static Column createVerticalExpandPaneLayout(int spacing, Pair... elements) { + UIExpandablePane[] panes = IntStream.range(0, elements.length) + .mapToObj(i -> { + Pair pair = elements[i]; + if (i != elements.length - 1) { + return new UIExpandablePane(pair.getFirst(), pair.getSecond(), true); + } + return new UIExpandablePane(pair.getFirst(), pair.getSecond()); + }) + .toArray(UIExpandablePane[]::new); + return createVerticalLayout(spacing, panes); + } + + /** + * 创建垂直布局面板 + * + * @param spacing 间距 + * @param elements 面板元素 + * @return 面板 + */ + public static Column createVerticalLayout(int spacing, JPanel... elements) { + Column column = new Column(); + column.setSpacing(spacing); + for (JPanel element : elements) { + column.add(element); + } + return column; + } + + /** + * 组件包装于BorderLayout中 + * + * @param component 组件 + * @return 包装后的面板 + */ + public static JPanel asBorderLayoutWrapped(Component component) { + JPanel panel = new JPanel(new BorderLayout()); + panel.add(component); + return panel; + } + +} 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 8fd013916b..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,8 +29,10 @@ 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"; String MENU_TOOL_BAR = "menuToolBar"; String MENU_ITEM_TOOL_BAR = "menuItemToolBar"; diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 093d3079f4..bfbc5c2347 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -1,5 +1,6 @@ package com.fr.design.actions.file; +import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIUtils; @@ -15,7 +16,6 @@ import com.fr.design.dialog.DialogActionListener; import com.fr.design.editor.editor.IntegerEditor; import com.fr.design.file.SaveSomeTemplatePane; import com.fr.design.gui.frpane.FineTabbedPane; -import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UINoThemeColorButton; @@ -54,7 +54,6 @@ import com.fr.io.attr.ImageExportAttr; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.report.ReportConfigManager; -import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; import com.fr.stable.os.OperatingSystem; import com.fr.third.apache.logging.log4j.Level; @@ -299,7 +298,7 @@ public class PreferencePane extends BasicPane { // 启动页配置 cell(createStartupPagePane()) ).weight(1).getComponent(); - UIScrollPane generalScrollPane = patchScroll(generalPane); + JPanel generalScrollPane = patchScroll(FineLayoutBuilder.asBorderLayoutWrapped(generalPane)); // 高级面板 JPanel advancePane = column(SETTING_V_GAP, @@ -327,7 +326,7 @@ public class PreferencePane extends BasicPane { cell(createDesignerStartupPane()) ).weight(1).getComponent(); useUniverseDBMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_Universe_Database_Manager")); - UIScrollPane adviceScrollPane = patchScroll(advancePane); + JPanel adviceScrollPane = patchScroll(advancePane); // 版本管理面板 //初始化vcs总面板 @@ -339,7 +338,7 @@ public class PreferencePane extends BasicPane { // vcsPane createVcsSettingPane(vcsPane, vcsParentPane, cardLayout); //添加滚动条 - UIScrollPane vcsScrollPane = patchScroll(vcsPane); + JPanel vcsScrollPane = patchScroll(vcsPane); //配置面板作为vcs总面板的一张卡片 vcsParentPane.add(vcsScrollPane, VcsMovePanel.SETTING); @@ -428,10 +427,10 @@ public class PreferencePane extends BasicPane { } @NotNull - private UIScrollPane patchScroll(JPanel generalPane) { + private JPanel patchScroll(JPanel generalPane) { UIScrollPane uiScrollPane = new UIScrollPane(generalPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); uiScrollPane.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); - return uiScrollPane; + return FineLayoutBuilder.asBorderLayoutWrapped(uiScrollPane); } private void createVcsSettingPane(JPanel generalPane, JPanel parentPane, CardLayout cardLayout) { diff --git a/designer-base/src/main/java/com/fr/design/actions/help/AboutDialog.java b/designer-base/src/main/java/com/fr/design/actions/help/AboutDialog.java index 121d9ece9c..4d55af0306 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/AboutDialog.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/AboutDialog.java @@ -2,7 +2,7 @@ package com.fr.design.actions.help; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIStyle; -import com.fr.design.gui.frpane.UITabbedPane; +import com.fr.design.gui.frpane.FineTabbedPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; @@ -46,11 +46,12 @@ public class AboutDialog extends JDialog implements ActionListener { FineUIStyle.setStyle(okButton, FineUIStyle.STYLE_PRIMARY); okButton.addActionListener(this); - tabbedPane = new UITabbedPane(); sysPane = new SystemInfoPane(); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About"), aboutPanel); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("FIne-Design_Basic_System"), sysPane); + tabbedPane = FineTabbedPane.builder() + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About"), aboutPanel) + .addTab(com.fr.design.i18n.Toolkit.i18nText("FIne-Design_Basic_System"), sysPane) + .build(); buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); buttonPanel.add(okButton); @@ -79,7 +80,7 @@ public class AboutDialog extends JDialog implements ActionListener { this.getRootPane().setDefaultButton(okButton); - this.setSize(FineUIScale.scale(new Dimension(defaultPane.getPreferredSize().width, 600))); + this.setSize(FineUIScale.scale(new Dimension(defaultPane.getPreferredSize().width, 620))); GUICoreUtils.centerWindow(this); } @@ -96,6 +97,6 @@ public class AboutDialog extends JDialog implements ActionListener { private SystemInfoPane sysPane; private JPanel buttonPanel; - private UITabbedPane tabbedPane; + private FineTabbedPane tabbedPane; private UIButton okButton; } diff --git a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java index a6dc6aa107..22e71aef4e 100644 --- a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java @@ -435,7 +435,7 @@ public abstract class LiteConditionPane extends BasicBeanPa JPanel buttonPane = initButtonPane(); JScrollPane treeScrollPane = iniTreeScrollPane(); // 滚动面板不能直接加入row-col布局,需设定宽高 - treeScrollPane.setPreferredSize(FineUIScale.scale(new Dimension(600, 250))); + treeScrollPane.setPreferredSize(FineUIScale.scale(new Dimension(600, 240))); JPanel previewPane = column( cell(northButtonPane), row( @@ -571,8 +571,8 @@ public abstract class LiteConditionPane extends BasicBeanPa row(5, cell(andRadioButton).weight(0.5), cell(orRadioButton).weight(0.5) - ).weight(0.25), - flex(0.5), + ).weight(0.35), + flex(0.4), row(5, cell(addButton).weight(0.5), cell(modifyButton).weight(0.5) 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); - - // 最上面的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); + 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,参数面板 + //参数面板 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,31 @@ 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; + /** + * TXT设定Pane + * @return + */ + private JPanel getTextSetPanel() { + initRatioButton(); + //编码类型 + encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type")); + charsetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY); + return column(cell(getTxtCenterPane()), cell(getPreviewPanel())).getComponent(); } - 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}; - 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") + ":"); + /** + * 初始化Button + */ + private void initRatioButton(){ 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 @@ -385,6 +362,7 @@ public class FileTableDataPane extends AbstractTableDataPane { } } }); + needColumnNameCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FirstRow_IS_Column_Name"), true); ButtonGroup bg2 = new ButtonGroup(); bg2.add(tableDismemberRadioButton); bg2.add(spaceDismenberRadioButton); @@ -392,18 +370,38 @@ 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") + ":"); - 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); + } + + + /** + * 获取TXT中心Pane + * @return + */ + private JPanel getTxtCenterPane(){ + //分隔符选项 + 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设定主要面板 + return 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(); + } + + 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 +478,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 +505,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 +816,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 +839,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/foldablepane/UIExpandablePane.java b/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java index 2432915650..140aa74c83 100644 --- a/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java +++ b/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java @@ -1,12 +1,19 @@ package com.fr.design.foldablepane; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.border.FineBorderFactory; + import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Color; 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; +import static com.fine.swing.ui.layout.Layouts.fix; + /** * Created by MoMeak on 2017/7/5. @@ -31,18 +38,22 @@ public class UIExpandablePane extends JPanel { this.headWidth = headWidth; this.headHeight = headHeight; this.contentPanel = contentPanel; - initComponents(); + initComponents(false); } public UIExpandablePane(String title, JPanel contentPanel) { + this(title, contentPanel, false); + } + + public UIExpandablePane(String title, JPanel contentPanel, boolean withUnderline) { super(); this.title = title; this.headHeight = headHeight; this.contentPanel = contentPanel; - initComponents(); + initComponents(withUnderline); } - private void initComponents() { + private void initComponents(boolean withUnderline) { this.setLayout(new BorderLayout()); headerPanel = new HeaderPane(title); @@ -50,6 +61,15 @@ public class UIExpandablePane extends JPanel { setcontentPanelontentPanelBorder(); this.add(headerPanel, BorderLayout.NORTH); this.add(contentPanel, BorderLayout.CENTER); + if (withUnderline) { + this.add(column( + cell(headerPanel), cell(contentPanel).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, 10, 0))), + fix(1).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder()))) + .getComponent()); + } else { + this.add(column(cell(headerPanel), cell(contentPanel)).getComponent()); + } + setOpaque(false); } 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..63d1d8e69f 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,33 @@ 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.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.JOptionPane; +import javax.swing.DefaultListCellRenderer; import javax.swing.SwingUtilities; +import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -29,13 +35,17 @@ import java.awt.event.MouseEvent; 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.flex; +import static com.fine.swing.ui.layout.Layouts.row; + 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 +53,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 +71,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 +143,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 +156,7 @@ public abstract class EditingStringListPane extends BasicBeanPane> } } }); - editButton.addActionListener(new ActionListener() { + modifyButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -152,9 +175,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 +197,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/frpane/FineTabbedPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java index 64d2d67ad6..9b44e75a91 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java @@ -5,6 +5,7 @@ import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.gui.ibutton.UIButtonGroup; +import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; @@ -32,9 +33,9 @@ public class FineTabbedPane extends Column { private JPanel centerPane; private final float headRatio; private final UIButtonGroup tabGroup; - private final Map tabComponents; + private final Map tabComponents; - private FineTabbedPane(Map tabComponents, float headRatio, int[] tabLayout) { + private FineTabbedPane(Map tabComponents, float headRatio, int[] tabLayout) { this.headRatio = headRatio; this.tabComponents = tabComponents; @@ -60,7 +61,7 @@ public class FineTabbedPane extends Column { public static class TabPaneBuilder { private int[] tabLayout; private float headRatio = 0.5f; - private final Map tabComponents = new LinkedHashMap<>(); + private final Map tabComponents = new LinkedHashMap<>(); /** * 设置头部居中比例,0-1之间 @@ -117,14 +118,17 @@ public class FineTabbedPane extends Column { private void initLayout() { cards = new CardLayout(); centerPane = new JPanel(cards); - tabComponents.forEach((key, value) -> centerPane.add(value, key)); + tabComponents.forEach((key, value) -> { + value.setOpaque(false); + centerPane.add(value, key); + }); float flexRatio = (1 - headRatio) / 2; add( row( flex(flexRatio), cell(tabGroup).weight(headRatio), flex(flexRatio) ), fix(5), - cell(centerPane).with(it -> FineUIStyle.setStyle(it, FineUIStyle.LIGHT_GREY)) + cell(centerPane).weight(1).with(it -> FineUIStyle.setStyle(it, FineUIStyle.LIGHT_GREY)) ); setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java index 79dece5057..ac94b82499 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java @@ -1,8 +1,7 @@ package com.fr.design.gui.frpane; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.constants.UIConstants; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; @@ -225,9 +224,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver { } protected void initAddButton() { - addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); - addButton.setBorderType(UIButton.OTHER_BORDER); - addButton.setOtherBorder(UIConstants.BS, UIConstants.LINE_COLOR); + addButton = new UIButton(new LazyIcon("add")); } private void initAddButtonListener() { diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationPane.java index 3a23a478c3..dde2337196 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationPane.java @@ -19,7 +19,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.table.TableCellEditor; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; import com.fr.design.constants.UIConstants; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -212,7 +212,7 @@ public class UICorrelationPane extends JPanel implements UIObserver { } protected void initAddButton() { - addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")) { + addButton = new UIButton(new LazyIcon("add")) { public boolean shouldResponseChangeListener() { return false; } diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxRenderer.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxRenderer.java index 0903070dc0..07cb941293 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxRenderer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxRenderer.java @@ -36,7 +36,6 @@ public class UIComboBoxRenderer extends DefaultListCellRenderer { renderer.setForeground(list.getForeground()); renderer.setBackground(list.getBackground()); } - renderer.setText(" " + renderer.getText()); return renderer; } } \ No newline at end of file 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/gui/style/FormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java index 2485b4de4e..d26cf47e61 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java @@ -1,7 +1,10 @@ package com.fr.design.gui.style; +import com.fine.theme.utils.FineLayoutBuilder; +import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIStyle; +import com.fine.theme.utils.FineUIUtils; import com.fr.base.CoreDecimalFormat; -import com.fr.base.GraphHelper; import com.fr.base.Style; import com.fr.base.TextFormat; import com.fr.data.core.FormatField; @@ -10,7 +13,6 @@ import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit; import com.fr.design.border.UIRoundedBorder; -import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; @@ -18,26 +20,19 @@ import com.fr.design.gui.icombobox.TextFontComboBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; import java.awt.BorderLayout; -import java.awt.CardLayout; import java.awt.Color; import java.awt.Component; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics; import java.math.RoundingMode; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.SwingConstants; -import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.border.TitledBorder; import java.awt.event.ItemEvent; @@ -53,13 +48,7 @@ import java.text.SimpleDateFormat; */ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObserver { private static final long serialVersionUID = 724330854437726751L; - - private static final int LABEL_X = 4; - private static final int LABEL_Y = 18; - private static final int LABEL_DELTA_WIDTH = 8; - private static final int LABEL_HEIGHT = 15; //标签背景的范围 private static final int CURRENCY_FLAG_POINT = 6; - private static final Border LEFT_BORDER = BorderFactory.createEmptyBorder(0, 30, 0, 0); private static final Integer[] TYPES = new Integer[]{ FormatContents.NULL, FormatContents.NUMBER, @@ -85,6 +74,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse private boolean isRightFormat; private boolean isDate = false; private GlobalNameListener globalNameListener = null; + private JPanel self = this; /** * Constructor. @@ -98,14 +88,10 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse } protected void initComponents(Integer[] types) { - this.setLayout(new BorderLayout(0, 4)); + this.setLayout(new BorderLayout()); initSampleLabel(); - contentPane = new JPanel(new BorderLayout(0, 4)) { - @Override - public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, 65); - } - }; + contentPane = new JPanel(); + contentPane.setLayout(new BorderLayout(0, FineUIScale.scale(10))); typeComboBox = new UIComboBox(types); UIComboBoxRenderer render = createComBoxRender(); typeComboBox.setRenderer(render); @@ -113,7 +99,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse typeComboBox.setGlobalName("typeComboBox"); contentPane.add(sampleLabel, BorderLayout.NORTH); - txtCenterPane = new JPanel(new BorderLayout()); + txtCenterPane = new JPanel(new BorderLayout(0, FineUIScale.scale(10))); textField = new TextFontComboBox(); textField.addItemListener(textFieldItemListener); textField.setEditable(true); @@ -122,58 +108,38 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse contentPane.add(txtCenterPane, BorderLayout.CENTER); - centerPane = new JPanel(new CardLayout()); - centerPane.add(new JPanel(), "hide"); - centerPane.setPreferredSize(new Dimension(0, 0)); - centerPane.add(contentPane, "show"); - + centerPane = new JPanel(new BorderLayout()); + centerPane.add(contentPane); frFontPane = new FRFontPane(); UILabel font = new UILabel(Toolkit.i18nText("Fine-Design_Form_FR_Font"), SwingConstants.LEFT); JPanel fontPane = new JPanel(new BorderLayout()); fontPane.add(font, BorderLayout.NORTH); - typeComboBox.setPreferredSize(new Dimension(155,20)); JPanel typePane = new JPanel(new BorderLayout()); typePane.add(typeComboBox, BorderLayout.CENTER); - typePane.setBorder(LEFT_BORDER); -// centerPane.setBorder(LEFT_BORDER); - frFontPane.setBorder(LEFT_BORDER); JPanel option = new JPanel(new BorderLayout()); option.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Option"), SwingConstants.LEFT), BorderLayout.WEST); roundingBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Base_Option_Half_Up")); - roundingBox.setBorder(BorderFactory.createEmptyBorder(0, 40, 0, 0)); - roundingBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - } - }); roundingBox.setGlobalName("roundingBox"); option.add(roundingBox, BorderLayout.CENTER); - optionPane = new JPanel(new CardLayout()); - optionPane.add(new JPanel(), "hide"); - optionPane.setPreferredSize(new Dimension(0, 0)); - optionPane.add(option, "show"); + optionPane = new JPanel(new BorderLayout()); + optionPane.add(option); Component[][] components = getComponent(fontPane, centerPane, typePane); this.add(createContentPane(components), BorderLayout.CENTER); } protected JPanel createContentPane (Component[][] components) { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); } protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) { return new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format")), typePane}, new Component[]{centerPane, null}, new Component[]{optionPane, null}, new Component[]{fontPane, frFontPane}, @@ -194,41 +160,17 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse } private void initSampleLabel() { + Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"); Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4); String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"); - Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.LEFT, 0, null, UIConstants.LINE_COLOR); - sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()) { - - @Override - public void paint(Graphics g) { - super.paint(g); - int width = getWidth(); - Color original = g.getColor(); - g.setColor(getBackground()); - g.fillRect(LABEL_X, LABEL_Y, width - LABEL_DELTA_WIDTH, LABEL_HEIGHT); - g.setColor(UIConstants.LINE_COLOR); - FontMetrics cellFM = g.getFontMetrics(); - int textWidth = cellFM.stringWidth(getText()); - GraphHelper.drawString(g, getText(), (width - textWidth) / 2, 26); - g.setColor(original); - } - }; + Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.LEFT, 0, null, labelColor); + sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()); sampleLabel.setHorizontalAlignment(UILabel.CENTER); sampleLabel.setBorder(border); + FineUIStyle.setStyle(sampleLabel, FineUIStyle.LABEL_TIP); } - @Override - /** - * 得到合适的大小 - */ - public Dimension getPreferredSize() { - if (this.typeComboBox.getSelectedIndex() == FormatContents.NULL) { - return typeComboBox.getPreferredSize(); - } - return super.getPreferredSize(); - } - /** * 弹出框标题 * @@ -340,7 +282,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse */ private void refreshPreviewLabel() { this.sampleLabel.setText(FormatField.getInstance().getFormatValue()); - this.sampleLabel.setForeground(UIManager.getColor("Label.foreground")); + FineUIStyle.setStyle(sampleLabel, FineUIStyle.LABEL_TIP); try { isRightFormat = true; if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) { @@ -369,38 +311,30 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse if (e.getStateChange() == ItemEvent.SELECTED) { int contents = getFormatContents(); String[] items = FormatField.getInstance().getFormatArray(contents, false); - CardLayout cardLayout = (CardLayout) centerPane.getLayout(); if (isTextOrNull()) { - centerPane.setPreferredSize(new Dimension(0, 0)); - cardLayout.show(centerPane, "hide"); + centerPane.setVisible(false); } else { textField.removeAllItems(); textField.setItemArray(items); textField.setSelectedIndex(0); - centerPane.setPreferredSize(new Dimension(270, 65)); - cardLayout.show(centerPane, "show"); + centerPane.setVisible(true); } - CardLayout optionLayout = ((CardLayout) optionPane.getLayout()); if (getFormatContents() == FormatContents.PERCENT) { - optionPane.setPreferredSize(new Dimension(100, 20)); - optionLayout.show(optionPane, "show"); + optionPane.setVisible(true); } else { - optionPane.setPreferredSize(new Dimension(0, 0)); - optionLayout.show(optionPane, "hide"); + optionPane.setVisible(false); roundingBox.setSelected(false); } + self.repaint(); } } }; - ItemListener textFieldItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - refreshPreviewLabel(); - } + ItemListener textFieldItemListener = e -> { + if (e.getStateChange() == ItemEvent.SELECTED) { + refreshPreviewLabel(); } }; 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..b322cc910c 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,46 +1,52 @@ 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; -import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; 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.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.JDialog; import javax.swing.JPanel; 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.Dimension; +import java.awt.Dialog; +import java.awt.FlowLayout; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; 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.flex; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; /** @@ -57,7 +63,7 @@ public class WatermarkPane extends BasicPane { private UIComboBox fontSizeComboBox; //横向间距 private UISpinner horizontalGapSpinner; - //横向间距 + //纵向间距 private UISpinner verticalGapSpinner; // 文字颜色 private NewColorSelectPane colorPane; @@ -69,7 +75,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 +83,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 +154,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..cface962b6 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,40 +1,38 @@ 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; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.web.CustomIconPane; import com.fr.form.ui.WidgetInfoConfig; - -import javax.swing.*; -import java.awt.*; +import javax.swing.Icon; +import javax.swing.JPanel; +import javax.swing.ImageIcon; +import java.awt.Image; +import java.awt.BorderLayout; 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 labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - labelPane.setLayout(new /**/ FlowLayout(FlowLayout.LEFT, 20, 0)); showIconImageLable = new UILabel(); - 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(); - labelPane.add(showIconImageLable); - iconPane.add(labelPane, BorderLayout.WEST); - iconPane.add(iconButtonPane, BorderLayout.EAST); - iconButtonPane.add(editIconButton); editIconButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -54,7 +52,6 @@ public class IconDefinePane extends BasicPane { }); removeIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Delete")); - iconButtonPane.add(removeIconButton); removeIconButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { curIconName = null; @@ -62,9 +59,10 @@ public class IconDefinePane extends BasicPane { } }); - 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 +84,16 @@ public class IconDefinePane extends BasicPane { setShowIconImage(); } + /** + * 直接更新icon + * @param iconName + * @param icon + */ + 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 c705431793..4184e561b6 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 @@ -187,7 +187,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", @@ -223,6 +228,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 51042cb0b2..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,9 +1306,15 @@ CellOtherSetPane.height=$Component.defaultHeight [style]Label.tipLabel = \ foreground: $Label.tipColor +[style]Label.warningTipLabel = \ + foreground: $Label.warningColor + [style]Button.plainButton = \ border: null; \ background: null; \ hoverBackground : null; \ selectedBackground : null; \ - pressedBackground : null \ No newline at end of file + pressedBackground : null + +[style]ToggleButton.compactButton = \ + margin: 2,0,2,0 \ No newline at end of file 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-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java index 297245960d..0949b792a4 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java @@ -4,6 +4,7 @@ package com.fr.design.mainframe; +import com.fine.theme.utils.FineUIScale; import com.fr.base.BaseUtils; import com.fr.base.chart.BaseChartCollection; import com.fr.chart.chartattr.ChartCollection; @@ -21,8 +22,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.SwingWorker; -import java.awt.BorderLayout; -import java.awt.Component; +import java.awt.*; public class ChartPropertyPane extends BaseChartPropertyPane { @@ -44,6 +44,8 @@ public class ChartPropertyPane extends BaseChartPropertyPane { protected void initComponent() { this.setLayout(new BorderLayout()); this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + // 外部轮廓大小固定,适配滚动面板 + this.setPreferredSize(FineUIScale.scale(new Dimension(getWidth(), 900))); } @Override diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/AbstractChartAttrPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/AbstractChartAttrPane.java index c3beef7570..e3dff4837a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/AbstractChartAttrPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/AbstractChartAttrPane.java @@ -4,8 +4,7 @@ package com.fr.design.mainframe.chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; -import javax.swing.*; -import java.awt.*; +import java.awt.BorderLayout; public abstract class AbstractChartAttrPane extends AbstractAttrNoScrollPane { public abstract void populate(ChartCollection collection); @@ -30,7 +29,6 @@ public abstract class AbstractChartAttrPane extends AbstractAttrNoScrollPane { protected void initContentPane() { leftContentPane = createContentPane(); - leftContentPane.setBorder(BorderFactory.createMatteBorder(10, 0, 0, 0, original)); this.add(leftContentPane, BorderLayout.CENTER); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 8b1c293282..5261223840 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -1,5 +1,8 @@ package com.fr.design.mainframe.chart.gui; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineLayoutBuilder; +import com.fine.theme.utils.FineUIStyle; import com.fr.base.BaseUtils; import com.fr.chart.base.AttrChangeConfig; import com.fr.chart.chartattr.ChartCollection; @@ -24,15 +27,12 @@ import com.fr.plugin.chart.vanchart.VanChart; import com.fr.stable.StringUtils; import com.fr.van.chart.config.DefaultStyleHelper4Van; -import javax.swing.BorderFactory; -import javax.swing.BoxLayout; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; +import java.awt.Component; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.Graphics; -import java.awt.GridLayout; import java.awt.Image; import java.awt.Rectangle; import java.awt.event.ActionEvent; @@ -46,7 +46,15 @@ import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +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; /** * 图表 类型 增删 控制按钮界面. @@ -103,38 +111,32 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen this.setLayout(new BorderLayout()); initButton(); - buttonPane = new JPanel(); - this.add(buttonPane, BorderLayout.CENTER); - - JPanel northPane = new JPanel(); - this.add(northPane, BorderLayout.NORTH); - - northPane.setLayout(new BorderLayout()); - northPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); - - JPanel button = new JPanel(); - button.setPreferredSize(new Dimension(89, 20)); - button.setLayout(new GridLayout(1, 4, 3, 0)); - button.add(addButton); - button.add(copyButton); - button.add(moveForwardButton); - button.add(moveBackButton); - northPane.add(button, BorderLayout.WEST); - northPane.add(configButton, BorderLayout.EAST); + buttonPane = new JPanel(new BorderLayout()); + this.add(column(10, + row(5, + cell(addButton).weight(0.5), + cell(copyButton).weight(0.5), + cell(moveForwardButton).weight(0.5), + cell(moveBackButton).weight(0.5), + flex(2), + cell(configButton).weight(0.5) + ), + cell(buttonPane) + ).getComponent() + ); initConfigCreator(); - // Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); } private void initButton() { - addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); - configButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png")); - copyButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); + addButton = new UIButton(new LazyIcon("add")); + configButton = new UIButton(new LazyIcon("tool_config")); + copyButton = new UIButton(new LazyIcon("tool_copy")); copyButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Action_Copy")); - moveForwardButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/left.png")); + moveForwardButton = new UIButton(new LazyIcon("move_left")); moveForwardButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Left")); - moveBackButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/right.png")); + moveBackButton = new UIButton(new LazyIcon("move_right")); moveBackButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Right")); initAddButton(); initConfigButton(); @@ -151,7 +153,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } private void initAddButton() { - addButton.setPreferredSize(new Dimension(20, 20)); addButton.addActionListener((e) -> { String name = getNewChartName(); ChartProvider chart = getChangeStateNewChart(); @@ -168,12 +169,10 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } private void initConfigButton() { - configButton.setPreferredSize(new Dimension(20, 20)); configButton.addActionListener((e) -> showConfigDialog()); } private void initCopyButton() { - copyButton.setPreferredSize(new Dimension(20, 20)); copyButton.addActionListener((e) -> { String name = getCopyChartName(); ChartProvider chart = getCopyChart(); @@ -182,8 +181,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } private void initMoveButton() { - moveForwardButton.setPreferredSize(new Dimension(20, 20)); - moveBackButton.setPreferredSize(new Dimension(20, 20)); moveForwardButton.addActionListener((e) -> moveForwardChart()); moveBackButton.addActionListener((e) -> moveBackChart()); } @@ -335,18 +332,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen return; } northPane.removeAll(); - northPane.setLayout(new BoxLayout(northPane, BoxLayout.Y_AXIS)); - - JPanel pane = null; - for (int i = 0; i < indexList.size(); i++) { - if (i % COL_COUNT == 0) { - pane = new JPanel(new FlowLayout(FlowLayout.LEFT)); - northPane.add(pane); - } - - pane.add(indexList.get(i)); - } - + northPane.add(FineLayoutBuilder.createCommonTableLayout(COL_COUNT, 10, 10, indexList)); this.revalidate(); } @@ -355,22 +341,12 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen return; } northPane.removeAll(); - northPane.setLayout(new BoxLayout(northPane, BoxLayout.Y_AXIS)); - - JPanel pane = null; - - for (int i = 0; i < indexList.size(); i++) { - if (i % COL_COUNT == 0) { - pane = new JPanel(new FlowLayout(FlowLayout.LEFT)); - northPane.add(pane); - } - if (i != index) { - pane.add(indexList.get(i)); - } else { - pane.add(currentEditingEditor); - } - } + List components = IntStream.range(0, indexList.size()) + .mapToObj(i -> i == index ? currentEditingEditor : indexList.get(i)) + .collect(Collectors.toList()); + northPane.add(FineLayoutBuilder.createCommonTableLayout(COL_COUNT, 10, 10, components)); this.revalidate(); + } /** @@ -518,6 +494,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } } }); + FineUIStyle.setStyle(this, FineUIStyle.COMPACT_BUTTON); } public String getButtonName() { @@ -530,10 +507,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen buttonName = name; } - public Dimension getPreferredSize() { - return new Dimension(B_W, B_H); - } - private void paintDeleteButton(Graphics g2d) { Rectangle2D bounds = this.getBounds(); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java index bd94ff561a..8505b81e93 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe.chart.gui; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; @@ -58,8 +60,8 @@ public class ChartTypePane extends AbstractChartAttrPane { @Override protected JPanel createContentPane() { initButtonListener(); - JPanel content = new JPanel(new BorderLayout()); - + JPanel content = new JPanel(new BorderLayout(0, FineUIScale.scale(10))); + content.setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); buttonPane = new ChartTypeButtonPane(this); buttonPane.refreshChartInForm(inForm); content.add(buttonPane, BorderLayout.NORTH); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java index c24a192441..4dcf5193ec 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.chart.gui.data; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.Utils; import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.chartattr.ChartCollection; @@ -10,23 +11,20 @@ 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.TableLayout; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.style.AbstractChartTabPane; import com.fr.design.mainframe.chart.gui.style.ThirdTabPane; import com.fr.stable.StringUtils; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import javax.swing.BorderFactory; import javax.swing.JPanel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.util.ArrayList; import java.util.List; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Dimension; -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.row; /** * 图表数据 分类 系列 过滤界面. @@ -57,20 +55,15 @@ public class ChartDataFilterPane extends ThirdTabPane { protected void initTabPane() { super.initTabPane(); - tabPane.setPreferredSize(new Dimension(221, 25)); } protected void initLayout() { this.setLayout(new BorderLayout()); if (!paneList.isEmpty()) { - JPanel pane = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0)); if (nameArray.length > 1) { - pane.add(tabPane); - this.add(pane, BorderLayout.NORTH); - centerPane.setBorder(BorderFactory.createEmptyBorder(10,0,0,0)); + this.add(tabPane, BorderLayout.NORTH); } - centerPane.setBorder(null); } this.add(centerPane, BorderLayout.CENTER); } @@ -129,8 +122,6 @@ public class ChartDataFilterPane extends ThirdTabPane { this.removeAll(); paneList = initPaneList4NoPresent(plot4Pane, parentPane); initAllPane(); - tabPane.setPreferredSize(new Dimension(221, 25)); - centerPane.setPreferredSize(new Dimension(getContentPaneWidth(), 200)); this.validate(); } @@ -213,19 +204,10 @@ public class ChartDataFilterPane extends ThirdTabPane { protected void layoutContentPane() { super.layoutContentPane(); - leftcontentPane.setBorder(BorderFactory.createEmptyBorder()); } public void reloaPane(JPanel pane){ super.reloaPane(pane); - leftcontentPane.setBorder(BorderFactory.createEmptyBorder()); - } - - @Override - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); - dim.height = FIL_HEIGHT; - return dim; } @Override @@ -238,51 +220,37 @@ public class ChartDataFilterPane extends ThirdTabPane { protected JPanel initOtherPane() { onlyPreData = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Only_Use_Before_Records")); - JPanel panel1 = new JPanel(new BorderLayout()); - JPanel panel2 = new JPanel(new BorderLayout()); - panel1.add(onlyPreData, BorderLayout.NORTH); preDataNum = new UITextField(); UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Records_Num")); combineOther = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther")); combineOther.setSelected(true); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p,f}; - double[] rowSize = {p, p}; - Component[][] components = new Component[][]{ - new Component[]{label,preDataNum}, - new Component[]{combineOther,null} - }; - - preDataNumPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); - preDataNumPane.setBorder(BorderFactory.createEmptyBorder(10,15,0,0)); //默认不显示 + preDataNumPane = column(10, + row(cell(label).weight(1.2), cell(preDataNum).weight(3)), + cell(combineOther) + ).getComponent(); preDataNumPane.setVisible(false); - panel1.add(preDataNumPane, BorderLayout.CENTER); notShowNull = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_Not_Show_Cate")); - panel2.add(notShowNull, BorderLayout.NORTH); - onlyPreData.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - checkBoxUse(); - } - }); + onlyPreData.addChangeListener(e -> checkBoxUse()); present = new PresentComboBox() { protected void fireChange() { fire(); } }; - presentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Style_Present") ,present); - panel2.add(presentPane, BorderLayout.SOUTH); - - double[] column = {f}; - double[] row = {p, p}; - Component[][] coms = new Component[][]{ - new Component[]{panel1}, - new Component[]{panel2} - }; - return TableLayout4VanChartHelper.createGapTableLayoutPane(coms, row,column); + presentPane = row( + cell( + new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Present")) + ).weight(1.2), cell(present).weight(3) + ).getComponent(); + + return column(10, + cell(onlyPreData), + cell(preDataNumPane), + cell(notShowNull), + cell(presentPane) + ).with(it -> it.setBorder(new ScaledEmptyBorder(10, 0, 0, 0))).getComponent(); } @@ -394,12 +362,10 @@ public class ChartDataFilterPane extends ThirdTabPane { protected void layoutContentPane() { super.layoutContentPane(); - leftcontentPane.setBorder(BorderFactory.createEmptyBorder()); } public void reloaPane(JPanel pane){ super.reloaPane(pane); - leftcontentPane.setBorder(BorderFactory.createEmptyBorder()); } @Override @@ -413,51 +379,37 @@ public class ChartDataFilterPane extends ThirdTabPane { protected JPanel initOtherPane() { onlyPreData = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Only_Use_Before_Records")); - JPanel panel1 = new JPanel(new BorderLayout()); - JPanel panel2 = new JPanel(new BorderLayout()); - panel1.add(onlyPreData, BorderLayout.NORTH); preDataNum = new UITextField(); UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Records_Num")); combineOther = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther")); combineOther.setSelected(true); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p,f}; - double[] rowSize = {p, p}; - Component[][] components = new Component[][]{ - new Component[]{label,preDataNum}, - new Component[]{combineOther,null} - }; - - preDataNumPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); - preDataNumPane.setBorder(BorderFactory.createEmptyBorder(10,15,0,0)); //默认不显示 + preDataNumPane = column(10, + row(cell(label).weight(1.2), cell(preDataNum).weight(3)), + cell(combineOther) + ).getComponent(); preDataNumPane.setVisible(false); - panel1.add(preDataNumPane, BorderLayout.CENTER); notShowNull = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_Not_Show_Series")); - panel2.add(notShowNull, BorderLayout.NORTH); - onlyPreData.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - checkBoxUse(); - } - }); + onlyPreData.addChangeListener(e -> checkBoxUse()); present = new PresentComboBox() { protected void fireChange() { fire(); } }; - presentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Style_Present") ,present); - panel2.add(presentPane, BorderLayout.SOUTH); - - double[] column = {f}; - double[] row = {p, p}; - Component[][] coms = new Component[][]{ - new Component[]{panel1}, - new Component[]{panel2} - }; - return TableLayout4VanChartHelper.createGapTableLayoutPane(coms, row,column); + presentPane = row( + cell( + new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Present")) + ).weight(1.2), cell(present).weight(3) + ).getComponent(); + + return column(10, + cell(onlyPreData), + cell(preDataNumPane), + cell(notShowNull), + cell(presentPane) + ).with(it -> it.setBorder(new ScaledEmptyBorder(10, 0, 0, 0))).getComponent(); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java index 40983c56b5..e89a0eaaf9 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java @@ -1,28 +1,26 @@ package com.fr.design.mainframe.chart.gui.data; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; import com.fr.base.TableData; import com.fr.data.impl.NameTableData; -import com.fr.design.constants.LayoutConstants; -import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.utils.gui.UIComponentUtils; import com.fr.log.FineLoggerFactory; -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import javax.swing.border.LineBorder; import java.awt.BorderLayout; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; 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.flex; +import static com.fine.swing.ui.layout.Layouts.row; + public class DatabaseTableDataPane extends BasicPane{ private static final long serialVersionUID = 5316016202202932242L; private TableDataComboBox tableNameCombox; @@ -38,21 +36,16 @@ public class DatabaseTableDataPane extends BasicPane{ initTableCombox(); initReviewButton(); - this.setLayout(new BorderLayout(0,0)); - if (label != null) { - this.add(label, BorderLayout.WEST); - } - - JPanel pane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE,0)); - pane.add(tableNameCombox,BorderLayout.CENTER); - pane.add(reviewButton,BorderLayout.EAST); - - this.add(UIComponentUtils.wrapWithBorderLayoutPane(pane),BorderLayout.CENTER); + this.setLayout(new BorderLayout()); + this.add( + row( + cell(label).weight(1.2), cell(tableNameCombox).weight(2.4), flex(0.1), cell(reviewButton).weight(0.5) + ).getComponent(), BorderLayout.CENTER + ); setBorder(); } protected void setBorder () { - this.setBorder(BorderFactory.createEmptyBorder(0,24,0,15)); } /** * 返回选中的数据源. @@ -101,15 +94,14 @@ public class DatabaseTableDataPane extends BasicPane{ } private void initReviewButton() { - reviewButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/search.png")); - reviewButton.setBorder(new LineBorder(UIConstants.LINE_COLOR)); + reviewButton = new UIButton(new LazyIcon("search")); reviewButton.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { - TableDataWrapper tableDataWrappe = tableNameCombox.getSelectedItem(); - if ( tableDataWrappe != null) { + TableDataWrapper tableDataWrapper = tableNameCombox.getSelectedItem(); + if ( tableDataWrapper != null) { try { - tableDataWrappe.previewData(); + tableDataWrapper.previewData(); } catch (Exception e1) { FineLoggerFactory.getLogger().error(e1.getMessage(), e1); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java index 9943c79631..6bf18a70eb 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java @@ -1,25 +1,26 @@ package com.fr.design.mainframe.chart.gui.data; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.chartx.data.DataLayoutHelper; -import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.mode.ChartEditContext; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.van.chart.designer.AbstractVanChartScrollPane; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; 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.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; + /** * 一般数据界面 * @author kunsnat E-mail:kunsnat@gmail.com @@ -62,19 +63,14 @@ public class NormalChartDataPane extends DataContentsPane { JPanel contentPane = new JPanel(new BorderLayout()); dataPane = new UIComboBoxPane() { protected void initLayout() { - this.setLayout(new BorderLayout(ChartEditContext.normalMode() ? LayoutConstants.HGAP_LARGE : 0,6)); + this.setLayout(new BorderLayout(0, FineUIScale.scale(10))); + setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); if (ChartEditContext.supportReportData()) { - JPanel northPane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE, 0)); - northPane.add(jcb, BorderLayout.CENTER); - UILabel label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Source")); - label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); - northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); - if (ChartEditContext.normalMode()) { - northPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 8)); - } else { - northPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); - } - this.add(northPane, BorderLayout.NORTH); + UILabel dataSourceLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Source")); + this.add(row( + cell(dataSourceLabel).weight(LEFT_WEIGHT), + cell(jcb).weight(RIGHT_WEIGHT) + ).getComponent(), BorderLayout.NORTH); } this.add(cardPane, BorderLayout.CENTER); @@ -95,7 +91,6 @@ public class NormalChartDataPane extends DataContentsPane { } }; contentPane.add(dataPane, BorderLayout.CENTER); - dataPane.setBorder(BorderFactory.createEmptyBorder(10 ,0, 0, 0)); return contentPane; } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java index 82240bc6d2..0c84c65e63 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.chart.gui.data; +import com.fine.theme.utils.FineUIScale; import com.fr.base.TableData; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; @@ -9,23 +10,16 @@ import com.fr.data.impl.NameTableData; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; -import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; -import com.fr.design.utils.gui.UIComponentUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import java.awt.BorderLayout; -import java.awt.Dimension; public class TableDataPane extends FurtherBasicBeanPane{ private static final long serialVersionUID = 4740461028440155147L; - private static final int TOP = -5; - private static final int TABLE_DATA_LABEL_LINE_WRAP_WIDTH = 65; - private static final int TABLE_DATA_PANE_WIDTH = 246; private DatabaseTableDataPane tableDataPane; private AbstractTableDataContentPane dataContentPane; @@ -37,14 +31,12 @@ public class TableDataPane extends FurtherBasicBeanPane{ public TableDataPane(ChartDataPane parent) { this.parent = parent; + setLayout(new BorderLayout(0, FineUIScale.scale(10))); initDataPane(); } private void initDataPane() { - UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data")); - UIComponentUtils.setLineWrap(label, TABLE_DATA_LABEL_LINE_WRAP_WIDTH); - UIComponentUtils.setPreferedWidth(label, ChartDataPane.LABEL_WIDTH); - + UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data")); tableDataPane = new DatabaseTableDataPane(label) { @Override protected void userEvent() { @@ -52,9 +44,6 @@ public class TableDataPane extends FurtherBasicBeanPane{ checkBoxUse(); } }; - - tableDataPane.setPreferredSize(new Dimension(TABLE_DATA_PANE_WIDTH , tableDataPane.getPreferredSize().height)); - this.setBorder(BorderFactory.createEmptyBorder(TOP,0,0,0)); this.add(tableDataPane, BorderLayout.NORTH); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java index 1073f0e410..2e1f486ccf 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java @@ -53,7 +53,6 @@ public abstract class AbstractReportDataContentPane extends BasicBeanPane addNewCatePane()); } /** @@ -100,37 +86,29 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor } private TinyFormulaPane addNewCatePane() { - final TinyFormulaPane pane = initCategoryBox(StringUtils.EMPTY); - pane.setPreferredSize(new Dimension(100, 16)); - - pane.registerChangeListener(uiobListener); - - formualList.add(pane); + final TinyFormulaPane formulaPane = initCategoryBox(StringUtils.EMPTY); - final JPanel newButtonPane = new JPanel(); - newButtonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); - newButtonPane.add(pane); - - UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); - newButtonPane.add(delButton); + formulaPane.registerChangeListener(uiobListener); + formualList.add(formulaPane); + UIButton delButton = new UIButton(new LazyIcon("close")); + JPanel newButtonPane = row( + cell(formulaPane).weight(3.7), flex(0.1), cell(delButton).weight(0.4) + ).with(it -> it.setBorder(new ScaledEmptyBorder(10, 0, 0, 0))).getComponent(); boxPane.add(newButtonPane); - delButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - boxPane.remove(newButtonPane); - formualList.remove(pane); - checkComponent(); - relayoutPane(); - } + delButton.addActionListener(e -> { + boxPane.remove(newButtonPane); + formualList.remove(formulaPane); + checkComponent(); + relayoutPane(); }); delButton.registerChangeListener(uiobListener); checkComponent(); relayoutPane(); - return pane; + return formulaPane; } private void checkAddButton() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java index fb315b84ed..944f7d2825 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java @@ -5,25 +5,27 @@ import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartdata.NormalReportDataDefinition; import com.fr.chart.chartdata.SeriesDefinition; +import com.fr.design.border.FineBorderFactory; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.formula.DefaultTinyFormulaPane; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; -import com.fr.stable.StringUtils; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import javax.swing.BorderFactory; -import javax.swing.JPanel; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.BorderLayout; -import java.awt.Dimension; 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.flex; +import static com.fine.swing.ui.layout.Layouts.row; + public class CategoryPlotReportDataContentPane extends AbstractReportDataContentPane { - protected static final int PRE_WIDTH = 210; protected TinyFormulaPane categoryName; protected ChartDataFilterPane filterPane; @@ -35,30 +37,24 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent public CategoryPlotReportDataContentPane(ChartDataPane parent) { initEveryPane(); categoryName = initCategoryBox(Toolkit.i18nText("Fine-Design_Chart_Category_Name")); - categoryName.setPreferredSize(new Dimension(236,30)); - categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,20)); - this.add(categoryName, "0,0,1,0"); + this.setLayout(new BorderLayout()); filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent); - JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane); - panel.setBorder(getSidesBorder()); - filterPane.setBorder(getFilterPaneBorder()); - this.add(panel, "0,6,1,4"); } + this.add(column( + cell(categoryName), + fix(10).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())), + cell(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane)) + ).getComponent()); + } protected TinyFormulaPane initCategoryBox(final String leftLabel) { TinyFormulaPane categoryName = new DefaultTinyFormulaPane() { @Override protected void initLayout() { - this.setLayout(new BorderLayout(4, 0)); - - if(StringUtils.isNotEmpty(leftLabel)) { - UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Category_Name")); - label1.setPreferredSize(new Dimension(75, 20)); - this.add(label1, BorderLayout.WEST); - } - - formulaTextField.setPreferredSize(new Dimension(100, 20)); - this.add(formulaTextField, BorderLayout.CENTER); - this.add(formulaTextFieldButton, BorderLayout.EAST); + UILabel label = new UILabel(leftLabel); + this.setLayout(new BorderLayout()); + this.add(row( + cell(label).weight(1.2), cell(formulaTextField).weight(2), flex(0.1), cell(formulaTextFieldButton).weight(0.4) + ).getComponent()); } public void okEvent() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java index 7432dfcce1..0f2e21a6a4 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java @@ -1,28 +1,25 @@ package com.fr.design.mainframe.chart.gui.data.table; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalTableDataDefinition; +import com.fr.design.border.FineBorderFactory; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.ChartDataHelper; -import com.fr.design.utils.gui.GUICoreUtils; -import javax.swing.BorderFactory; import javax.swing.BoxLayout; 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 java.awt.event.ItemEvent; @@ -30,6 +27,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.flex; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 多分类轴 的数据集定义界面. * @@ -38,9 +40,6 @@ import java.util.List; */ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableDataContentPane implements UIObserver { private static final long serialVersionUID = -3305681053750642843L; - private static final int COMBOX_GAP = 8; - private static final int COMBOX_WIDTH = 95; - private static final int COMBOX_HEIGHT = 20; private JPanel boxPane; @@ -59,40 +58,37 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD public CategoryPlotMoreCateTableDataContentPane(ChartDataPane parent) { categoryCombox = new UIComboBox(); - categoryCombox.setPreferredSize(new Dimension(COMBOX_WIDTH,COMBOX_HEIGHT)); - - JPanel categoryPane = new JPanel(new BorderLayout(4, 0)); - categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); - UILabel categoryLabel = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Category")); - categoryLabel.setPreferredSize(new Dimension(85,COMBOX_HEIGHT)); - - addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); - addButton.setPreferredSize(new Dimension(20, COMBOX_HEIGHT)); - - categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, addButton, null, categoryLabel, null})); - - categoryPane.setBorder(BorderFactory.createEmptyBorder(0,24,10,15)); + UILabel categoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Category")); + addButton = new UIButton(new LazyIcon("add")); boxPane = new JPanel(); boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); - categoryPane.add(boxPane, BorderLayout.SOUTH); + JPanel categoryPane = column(10, + row( + cell(categoryLabel).weight(1.2), + cell(categoryCombox).weight(2.4), + flex(0.1), + cell(addButton).weight(0.5) + ), + cell(boxPane) + ).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())).getComponent(); + this.setLayout(new BorderLayout()); - this.add(categoryPane, BorderLayout.NORTH); - this.add(getJSeparator()); seriesTypeComboxPane = new SeriesTypeUseComboxPane(parent, new Bar2DPlot()); - this.add(seriesTypeComboxPane, BorderLayout.SOUTH); + this.add(FineLayoutBuilder.createVerticalLayout(10, categoryPane, seriesTypeComboxPane)); addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (boxList.size() < 2) { - addNewCombox(); + addNewComboBox(); relayoutPane(); } checkSeriseUse(categoryCombox.getSelectedItem() != null); + checkComponent(); } }); @@ -112,49 +108,39 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD addButton.setEnabled(hasUse); } - private UIComboBox addNewCombox() { - final JPanel buttonPane = new JPanel(); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); - - final UIComboBox combox = new UIComboBox(); - combox.setPreferredSize(new Dimension(COMBOX_WIDTH, COMBOX_HEIGHT)); + private UIComboBox addNewComboBox() { + final UIComboBox comboBox = new UIComboBox(); int count = categoryCombox.getItemCount(); for (int i = 0; i < count; i++) { - combox.addItem(categoryCombox.getItemAt(i)); + comboBox.addItem(categoryCombox.getItemAt(i)); } - combox.registerChangeListener(uiobListener); - combox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - makeToolTipUse(combox); - } - }); + comboBox.registerChangeListener(uiobListener); + comboBox.addItemListener(e -> makeToolTipUse(comboBox)); + + comboBox.setSelectedItem(categoryCombox.getItemAt(0)); + makeToolTipUse(comboBox); - combox.setSelectedItem(categoryCombox.getItemAt(0)); - makeToolTipUse(combox); + UIButton delButton = new UIButton(new LazyIcon("close")); + JPanel buttonPane = row( + flex(1.2), cell(comboBox).weight(2.4), flex(0.1), cell(delButton).weight(0.5) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, 10, 0))).getComponent(); - buttonPane.add(combox); - UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); - buttonPane.add(delButton); boxPane.add(buttonPane); - boxList.add(combox); + boxList.add(comboBox); checkComponent(); - delButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - boxPane.remove(buttonPane); - boxList.remove(combox); - checkComponent(); - relayoutPane(); - } + delButton.addActionListener(e -> { + boxPane.remove(buttonPane); + boxList.remove(comboBox); + checkComponent(); + relayoutPane(); }); delButton.registerChangeListener(uiobListener); - return combox; + return comboBox; } private void checkAddButton() { @@ -223,7 +209,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD NormalTableDataDefinition normal = (NormalTableDataDefinition) top; int size = normal.getMoreCateSize(); for (int i = 0; i < size; i++) { - UIComboBox box = addNewCombox(); + UIComboBox box = addNewComboBox(); box.setSelectedItem(normal.getMoreCateWithIndex(i)); } } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java index 7d12e3e52d..270f3ffa71 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java @@ -6,22 +6,21 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartdata.NormalTableDataDefinition; import com.fr.chart.chartdata.TopDefinition; import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.design.i18n.Toolkit; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; +import java.awt.BorderLayout; 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; + /** * 属性表, 矩形类的 数据集 数据界面. * @author kunsnat E-mail:kunsnat@gmail.com @@ -40,29 +39,24 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa public CategoryPlotTableDataContentPane(ChartDataPane parent) { categoryCombox = new UIComboBox(); - JPanel categoryPane = new JPanel(new BorderLayout(4,0)); - categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); - UILabel label1 = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")) ; - label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT)); - categoryCombox.setPreferredSize(new Dimension(100,20)); + UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")) ; categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); - categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox,null,null,label1,null})); - categoryPane.setPreferredSize(new Dimension(246,30)); - categoryPane.setBorder(BorderFactory.createEmptyBorder(0,24,10,15)); - this.setLayout(new BorderLayout()); - - this.add(categoryPane, BorderLayout.NORTH); - - this.add(getJSeparator()); seriesTypeComboxPane = new SeriesTypeUseComboxPane(parent, new Bar2DPlot()); - this.add(seriesTypeComboxPane, BorderLayout.SOUTH); - categoryCombox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { - checkSeriseUse(categoryCombox.getSelectedItem() != null); - makeToolTipUse(categoryCombox); - } + this.setLayout(new BorderLayout()); + + this.add(column(10, + row( + cell(label).weight(1.2), cell(categoryCombox).weight(3) + ), + cell(seriesTypeComboxPane) + ).getComponent() + ); + + categoryCombox.addItemListener(e -> { + checkSeriseUse(categoryCombox.getSelectedItem() != null); + makeToolTipUse(categoryCombox); }); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java index 889e6f5302..f3d326f8dc 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java @@ -6,17 +6,14 @@ import com.fr.chart.chartdata.OneValueCDDefinition; import com.fr.data.util.function.AbstractDataFunction; import com.fr.data.util.function.NoneFunction; import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.border.FineBorderFactory; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.extended.chart.UIComboBoxWithNone; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.util.List; import java.awt.BorderLayout; @@ -25,6 +22,11 @@ import java.awt.Dimension; 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.fix; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 属性表 数据集 系列名使用 系列值 界面. * @@ -45,9 +47,6 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())) + ).getComponent(); this.setLayout(new BorderLayout()); this.add(centerPane, BorderLayout.CENTER); } private void initCenterPaneWithOutCaculateSummary() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p, p, p, p}; UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name")); - label1.setPreferredSize(getLabelDimension()); UILabel label2 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Value")); - label2.setPreferredSize(getLabelDimension()); - UILabel label3 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method")); - label3.setPreferredSize(getLabelDimension()); - Component[][] components = getUseComponentWithOutSummary(label1, label2, label3); - - centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 4, 6); - centerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); + centerPane = column(10, + row( + cell(label1).weight(1), cell(seriesName).weight(2) + ), + row( + cell(label2).weight(1), cell(seriesValue).weight(2) + ), + fix(1).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())) + ).getComponent(); this.setLayout(new BorderLayout()); this.add(centerPane, BorderLayout.CENTER); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java index cf78e59ffb..2a78359109 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java @@ -1,30 +1,32 @@ package com.fr.design.mainframe.chart.gui.data.table; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.MoreNameCDDefinition; import com.fr.chart.chartdata.OneValueCDDefinition; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.constants.LayoutConstants; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; -import com.fr.design.utils.gui.GUICoreUtils; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.util.List; import java.awt.BorderLayout; import java.awt.CardLayout; -import java.awt.Component; 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.row; + /** * 属性表: 柱形, 饼图 数据集界面, "系列名使用"界面. * @@ -98,32 +100,21 @@ public class SeriesTypeUseComboxPane extends BasicBeanPane { } protected void initLayout() { - this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM)); - JPanel northPane = new JPanel(new BorderLayout(4, 0)); - + this.setLayout(new BorderLayout()); //使用系列名/系列值选项面板 UILabel seriesLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From")); - seriesLabel.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); - JPanel borderLayoutPane = GUICoreUtils.createBorderLayoutPane(new Component[]{content, null, null, seriesLabel, null}); - northPane.add(borderLayoutPane); - northPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 0, 16)); - this.add(northPane, BorderLayout.NORTH); - - //系列名/系列值配置面板 - cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); - this.add(cardPane, BorderLayout.CENTER); //数据筛选 dataScreeningPane = new ChartDataFilterPane(this.initplot, parent); - JPanel panel = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 250, 24, dataScreeningPane); - panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); - dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - this.add(panel, BorderLayout.SOUTH); - } - public Dimension getPreferredSize() { - Dimension preferredSize = super.getPreferredSize(); - return new Dimension(246, (int) preferredSize.getHeight()); + this.add(column( + row( + cell(seriesLabel).weight(1), cell(content).weight(2) + ), + fix(10), + cell(cardPane), + cell(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), dataScreeningPane)) + ).with(it -> it.setBorder(new ScaledEmptyBorder(10, 0, 0, 0))).getComponent()); } /** diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java index 63b259e7aa..89281390d0 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java @@ -1,8 +1,8 @@ package com.fr.design.mainframe.chart.gui.style; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.FRContext; -import com.fr.base.Utils; import com.fr.chart.base.TextAttr; import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; @@ -18,7 +18,6 @@ import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; import com.fr.general.GeneralUtils; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; import javax.swing.SwingConstants; @@ -193,8 +192,8 @@ public class ChartTextAttrPane extends BasicPane { protected void initState() { fontNameComboBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report()); fontSizeComboBox = new UIComboBox(getFontSizeComboBoxModel()); - bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); - italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + bold = new UIToggleButton(new LazyIcon("bold")); + italic = new UIToggleButton(new LazyIcon("italic")); initFontColorState(); } @@ -217,11 +216,7 @@ public class ChartTextAttrPane extends BasicPane { } protected JPanel getContentPane(JPanel buttonPane) { - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {f, e}; - - return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), getRowSize(), columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, getComponents(buttonPane), new double[]{1.2, 3}); } protected double[] getRowSize() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithThemeStyle.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithThemeStyle.java index 345d57de8a..76862a7577 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithThemeStyle.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithThemeStyle.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.chart.gui.style; +import com.fine.theme.utils.FineUIScale; import com.fr.chart.base.TextAttr; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; @@ -7,7 +8,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; import java.awt.BorderLayout; @@ -33,7 +33,7 @@ public class ChartTextAttrPaneWithThemeStyle extends ChartTextAttrPane { } protected JPanel getContentPane(JPanel buttonPane) { - JPanel panel = new JPanel(new BorderLayout(0, 10)); + JPanel panel = new JPanel(new BorderLayout(0, FineUIScale.scale(10))); preButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Follow_Theme"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); @@ -46,7 +46,6 @@ public class ChartTextAttrPaneWithThemeStyle extends ChartTextAttrPane { textFontPane = TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), getRowSize(), columnSize); panel.add(preButtonPane, BorderLayout.CENTER); panel.add(textFontPane, BorderLayout.SOUTH); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); return panel; } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithThemeStyle.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithThemeStyle.java index db59476792..412266358a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithThemeStyle.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithThemeStyle.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.chart.gui.style; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.base.ColorWithThemeStyle; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -7,13 +8,10 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.style.color.ColorSelectBox; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; 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; @@ -40,7 +38,7 @@ public class ColorSelectBoxWithThemeStyle extends BasicPane { private void initContent() { - UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color"), SwingConstants.LEFT); + UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")); Component[][] components = ChartEditContext.supportTheme() ? new Component[][]{ new Component[]{text, preButton}, new Component[]{null, colorSelectBox}, @@ -48,23 +46,17 @@ public class ColorSelectBoxWithThemeStyle extends BasicPane { new Component[]{text, colorSelectBox} }; - JPanel gapTableLayoutPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components); + JPanel gapTableLayoutPane = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); this.setLayout(new BorderLayout()); this.add(gapTableLayoutPane, BorderLayout.CENTER); } private void initListener() { - preButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkPreButton(); - } - }); + preButton.addActionListener(e -> checkPreButton()); } private void checkPreButton() { colorSelectBox.setVisible(preButton.getSelectedIndex() == CUSTOM); - this.setPreferredSize(ChartEditContext.supportTheme() && preButton.getSelectedIndex() == CUSTOM ? new Dimension(0, 55) : new Dimension(0, 23)); } public String title4PopupWindow() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java index a58a889164..5afaded3f2 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java @@ -3,29 +3,18 @@ package com.fr.design.mainframe.chart.gui.style; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.ibutton.UIButtonGroup; import javax.swing.JPanel; -import javax.swing.border.Border; import java.util.List; import java.awt.BorderLayout; import java.awt.CardLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; public abstract class ThirdTabPane extends BasicBeanPane{ private static final long serialVersionUID = 2298609199400393886L; - private static final int MIN_TAB_HEIGHT = 25; protected UIButtonGroup tabPane; protected String[] nameArray; public JPanel centerPane; @@ -57,54 +46,18 @@ public abstract class ThirdTabPane extends BasicBeanPane{ if (!paneList.isEmpty()) { tabPane = new UIButtonGroup(nameArray); tabPane.setSelectedIndex(0); - int prefHeight = tabPane.getPreferredSize().height; - int prefWidth = tabPane.getPreferredSize().width + 20; // 暂且加一个偏移量 - int minWidth = 60 * nameArray.length; - tabPane.setPreferredSize( - new Dimension(prefWidth > minWidth ? prefWidth : minWidth, - prefHeight > MIN_TAB_HEIGHT ? prefHeight : MIN_TAB_HEIGHT)); - tabPane.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - cardLayout.show(centerPane, nameArray[tabPane.getSelectedIndex()]); - } - }); - - centerPane.setBorder(myBorder); + tabPane.addActionListener(e -> cardLayout.show(centerPane, nameArray[tabPane.getSelectedIndex()])); } } protected void initLayout() { this.setLayout(new BorderLayout()); if (!paneList.isEmpty()) { - JPanel pane = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0)); - pane.add(tabPane); - this.add(pane, BorderLayout.NORTH); + this.add(tabPane, BorderLayout.NORTH); } this.add(centerPane, BorderLayout.CENTER); } - private Border myBorder = new Border() { - @Override - public void paintBorder(Component c, Graphics g, int x, int y, int width,int height) { - Graphics2D g2d = (Graphics2D)g; - g2d.setColor(UIConstants.LINE_COLOR); - g2d.drawLine(0, 0, 0, height); - g2d.drawLine(tabPane.getPreferredSize().width - 1, 0, width - 2, 0); - g2d.drawLine(0, height - 1, width - 2, height - 1); - } - - @Override - public boolean isBorderOpaque() { - return false; - } - - @Override - public Insets getBorderInsets(Component c) { - return new Insets(2, 2, 2, 2); - } - }; - /** * * @return 中间的内容面板的指定宽度 diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartCategoryPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartCategoryPane.java index c0842ab15e..0789ef53d6 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartCategoryPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartCategoryPane.java @@ -18,7 +18,6 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.Constants; import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont; -import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JSeparator; import java.awt.BorderLayout; @@ -134,7 +133,6 @@ public class ChartCategoryPane extends ChartAxisUsePane{ @Override protected void layoutContentPane() { leftcontentPane = createContentPane(); - leftcontentPane.setBorder(BorderFactory.createMatteBorder(5, 10, 5, 0, original)); this.add(leftcontentPane); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/AbstractPlotSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/AbstractPlotSeriesPane.java index e9b118df87..cf8f55bb79 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/AbstractPlotSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/AbstractPlotSeriesPane.java @@ -70,7 +70,6 @@ public abstract class AbstractPlotSeriesPane extends BasicBeanPane{ panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } - panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); return panel; } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ChartTabPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ChartTabPane.java index 495c0409ad..05b353ea07 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ChartTabPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ChartTabPane.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe.chart.gui.type; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.chart.chartattr.Chart; import com.fr.design.dialog.MultiTabPane; import com.fr.design.gui.ibutton.UIToggleButton; @@ -7,8 +9,9 @@ import com.fr.design.mainframe.chart.gui.style.legend.AutoSelectedPane; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Graphics; /** * Created by Mitisky on 16/3/9. @@ -21,9 +24,9 @@ public abstract class ChartTabPane extends MultiTabPane { @Override protected void initLayout() { JPanel tabPanel = new JPanel(new BorderLayout()); - tabPanel.setBorder(BorderFactory.createMatteBorder(0, 5, 0, 10, getBackground())); tabPanel.add(tabPane, BorderLayout.CENTER); - this.setLayout(new BorderLayout(0, 4)); + this.setLayout(new BorderLayout(0, FineUIScale.scale(10))); + this.setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); this.add(tabPanel, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java index a542f100cb..57176c256c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java @@ -1,8 +1,10 @@ package com.fr.van.chart.column; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.background.ImageBackground; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -10,28 +12,19 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; -import com.fr.design.utils.gui.UIComponentUtils; -import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.base.AttrSeriesImageBackground; import com.fr.plugin.chart.column.VanChartColumnPlot; import com.fr.stable.Constants; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.designer.component.VanChartBeautyPaneWithGradientBar; import com.fr.van.chart.designer.component.border.VanChartBorderPane; import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; -import javax.swing.BorderFactory; import javax.swing.JPanel; -import java.awt.BorderLayout; import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; /** * 新条形图系列界面 @@ -52,20 +45,13 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane { } protected JPanel getContentInPlotType() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {f}; - double[] rowSize = {p,p,p,p,p,p,p,p,p,p}; - Component[][] components = new Component[][]{ - new Component[]{createSeriesStylePane(new double[]{p,p}, new double[]{f,e})}, - new Component[]{createBorderPane()}, - new Component[]{createStackedAndAxisPane()}, - new Component[]{createTrendLinePane()}, - }; - - contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - + contentPane = FineLayoutBuilder.createVerticalLayout(0, + createSeriesStylePane(), + createBorderPane(), + createStackedAndAxisPane(), + createTrendLinePane() + ); + contentPane = FineLayoutBuilder.asBorderLayoutWrapped(contentPane); return contentPane; } @@ -74,55 +60,26 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane { return new VanChartBorderWithRadiusPane(true); } - private JPanel createSeriesStylePane(double[] row, double[] col) { - isFixedWidth = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), Toolkit.i18nText("Fine-Design_Chart_NO")}); + private JPanel createSeriesStylePane() { + isFixedWidth = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), Toolkit.i18nText("Fine-Design_Chart_NO")}); columnWidth = new UISpinnerWithPx(0,1000,1,0); - columnWidth.setBorder(BorderFactory.createEmptyBorder(0, (int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0)); seriesGap = new UINumberDragPaneWithPercent(-100, 100); categoryGap = new UINumberDragPaneWithPercent(0, 100); - isFillWithImage = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), Toolkit.i18nText("Fine-Design_Chart_NO")}); + isFillWithImage = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), Toolkit.i18nText("Fine-Design_Chart_NO")}); imagePane = new ImageBackgroundQuickPane(false); - imagePane.setBorder(BorderFactory.createEmptyBorder(0,(int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0)); - - JPanel panel1 = new JPanel(new BorderLayout()); - JPanel isFixedWidthPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Fixed_Column_Width"),isFixedWidth); - isFixedWidthPane.setBorder(BorderFactory.createEmptyBorder(0,0,6,0)); - panel1.add(isFixedWidthPane, BorderLayout.NORTH); - panel1.add(columnWidth, BorderLayout.CENTER); - - Component[][] components2 = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Gap_Series")),seriesGap}, - new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Gap_Category")),categoryGap}, + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Fixed_Column_Width")), isFixedWidth}, + new Component[]{null, columnWidth}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Gap_Series")), seriesGap}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Gap_Category")), categoryGap}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Filled_With_Image")), isFillWithImage}, + new Component[]{null, imagePane} }; - JPanel panel2 = TableLayout4VanChartHelper.createGapTableLayoutPane(components2, row, col); + JPanel borderPane = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); - UILabel fillImageLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Filled_With_Image")); - Component[][] components3 = new Component[][]{ - new Component[]{fillImageLabel, UIComponentUtils.wrapWithBorderLayoutPane(isFillWithImage)}, - }; - JPanel panel3 = TableLayout4VanChartHelper.createGapTableLayoutPane(components3, row, col); - - JPanel panel = new JPanel(new BorderLayout(0, 4)); - panel.add(panel1, BorderLayout.NORTH); - panel.add(panel2, BorderLayout.CENTER); - panel.add(panel3, BorderLayout.SOUTH); - - JPanel borderPane = new JPanel(new BorderLayout()); - borderPane.add(panel, BorderLayout.NORTH); - borderPane.add(imagePane, BorderLayout.CENTER); - isFixedWidth.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkColumnWidth(); - } - }); - isFillWithImage.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkImagePane(); - } - }); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), borderPane); + isFixedWidth.addActionListener(e -> checkColumnWidth()); + isFillWithImage.addActionListener(e -> checkImagePane()); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Filled_With_Image"), borderPane); } private void checkAll() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/AbstractVanChartScrollPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/AbstractVanChartScrollPane.java index f5d592e025..9949862884 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/AbstractVanChartScrollPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/AbstractVanChartScrollPane.java @@ -14,23 +14,9 @@ public abstract class AbstractVanChartScrollPane extends BasicScrollPane { protected void layoutContentPane() { leftcontentPane = createContentPane(); - leftcontentPane.setBorder(BorderFactory.createMatteBorder(0, 5, 0, 10, original)); this.add(leftcontentPane); } - protected void setLeftContentPaneBounds(Container parent, UIScrollBar scrollBar, int beginY, int maxheight) { - int width = parent.getWidth(); - int height = parent.getHeight(); - if (leftcontentPane.getPreferredSize().height > maxheight) { - scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, 6, height); - leftcontentPane.setBounds(0, -beginY, width - 6, height + beginY); - leftcontentPane.setBorder(BorderFactory.createMatteBorder(0, 4, 0, 4, original)); - - } else { - leftcontentPane.setBounds(0, 0, width, height); - leftcontentPane.setBorder(BorderFactory.createMatteBorder(0, 4, 0, 10, original)); - } - } public void reloaPane(JPanel pane){ super.reloaPane(pane); leftcontentPane.setBorder(BorderFactory.createEmptyBorder()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index d89a7d31e5..ce4a6492b5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -1,15 +1,16 @@ package com.fr.van.chart.designer.component; +import com.fine.theme.utils.FineLayoutBuilder; +import com.fine.theme.utils.FineUIScale; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.jxbrowser.JxUIPane; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.general.ComparatorUtils; @@ -22,7 +23,6 @@ import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.stable.StringUtils; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; @@ -52,6 +52,10 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +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; + /** * 数据点提示内容界面,含有通用设置、富文本编辑器、自定义JS界面 */ @@ -191,7 +195,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane(new String[]{ Toolkit.i18nText("Fine-Design_Chart_Common"), @@ -291,22 +289,18 @@ public class VanChartTooltipContentPane extends BasicBeanPane(Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), createTitlePositionPane()), + new Pair<>(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), createTitleStylePane()), + new Pair<>(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane), + new Pair<>(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane), + new Pair<>(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()) + ); + return FineLayoutBuilder.asBorderLayoutWrapped(column); } protected VanChartBackgroundPane creatBackgroundPane(){ @@ -166,27 +160,21 @@ public class VanChartPlotLegendPane extends BasicPane { backgroundPane = creatBackgroundPane(); fixedCheckPane = createFixedCheckPane(); JPanel panel = new JPanel(); - panel.setLayout(new BorderLayout()); + panel.setLayout(new BorderLayout(0, FineUIScale.scale(10))); panel.add(createDisplayStrategy(), BorderLayout.CENTER); panel.add(fixedCheckPane, BorderLayout.SOUTH); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {f, e}; - double[] rowSize = {p, p, p, p, p, p, p, p}; - - Component[][] components = new Component[][]{ - new Component[]{createTitlePositionPane(new double[]{p, p, p}, columnSize), null}, - new Component[]{createTitleStylePane(), null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane), null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane), null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel), null}, - }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + Column column = FineLayoutBuilder.createVerticalExpandPaneLayout(0, + new Pair<>(Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), createTitlePositionPane()), + new Pair<>(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), createTitleStylePane()), + new Pair<>(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane), + new Pair<>(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane), + new Pair<>(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel) + ); + return FineLayoutBuilder.asBorderLayoutWrapped(column); } - private JPanel createTitlePositionPane(double[] row, double[] col) { + private JPanel createTitlePositionPane() { String[] textArray = { Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Top"), Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Bottom"), @@ -213,7 +201,6 @@ public class VanChartPlotLegendPane extends BasicPane { customFloatPositionButton.setEventBannded(true); Component[][] components = new Component[][]{ - new Component[]{null, null}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")), location}, new Component[]{null, customFloatPositionButton} }; @@ -223,13 +210,12 @@ public class VanChartPlotLegendPane extends BasicPane { initPositionListener(); - JPanel positionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + JPanel positionPane = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); - JPanel panel = new JPanel(new BorderLayout()); - panel.add(positionPane, BorderLayout.NORTH); - panel.add(layoutPane, BorderLayout.CENTER); + return column(10, + cell(positionPane), cell(layoutPane) + ).getComponent(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); } private JPanel createLayoutPane() { @@ -237,16 +223,11 @@ public class VanChartPlotLegendPane extends BasicPane { new String[]{Toolkit.i18nText("Fine-Design_Chart_Layout_Flow"), Toolkit.i18nText("Fine-Design_Chart_Layout_Aligned")}, new LayoutType[]{LayoutType.FLOW, LayoutType.ALIGNED}); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - Component[][] components = new Component[][]{ - new Component[]{null, null}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Arrange")), layoutButton} }; - return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); } private void initPositionListener() { @@ -290,48 +271,34 @@ public class VanChartPlotLegendPane extends BasicPane { private JPanel createTitleStylePane() { textAttrPane = ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() : new ChartTextAttrPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); + return textAttrPane; } private JPanel createDisplayStrategy() { //区域显示策略 恢复用注释。开始删除。 maxProportion = new UINumberDragPaneWithPercent(0, 100, 1); customSize = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); + maxProportionPane = row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"))).weight(1.2), + cell(maxProportion).weight(3) + ).getComponent(); - JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), customSize); - maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); - JPanel panel = new JPanel(new BorderLayout()); - panel.add(limitSizePane, BorderLayout.NORTH); - panel.add(maxProportionPane, BorderLayout.CENTER); - - customSize.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkMaxProPortionUse(); - } - }); - return panel; - //区域显示策略 恢复用注释。结束删除。 - - //区域显示策略 恢复用注释。取消注释。 -// limitPane = new LimitPane(false); -// return limitPane; + customSize.addActionListener(e -> checkMaxProPortionUse()); + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Area_Size")), customSize}, + new Component[]{maxProportionPane, null} + }; + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); } private JPanel createFixedCheckPane() { fixedCheck = new UICheckBox(Toolkit.i18nText("Fine-Engine_Chart_Open_Fixed_Display")); fixedCheckLabel = new UILabel(Toolkit.i18nText("Fine-Engine_Chart_Fixed_Display")); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {f, e}; - double[] rowSize = {p, p}; Component[][] components = new Component[][]{ new Component[]{null, null}, new Component[]{fixedCheckLabel, fixedCheck} }; - return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(0, components, new double[]{1.2, 3}); } protected void checkAllUse() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java index 3469e26246..925d2c38b6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java @@ -1,10 +1,13 @@ package com.fr.van.chart.designer.style; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIStyle; import com.fr.base.BaseFormula; -import com.fr.base.BaseUtils; import com.fr.base.Utils; import com.fr.chart.base.TextAttr; import com.fr.chartx.config.info.constant.ConfigType; +import com.fr.design.border.FineBorderFactory; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.formula.DefaultTinyFormulaPane; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.frpane.UIBubbleFloatPane; @@ -15,8 +18,6 @@ import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; @@ -29,25 +30,24 @@ import com.fr.stable.Constants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.AbstractVanChartScrollPane; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartFloatPositionPane; import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutShadowWithRadiusPane; -import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; import java.awt.Point; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; 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; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.row; + // 属性表-样式 标题界面 public class VanChartTitlePane extends AbstractVanChartScrollPane { private static final long serialVersionUID = -2438898431228882682L; @@ -96,131 +96,108 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { private void initComponents() { isTitleVisible = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Title_Visible")); tooltipLabel = new UILabel("" + Toolkit.i18nText("Fine-Design_Chart_Title_Tooltip") + ""); - tooltipLabel.setForeground(Color.gray); - tooltipLabel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); + FineUIStyle.setStyle(tooltipLabel, FineUIStyle.LABEL_TIP); tooltipLabel.setVisible(false); - - JPanel panel = new JPanel(); - panel.setLayout(new BorderLayout()); - panel.add(isTitleVisible, BorderLayout.NORTH); - panel.add(tooltipLabel, BorderLayout.CENTER); - titlePane = createTitlePane(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p, p, p}; - Component[][] components = new Component[][]{ - new Component[]{panel}, - new Component[]{titlePane} - }; - - JPanel panel1 = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); - this.add(panel1, BorderLayout.CENTER); + this.add(column( + cell(isTitleVisible), + cell(tooltipLabel), + cell(titlePane) + ).getComponent(), BorderLayout.CENTER); - isTitleVisible.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - checkTitlePaneUse(); - } - }); + isTitleVisible.addActionListener(e -> checkTitlePaneUse()); } } private JPanel createTitlePane() { backgroundPane = createBackgroundPane(); + return column( + cell(createTitleContentPane()), + fix(10).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())), + cell(createTitlePositionPane()), + fix(10).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())), + cell(createTitleStylePane()), + fix(10).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())), + cell(new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane)), + fix(10).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())), + cell(createDisplayStrategy()) + ).getComponent(); - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {p, f}; - double[] column = {f, e}; - double[] rowSize = {p, p, p, p, p, p, p, p}; - Component[][] components = new Component[][]{ - new Component[]{createTitleContentPane(new double[]{p, p, p}, column), null}, - new Component[]{createTitlePositionPane(new double[]{p, p, p}, column), null}, - new Component[]{createTitleStylePane(), null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane), null}, - new Component[]{createDisplayStrategy(), null} - }; - - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } protected VanChartBackgroundWithOutShadowWithRadiusPane createBackgroundPane() { return new VanChartBackgroundWithOutShadowWithRadiusPane(); } - private JPanel createTitleContentPane(double[] row, double[] col) { + private JPanel createTitleContentPane() { titleContent = new DefaultTinyFormulaPane(); useHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html")); UIComponentUtils.setLineWrap(useHtml); - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"), SwingConstants.LEFT), titleContent}, - new Component[]{null, useHtml}, - }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content"), panel); + JPanel titleContentPane = column(10, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"), SwingConstants.LEFT)).weight(1.2), + cell(titleContent).weight(3) + )).getComponent(); + return new UIExpandablePane( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content"), titleContentPane); } - private JPanel createTitlePositionPane(double[] row, double[] col) { - Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; + private JPanel createTitlePositionPane() { + Icon[][] hAlignmentIconArray = {{new LazyIcon("h_left"), new LazyIcon("h_left").white()}, + {new LazyIcon("h_center"), new LazyIcon("h_center").white()}, + {new LazyIcon("h_right"), new LazyIcon("h_right").white()}}; Integer[] alignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; - - alignmentPane = new UIButtonGroup(alignmentIconArray, alignment); + alignmentPane = new UIButtonGroup<>(hAlignmentIconArray, alignment); customFloatPositionButton = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Float_Position")); UIComponentUtils.setLineWrap(customFloatPositionButton); customFloatPositionButton.setEventBannded(true); - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints"), SwingConstants.LEFT), alignmentPane}, - new Component[]{null, customFloatPositionButton} - }; - customFloatPositionPane = new VanChartFloatPositionPane(); initPositionListener(); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); + JPanel titlePositionPane = column(10, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints"))).weight(1.2), + cell(alignmentPane).weight(3) + ), + cell(customFloatPositionButton) + ).getComponent(); + + return new UIExpandablePane( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), titlePositionPane); } private JPanel createTitleStylePane() { textAttrPane = ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() : new ChartTextAttrPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); + return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); } private JPanel createDisplayStrategy() { //区域显示策略 恢复用注释。开始删除。 maxProportion = new UINumberDragPaneWithPercent(0, 100, 1); - limitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); + limitSize = new UIButtonGroup<>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); + maxProportionPane = row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"))).weight(1.2), + cell(maxProportion).weight(3) + ).getComponent(); - JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"), limitSize); - maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); JPanel panel = new JPanel(new BorderLayout()); - panel.add(limitSizePane, BorderLayout.NORTH); - panel.add(maxProportionPane, BorderLayout.CENTER); + panel.add(column(10, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"))).weight(1.2), + cell(limitSize).weight(3) + ), + cell(maxProportionPane) - limitSize.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkMaxProPortionUse(); - } - }); + ).getComponent()); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); + limitSize.addActionListener(e -> checkMaxProPortionUse()); - //区域显示策略 恢复用注释。结束删除。 + return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); - //区域显示策略 恢复用注释。取消注释。 -// limitPane = new LimitPane(); -// return limitPane; } private void initPositionListener() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java index e6eb8c6131..9c332c3e5e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java @@ -1,16 +1,15 @@ package com.fr.van.chart.designer.style.background; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.van.chart.designer.AbstractVanChartScrollPane; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.background.VanChartBackgroundPane; import com.fr.van.chart.designer.component.background.VanChartBackgroundPaneWithThemeStyle; import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane; @@ -52,16 +51,11 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane implements AutoSele protected void initLayout() { - this.setLayout(new BorderLayout()); + this.setLayout(new BorderLayout(0, FineUIScale.scale(10))); if (!paneList.isEmpty()) { - JPanel pane = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0)); if (nameArray.length > 1) { - pane.add(tabPane); - tabPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - this.add(pane, BorderLayout.NORTH); + this.add(cell(tabPane).getComponent(), BorderLayout.NORTH); } } - centerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); this.add(centerPane, BorderLayout.CENTER); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java index 045b6cd3fa..b795eff6c4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java @@ -1,13 +1,14 @@ package com.fr.van.chart.designer.style.datasheet; +import com.fine.swing.ui.layout.Column; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.DataSheet; import com.fr.chartx.config.info.constant.ConfigType; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.style.FormatPane; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; @@ -18,8 +19,8 @@ import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.type.AxisType; +import com.fr.stable.collections.combination.Pair; import com.fr.van.chart.designer.AbstractVanChartScrollPane; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.border.VanChartBorderPane; import com.fr.van.chart.designer.component.border.VanChartBorderPaneWithPreStyle; import com.fr.van.chart.designer.component.format.FormatPaneWithNormalType; @@ -27,8 +28,6 @@ import com.fr.van.chart.designer.component.format.FormatPaneWithNormalType; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; /** * 样式-数据表 @@ -54,32 +53,22 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane { private void initComponents() { isShowDataSheet = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Show_Data_Sheet")); dataSheetPane = createDataSheetPane(); - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p, p, p}; Component[][] components = creatComponent(dataSheetPane); - JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + JPanel panel = FineLayoutBuilder.compatibleTableLayout(0, components, new double[]{1}); this.setLayout(new BorderLayout()); this.add(panel, BorderLayout.CENTER); - isShowDataSheet.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - checkDataSheetPaneUse(); - } - }); + isShowDataSheet.addActionListener(e -> checkDataSheetPaneUse()); } } protected Component[][] creatComponent(JPanel dataSheetPane) { - Component[][] components = new Component[][]{ + return new Component[][]{ new Component[]{isShowDataSheet}, new Component[]{dataSheetPane} }; - return components; } // 检查数据表界面是否可用. @@ -91,19 +80,12 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane { textAttrPane = createChartTextAttrPane(); formatPane = new FormatPaneWithNormalType(); borderPane = createBorderPanePane(); + Column column = FineLayoutBuilder.createVerticalExpandPaneLayout(0, + new Pair<>(Toolkit.i18nText("Fine-Design_Report_Base_Format"), formatPane), + new Pair<>(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane), + new Pair<>(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane)); - double p = TableLayout.PREFERRED; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; - double[] columnSize = {d, e}; - double[] rowSize = {p, p, p}; - Component[][] components = new Component[][]{ - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format"), formatPane), null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane), null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane), null}, - }; - - return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.asBorderLayoutWrapped(column); } protected VanChartBorderPane createBorderPanePane() { @@ -150,7 +132,6 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane { //数据表埋点 ChartInfoCollector.getInstance().updateChartConfig(chart, ConfigType.DATA_TABLE, chart.getBuryingPointDataTableConfig()); -// plot.setDataSheet2PlotList(); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPiePlotLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPiePlotLabelPane.java index ac24b99510..09b719ab0a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPiePlotLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPiePlotLabelPane.java @@ -1,11 +1,11 @@ package com.fr.van.chart.designer.style.label; import com.fr.chart.chartattr.Plot; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.AttrLabel; import com.fr.plugin.chart.base.AttrLabelDetail; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -25,14 +25,14 @@ public class VanChartPiePlotLabelPane extends VanChartPlotLabelPane { } protected void createLabelPane() { - setLabelPane(new JPanel(new BorderLayout(0, 4))); + setLabelPane(new JPanel(new BorderLayout())); setLabelDetailPane(new VanChartPieValueLabelDetailPane(getPlot(), getParentPane(), isInCondition())); - JPanel valuePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Label"), getLabelDetailPane()); + JPanel valuePane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Value_Label"), getLabelDetailPane(), true); getLabelPane().add(valuePane, BorderLayout.NORTH); if (!isInCondition()) { pieCategoryLabelPane = new VanChartPieCategoryLabelDetailPane(getPlot(), getParentPane(), isInCondition()); - JPanel categoryPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Category_Label"), pieCategoryLabelPane); + JPanel categoryPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Category_Label"), pieCategoryLabelPane); getLabelPane().add(categoryPane, BorderLayout.CENTER); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index 0467fe3f5e..2cf72679f3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -1,9 +1,12 @@ package com.fr.van.chart.designer.style.label; +import com.fine.theme.utils.FineLayoutBuilder; +import com.fine.theme.utils.FineUIScale; import com.fr.chart.chartattr.Plot; import com.fr.chartx.TwoTuple; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicPane; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ilable.UILabel; @@ -125,7 +128,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { double[] rowSize = getLabelPaneRowSize(plot, p); Component[][] components = getLabelPaneComponents(plot, p, columnSize); - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(0, components, new double[]{1, 0}); } protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { @@ -153,7 +156,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected JPanel createBorderAndBackgroundPane() { JPanel jPanel = new JPanel(); - jPanel.setLayout(new BorderLayout(0, 5)); + jPanel.setLayout(new BorderLayout(0, FineUIScale.scale(10))); jPanel.add(createLabelBorderPane(), BorderLayout.NORTH); jPanel.add(createLabelBackgroundPane(), BorderLayout.CENTER); return jPanel; @@ -161,7 +164,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected JPanel createLabelBorderPane() { borderPane = new VanChartBorderWithShapePane(); - borderPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane); + borderPaneWithTitle = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane, true); return borderPaneWithTitle; } @@ -179,7 +182,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } }; - backgroundPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane); + backgroundPaneWithTitle = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane); return backgroundPaneWithTitle; } @@ -201,7 +204,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) { - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); + return new UIExpandablePane(title, panel); } protected TwoTuple getPositionNamesAndValues() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java index 4aed8c30a9..ab4340f361 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java @@ -1,11 +1,10 @@ package com.fr.van.chart.designer.style.label; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.chartattr.Plot; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.AttrLabel; import com.fr.van.chart.designer.PlotFactory; @@ -14,8 +13,6 @@ import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; public class VanChartPlotLabelPane extends BasicPane { private static final long serialVersionUID = -1701936672446232396L; @@ -39,7 +36,7 @@ public class VanChartPlotLabelPane extends BasicPane { this.plot = plot; this.inCondition = inCondition; isLabelShow = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Use_Label")); - labelPane = new JPanel(new BorderLayout(0, 4)); + labelPane = new JPanel(new BorderLayout()); createLabelPane(); addComponents(); } @@ -86,22 +83,12 @@ public class VanChartPlotLabelPane extends BasicPane { if (inCondition) { return labelPane; } - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p, p}; Component[][] components = new Component[][]{ new Component[]{isLabelShow}, new Component[]{labelPane} }; - isLabelShow.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - checkBoxUse(); - } - }); - - JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - return panel; + isLabelShow.addActionListener(e -> checkBoxUse()); + return FineLayoutBuilder.compatibleTableLayout(0, components, new double[]{1}); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java index 0a5f7b8feb..470e9ead02 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java @@ -1,5 +1,7 @@ package com.fr.van.chart.designer.style.series; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.chart.chartdata.model.DataProcessor; import com.fr.base.chart.chartdata.model.LargeDataModel; import com.fr.base.chart.chartdata.model.NormalDataModel; @@ -9,14 +11,12 @@ import com.fr.chart.base.AttrFillStyle; import com.fr.chart.base.GradientStyle; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; -import com.fr.design.constants.LayoutConstants; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane; import com.fr.design.widget.FRWidgetFactory; @@ -42,15 +42,16 @@ import com.fr.van.chart.designer.component.border.VanChartBorderPane; import com.fr.van.chart.designer.other.VanChartInteractivePane; import com.fr.van.chart.pie.RadiusCardLayoutPane; -import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; 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; + /** * 图表样式-系列抽象界面 */ @@ -104,13 +105,9 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP scrollPane.setViewportView(getContentInPlotType()); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); } - JPanel panel = new JPanel(new BorderLayout()); - JPanel colorPane = getColorPane(); - if (colorPane != null) { - panel.add(colorPane, BorderLayout.NORTH); - } - panel.add(getContentInPlotType(), BorderLayout.CENTER); - return panel; + return column( + cell(getColorPane()), cell(getContentInPlotType()) + ).getComponent(); } /** @@ -135,8 +132,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP panel.add(vanChartFillStylePane, BorderLayout.CENTER); } setColorPaneContent(panel); - JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel); - panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0)); + JPanel colorPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Color"), panel, true); return panel.getComponentCount() == 0 ? null : colorPane; } @@ -184,23 +180,19 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP //边框(默认没有圆角) protected JPanel createBorderPane() { borderPane = createDiffBorderPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane); + borderPane.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane); } //半径界面 protected JPanel createRadiusPane(String title) { radiusPane = initRadiusPane(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; - double[] rowSize = {p}; UILabel label = FRWidgetFactory.createLineWrapLabel(title); - label.setVerticalAlignment(SwingConstants.TOP); Component[][] components = new Component[][]{ new Component[]{label, radiusPane}, }; - radiusPaneWithTitle = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, TableLayout4VanChartHelper.COMPONENT_INTERVAL, LayoutConstants.VGAP_LARGE); + radiusPaneWithTitle = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); return ((VanChartPlot) plot).isInCustom() ? null : radiusPaneWithTitle; } @@ -284,7 +276,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP //堆积和坐标轴设置(自定义柱形图等用到) protected JPanel createStackedAndAxisPane() { stackAndAxisEditPane = new VanChartStackedAndAxisListControlPane(); - stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); + stackAndAxisEditExpandablePane = new UIExpandablePane(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); return stackAndAxisEditExpandablePane; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java index 5f76337d67..5c7e7dd2ed 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java @@ -1,12 +1,13 @@ package com.fr.van.chart.designer.style.tooltip; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.chartattr.Plot; import com.fr.design.dialog.BasicPane; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.base.AttrTooltip; @@ -20,8 +21,6 @@ import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; public class VanChartPlotTooltipPane extends BasicPane { private static final long serialVersionUID = 6087381131907589370L; @@ -47,28 +46,19 @@ public class VanChartPlotTooltipPane extends BasicPane { addComponents(plot); } - protected void addComponents(Plot plot) { + protected void addComponents(Plot plot) { isTooltipShow = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Use_Tooltip")); tooltipPane = createTooltipPane(plot); - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p,p}; Component[][] components = new Component[][]{ new Component[]{isTooltipShow}, new Component[]{tooltipPane} }; - JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + JPanel panel = FineLayoutBuilder.compatibleTableLayout(0, components, new double[]{1}); this.setLayout(new BorderLayout()); this.add(panel,BorderLayout.CENTER); - isTooltipShow.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - checkBoxUse(); - } - }); + isTooltipShow.addActionListener(e -> checkBoxUse()); } protected JPanel createTooltipPane(Plot plot) { @@ -77,25 +67,18 @@ public class VanChartPlotTooltipPane extends BasicPane { initTooltipContentPane(plot); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {f, e}; - double[] rowSize = {p,p,p,p,p,p,p,p,p}; - Component[][] components = createComponents(plot); - return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + return FineLayoutBuilder.compatibleTableLayout(0, components, new double[]{1}); } protected Component[][] createComponents(Plot plot) { - Component[][] components = new Component[][]{ + return new Component[][]{ new Component[]{tooltipContentPane,null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, + new Component[]{new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane, true),null}, + new Component[]{new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane, true),null}, new Component[]{createDisplayStrategy(plot),null}, }; - return components; } public VanChartStylePane getParentPane() { @@ -123,7 +106,7 @@ public class VanChartPlotTooltipPane extends BasicPane { components[2] = new Component[]{showAllSeries,null}; } JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); } protected String getShowAllSeriesLabelText() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java index 6253190da2..52f865356d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java @@ -2,6 +2,7 @@ package com.fr.van.chart.pie; import com.fr.chart.chartattr.Plot; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -69,7 +70,7 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel, true); } public void populateBean(Plot plot) { diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnPane.java index d3378b8956..15df8e7fa5 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnPane.java @@ -108,7 +108,6 @@ public class DSColumnPane extends BasicPane { contentPane.add(tabbedPane, BorderLayout.CENTER); - this.setPreferredSize(new Dimension(610, 400)); } @Override 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..8c27cff970 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 @@ -12,7 +12,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.write.submit.DBManipulationPane; import com.fr.form.event.Listener; import com.fr.js.JavaScript; @@ -23,8 +22,6 @@ import javax.swing.BorderFactory; 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 java.util.ArrayList; @@ -32,6 +29,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 +68,10 @@ 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); 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 +79,13 @@ 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); + + 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..967816998c 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,18 @@ 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.BorderLayout; 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.fine.swing.ui.layout.Layouts.fix; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + public class ExcelExportPane extends BasicPane { private UICheckBox isExportHidedRow; private UICheckBox isExportHidenColumn; @@ -48,81 +55,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 +111,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..32963f1d10 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.BorderLayout; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; /** * 通用 @@ -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..0e1e8fe76a 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,26 @@ 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.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; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; /** * 导出图片配置 @@ -49,40 +52,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 +111,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..2784511bae 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,20 +1,23 @@ package com.fr.design.report; - 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; import com.fr.io.attr.PDFExportAttr; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.JPanel; -import java.awt.Dimension; +import java.awt.BorderLayout; 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; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + public class PDFExportPane extends BasicPane { private UICheckBox isNeedPassword; private UITextField passwordField; @@ -25,20 +28,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 +38,12 @@ public class PDFExportPane extends BasicPane { passwordWritePane.setVisible(isNeedPassword.isSelected()); } }); - outNorthPane.add(passwordPane); - } + JPanel 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..ef4c2966b7 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 @@ -19,12 +19,18 @@ import java.awt.event.FocusEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import javax.swing.*; - -import com.fr.design.gui.ispinner.ColumnRowSpinner; +import javax.swing.Icon; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ButtonGroup; +import javax.swing.JSpinner; +import javax.swing.SpinnerNumberModel; +import javax.swing.JFormattedTextField; +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 +65,13 @@ 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.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.swing.ui.layout.Layouts.fix; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + /** * @author richer * @since 6.5.5 创建于2011-6-14 页面设置面板 @@ -74,14 +87,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 +160,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 +203,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 +226,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 +256,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 +348,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 +558,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 +835,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..cfef54ab32 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,19 @@ 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.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.cell; +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 +51,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 +84,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 +99,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(); + 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, "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..59a29b5d93 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 @@ -2,15 +2,18 @@ package com.fr.design.report.mobile; import com.fr.base.mobile.MobileFitAttrState; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.report.mobile.ElementCaseMobileAttr; -import javax.swing.*; -import java.awt.*; +import java.awt.BorderLayout; 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.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + /** * Created by 夏翔 on 2016/5/28. */ @@ -29,18 +32,17 @@ public class AppFitBrowserPane extends BasicBeanPane { } 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) { @@ -59,7 +61,6 @@ public class AppFitBrowserPane extends BasicBeanPane { } horizionPane.populateBean(ob.getHorziontalAttr()); verticalPane.populateBean(ob.getVerticalAttr()); -// radioCheckPane.populateBean(ob.isZoom()); appFitPreviewPane.refreshPreview(getCurrentFitOptions()); } @@ -68,8 +69,6 @@ public class AppFitBrowserPane extends BasicBeanPane { public ElementCaseMobileAttr updateBean() { MobileFitAttrState horizonState = horizionPane.updateBean(); MobileFitAttrState verticalState = verticalPane.updateBean(); -// boolean isZoom = radioCheckPane.updateBean(); -// return new ElementCaseMobileAttr(horizonState, verticalState, isZoom); return new ElementCaseMobileAttr(horizonState, verticalState); } 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..6f720fd919 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,14 +1,19 @@ 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; -import com.fr.design.layout.FRGUIPaneFactory; - -import javax.swing.*; +import javax.swing.ImageIcon; +import java.awt.BorderLayout; import java.util.ArrayList; +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 夏翔 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..e62eda1efe 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,15 @@ 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.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; /** * Created by plough on 2018/5/31. @@ -27,15 +27,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..d449dd1fcb 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 @@ -4,17 +4,19 @@ import com.fr.base.mobile.MobileFitAttrState; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.general.data.index.Index; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.ButtonGroup; +import java.awt.Component; 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.flex; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.fix; + /** * Created by Administrator on 2016/5/16/0016. */ @@ -27,10 +29,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 +36,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 +80,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..9afc207db6 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,14 +1,18 @@ 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; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.report.mobile.ElementCaseMobileAttr; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +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.flex; +import static com.fine.swing.ui.layout.Layouts.row; /** * Created by 方磊 on 2016/11/8. @@ -25,20 +29,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..93533777e2 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,11 +1,17 @@ package com.fr.design.report.mobile; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.report.mobile.ElementCaseMobileAttr; -import javax.swing.*; +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; /** * Created by Administrator on 2016/5/12/0012. @@ -23,23 +29,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..71b61faeed 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,17 +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 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.theme.utils.FineUIUtils.wrapComponentWithTitle; /** * Created by plough on 2018/1/8. @@ -25,51 +29,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..5720e53232 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,7 +10,6 @@ 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; @@ -16,18 +18,22 @@ import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ListCellRenderer; +import javax.swing.DefaultListCellRenderer; import javax.swing.SwingUtilities; import javax.swing.TransferHandler; +import javax.swing.BorderFactory; +import javax.swing.UIManager; 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 +71,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 +120,6 @@ public class DragToolBarPane extends WidgetToolBarPane { southToolBar.removeButtonList(); southToolBar.repaint(); northToolBar.removeButtonList(); - if (defaultToolBar == null) { return; } @@ -121,6 +142,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..0c1e2280ce 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,22 +47,21 @@ 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.Icon; 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.DefaultListCellRenderer; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.CardLayout; import java.awt.Component; import java.awt.Dimension; @@ -71,6 +72,12 @@ 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.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 +109,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 +147,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 +293,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 +324,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 +358,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 +424,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 +582,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 +655,12 @@ 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.populateIcon(((Button) widget).getIconName(), icon); } /** @@ -739,11 +754,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..dd1ec883e8 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,45 @@ 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.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; 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 +57,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..1adc107ed2 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; @@ -16,7 +15,6 @@ import com.fr.stable.StringUtils; import com.fr.web.attr.ReportWebAttr; import com.fr.design.i18n.Toolkit; -import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.InputMethodEvent; @@ -27,11 +25,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 +42,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 +53,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 +65,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 +77,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 +102,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..6a59579ddc 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; @@ -28,7 +29,7 @@ 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.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -36,6 +37,11 @@ import java.awt.event.MouseEvent; 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.flex; +import static com.fine.swing.ui.layout.Layouts.row; + public class ServerPrinterPane extends BasicPane { private JList printerList; @@ -52,38 +58,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 +89,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 +102,7 @@ public class ServerPrinterPane extends BasicPane { protected String title4PopupWindow() { return "printer"; } - + private void checkButtonEnabled() { this.editButton.setEnabled(false); this.removeButton.setEnabled(false); @@ -126,7 +123,7 @@ public class ServerPrinterPane extends BasicPane { } } } - + ActionListener addActionListener = new ActionListener(){ public void actionPerformed(ActionEvent evt){ final PrintersPane printersPane = new PrintersPane(); @@ -139,13 +136,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 +227,7 @@ public class ServerPrinterPane extends BasicPane { checkButtonEnabled(); } }; - + MouseAdapter mouseClickedListener = new MouseAdapter(){ @Override public void mouseClicked(MouseEvent e){ @@ -253,14 +250,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 +284,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 +301,7 @@ public class ServerPrinterPane extends BasicPane { } else { printer.setPrinters(null); } - + return printer; } @@ -315,25 +312,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 +350,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..b3e1e4e9f9 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,13 +7,12 @@ 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.*; +import java.awt.Insets; +import java.awt.Graphics; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import javax.swing.Icon; public class ToolBarButton extends UIButton implements MouseListener { private Widget widget; @@ -27,16 +25,8 @@ 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) { - com.fr.form.ui.Button button = (com.fr.form.ui.Button) widget; - String iconName = button.getIconName(); - if (StringUtils.isNotEmpty(iconName)) { - Image iimage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconName); - if (iimage != null) { - setIcon(new ImageIcon(iimage)); - } - } - } + //直接设置Icon图标 + setIcon(icon); this.addMouseListener(this); setMargin(new Insets(0, 0, 0, 0)); } @@ -79,7 +69,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..d7fbe0ac05 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; @@ -23,19 +27,23 @@ import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; +import javax.swing.BorderFactory; +import javax.swing.UIManager; 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.Color; 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 +56,12 @@ 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 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 +70,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 +93,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 +132,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 +168,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 +306,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..240394940d 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,60 @@ 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.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; + 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 +128,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..408d9aa459 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,10 @@ import java.net.URLConnection; 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; + public class WebJsPane extends BasicPane { private UITextField localText; private UITextField urlText; @@ -48,15 +52,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 +89,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 +120,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 +143,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 +156,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 +184,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 +217,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); } }