diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java index dcc20f6ea7..e51997bdc6 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java @@ -1,5 +1,9 @@ package com.fr.design.actions.help.alphafine; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIStyle; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.FRContext; import com.fr.base.svg.IconUtils; import com.fr.design.DesignerEnvManager; @@ -37,6 +41,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; + /** * Created by XiaXiang on 2017/4/6. */ @@ -74,13 +83,14 @@ public class AlphaFineConfigPane extends BasicPane { } private void initComponents() { - JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - createOpenPane(contentPane); - createOnlinePane(contentPane); - createShortcutsPane(contentPane); - createSearchConfigPane(contentPane); this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.add(contentPane, BorderLayout.NORTH); + add(column( + 10, + cell(createOpenPane()), + cell(createOnlinePane()), + cell(createShortcutsPane()), + cell(createSearchConfigPane()) + ).getComponent()); } private Component[][] initOnlineComponents() { @@ -91,11 +101,7 @@ public class AlphaFineConfigPane extends BasicPane { } // 搜索范围 - private void createSearchConfigPane(JPanel contentPane) { - double[] rowSize = {ROW_HEIGHT, ROW_HEIGHT, ROW_HEIGHT}; - double[] columnSize = {COLUMN_WIDTH, COLUMN_WIDTH, COLUMN_WIDTH}; - - JPanel searchConfigWrapperPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Search_Range")); + private Component createSearchConfigPane() { // 搜索选项 productDynamicsCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_News")); containActionCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Function")); @@ -105,11 +111,9 @@ public class AlphaFineConfigPane extends BasicPane { containFileContentSearchCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Templates_Content")); containTemplateShopCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Shop")); containMyTemplateCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_My_Templates")); - JPanel searchConfigPane = TableLayoutHelper.createTableLayoutPane(initSearchRangeComponents(), rowSize, columnSize); // 自定义排序 JPanel customSortWrapperPane = new JPanel(); - customSortWrapperPane.setPreferredSize(new Dimension(SEARCH_CONFIG_PANE_HEIGHT, SEARCH_CONFIG_PANE_WIDTH)); customSortWrapperPane.setAlignmentY(JPanel.TOP_ALIGNMENT); customSortLabel = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Config_Custom_Sort"), false); customSortLabel.setForeground(UIConstants.NORMAL_BLUE); @@ -123,9 +127,11 @@ public class AlphaFineConfigPane extends BasicPane { customSortLabel.setEnabled(false); } - searchConfigWrapperPane.add(searchConfigPane); - searchConfigWrapperPane.add(customSortWrapperPane); - contentPane.add(searchConfigWrapperPane); + initSearchRangeComponents(); + return FineUIUtils.wrapComponentWithTitle(column(5, + row(cell(productDynamicsCheckbox).weight(0.25), cell(containTemplateShopCheckbox).weight(0.25), cell(containDocumentCheckbox).weight(0.25), cell(customSortWrapperPane).weight(0.25)), + row(cell(containPluginCheckbox).weight(0.25), cell(containActionCheckbox).weight(0.25), cell(containMyTemplatePane).weight(0.25), flex(0.25)) + ).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Search_Range")); } /** @@ -139,15 +145,10 @@ public class AlphaFineConfigPane extends BasicPane { } - private Component[][] initSearchRangeComponents() { + private void initSearchRangeComponents() { // 我的模板checkbox设置,点击后 initMyTemplateSearchPane(); - Component[][] components = new Component[][]{ - new Component[]{productDynamicsCheckbox, containTemplateShopCheckbox, containDocumentCheckbox}, - new Component[]{containPluginCheckbox, containActionCheckbox, containMyTemplatePane}, - }; - // 添加选项点事件,无选中选项时自定排序按钮置灰 UICheckBox[] checkBoxes = new UICheckBox[]{productDynamicsCheckbox, containTemplateShopCheckbox, containDocumentCheckbox, containPluginCheckbox, containActionCheckbox, containMyTemplateCheckbox}; for (UICheckBox box : checkBoxes) { @@ -155,7 +156,6 @@ public class AlphaFineConfigPane extends BasicPane { customSortLabel.setEnabled(hasSelectedSearchRangeCheckBox()); }); } - return components; } /** @@ -184,7 +184,7 @@ public class AlphaFineConfigPane extends BasicPane { * 搜索范围-我的模板 */ private void initMyTemplateSearchPane() { - containMyTemplatePane = new JPanel(new FlowLayout(FlowLayout.LEFT, 4, 5)); + containMyTemplatePane = new JPanel(new BorderLayout(4, 5)); containMyTemplateCheckbox.setBorder(BorderFactory.createEmptyBorder()); containMyTemplateCheckbox.addActionListener(new ActionListener() { @Override @@ -199,7 +199,7 @@ public class AlphaFineConfigPane extends BasicPane { myTemplateSearchConfigButton = new JButton(); myTemplateSearchConfigButton.setBorder(BorderFactory.createEmptyBorder()); myTemplateSearchConfigButton.setMargin(new Insets(0, 0, 0, 0)); - myTemplateSearchConfigButton.setIcon(IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/config.svg")); + myTemplateSearchConfigButton.setIcon(new LazyIcon("tool_config")); myTemplateSearchMenu = new UIPopupMenu(); containTemplateNameSearchCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_AlphaFine_Config_Name_Search")); containFileContentSearchCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_AlphaFine_Config_Content_Search")); @@ -209,11 +209,13 @@ public class AlphaFineConfigPane extends BasicPane { containFileContentSearchCheckbox.setBackground(null); myTemplateSearchMenu.add(containTemplateNameSearchCheckbox); myTemplateSearchMenu.add(containFileContentSearchCheckbox); + containTemplateNameSearchCheckbox.setBorder(new ScaledEmptyBorder(0, 5, 0, 5)); + containFileContentSearchCheckbox.setBorder(new ScaledEmptyBorder(0, 5, 0, 5)); myTemplateSearchConfigButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); - GUICoreUtils.showPopupMenu(myTemplateSearchMenu, containMyTemplatePane, containMyTemplateCheckbox.getWidth(), containMyTemplatePane.getY()); + GUICoreUtils.showPopupMenu(myTemplateSearchMenu, containMyTemplatePane, containMyTemplateCheckbox.getWidth(), containMyTemplatePane.getHeight()); } @Override @@ -222,24 +224,22 @@ public class AlphaFineConfigPane extends BasicPane { myTemplateSearchMenu.setVisible(false); } }); - containMyTemplatePane.add("containMyTemplateCheckbox", containMyTemplateCheckbox); - containMyTemplatePane.add("myTemplateSearchConfigButton", myTemplateSearchConfigButton); + FineUIStyle.setStyle(myTemplateSearchConfigButton, FineUIStyle.PLAIN_BUTTON); + containMyTemplatePane.add(row(2, cell(containMyTemplateCheckbox), cell(myTemplateSearchConfigButton)).getComponent()); } - private void createShortcutsPane(JPanel contentPane) { - JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Shortcut_Config")); + private Component createShortcutsPane() { shortcutsField = new UITextField(); shortcutsField.setEditable(false); shortcutsField.selectAll(); - shortcutsField.setPreferredSize(new Dimension(100, 20)); initFieldListener(); - northPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Open") + ":")); - northPane.add(shortcutsField); UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_SetShortcuts")); label.setForeground(LABEL_TEXT); - northPane.add(label); - contentPane.add(northPane); + return FineUIUtils.wrapComponentWithTitle( + row(10, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Open") + ":")), + cell(shortcutsField), cell(label) + ).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Shortcut_Config")); } private void initFieldListener() { @@ -265,8 +265,7 @@ public class AlphaFineConfigPane extends BasicPane { }); } - private void createOnlinePane(JPanel contentPane) { - JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Search_Type")); + private Component createOnlinePane() { searchOnlineCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Enable_Internet_Search")); needSegmentationCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Enable_Segmentation")); searchOnlineCheckbox.addActionListener(new ActionListener() { @@ -292,15 +291,12 @@ public class AlphaFineConfigPane extends BasicPane { double[] rowSize = {ROW_HEIGHT}; double[] columnSize = {COLUMN_WIDTH, COLUMN_WIDTH, COLUMN_WIDTH}; JPanel onlinePane = TableLayoutHelper.createTableLayoutPane(initOnlineComponents(), rowSize, columnSize); - northPane.add(onlinePane); - contentPane.add(northPane); + return FineUIUtils.wrapComponentWithTitle(onlinePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Search_Type")); } - private void createOpenPane(JPanel contentPane) { - JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Enable")); + private Component createOpenPane() { enabledCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Enable_AlphaFine")); - northPane.add(enabledCheckbox); - contentPane.add(northPane); + return FineUIUtils.wrapComponentWithTitle(enabledCheckbox, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Enable")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java index 92483988d7..fe8f2cf836 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java @@ -1,6 +1,6 @@ package com.fr.design.actions.help.alphafine.component; -import com.fr.base.svg.IconUtils; +import com.fine.theme.icon.LazyIcon; import com.fr.design.actions.help.alphafine.AlphaFineConfigPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -74,14 +74,14 @@ public class CustomSortPane extends JPanel { } private void createToolbarPane() { - top = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top.svg")); - bottom = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom.svg")); - up = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up.svg")); - down = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down.svg")); - top.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top_disable.svg")); - bottom.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom_disable.svg")); - up.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up_disable.svg")); - down.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down_disable.svg")); + top = new UIButton(new LazyIcon("to_top")); + bottom = new UIButton(new LazyIcon("to_bottom")); + up = new UIButton(new LazyIcon("move_up")); + down = new UIButton(new LazyIcon("move_down")); + top.setDisabledIcon(new LazyIcon("to_top").disabled()); + bottom.setDisabledIcon(new LazyIcon("to_bottom").disabled()); + up.setDisabledIcon(new LazyIcon("move_up").disabled()); + down.setDisabledIcon(new LazyIcon("move_down").disabled()); top.addActionListener(e -> { SwingUtilities.invokeLater(() -> { sortItemPane.setComponentZOrder(selectedLabel, 0); diff --git a/designer-base/src/main/java/com/fr/design/condition/CellHighlightAddMenuDef.java b/designer-base/src/main/java/com/fr/design/condition/CellHighlightAddMenuDef.java index 6d142b4ebe..fe47d1088c 100644 --- a/designer-base/src/main/java/com/fr/design/condition/CellHighlightAddMenuDef.java +++ b/designer-base/src/main/java/com/fr/design/condition/CellHighlightAddMenuDef.java @@ -29,7 +29,9 @@ public class CellHighlightAddMenuDef extends MenuDef { // 生成UIButton,iconpath不可为null public UIButton createUIButton() { if (createdButton == null) { - if (this.iconPath != null && this.name != null) { + if (icon != null) { + createdButton = new UIButton(icon); + } else if (this.iconPath != null && this.name != null) { createdButton = new UIButton(BaseUtils.readIcon(this.iconPath)); } else if (this.iconPath != null) { createdButton = new UIButton(BaseUtils.readIcon(this.iconPath)); diff --git a/designer-base/src/main/java/com/fr/design/condition/ConditionAttrSingleConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/ConditionAttrSingleConditionPane.java index 0952253f4e..751f8b2676 100644 --- a/designer-base/src/main/java/com/fr/design/condition/ConditionAttrSingleConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/ConditionAttrSingleConditionPane.java @@ -40,7 +40,6 @@ public abstract class ConditionAttrSingleConditionPane extends SingleConditio conditionAttributesPane.resetUseAbleActionList(); conditionAttributesPane.updateMenuDef(); conditionAttributesPane.checkConditionPane(); - conditionAttributesPane.resetWindow(); conditionAttributesPane.redraw(); } diff --git a/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java b/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java index e96edbdf07..219925d8fc 100644 --- a/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java @@ -3,6 +3,7 @@ package com.fr.design.condition; 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.fr.common.annotations.Open; @@ -32,7 +33,7 @@ import static com.fine.swing.ui.layout.Layouts.row; @Open public abstract class ConditionAttributesPane extends BasicBeanPane { - private static final int MIN_HEIGHT = 60; + private static final int MAT_HEIGHT = 120; protected CellHighlightAddMenuDef menuDef; protected JPanel selectedItemPane; @@ -44,7 +45,16 @@ public abstract class ConditionAttributesPane extends BasicBeanPane { //可用的Actions. protected java.util.List useAbleActionList = new java.util.ArrayList(); - protected JScrollPane selectedItemScrollPane = new JScrollPane(); + protected JScrollPane selectedItemScrollPane = new JScrollPane() { + @Override + public Dimension getPreferredSize() { + Dimension size = super.getPreferredSize(); + if (size.height > MAT_HEIGHT) { + size.height = MAT_HEIGHT; + } + return size; + } + }; protected void initComponents() { this.setLayout(new BorderLayout()); @@ -70,18 +80,19 @@ public abstract class ConditionAttributesPane extends BasicBeanPane { addItemPane.add(toolBar, BorderLayout.WEST); addItemPane.setBorder(new FineRoundBorder()); + addItemPane.setPreferredSize(new Dimension(addItemPane.getPreferredSize().width, FineUIScale.scale(24))); selectedItemPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); // 选中的添加Itempane selectedItemScrollPane.setViewportView(selectedItemPane); selectedItemScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - selectedItemScrollPane.setMinimumSize(new Dimension((int) selectedItemScrollPane.getPreferredSize().getWidth(), MIN_HEIGHT)); + dealScrollPane(selectedItemScrollPane); this.add(FineUIUtils.wrapComponentWithTitle(column( 10, - row(cell(addItemPane),flex()), + row(cell(addItemPane), flex()), cell(selectedItemScrollPane).with(it -> it.setBorder(new FineRoundBorder())), fix(10) ).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Property")), BorderLayout.NORTH); @@ -139,13 +150,6 @@ public abstract class ConditionAttributesPane extends BasicBeanPane { } } - /** - * 根据所需属性个数设置属性布局大小 - */ - public void resetWindow() { - selectedItemScrollPane.setPreferredSize(new Dimension(selectedItemScrollPane.getWidth(), Math.min(35 * (classPaneMap.size() - useAbleActionList.size()), 150))); - } - public void removeConditionAttrSingleConditionPane(JComponent component) { selectedItemPane.remove(component); } diff --git a/designer-base/src/main/java/com/fr/design/condition/DSColumnLiteConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/DSColumnLiteConditionPane.java index 1422202a14..6ae84c14cb 100644 --- a/designer-base/src/main/java/com/fr/design/condition/DSColumnLiteConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/DSColumnLiteConditionPane.java @@ -1,5 +1,6 @@ package com.fr.design.condition; +import com.fine.theme.utils.FineUIScale; import com.fr.data.condition.CommonCondition; import com.fr.data.condition.JoinCondition; import com.fr.data.core.Compare; @@ -115,15 +116,19 @@ public class DSColumnLiteConditionPane extends LiteConditionPane extends BasicBeanPa cell(northButtonPane), row( cell(treeScrollPane).weight(0.75), cell(buttonPane).weight(0.25) - ) + ).weight(1) ).with(it -> { it.setBorder(new FineRoundBorder()); it.setOpaque(true); @@ -512,10 +513,11 @@ public abstract class LiteConditionPane extends BasicBeanPa conditionTitleLabel = new UILabel(); FineUIUtils.wrapBoldLabelWithUnderline(conditionTitleLabel); UILabel conditionTypeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Type") + ":"); + conditionTypeLabel.setPreferredSize(FineUIScale.scale(new Dimension(68, 24))); commonRadioButton.addActionListener(radioActionListener); formulaRadioButton.addActionListener(radioActionListener); - conditonTypePane = row(10, - cell(conditionTypeLabel).weight(0.15), cell(commonRadioButton), cell(formulaRadioButton), flex() + conditonTypePane = row( + cell(conditionTypeLabel), fix(LayoutConstants.VGAP_MEDIUM), cell(commonRadioButton), fix(10), cell(formulaRadioButton), flex() ).getComponent(); JPanel conditionWrapperPane = column(10, cell(conditionTitleLabel), @@ -539,9 +541,12 @@ public abstract class LiteConditionPane extends BasicBeanPa conditionCardPane.add(formulaConditionPane, "FORMULA"); formulaTextArea = new UITextArea(); UIButton editFormulaButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Lite_Condition_Define")); - formulaConditionPane.add(row(10, - cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Lite_Condition_Formula") + " =")), + formulaConditionPane.add(row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Lite_Condition_Formula") + " =")) + .with(it -> it.setPreferredSize(FineUIScale.scale(new Dimension(68, 24)))), + fix(LayoutConstants.VGAP_MEDIUM), cell(formulaTextArea).weight(2), + fix(10), cell(editFormulaButton)) .getComponent()); editFormulaButton.addActionListener(actionListener1); @@ -572,11 +577,11 @@ public abstract class LiteConditionPane extends BasicBeanPa cell(andRadioButton).weight(0.5), cell(orRadioButton).weight(0.5) ).weight(0.35), - flex(0.4), + flex(0.3), row(5, cell(addButton).weight(0.5), cell(modifyButton).weight(0.5) - ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 8, 0, 0))).weight(0.25) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 8, 0, 0))).weight(0.35) ).with(it -> it.setBorder(BorderFactory.createCompoundBorder( FineBorderFactory.createDefaultUnderlineBorder(), new ScaledEmptyBorder(5, 5, 5, 5)) diff --git a/designer-base/src/main/java/com/fr/design/condition/ObjectLiteConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/ObjectLiteConditionPane.java index c39d5b7446..3bec57e955 100644 --- a/designer-base/src/main/java/com/fr/design/condition/ObjectLiteConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/ObjectLiteConditionPane.java @@ -2,8 +2,11 @@ package com.fr.design.condition; import java.awt.BorderLayout; import java.awt.Component; +import java.awt.Dimension; import javax.swing.DefaultComboBoxModel; + +import com.fine.theme.utils.FineUIScale; import com.fr.design.gui.ilable.UILabel; import javax.swing.JList; import javax.swing.JPanel; @@ -78,13 +81,14 @@ public class ObjectLiteConditionPane extends LiteConditionPane }); conditionValuePane = ValueEditorPaneFactory.createAllValueEditorPaneWithGlobalListener(); + UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ConditionB_Operator") + ":"); + label.setPreferredSize(FineUIScale.scale(new Dimension(68, 24))); - Component[][] components = { { new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ConditionB_Operator") + ":"), new UILabel() }, - { conditionOPComboBox, conditionValuePane } }; + Component[][] components = { { label, conditionOPComboBox, conditionValuePane }}; double p = TableLayout.PREFERRED; - double rowSize[] = { p, p }; - double columnSize[] = { p, TableLayout.FILL }; + double rowSize[] = { p }; + double columnSize[] = { p, p, TableLayout.FILL }; JPanel leftPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); this.add(leftPanel, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java index 8f2c3008c0..0e5f23dcf4 100644 --- a/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java @@ -1,11 +1,14 @@ package com.fr.design.condition; +import java.awt.Color; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; @@ -30,6 +33,8 @@ public abstract class SingleConditionPane extends BasicPane { cancel.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Remove")); cancel.addActionListener(cancleListener); cancel.setMargin(new Insets(0, 0, 0, 0)); + cancel.setBorder(new ScaledEmptyBorder(0, 0, 0, 20)); + cancel.setBackground(FlatUIUtils.getUIColor("default.background", new Color(246, 248, 250, 255))); } } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java index 4c2e6eb897..2cb5813ccd 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java @@ -2,7 +2,9 @@ package com.fr.design.data.datapane.connect; 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.base.BaseUtils; import com.fr.base.svg.IconUtils; import com.fr.data.core.db.TableProcedure; @@ -77,7 +79,7 @@ public class ConnectionTableProcedurePane extends BasicPane { JPanel centerPane = initCenterPane(); this.add(connectionComboBox, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); - this.setPreferredSize(new Dimension(WIDTH, getPreferredSize().height)); + this.setPreferredSize(new Dimension(FineUIScale.scale(WIDTH), getPreferredSize().height)); addKeyMonitor(); } @@ -174,8 +176,8 @@ public class ConnectionTableProcedurePane extends BasicPane { searchField.setPlaceholder(Toolkit.i18nText("Fine-Design_Basic_Table_Search")); searchField.getDocument().addDocumentListener(searchListener); // 搜索图标 - UILabel searchLabel = new UILabel(IconUtils.readIcon("/com/fr/design/images/data/search")); - searchLabel.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3)); + UILabel searchLabel = new UILabel(new LazyIcon("search")); + searchLabel.setBorder(new ScaledEmptyBorder(0, 3, 0, 3)); searchField.setBorder(null); panel.add(row(cell(searchLabel), cell(searchField).weight(1)).with(it -> it.setBorder(new FineRoundBorder())).getComponent()); panel.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java index 08c8e36660..b04b820617 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java @@ -1,6 +1,8 @@ package com.fr.design.data.datapane.connect; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; @@ -48,7 +50,7 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { protected void initComponents() { this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); - Dimension buttonSize = new Dimension(24, 24); + Dimension buttonSize = FineUIScale.scale(new Dimension(24, 24)); itemComboBox = new UIComboBox(); itemComboBox.setEnabled(true); this.add(itemComboBox, BorderLayout.CENTER); @@ -56,13 +58,14 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { JPanel jPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 0 ,4); editButton = initEditButton(editButton, buttonSize); editButton.setBorder(null); - editButton.setBackground(new Color(246, 248, 250, 255)); + editButton.setBackground(FlatUIUtils.getUIColor("default.background", new Color(246, 248, 250, 255))); jPanel.add(editButton); jPanel.add(refreshButton); + jPanel.setOpaque(true); this.add(jPanel, BorderLayout.EAST); refreshButton.setPreferredSize(buttonSize); refreshButton.setBorder(null); - refreshButton.setBackground(new Color(246, 248, 250, 255)); + refreshButton.setBackground(FlatUIUtils.getUIColor("default.background", new Color(246, 248, 250, 255))); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { refreshItems(); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java index dfd47b424f..29a1636a09 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java @@ -75,7 +75,7 @@ public class JNDIDefPane extends JPanel { "org.jboss.naming.HttpNamingContextFactory", "org.jnp.interfaces.NamingContextFactory", "com.caucho.burlap.BurlapContextFactory", }); JNDIFactoryComboBox.setEditable(true); JNDIFactoryComboBox.addActionListener(jndiListener); - JNDIFactoryComboBox.setPreferredSize(FineUIScale.scale(new Dimension(30, JNDIFactoryComboBox.getPreferredSize().height + 2))); + JNDIFactoryComboBox.setPreferredSize(new Dimension(FineUIScale.scale(30), JNDIFactoryComboBox.getPreferredSize().height + FineUIScale.scale(2))); // 上下文 JPanel contextPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/common/ChooseMark.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/common/ChooseMark.java index 099e9a960a..aef396d626 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/common/ChooseMark.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/common/ChooseMark.java @@ -1,11 +1,17 @@ package com.fr.design.data.datapane.preview.desensitization.view.common; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.design.gui.ibutton.UIRadioButton; import javax.swing.AbstractCellEditor; +import javax.swing.BorderFactory; +import javax.swing.JPanel; import javax.swing.JTable; +import javax.swing.UIManager; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; +import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; /** @@ -17,16 +23,21 @@ import java.awt.Component; */ public class ChooseMark extends AbstractCellEditor implements TableCellEditor, TableCellRenderer { - private final UIRadioButton selectedButton; + private UIRadioButton selectedButton; + private final JPanel pane = new JPanel(new BorderLayout()); public ChooseMark() { this.selectedButton = new UIRadioButton(); + this.selectedButton.setOpaque(false); + pane.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + pane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); } @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { selectedButton.setSelected(isSelected); - return selectedButton; + pane.add(this.selectedButton); + return pane; } @Override @@ -36,7 +47,10 @@ public class ChooseMark extends AbstractCellEditor implements TableCellEditor, T @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + pane.removeAll(); + selectedButton = new UIRadioButton(); selectedButton.setSelected(isSelected); - return selectedButton; + pane.add(this.selectedButton); + return pane; } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/common/DesensitizationOpenPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/common/DesensitizationOpenPane.java index e04c3fed0e..0cf850d4dc 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/common/DesensitizationOpenPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/common/DesensitizationOpenPane.java @@ -1,5 +1,6 @@ package com.fr.design.data.datapane.preview.desensitization.view.common; +import com.fine.theme.utils.FineUIUtils; import com.fr.base.svg.IconUtils; import com.fr.design.border.UITitledBorder; import com.fr.design.constants.UIConstants; @@ -14,11 +15,15 @@ import com.fr.general.locale.LocaleMark; import com.fr.log.FineLoggerFactory; import javax.swing.JPanel; +import java.awt.BorderLayout; import java.awt.Desktop; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.net.URL; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + /** * 启用数据脱敏的面板 * @@ -45,10 +50,7 @@ public class DesensitizationOpenPane extends JPanel { public DesensitizationOpenPane() { - VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP); - layout.setAlignLeft(true); - this.setLayout(layout); - this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Report_Desensitization_Config"))); + this.setLayout(new BorderLayout()); JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); // 启用数据脱敏的勾选框 @@ -73,10 +75,7 @@ public class DesensitizationOpenPane extends JPanel { // 提示Label tipsLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Desensitization_Opened_Tooltips")); - tipsLabel.setForeground(UIConstants.CHECK_BOX_TIP_FONT_COLOR); - - this.add(panel); - this.add(tipsLabel); + this.add(FineUIUtils.wrapComponentWithTitle(column(10, cell(panel), cell(tipsLabel)).getComponent(), Toolkit.i18nText("Fine-Design_Report_Desensitization_Config"))); } /** diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleChoosePane.java index d37ed152d2..12a1feb833 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleChoosePane.java @@ -1,5 +1,7 @@ package com.fr.design.data.datapane.preview.desensitization.view.rule; +import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.svg.IconUtils; import com.fr.data.desensitize.rule.DesensitizationRuleManager; import com.fr.data.desensitize.rule.base.DesensitizationRule; @@ -18,9 +20,11 @@ import com.fr.stable.StringUtils; import com.fr.stable.collections.CollectionUtils; import javax.swing.AbstractCellEditor; +import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JTable; import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import java.awt.CardLayout; @@ -131,7 +135,6 @@ public class DesensitizationRuleChoosePane extends JPanel { this.setDefaultEditor(DesensitizationRuleStatusPane.class, new DesensitizationRuleStatusPane()); this.setDefaultRenderer(DesensitizationRuleStatusPane.class, new DesensitizationRuleStatusPane()); this.createTable().getColumnModel().getColumn(0).setMaxWidth(20); - this.createTable().getColumnModel().getColumn(3).setMaxWidth(60); } @Override @@ -199,6 +202,9 @@ public class DesensitizationRuleChoosePane extends JPanel { // 规则状态 this.ruleStatusLabel = new UILabel(); this.ruleStatusLabel.setForeground(Color.RED); + this.ruleStatusLabel.setOpaque(true); + this.ruleStatusLabel.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + this.ruleStatusLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor"))); } /** @@ -243,7 +249,7 @@ public class DesensitizationRuleChoosePane extends JPanel { public AddRuleAction() { this.setName(Toolkit.i18nText("Fine-Design_Report_Desensitization_Add")); - this.setSmallIcon("/com/fr/design/standard/add/add_black", false); + this.setSmallIcon(new LazyIcon("add")); } @Override @@ -276,7 +282,7 @@ public class DesensitizationRuleChoosePane extends JPanel { public EditRuleAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Edit")); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/standard/edit/edit")); + this.setSmallIcon(new LazyIcon("edit")); } @Override @@ -322,7 +328,7 @@ public class DesensitizationRuleChoosePane extends JPanel { public DeleteRuleAction(Component parent) { super(parent); this.setName(Toolkit.i18nText("Fine-Design_Basic_Base_Remove")); - this.setSmallIcon("/com/fr/design/images/control/remove"); + this.setSmallIcon(new LazyIcon("remove")); } @Override @@ -349,7 +355,7 @@ public class DesensitizationRuleChoosePane extends JPanel { public DebugRuleAction(Component parent) { this.parent = parent; this.setName(Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Debug")); - this.setSmallIcon("/com/fr/design/standard/debug/debug"); + this.setSmallIcon(new LazyIcon("debug")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleDebugPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleDebugPane.java index eba6d10899..fc7fdb8852 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleDebugPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleDebugPane.java @@ -1,5 +1,7 @@ package com.fr.design.data.datapane.preview.desensitization.view.rule; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.data.desensitize.calculate.DesensitizationCalculator; import com.fr.data.desensitize.rule.base.DesensitizationRule; import com.fr.design.dialog.BasicPane; @@ -22,6 +24,11 @@ import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; +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; + /** * 脱敏规则调试页 * @@ -48,9 +55,8 @@ public class DesensitizationRuleDebugPane extends BasicPane { } private JPanel initNorthPane() { - JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Description")); + JPanel northPane = new JPanel(new BorderLayout()); JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.setBorder(BorderFactory.createEmptyBorder(20, 10, 0, 0)); UILabel desensitizationRule = new UILabel(Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Algorithm")); UILabel characterReplace = new UILabel(rule.getRuleType().getRuleTypeName()); UILabel description = new UILabel(DesensitizationRule.getDescription(rule)); @@ -65,14 +71,14 @@ public class DesensitizationRuleDebugPane extends BasicPane { new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED}, 20), BorderLayout.CENTER); - northPane.add(panel); + northPane.add(FineUIUtils.wrapComponentWithTitle(panel, Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Description"))); + northPane.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); return northPane; } private JPanel initCenterPane() { - JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Debug")); + JPanel centerPane = new JPanel(new BorderLayout()); JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.setBorder(BorderFactory.createEmptyBorder(20, 10, 0, 0)); UILabel beforeDesensitize = new UILabel(Toolkit.i18nText("Fine-Design_Report_Desensitization_Before")); UITextField beforeDesensitizeText = new UITextField(20); @@ -105,19 +111,14 @@ public class DesensitizationRuleDebugPane extends BasicPane { } }); - JComponent[][] components = new JComponent[][]{ - {beforeDesensitize, beforeDesensitizeText, desensitizeButton}, - {afterDesensitize, afterDesensitizeText, new UILabel()} - }; - panel.add( - TableLayoutHelper.createCommonTableLayoutPane( - components, - new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED}, - new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}, - 20), - BorderLayout.CENTER); + beforeDesensitize.setBorder(new ScaledEmptyBorder(0, 0, 0, 10)); + afterDesensitize.setBorder(new ScaledEmptyBorder(0, 0, 0, 10)); + panel.add(column(10, + row(cell(beforeDesensitize), cell(beforeDesensitizeText).weight(0.6), flex(0.02), cell(desensitizeButton).weight(0.2), flex()), + row(cell(afterDesensitize), cell(afterDesensitizeText).weight(0.82), flex()) + ).getComponent()); - centerPane.add(panel); + centerPane.add(FineUIUtils.wrapComponentWithTitle(panel, Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Debug"))); return centerPane; } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRulePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRulePane.java index ba8b00d735..10c405f1c1 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRulePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRulePane.java @@ -1,5 +1,6 @@ package com.fr.design.data.datapane.preview.desensitization.view.rule; +import com.fine.theme.utils.FineUIUtils; import com.fr.data.desensitize.rule.base.DesensitizationRule; import com.fr.data.desensitize.rule.base.DesensitizationRuleSource; import com.fr.design.beans.BasicBeanPane; @@ -11,6 +12,9 @@ import javax.swing.JPanel; import java.awt.BorderLayout; import java.util.Map; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + /** * 脱敏规则展示页 * @@ -49,14 +53,14 @@ public class DesensitizationRulePane extends BasicBeanPane private void initPane() { // 内容面板 contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - contentPane.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Choose"))); this.add(contentPane, BorderLayout.CENTER); // 规则来源选择Pane ruleSourceChoosePane = new DesensitizationRuleSourceChoosePane(this); // 规则选择Pane ruleChoosePane = new DesensitizationRuleChoosePane(latestRules); - contentPane.add(ruleSourceChoosePane, BorderLayout.NORTH); - contentPane.add(ruleChoosePane, BorderLayout.CENTER); + + contentPane.add(FineUIUtils.wrapComponentWithTitle(column(10, cell(ruleSourceChoosePane), cell(ruleChoosePane)).getComponent(), + Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Choose"))); } /** diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java index 52b7e5b19b..5ee8127b7a 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java @@ -1,5 +1,7 @@ package com.fr.design.data.datapane.preview.desensitization.view.setting; +import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.data.desensitize.base.DesensitizationTableData; import com.fr.data.desensitize.base.TableDataDesensitizationItem; import com.fr.data.desensitize.rule.DesensitizationRuleManager; @@ -24,10 +26,12 @@ import com.fr.stable.StringUtils; import org.jetbrains.annotations.Nullable; import javax.swing.AbstractCellEditor; +import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JTable; import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.event.CellEditorListener; import javax.swing.event.ChangeEvent; import javax.swing.table.TableCellEditor; @@ -277,6 +281,9 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter implemen sqlSplitPane.add(box, BorderLayout.CENTER); - box.setMinimumSize(new Dimension(300, 400)); + box.setMinimumSize(FineUIScale.scale(new Dimension(300, 400))); - this.connectionTableProcedurePane.setMinimumSize(new Dimension(230, 400)); - this.connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400)); + this.connectionTableProcedurePane.setMinimumSize(FineUIScale.scale(new Dimension(230, 400))); + this.connectionTableProcedurePane.setMaximumSize(FineUIScale.scale(new Dimension(500, 400))); JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, this.connectionTableProcedurePane, sqlSplitPane); + mainSplitPane.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); mainSplitPane.setOneTouchExpandable(true); contentPane.add(mainSplitPane, BorderLayout.CENTER); } @@ -630,7 +632,7 @@ public class DBTableDataPane extends AbstractTableDataPane implemen public EditPageQueryAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Page_Query")); this.setMnemonic('L'); - this.setSmallIcon(new LazyIcon("text")); + this.setSmallIcon(new LazyIcon("page_query")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java index 5a4f3fca6f..293c096ae3 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java @@ -1,6 +1,8 @@ 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.BaseUtils; import com.fr.base.StoreProcedureParameter; import com.fr.data.core.db.TableProcedure; @@ -100,7 +102,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp storeProcedureContext.setEditable(false); UIScrollPane storeProcedureContextPane = new UIScrollPane(storeProcedureContext); storeProcedureContextPane.setBorder(new UIRoundedBorder(UIManager.getColor("defaultBorderColor"), 1, UIConstants.ARC)); - storeProcedureContextPane.setPreferredSize(new Dimension(680, 600)); + storeProcedureContextPane.setPreferredSize(FineUIScale.scale(new Dimension(680, 600))); JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); namePane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Stored_Procedure") + ":")); @@ -126,11 +128,12 @@ public class ProcedureDataPane extends AbstractTableDataPane imp // 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table initconnectionTableProcedurePane(); this.setLayout(new BorderLayout(4, 4)); - this.connectionTableProcedurePane.setMinimumSize(new Dimension(230, 400)); - this.connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400)); - box.setMinimumSize(new Dimension(300, 400)); + this.connectionTableProcedurePane.setMinimumSize(FineUIScale.scale(new Dimension(230, 400))); + this.connectionTableProcedurePane.setMaximumSize(FineUIScale.scale(new Dimension(500, 400))); + box.setMinimumSize(FineUIScale.scale(new Dimension(300, 400))); // 使用SplitPane JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane); + mainSplitPane.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); mainSplitPane.setOneTouchExpandable(true); this.add(mainSplitPane, BorderLayout.CENTER); } 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 a15e6335cc..4345de09ea 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 @@ -317,7 +317,7 @@ public abstract class BasicPane extends JPanel { cell(showfield = new UILabel(" ")).weight(0.3) ).getComponent()); showfield.setForeground(new Color(204, 0, 1)); - showfield.setPreferredSize(FineUIScale.scale(new Dimension(220, showfield.getPreferredSize().height))); + showfield.setPreferredSize(new Dimension(FineUIScale.scale(220), showfield.getPreferredSize().height)); this.add(northPane, BorderLayout.NORTH); this.centerPane = bPane; this.add(bPane, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java index e629f8be1e..f7024d9743 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java @@ -2,6 +2,7 @@ package com.fr.design.gui.controlpane; 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; @@ -383,7 +384,7 @@ public abstract class JListControlPane extends JControlPane implements ListContr @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - setPreferredSize(new Dimension(list.getWidth(), 24)); + setPreferredSize(FineUIScale.scale(new Dimension(list.getWidth(), 24))); if (value instanceof ListModelElement) { ListModelElement element = ((ListModelElement) value); Nameable nameable = element.wrapper; diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index 16ebf0ff66..0a97cb1c11 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -192,12 +192,12 @@ public abstract class UIControlPane extends JControlPane { private JComponent editPane; private PopupToolPane popupToolPane; private static final int WIDTH = 570; - private static final int HEIGHT = 490; + private static final int HEIGHT = 553; PopupEditDialog(JComponent pane) { super(DesignerContext.getDesignerFrame()); setUndecorated(true); - pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10)); + pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.editPane = pane; JPanel editPaneWrapper = new JPanel(new BorderLayout()); popupToolPane = new PopupToolPane(this); diff --git a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java index 80e7e88bbf..26834f3074 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java @@ -1,5 +1,9 @@ package com.fr.design.gui.icombocheckbox; +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.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.gui.icontainer.UIScrollPane; @@ -81,7 +85,8 @@ public class UICheckListPopup extends UIPopupMenu { checkboxPane.setLayout(new GridLayout(checkBoxList.size(), 1, 0, 0)); checkboxPane.setBackground(Color.WHITE); jScrollPane = new UIScrollPane(checkboxPane); - + jScrollPane.setBorder(new FineRoundBorder()); + jScrollPane.setBackground(FlatUIUtils.getUIColor("default.background", new Color(246, 248, 250))); this.setLayout(new BorderLayout()); this.add(jScrollPane, BorderLayout.CENTER); @@ -106,10 +111,10 @@ public class UICheckListPopup extends UIPopupMenu { } addSelectListener(); - jScrollPane.setPreferredSize(new Dimension(130, checkBoxList.size() * CHECKBOX_HEIGHT + 10)); + jScrollPane.setPreferredSize(FineUIScale.scale(new Dimension(140, checkBoxList.size() * CHECKBOX_HEIGHT + 10))); //超过1页的数量时显示滚动条 if (checkBoxList.size() > maxDisplayNumber) { - jScrollPane.setPreferredSize(new Dimension(130, maxDisplayNumber * CHECKBOX_HEIGHT)); + jScrollPane.setPreferredSize(FineUIScale.scale(new Dimension(140, maxDisplayNumber * CHECKBOX_HEIGHT))); } checkboxPane.repaint(); jScrollPane.repaint(); @@ -117,11 +122,11 @@ public class UICheckListPopup extends UIPopupMenu { private void addOneCheckValue(Object checkValue) { JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - checkPane.setPreferredSize(new Dimension(120, CHECKBOX_HEIGHT)); + checkPane.setPreferredSize(FineUIScale.scale(new Dimension(140, CHECKBOX_HEIGHT))); final JCheckBox temp = createCheckbox(); final UILabel label = new UILabel(checkValue.toString()); label.setBackground(Color.WHITE); - label.setPreferredSize(new Dimension(80, 20)); + label.setPreferredSize(FineUIScale.scale(new Dimension(100, 20))); checkPane.setBackground(Color.WHITE); checkPane.add(temp); checkPane.add(label); @@ -137,10 +142,10 @@ public class UICheckListPopup extends UIPopupMenu { private JCheckBox createCheckbox() { JCheckBox checkBox = new JCheckBox(); - checkBox.setPreferredSize(new Dimension(20, 20)); + checkBox.setPreferredSize(FineUIScale.scale(new Dimension(20, 20))); checkBox.setBackground(Color.WHITE); - checkBox.setIcon(IOUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL)); - checkBox.setSelectedIcon(IOUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED)); + checkBox.setIcon(new LazyIcon("checkbox_unchecked")); + checkBox.setSelectedIcon(new LazyIcon("checkbox_checked")); return checkBox; } @@ -252,17 +257,17 @@ public class UICheckListPopup extends UIPopupMenu { private void switchSelectIcon(int selectCount) { JCheckBox checkBox = checkBoxList.get(0); if (selectCount == 0) { - checkBox.setIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL)); + checkBox.setIcon(new LazyIcon("checkbox_unchecked")); } else if (selectCount < checkBoxList.size() - 1) { //虽然有选中,但是要判断此时全选状态去换图标 if (checkBoxList.get(0).isSelected()) { - checkBox.setSelectedIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_HATFSELECT)); + checkBox.setSelectedIcon(new LazyIcon("checkbox_checked")); } else { - checkBox.setIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_HATFSELECT)); + checkBox.setIcon(new LazyIcon("checkbox_part_checked")); } } else { //全选了,图标要换回来 - checkBox.setSelectedIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED)); + checkBox.setIcon(new LazyIcon("checkbox_checked")); } } diff --git a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java index ce0a9f869e..1925fb988d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java @@ -1,5 +1,7 @@ package com.fr.design.gui.icombocheckbox; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; import com.fr.base.BaseUtils; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; @@ -11,10 +13,12 @@ import com.fr.design.icon.IconPathConstants; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.stable.StringUtils; +import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; +import javax.swing.UIManager; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; import java.awt.BorderLayout; @@ -154,66 +158,21 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam private UIButton createArrowButton() { final UIButton arrowBtn = new UIButton(); arrowBtn.setNormalPainted(false); - arrowBtn.setPreferredSize(new Dimension(20, 5)); - arrowBtn.setBackground(new Color(218, 218, 218)); + arrowBtn.setPreferredSize(FineUIScale.scale(new Dimension(20, 5))); + arrowBtn.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); arrowBtn.setOpaque(true); arrowBtn.setIcon(getIcon()); arrowBtn.setExtraPainted(false); addPopupListener(arrowBtn); - arrowBtn.addMouseListener(new MouseAdapter() { - @Override - public void mouseEntered(MouseEvent e) { - arrowBtn.setBackground(new Color(200, 200, 200)); - } - - @Override - public void mouseExited(MouseEvent e) { - arrowBtn.setBackground(new Color(218, 218, 218)); - } - }); return arrowBtn; } private UITextField createEditor() { - UITextField editor = new UITextField() { - @Override - protected void initListener() { - this.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - attributeChange(); - } - }); - this.addFocusListener(new FocusAdapter() { - @Override - public void focusLost(FocusEvent e) { - attributeChange(); - } - }); - UIComboCheckBox.this.popup.addPopupMenuListener(new PopupMenuListener() { - @Override - public void popupMenuWillBecomeVisible(PopupMenuEvent e) { - // do nothing - } - - @Override - public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { - attributeChange(); - if (uiObserverListener != null) { - uiObserverListener.doChange(); - } - } - - @Override - public void popupMenuCanceled(PopupMenuEvent e) { - // do nothing - } - }); - } - }; + UITextField editor = new TextField(); editor.setEditable(false); - editor.setPreferredSize(new Dimension(110, 20)); + editor.setPreferredSize(FineUIScale.scale(new Dimension(110, 20))); + editor.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 0, UIManager.getColor("defaultBorderColor"))); addPopupListener(editor); return editor; @@ -269,6 +228,8 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam private void togglePopup() { if (this.arrowButton.isEnabled()) { + popup.setBorder(new FineRoundBorder()); + popup.setPreferredSize(new Dimension(FineUIScale.scale(this.getWidth()), (int) popup.getPreferredSize().getHeight())); popup.show(this, 0, getHeight()); } } @@ -434,6 +395,47 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam this.arrowButton.setEnabled(enabled); } + private class TextField extends UITextField { + @Override + protected void initListener() { + this.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + attributeChange(); + } + }); + this.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + attributeChange(); + } + }); + addPopupMenuListener(); + } + + private void addPopupMenuListener() { + UIComboCheckBox.this.popup.addPopupMenuListener(new PopupMenuListener() { + @Override + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + // do nothing + } + + @Override + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + attributeChange(); + if (uiObserverListener != null) { + uiObserverListener.doChange(); + } + } + + @Override + public void popupMenuCanceled(PopupMenuEvent e) { + // do nothing + } + }); + } + } + /** * 简单的测试demo * @param args diff --git a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/ParameterTableModel.java b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/ParameterTableModel.java index a3f9f63f29..8eab9405fe 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/ParameterTableModel.java +++ b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/ParameterTableModel.java @@ -1,5 +1,7 @@ package com.fr.design.gui.itableeditorpane; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.Parameter; import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPaneFactory; @@ -240,8 +242,11 @@ public class ParameterTableModel extends UITableModelAdapter public ParameterValueRenderer(ValueEditorPane valueEditorPane) { disableLable = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Paramete_Name")); - disableLable.setForeground(Color.pink); + FineUIStyle.setStyle(disableLable, FineUIStyle.LABEL_WARNING_TIP); disableLable.setHorizontalAlignment(SwingConstants.LEFT); + disableLable.setOpaque(true); + disableLable.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + disableLable.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor"))); editor = valueEditorPane; } diff --git a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java index 4319025013..704cbcc303 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java @@ -1,24 +1,39 @@ package com.fr.design.gui.itableeditorpane; 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.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.GeneralUtils; +import com.fr.stable.StringUtils; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.SwingConstants; import javax.swing.UIManager; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableCellRenderer; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; +import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Insets; 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; + /** * 表格编辑面板,一般是两列.键-值 用泛型实现,用的时候请定义T.model里面的T要一样 * @@ -30,9 +45,9 @@ public class UITableEditorPane extends BasicPane { * */ private static final long serialVersionUID = 6855793816972735815L; - private JTable editTable; + protected static JTable editTable; // 放置action 的按钮. - private UITableModelAdapter tableModel; + protected UITableModelAdapter tableModel; private String leftLabelName; private JPanel buttonPane; @@ -67,17 +82,35 @@ public class UITableEditorPane extends BasicPane { UIScrollPane scrollPane = new UIScrollPane(editTable); scrollPane.setBorder(new FineRoundBorder()); - pane.add(scrollPane, BorderLayout.CENTER); initbuttonPane(action); JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); controlPane.add(buttonPane, BorderLayout.EAST); - controlPane.add(content == null ? l : content, BorderLayout.WEST); - pane.add(controlPane, BorderLayout.NORTH); + pane.add(column(cell(controlPane), cell(buildScrollTablePane(scrollPane)).weight(1)).getComponent()); this.editTable.getTableHeader().setDefaultRenderer(new TableHeaderRenderer()); + this.editTable.setDefaultRenderer(Object.class, new TableRenderer()); + this.editTable.setRowHeight(FineUIScale.scale(24)); + } + /** + * 组合 jtable 和垂直滚动条 + * @param scrollPane + * @return + */ + protected Component buildScrollTablePane(JScrollPane scrollPane) { + return row( + cell(scrollPane).weight(1), + column( + cell(new UILabel()).with(it -> { + it.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 1, UIManager.getColor("defaultBorderColor"))); + it.setPreferredSize(FineUIScale.scale(new Dimension(scrollPane.getVerticalScrollBar().getWidth(), (int) editTable.getTableHeader().getPreferredSize().getHeight()))); + }), + cell(scrollPane.getVerticalScrollBar()).weight(1).with(it -> { + it.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); + })) + ).getComponent(); } public UITableModelAdapter getTableModel() { @@ -164,7 +197,10 @@ public class UITableEditorPane extends BasicPane { return buttonPane; } - public JTable getEditTable() { + /** + * @return jTable + */ + public static JTable getEditTable() { return editTable; } @@ -193,13 +229,48 @@ public class UITableEditorPane extends BasicPane { public static class TableHeaderRenderer extends DefaultTableCellRenderer { public TableHeaderRenderer() { setHorizontalAlignment(SwingConstants.LEFT); + setPreferredSize(new Dimension(this.getWidth(), FineUIScale.scale(24))); } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - setBorder(UIManager.getBorder("TableHeader.cellBorder")); - return this; + Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + if (column == table.getColumnCount() - 1) { + ((JComponent) component).setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor"))); + } else { + ((JComponent) component).setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); + } + return component; + } + } + + /** + * 设置 Table 表身格式 + */ + public static class TableRenderer extends DefaultTableCellRenderer { + public TableRenderer() { + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + if(component instanceof JLabel) { + String toolTipText = GeneralUtils.objectToString(value); + if (StringUtils.isNotEmpty(toolTipText)) { + ((JLabel) component).setToolTipText(toolTipText); + } + } + if (column == table.getColumnCount() - 1) { + ((JComponent) component).setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")), + new ScaledEmptyBorder(0,4,0,0))); + } else { + ((JComponent) component).setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")), + new ScaledEmptyBorder(0,4,0,0))); + } + component.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + return component; } } } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java b/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java index 346b2c0419..3a92b44692 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java @@ -6,6 +6,7 @@ package com.fr.design.gui.itree.checkboxtree; +import com.fine.theme.utils.FineUIScale; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; @@ -63,7 +64,7 @@ public class CheckBoxTreeCellRenderer extends NullPanel implements TreeCellRende setLayout(FRGUIPaneFactory.createBorderLayout()); add(_checkBox, BorderLayout.WEST); JPanel gapPanel = new JPanel(); - gapPanel.setPreferredSize(new Dimension(4, 20)); + gapPanel.setPreferredSize(FineUIScale.scale(new Dimension(4, 20))); add(gapPanel, BorderLayout.CENTER); _actualTreeRenderer = renderer; } @@ -77,7 +78,7 @@ public class CheckBoxTreeCellRenderer extends NullPanel implements TreeCellRende } public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { - _checkBox.setPreferredSize(new Dimension(PROTOTYPE.getPreferredSize().width, 0)); + _checkBox.setPreferredSize(FineUIScale.scale(new Dimension(PROTOTYPE.getPreferredSize().width, 0))); setComponentOrientation(tree.getComponentOrientation()); TreePath path = tree.getPathForRow(row); diff --git a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java index 417533465d..b3b53c3351 100644 --- a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java @@ -149,7 +149,7 @@ public class FRGUIPaneFactory { * @return FRGridLayout对象 */ public static LayoutManager createNColumnGridLayout(int nColumn) { - return new FRGridLayout(nColumn); + return new FRGridLayout(nColumn, 4, 2); } public static LayoutManager createCenterLayout(JComponent centerBody) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java index bdb2989574..99a57b5b9f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.DesignState; import com.fr.design.base.mode.DesignModeContext; @@ -16,6 +17,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.JComponent; import javax.swing.JPanel; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; @@ -228,6 +230,7 @@ public class CenterRegionContainerPane extends JPanel { // 颜色,字体那些按钮的工具栏 toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); setStyle(toolbarComponent, TOP_TOOLS); + toolbarComponent.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); toolbarComponent.setBorder(new ScaledEmptyBorder(0, 10, 0, 10)); JPanel customNorthPane = strategy.customNorthPane(toolbarPane, plus); if (!isExist(customNorthPane)) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java index a60bb7f18e..e0bf8843d1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java @@ -1,6 +1,10 @@ package com.fr.design.mainframe.check; import com.fine.theme.utils.FineUIStyle; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.dialog.link.MessageWithLink; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -18,12 +22,21 @@ import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.UIManager; import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.Frame; 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.flex; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 字体缺失检测的具体结果对话框 * @@ -54,44 +67,41 @@ public class CheckFontInfoDialog extends JDialog implements ActionListener { super(parent,true); //提示信息 JPanel imagePanel = new JPanel(); - imageLabel = new UILabel(IOUtils.readIcon("com/fr/design/images/warnings/warning32.png")); + imageLabel = new UILabel(new LazyIcon("warning")); imagePanel.add(imageLabel); String link = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT); - JPanel messagePanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); + JPanel messagePanel = new JPanel(new FlowLayout()); MessageWithLink linkMessage = new MessageWithLink(Toolkit.i18nText("Fine_Designer_Check_Font_Message"), Toolkit.i18nText("Fine_Designer_Check_Font_Install_Font"), link); - linkMessage.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink")); + linkMessage.setBorder(new ScaledEmptyBorder(0, 0, 0, 10)); messagePanel.add(linkMessage); // 查看详情按钮 directUiLabel = new UILabel(); - directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right")); + directUiLabel.setIcon(new LazyIcon("plus")); detailLabel = new UILabel(); detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail")); - upInTopPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); - upInTopPanel.add(imageLabel, BorderLayout.WEST); - upInTopPanel.add(messagePanel, BorderLayout.CENTER); - - downInTopPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); - downInTopPanel.add(directUiLabel, BorderLayout.WEST); - downInTopPanel.add(detailLabel, BorderLayout.CENTER); - - topPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); - topPanel.add(upInTopPanel, BorderLayout.NORTH); - topPanel.add(downInTopPanel, BorderLayout.SOUTH); + upInTopPanel = row( + column(flex(), cell(imageLabel), flex()).with(it -> it.setPreferredSize(new Dimension(FineUIScale.scale(30), it.getHeight()))), + cell(messagePanel)).getComponent(); + downInTopPanel = row(fix(30), row(cell(directUiLabel), cell(detailLabel), flex())).getComponent(); + topPanel = column(cell(upInTopPanel), cell(downInTopPanel)).getComponent(); //中间的详情展示(可隐藏) hiddenPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); - hiddenPanel.setBorder(BorderFactory.createEmptyBorder(0,12,0,12)); JScrollPane scrollPane = new JScrollPane(); JTextArea checkArea = new JTextArea(areaText); scrollPane.setViewportView(checkArea); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + scrollPane.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + scrollPane.getViewport().setOpaque(false); + checkArea.setOpaque(false); checkArea.setEnabled(false); - hiddenPanel.add(scrollPane); + hiddenPanel = row(fix(30), cell(scrollPane).weight(1)).getComponent(); hiddenPanel.setVisible(false); + hiddenPanel.setBorder(new ScaledEmptyBorder(0, 0, 0, 10)); downInTopPanel.addMouseListener(new MouseAdapter() { @Override @@ -100,12 +110,12 @@ public class CheckFontInfoDialog extends JDialog implements ActionListener { hiddenPanel.setVisible(false); CheckFontInfoDialog.this.setSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.mainframe.check.CheckFontInfoDialog.collapse")); detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail")); - directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right")); + directUiLabel.setIcon(new LazyIcon("plus")); } else { CheckFontInfoDialog.this.setSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.mainframe.check.CheckFontInfoDialog.unfold")); hiddenPanel.setVisible(true); detailLabel.setText(Toolkit.i18nText("Fine_Designer_Hide_Detail")); - directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.down")); + directUiLabel.setIcon(new LazyIcon("minus")); } } }); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java index 55616e8695..240a0f23c4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java @@ -1,5 +1,8 @@ package com.fr.design.mainframe.loghandler; +import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.stable.collections.combination.Pair; import com.fr.base.BaseUtils; import com.fr.base.TRL; @@ -97,11 +100,11 @@ public class DesignerLogHandler { // 所有的面板 private LogHandlerBar caption; - private JCheckBoxMenuItem showInfo; + private UICheckBox showInfo; - private JCheckBoxMenuItem showError; + private UICheckBox showError; - private JCheckBoxMenuItem showServer; + private UICheckBox showServer; private LogHandlerArea logHandlerArea; @@ -137,11 +140,11 @@ public class DesignerLogHandler { caption.clearMessage(); } }; - showInfo = new JCheckBoxMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log_Level_Info"), true); + showInfo = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log_Level_Info"), true); showInfo.addItemListener(itemlistener); - showError = new JCheckBoxMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log_Level_Warn"), true); + showError = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log_Level_Warn"), true); showError.addItemListener(itemlistener); - showServer = new JCheckBoxMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log_Level_Error"), true); + showServer = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log_Level_Error"), true); showServer.addItemListener(itemlistener); caption.addSetListener(new ActionListener() { @@ -149,21 +152,20 @@ public class DesignerLogHandler { public void actionPerformed(ActionEvent e) { JPopupMenu jPopupMenu = new JPopupMenu(); + jPopupMenu.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); int logLevelInt = Log4jConfig.getInstance().getRootLevel().intLevel(); if (logLevelInt <= DesignerLogger.INFO_INT) { jPopupMenu.add(showInfo); jPopupMenu.add(showError); jPopupMenu.add(showServer); - jPopupMenu.show(caption, caption.getWidth() + GAP_X, INFO_GAP_Y); } else if (logLevelInt == DesignerLogger.ERROR_INT) { jPopupMenu.add(showError); jPopupMenu.add(showServer); - jPopupMenu.show(caption, caption.getWidth() + GAP_X, ERRO_GAP_Y); } else { jPopupMenu.add(showServer); - jPopupMenu.show(caption, caption.getWidth() + GAP_X, SERVER_GAP_Y); } + jPopupMenu.show(caption, caption.getWidth() - (int) jPopupMenu.getPreferredSize().getWidth() - 10, (int) -jPopupMenu.getPreferredSize().getHeight()); } }); } @@ -211,17 +213,17 @@ public class DesignerLogHandler { popup = new JPopupMenu(); selectAll = new UIMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select_All")); selectAll.addActionListener(popupListener); - selectAll.setIcon(BaseUtils.readIcon("/com/fr/design/images/log/selectedall.png")); + selectAll.setIcon(new LazyIcon("select_all")); popup.add(selectAll); copy = new UIMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy")); copy.addActionListener(popupListener); - copy.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); + copy.setIcon(new LazyIcon("copy")); popup.add(copy); clear = new UIMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_All")); clear.addActionListener(popupListener); - clear.setIcon(BaseUtils.readIcon("/com/fr/design/images/log/clear.png")); + clear.setIcon(new LazyIcon("clearStash")); popup.add(clear); selectAll.setAccelerator(KeyStroke.getKeyStroke('A', DEFAULT_MODIFIER)); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java index a0035aae49..1aa6b951ae 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java @@ -1,6 +1,8 @@ package com.fr.design.mainframe.loghandler; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.ui.util.UIUtil; @@ -34,7 +36,7 @@ public class LogHandlerBar extends JPanel implements ItemSelectable { private int ERRORNUM = 0; private int SERVERNUM = 0; private static final int FLOW_LAYOUT_HGAP = 10; - private static final int FLOW_LAYOUT_VGAP = 5; + private static final int FLOW_LAYOUT_VGAP = 8; private boolean isWithSerious; @@ -46,25 +48,18 @@ public class LogHandlerBar extends JPanel implements ItemSelectable { this.setLayout(new FlowLayout(FlowLayout.RIGHT, FLOW_LAYOUT_HGAP, FLOW_LAYOUT_VGAP)); // this.setUI(new LogHandlerBarUI()); this.text = text; - clear = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/clear.png")); - clear.setMargin(null); - clear.setOpaque(false); - clear.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + clear = creatPlainButtonByIconId("clearStash"); clear.setToolTipText(i18nText("Fine-Design_Basic_Clear_All")); - selectedall = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/selectedall.png")); - selectedall.setMargin(null); - selectedall.setOpaque(false); - selectedall.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + selectedall = creatPlainButtonByIconId("selected_all"); selectedall.setToolTipText(i18nText("Fine-Design_Basic_Select_All")); - set = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/setting.png")); - set.setMargin(null); - set.setOpaque(false); - set.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + set = creatPlainButtonByIconId("filter_popup"); set.setToolTipText(i18nText("Fine-Design_Report_Set")); normalLabel = new UILabel(i18nText("Fine-Design_Basic_NNormal") + "(0)"); + normalLabel.setBorder(new ScaledEmptyBorder(0, 0, 0, 10)); alertLabel = new UILabel(i18nText("Fine-Design_Basic_Alert") + "(0)"); + alertLabel.setBorder(new ScaledEmptyBorder(0, 0, 0, 10)); seriouslyLabel = new UILabel(i18nText("Fine-Design_Basic_Seriously") + "(0)"); - + seriouslyLabel.setBorder(new ScaledEmptyBorder(0, 0, 0, 10)); this.add(normalLabel); this.add(alertLabel); this.add(seriouslyLabel); @@ -73,6 +68,12 @@ public class LogHandlerBar extends JPanel implements ItemSelectable { this.add(set); } + private UIButton creatPlainButtonByIconId(String iconId) { + UIButton button = new UIButton(new LazyIcon(iconId, 18)); + FineUIStyle.setStyle(button, FineUIStyle.PLAIN_BUTTON); + return button; + } + /** * 更新日志数量统计标签 */ diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/background/BackgroundSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/background/BackgroundSettingPane.java index 667c601141..18d9c093b7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/background/BackgroundSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/background/BackgroundSettingPane.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe.theme.edit.background; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.beans.BasicBeanPane; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icombobox.UIComboBox; @@ -71,8 +73,8 @@ public class BackgroundSettingPane extends BasicBeanPane { JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane( new Component[][]{new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Fill")), headCombobox}}, TableLayoutHelper.FILL_NONE, 33, 5); - headCombobox.setPreferredSize(new Dimension(160, 20)); - jPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); + headCombobox.setPreferredSize(FineUIScale.scale(new Dimension(160, 20))); + jPanel.setBorder(new ScaledEmptyBorder(5, 10, 5, 10)); return jPanel; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java index 75733121de..5810a02dd5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe.vcs.ui; +import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.svg.IconUtils; import com.fr.design.data.tabledata.tabledatapane.loading.TipsPane; import com.fr.design.dialog.BasicPane; @@ -21,6 +23,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTable; import javax.swing.RowSorter; +import javax.swing.SortOrder; import javax.swing.SwingConstants; import javax.swing.SwingWorker; import javax.swing.UIManager; @@ -153,7 +156,7 @@ public abstract class AbstractSupportSelectTablePane exte tablePane.setLayout(new BorderLayout()); tablePane.add(tableTopPane, BorderLayout.NORTH); tablePane.add(tableContentPane, BorderLayout.CENTER); - tableContentPane.getEditTable().getColumnModel().getColumn(0).setMaxWidth(50); + tableContentPane.getEditTable().getColumnModel().getColumn(0).setMaxWidth(28); RowSorter> sorter = new TableRowSorter>(model) { @Override public boolean isSortable(int column) { @@ -173,7 +176,6 @@ public abstract class AbstractSupportSelectTablePane exte tableContentPane = new UITableEditorPane<>(model); model.setList(entities); JTable table = tableContentPane.getEditTable(); - table.getTableHeader().setBackground(DEFAULT_HEADER_COLOR); table.getTableHeader().setDefaultRenderer(new HeaderRenderer(tableContentPane.getEditTable())); table.addMouseListener(new MouseAdapter() { @Override @@ -251,6 +253,7 @@ public abstract class AbstractSupportSelectTablePane exte public class HeaderRenderer implements TableCellRenderer { JTableHeader tableHeader; final UICheckBox selectBox; + private boolean ascSort = true; public HeaderRenderer(JTable table) { this.tableHeader = table.getTableHeader(); @@ -264,12 +267,14 @@ public abstract class AbstractSupportSelectTablePane exte int selectColumn = tableHeader.columnAtPoint(e.getPoint()); if (selectColumn == 0) { boolean value = !selectBox.isSelected(); - selectBox.setSelected(value); selectAllOrNull(value); selectCount = value ? table.getRowCount() : 0; + setHeaderStatus(table, value); changeExtraComponentStatus(); tableHeader.repaint(); model.fireTableDataChanged(); + } else { + ascSort = table.getRowSorter().getSortKeys().get(0).getSortOrder() == SortOrder.ASCENDING; } } } @@ -288,13 +293,26 @@ public abstract class AbstractSupportSelectTablePane exte * * @param table */ - public void refreshHeader(JTable table, boolean value) { - selectBox.setSelected(value); + public void refreshHeader(JTable table, boolean isAllSelected) { + setHeaderStatus(table, isAllSelected); int rowHeight = table.getRowHeight(); table.updateUI(); table.setRowHeight(rowHeight); } + public void setHeaderStatus(JTable table, boolean isAllSelected) { + if (isAllSelected) { + selectBox.setSelected(true); + selectBox.setSelectedIcon(new LazyIcon("checkbox_checked")); + } else if (selectCount > 0 && selectCount < table.getRowCount()) { + selectBox.setSelected(true); + selectBox.setSelectedIcon(new LazyIcon("checkbox_part_checked")); + } else { + selectBox.setSelected(false); + selectBox.setSelectedIcon(new LazyIcon("checkbox_unchecked")); + } + } + @Override public Component getTableCellRendererComponent(JTable table, Object value, @@ -306,7 +324,7 @@ public abstract class AbstractSupportSelectTablePane exte String valueStr = (String) value; UILabel label = new UILabel(valueStr); if (needIcon4Head(column)) { - label.setIcon(IconUtils.readIcon("/com/fr/design/standard/vcslist/vcs_sort")); + setAscSort(label, column); label.setHorizontalTextPosition(JLabel.LEFT); label.setHorizontalAlignment(SwingConstants.LEFT); } @@ -320,6 +338,16 @@ public abstract class AbstractSupportSelectTablePane exte return component; } + private void setAscSort(UILabel label, int column) { + if (column != 0) { + if (ascSort) { + label.setIcon(new LazyIcon("sort_asc")); + } else { + label.setIcon(new LazyIcon("sort_desc")); + } + } + } + } @@ -338,7 +366,7 @@ public abstract class AbstractSupportSelectTablePane exte setColumnClass(classes); this.setDefaultEditor(Boolean.class, new BooleanEditor()); this.setDefaultRenderer(Boolean.class, new BooleanRenderer()); - this.setDefaultRenderer(UILabel.class, new ToolTipTableCellRenderer()); + this.createTable().getColumnModel().getColumn(0).setCellRenderer(new BooleanRenderer()); } @Override @@ -387,8 +415,8 @@ public abstract class AbstractSupportSelectTablePane exte boolean isSelected, boolean hasFocus, int row, int column) { setSelected((Boolean) table.getValueAt(row, 0)); setUI(getUICheckBoxUI()); - setBorder(BorderFactory.createEmptyBorder()); - setBackground(isSelected ? DEFAULT_SELECT_TABLE_ROW_COLOR : Color.WHITE); + setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); + setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); return this; } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java index 1aacaa9d7b..76030638b2 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java @@ -1,5 +1,9 @@ package com.fr.design.mainframe.vcs.ui; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.svg.IconUtils; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.FineJOptionPane; @@ -32,6 +36,8 @@ import java.util.List; 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; /** @@ -42,11 +48,11 @@ import static com.fr.design.i18n.Toolkit.i18nText; * Created on 2023/7/5 */ public class RecyclePane extends AbstractSupportSelectTablePane { - public static final Icon ICON_SEARCH = IconUtils.readIcon("/com/fr/design/standard/vcslist/vcs_recycle_search"); - public static final Icon ICON_REFRESH = IconUtils.readSVGIcon("/com/fr/design/standard/vcslist/vcs_recycle_restore", IconUtils.ICON_TYPE_NORMAL); - public static final Icon ICON_REFRESH_DISABLE = IconUtils.readSVGIcon("/com/fr/design/standard/vcslist/vcs_recycle_restore", IconUtils.ICON_TYPE_DISABLED); - public static final Icon ICON_DELETE = IconUtils.readSVGIcon("/com/fr/design/standard/vcslist/vcs_recycle_delete", IconUtils.ICON_TYPE_NORMAL); - public static final Icon ICON_DELETE_DISABLE = IconUtils.readSVGIcon("/com/fr/design/standard/vcslist/vcs_recycle_delete", IconUtils.ICON_TYPE_DISABLED); + public static final Icon ICON_SEARCH = new LazyIcon("search"); + public static final Icon ICON_REFRESH = new LazyIcon("refresh"); + public static final Icon ICON_REFRESH_DISABLE = new LazyIcon("refresh").disabled(); + public static final Icon ICON_DELETE = new LazyIcon("remove"); + public static final Icon ICON_DELETE_DISABLE = new LazyIcon("remove").disabled(); private Set listenerSet = new HashSet<>(); @@ -116,8 +122,14 @@ public class RecyclePane extends AbstractSupportSelectTablePane searchTextField = new UITextField(); searchTextField.setPlaceholder(Toolkit.i18nText("Fine-Design_Vcs_Start_Search")); searchTextField.setColumns(COLUMNS_COUNT); - leftPane.add(new UILabel(ICON_SEARCH)); - leftPane.add(searchTextField); + UILabel searchLabel = new UILabel(ICON_SEARCH); + searchLabel.setBorder(new ScaledEmptyBorder(0, 3, 0, 3)); + searchTextField.setBorder(null); + leftPane = row(cell(searchLabel), cell(searchTextField).weight(1)).with(it -> { + it.setBorder(new FineRoundBorder()); + it.setOpaque(true); + it.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + }).getComponent(); } //右边面板,包括还原按钮+删除按钮 if (isNeedRestore()) { @@ -136,6 +148,7 @@ public class RecyclePane extends AbstractSupportSelectTablePane } tableTopPane.add(leftPane, BorderLayout.EAST); tableTopPane.add(rightPane, BorderLayout.WEST); + tableTopPane.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecycleSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecycleSettingPane.java index 0653aad05f..2215ac0f20 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecycleSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecycleSettingPane.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe.vcs.ui; import com.fr.design.dialog.BasicPane; -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.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; @@ -49,17 +49,19 @@ public class RecycleSettingPane extends BasicPane { private void init() { this.setLayout(new BorderLayout()); - UITabbedPane tabbedPane = new UITabbedPane(); //回收站内容 JPanel recyclePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); UIScrollPane recycleScrollPane = patchScroll(recyclePane); - tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Vcs_Recycle_Content"), recycleScrollPane); recyclePane.add(new RecyclePane()); //通用设置 JPanel settingPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); UIScrollPane settingScrollPane = patchScroll(settingPane); - tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Carton_General_Settings"), settingScrollPane); settingPane.add(createSchedulePane()); + + FineTabbedPane tabbedPane = FineTabbedPane.builder() + .addTab(Toolkit.i18nText("Fine-Design_Vcs_Recycle_Content"), recycleScrollPane) + .addTab(Toolkit.i18nText("Fine-Design_Basic_Carton_General_Settings"), settingScrollPane) + .withHeadRatio(0.3f).build(); this.add(tabbedPane, BorderLayout.CENTER); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCellRender.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCellRender.java index 952c52a060..d75925d88d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCellRender.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCellRender.java @@ -23,7 +23,7 @@ public class VcsCellRender implements TableCellRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - vcsPanel.setBackground(isSelected ? DEFAULT_SELECT_TABLE_ROW_COLOR : Color.WHITE); + vcsPanel.setOpaque(false); return vcsPanel; } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java index 11da401226..c58f496a2e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.vcs.ui; +import com.fine.theme.icon.LazyIcon; import com.fr.base.svg.IconUtils; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListCache; @@ -66,9 +67,9 @@ public class VcsNewPane extends RecyclePane { private static final int DOUBLE_CLICK_COUNT = 2; protected VcsOperatorPane operatorPane; - private static final Icon PREVIEW_ICON = IconUtils.readIcon("/com/fr/design/standard/vcslist/vcs_operator_preview"); - private static final Icon DELETE_ICON = IconUtils.readIcon("/com/fr/design/standard/vcslist/vcs_operator_delete"); - private static final Icon RESTORE_ICON = IconUtils.readIcon("/com/fr/design/standard/vcslist/vcs_operator_restore"); + private static final Icon PREVIEW_ICON = new LazyIcon("preview"); + private static final Icon DELETE_ICON = new LazyIcon("remove"); + private static final Icon RESTORE_ICON = new LazyIcon("refresh"); private UILabel restore; private UILabel delete; @@ -126,7 +127,6 @@ public class VcsNewPane extends RecyclePane { this.operatorPane = createOperatorPane(); this.model.setDefaultEditor(VcsOperatorPane.class, new VcsCellEditor(createOperatorPane())); this.model.setDefaultRenderer(VcsOperatorPane.class, new VcsCellRender(createOperatorPane())); - this.model.setDefaultRenderer(UILabel.class, new ToolTipTableCellRenderer()); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsOperatorPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsOperatorPane.java index ce4db1e0d7..15230e9ab5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsOperatorPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsOperatorPane.java @@ -1,17 +1,25 @@ package com.fr.design.mainframe.vcs.ui; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.design.layout.FRGUIPaneFactory; +import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; - +import javax.swing.UIManager; import java.awt.*; 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; + /** * 操作面板,用于置放常用的操作label @@ -30,11 +38,20 @@ public class VcsOperatorPane extends JPanel { private void init(List iconJComponentMap) { - this.setLayout(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout()); + JPanel panel = new JPanel(); + this.setLayout(new BorderLayout()); + panel.setLayout(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout()); for (JComponent value : iconJComponentMap) { value.setCursor(new Cursor(Cursor.HAND_CURSOR)); - this.add(value); + panel.add(value); } + panel.setOpaque(false); + add(column(flex(), row(fix(4), cell(panel)), flex()) + .with(it -> { + it.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); + it.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + it.setOpaque(true); + }).getComponent()); } } diff --git a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java index 1de6b78b38..5d274dbed8 100644 --- a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java @@ -71,7 +71,7 @@ public class MenuDef extends ShortCut { protected JPopupMenu popupMenu; protected boolean hasScrollSubMenu; protected boolean isHeadMenu; - private Icon icon; + protected Icon icon; private String anchor; diff --git a/designer-base/src/main/java/com/fr/design/report/SelectImagePane.java b/designer-base/src/main/java/com/fr/design/report/SelectImagePane.java index 7781233aac..2d6ac90efd 100644 --- a/designer-base/src/main/java/com/fr/design/report/SelectImagePane.java +++ b/designer-base/src/main/java/com/fr/design/report/SelectImagePane.java @@ -1,10 +1,13 @@ package com.fr.design.report; +import com.fine.theme.light.ui.FineRoundBorder; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.Style; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.ImgChooseWrapper; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.style.background.image.ImageFileChooser; import com.fr.design.style.background.image.ImagePreviewPane; @@ -13,7 +16,8 @@ import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.painter.CellImagePainter; import com.fr.stable.Constants; -import java.awt.BorderLayout; + +import java.awt.Color; import java.awt.GridLayout; import java.awt.Image; import java.awt.event.ActionEvent; @@ -25,6 +29,10 @@ import javax.swing.JFileChooser; import javax.swing.JPanel; import javax.swing.JScrollPane; +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; + /** *

这个类主要用于插入图片时的设置

*

这个类原本在designer-realize包下面,现在表单也可选择图片,所以应该抽为公用的base包。包名不变,应该不影响插件使用

@@ -69,33 +77,33 @@ public class SelectImagePane extends BasicPane { public SelectImagePane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - // preview pane - JPanel previewContainerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(previewContainerPane, BorderLayout.CENTER); - - JPanel previewOwnerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER); - - previewOwnerPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"), null)); - previewPane = new ImagePreviewPane(); - previewOwnerPane.add(new JScrollPane(previewPane)); - - JPanel selectFilePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - previewContainerPane.add(selectFilePane, BorderLayout.EAST); - selectFilePane.setBorder(BorderFactory - .createEmptyBorder(8, 2, 4, 0)); + previewPane.setOpaque(false); + this.add(column( + 5, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))), + row( + 10, + cell(new JScrollPane(previewPane)).with(it -> { + it.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + it.getViewport().setOpaque(false); + it.setBorder(new FineRoundBorder()); + }).weight(1), + cell(initSelectFilePane()) + ).weight(1) + ).getComponent()); + } + /** + * 选择图片 + * @return + */ + public JPanel initSelectFilePane() { UIButton selectPictureButton = new UIButton( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Image_Select_Picture")); - selectFilePane.add(selectPictureButton, BorderLayout.NORTH); selectPictureButton.setMnemonic('S'); selectPictureButton.addActionListener(selectPictureActionListener); - - JPanel layoutPane = FRGUIPaneFactory.createMediumHGapHighTopFlowInnerContainer_M_Pane(); - selectFilePane.add(layoutPane, BorderLayout.CENTER); - //布局 defaultRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); tiledRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image_Titled")); @@ -107,12 +115,11 @@ public class SelectImagePane extends BasicPane { extendRadioButton.addActionListener(layoutActionListener); adjustRadioButton.addActionListener(layoutActionListener); - JPanel jp = new JPanel(new GridLayout(4, 1, 15, 15)); + JPanel jp = new JPanel(new GridLayout(4, 1, 10, 10)); jp.add(defaultRadioButton); jp.add(tiledRadioButton); jp.add(extendRadioButton); jp.add(adjustRadioButton); - layoutPane.add(jp); ButtonGroup layoutBG = new ButtonGroup(); layoutBG.add(defaultRadioButton); @@ -125,6 +132,7 @@ public class SelectImagePane extends BasicPane { // init image file chooser. imageFileChooser = new ImageFileChooser(); imageFileChooser.setMultiSelectionEnabled(false); + return column(10, cell(selectPictureButton), cell(jp)).getComponent(); } // 调整图片样式,只有水平和垂直对齐以及拉伸。相对于背景,平铺不予考虑。 diff --git a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java index fabecda3e0..7a57667532 100644 --- a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java +++ b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java @@ -1,6 +1,8 @@ package com.fr.design.roleAuthority; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineToggleButtonUI; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.base.vcs.DesignerMode; @@ -9,6 +11,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.gui.ibutton.UIHead; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; @@ -24,10 +27,11 @@ import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; -import javax.swing.BorderFactory; import javax.swing.Icon; +import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.JToggleButton; import javax.swing.JTree; import javax.swing.ScrollPaneConstants; import javax.swing.event.ChangeEvent; @@ -37,14 +41,19 @@ import javax.swing.tree.DefaultTreeSelectionModel; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import java.awt.BorderLayout; -import java.awt.GridLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.ArrayList; import java.util.Enumeration; +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; /** @@ -96,7 +105,7 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo jPanel.setOpaque(true); jPanel.add(column( 4, - row(2, cell(new UILabel(new LazyIcon("digitalPlatform"))), cell(buttonGroup)), + row(cell(buttonGroup), flex()), cell(scrollPane) ).getComponent()); this.add(jPanel, BorderLayout.CENTER); @@ -191,10 +200,7 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo } private void initbuttonGroup() { - - Icon[] iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/demo.png")}; - String[] textArray = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FS_Name")}; - buttonGroup = new UIHeadGroup(textArray) { + buttonGroup = new UIHeadGroup(iconList()) { public void tabChanged(int index) { roleTree.setEditable(false); if (op != null) { @@ -207,6 +213,27 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo } } }; + + for (int i = 0; i < buttonGroup.getComponents().length; i++) { + Component component = buttonGroup.getComponent(i); + if (!(component instanceof JToggleButton)) { + continue; + } + ((JToggleButton) component).setUI(new FineToggleButtonUI(false) { + @Override + protected void paintBackground(Graphics g, JComponent c) { + super.paintBackground(g, c); + g.setColor(FlatUIUtils.getUIColor("default.background", new Color(246, 248, 250))); + g.fillRect(0, 0, getWidth(), getHeight()); + } + }); + } + } + + private static List iconList() { + List uiHeads = new ArrayList<>(); + uiHeads.add(new UIHead(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FS_Name"), new LazyIcon("digitalPlatform"))); + return uiHeads; } /** diff --git a/designer-base/src/main/java/com/fr/design/style/BorderPane.java b/designer-base/src/main/java/com/fr/design/style/BorderPane.java index ee4c130f59..c1d2f67da0 100644 --- a/designer-base/src/main/java/com/fr/design/style/BorderPane.java +++ b/designer-base/src/main/java/com/fr/design/style/BorderPane.java @@ -3,7 +3,9 @@ */ package com.fr.design.style; +import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.BaseUtils; import com.fr.base.CellBorderStyle; import com.fr.base.GraphHelper; @@ -19,8 +21,8 @@ import com.fr.stable.Constants; import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; +import javax.swing.AbstractButton; import javax.swing.BorderFactory; -import javax.swing.ButtonGroup; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JPanel; @@ -35,6 +37,8 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -76,7 +80,7 @@ public class BorderPane extends BasicPane { private LineComboBox currentLineCombo; private NewColorSelectBox currentLineColorPane; - private UIButton insidebutton; + private JToggleButton insidebutton; public BorderPane() { this.initComponents(); @@ -85,12 +89,13 @@ public class BorderPane extends BasicPane { protected void initComponents() { initBasicComponents(); JPanel borderAllControlPane = initButtonPanel(); - JPanel borderLeftPane = column(flex(), cell(topToggleButton), cell(horizontalToggleButton), cell(bottomToggleButton), flex()).getComponent(); - JPanel borderBottomPane = row(flex(), cell(leftToggleButton), cell(verticalToggleButton), cell(rightToggleButton), flex()).getComponent(); + JPanel borderLeftPane = column(5, flex(), cell(topToggleButton), cell(horizontalToggleButton), cell(bottomToggleButton), flex()).getComponent(); + JPanel borderBottomPane = row(5, flex(), cell(leftToggleButton), cell(verticalToggleButton), cell(rightToggleButton), flex()).getComponent(); this.currentLineColorPane.setSelectObject(Color.BLUE); Component northPane1 = initNorthPanel(); Component centerPane1 = FineUIUtils.wrapComponentWithTitle(row(5, cell(borderLeftPane), - column(5, row(flex(), cell(borderAllControlPane),flex()), cell(borderComponent).with(it -> it.setPreferredSize(new Dimension(600, 300))), cell(borderBottomPane)) + column(5, row(flex(), cell(borderAllControlPane),flex()), cell(borderComponent) + .with(it -> it.setPreferredSize(FineUIScale.scale(new Dimension(600, 300)))), cell(borderBottomPane)) ).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); this.add(column(10, cell(northPane1), cell(centerPane1)).getComponent()); } @@ -115,14 +120,30 @@ public class BorderPane extends BasicPane { } private JPanel initButtonPanel() { - UIButton button1 = createVerButtonPane(NO_BORDERS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No")); - UIButton button2 = createVerButtonPane(EXTERNAL_BORDERS, ""); - UIButton button3 = createVerButtonPane(INSIDE_BORDERS, ""); - ButtonGroup buttonGroup = new ButtonGroup(); - buttonGroup.add(button1); - buttonGroup.add(button2); - buttonGroup.add(button3); - return row(cell(button1), cell(button2), cell(button3)).getComponent(); + JToggleButton button1 = createVerButtonPane(NO_BORDERS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No")); + JToggleButton button2 = createVerButtonPane(EXTERNAL_BORDERS, ""); + JToggleButton button3 = createVerButtonPane(INSIDE_BORDERS, ""); + ItemListener itemListener = e -> { + AbstractButton button = (AbstractButton) e.getSource(); + if (e.getStateChange() == ItemEvent.SELECTED) { + if (button == button1) { + if (button2.isSelected()) { + button2.setSelected(false); + } + if (button3.isSelected()) { + button3.setSelected(false); + } + } else if (button == button2 || button == button3) { + if (button1.isSelected()) { + button1.setSelected(false); + } + } + } + }; + button1.addItemListener(itemListener); + button2.addItemListener(itemListener); + button3.addItemListener(itemListener); + return row(5, cell(button1), cell(button2), cell(button3)).getComponent(); } private Component initNorthPanel() { @@ -156,7 +177,7 @@ public class BorderPane extends BasicPane { } } - private UIButton createVerButtonPane(int display, String text) { + private JToggleButton createVerButtonPane(int display, String text) { JPanel verPane = new JPanel(); BorderButton button = new BorderButton(display); @@ -253,9 +274,9 @@ public class BorderPane extends BasicPane { this.borderType = borderType; if (horizontal) { - this.setPreferredSize(new Dimension(40, 24)); + this.setPreferredSize(FineUIScale.scale(new Dimension(40, 24))); } else { - this.setPreferredSize(new Dimension(24, 40)); + this.setPreferredSize(FineUIScale.scale(new Dimension(24, 40))); } this.addActionListener(this); } @@ -305,7 +326,7 @@ public class BorderPane extends BasicPane { } // Shortcut setting button - private class BorderButton extends UIButton implements ActionListener { + private class BorderButton extends JToggleButton implements ActionListener { private int border; private BorderButton(int border) { @@ -315,8 +336,8 @@ public class BorderPane extends BasicPane { } else if(border == BorderPane.INSIDE_BORDERS) { this.setIcon(BaseUtils.readIcon("com/fr/design/images/m_format/in.png")); } + this.setPreferredSize(FineUIScale.scale(new Dimension(40, 24))); this.addActionListener(this); - setPreferredSize(new Dimension(36, 24)); setFocusPainted(false); } @@ -583,16 +604,16 @@ public class BorderPane extends BasicPane { int pInset = 4; int pWidth = this.getWidth() / 2 - 20 - pInset; int pHeight = this.getHeight() / 2 - 20 - pInset; - g.setColor(Color.lightGray); + g.setColor(FlatUIUtils.getUIColor("fill.hover", new Color(230,233,239))); g.fillRect(20, 20, pWidth, pHeight); - g.setColor(Color.lightGray); + g.setColor(FlatUIUtils.getUIColor("fill.hover", new Color(230,233,239))); g.fillRect(this.getWidth() / 2 + pInset + 1, 20, pWidth, pHeight); - g.setColor(Color.lightGray); + g.setColor(FlatUIUtils.getUIColor("fill.hover", new Color(230,233,239))); g.fillRect(20, this.getHeight() / 2 + pInset + 1, pWidth, pHeight); - g.setColor(Color.lightGray); + g.setColor(FlatUIUtils.getUIColor("fill.hover", new Color(230,233,239))); g.fillRect(this.getWidth() / 2 + pInset + 1, this.getHeight() / 2 + pInset + 1, pWidth, pHeight); } else { - g.setColor(Color.lightGray); + g.setColor(FlatUIUtils.getUIColor("fill.hover", new Color(230,233,239))); g.fillRect(20, 20, this.getWidth() - 40, this.getHeight() - 40); } updateBorders(g); diff --git a/designer-base/src/main/java/com/fr/design/style/FRFontPane.java b/designer-base/src/main/java/com/fr/design/style/FRFontPane.java index 8e47e3087f..23a6364f3b 100644 --- a/designer-base/src/main/java/com/fr/design/style/FRFontPane.java +++ b/designer-base/src/main/java/com/fr/design/style/FRFontPane.java @@ -3,7 +3,6 @@ */ package com.fr.design.style; -import com.fine.theme.utils.FineUIScale; import com.fr.base.FRContext; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; @@ -27,7 +26,6 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; import java.awt.Component; -import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; @@ -101,7 +99,6 @@ public class FRFontPane extends BasicPane { initCheckbox(); // preview pane. preview = new FRFontPreviewArea(); - preview.setPreferredSize(FineUIScale.scale(new Dimension(640, 240))); //peteter:这里主动从Context, 获得默认的FRFont的值. DefaultValues defaultValues = FRContext.getDefaultValues(); @@ -166,7 +163,7 @@ public class FRFontPane extends BasicPane { row(cell(this.isStrikethroughCheckBox), fix(5), cell(this.isShadowCheckBox), fix(5), cell(this.isSuperscriptCheckBox), fix(5), cell(this.isSubscriptCheckBox), flex()).weight(0.6) ), - column(5, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))), cell(preview)) + column(5, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))), cell(preview).weight(1)).weight(1) ).getComponent()); } diff --git a/designer-base/src/main/java/com/fr/design/style/FormatPane.java b/designer-base/src/main/java/com/fr/design/style/FormatPane.java index 66316d83b0..69744c3b8a 100644 --- a/designer-base/src/main/java/com/fr/design/style/FormatPane.java +++ b/designer-base/src/main/java/com/fr/design/style/FormatPane.java @@ -3,7 +3,10 @@ */ package com.fr.design.style; +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.base.FRContext; import com.fr.base.TextFormat; import com.fr.data.core.FormatField; @@ -21,6 +24,7 @@ import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; +import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.JList; import javax.swing.JPanel; @@ -33,6 +37,7 @@ 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.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -43,6 +48,7 @@ import java.util.Date; 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; /** @@ -84,41 +90,73 @@ public class FormatPane extends BasicPane { protected void initComponents() { this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); + this.setBorder(new ScaledEmptyBorder(4, 4, 4, 4)); //sample pane - sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()); - sampleLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 4)); - sampleLabel.setHorizontalAlignment(SwingConstants.CENTER); - sampleLabel.setFont(FRContext.getDefaultValues().getFRFont()); + JPanel samplePane = initSamplePane(); initRadioButton(); initRadioButtonGroup(); - //left control pane - JPanel leftControlPane = initLeftControlPane(); - - //content pane. - JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - contentPane.setBorder(BorderFactory.createEmptyBorder(4, 0, 2, 0)); - patternTextField = new UITextField(); - contentPane.add(patternTextField, BorderLayout.NORTH); - patternTextField.getDocument().addDocumentListener(patternTextDocumentListener); - patternList = new JList(new DefaultListModel()); - contentPane.add(new JScrollPane(patternList), BorderLayout.CENTER); - patternList.addListSelectionListener(patternListSelectionListener); + initPattern(); //init values. nullRadioButton.setSelected(true); this.applyRadioActionListener(this.nullRadioButton); + JScrollPane scrollPane = initPatternScrollPanel(); this.add(column( 10, - cell(FineUIUtils.wrapComponentWithTitle(sampleLabel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Sample"))), - row( - 10, - cell(FineUIUtils.wrapComponentWithTitle(leftControlPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Format_Category"))).weight(0.1), - cell(contentPane).weight(0.5) - ) + cell(samplePane), + row(10, + column( + 10, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Format_Category"))).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, 0, 0))), + cell(initLeftControlPane()), + flex() + ).weight(0.1), + column( + 10, + cell(patternTextField), + cell(scrollPane).weight(1) + ).weight(0.5) + ).weight(1) ).getComponent()); } + private JPanel initSamplePane() { + JPanel samplePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + samplePane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Sample"), null)); + samplePane.setLayout(FRGUIPaneFactory.createBorderLayout()); + sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()); + samplePane.add(sampleLabel, BorderLayout.CENTER); + sampleLabel.setBorder(new ScaledEmptyBorder(10, 0, 10, 0)); + sampleLabel.setHorizontalAlignment(SwingConstants.CENTER); + sampleLabel.setFont(FRContext.getDefaultValues().getFRFont()); + return samplePane; + } + + private void initPattern() { + patternTextField = new UITextField(); + patternTextField.getDocument().addDocumentListener(patternTextDocumentListener); + patternList = new JList(new DefaultListModel()); + patternList.setCellRenderer(new DefaultListCellRenderer(){ + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + setOpaque(false); + return this; + } + }); + patternList.addListSelectionListener(patternListSelectionListener); + } + + private JScrollPane initPatternScrollPanel() { + JScrollPane scrollPane = new JScrollPane(patternList); + patternList.setOpaque(false); + scrollPane.getViewport().setOpaque(false); + scrollPane.getVerticalScrollBar().setOpaque(false); + scrollPane.setBorder(new FineRoundBorder()); + scrollPane.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + return scrollPane; + } + private void initRadioButton () { nullRadioButton = new UIRadioButton(FormatField.getInstance().getName(FormatContents.NULL)); nullRadioButton.setMnemonic('o'); @@ -164,7 +202,7 @@ public class FormatPane extends BasicPane { } private JPanel initLeftControlPane() { - JPanel leftControlPane =FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); + JPanel leftControlPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); leftControlPane.add(this.createRadioCenterPane(nullRadioButton)); leftControlPane.add(this.createRadioCenterPane(numberRadioButton)); leftControlPane.add(this.createRadioCenterPane(currencyRadioButton)); @@ -183,7 +221,6 @@ public class FormatPane extends BasicPane { JPanel pane = new JPanel(); pane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); - pane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); pane.add(radioButton); return pane; diff --git a/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java index 390b77c39f..7099ed7652 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java @@ -7,6 +7,7 @@ import java.awt.Dimension; import java.util.HashMap; import java.util.Map; +import com.fine.theme.utils.FineUIScale; import com.fr.base.background.ColorBackground; import com.fr.design.gui.frpane.FineTabbedPane; @@ -40,7 +41,7 @@ public class BackgroundPane extends BasicPane { BackgroundFactory.getWrapper(ColorBackground.class).setType( DesignerContext.getDesignerFrame().isServerConfig() ? ColorNoThemeBackgroundPane.class : ColorBackgroundPane.class); this.initComponents(); - this.setPreferredSize(new Dimension(400, 300)); + this.setPreferredSize(FineUIScale.scale(new Dimension(400, 300))); } protected void initComponents() { @@ -48,9 +49,7 @@ public class BackgroundPane extends BasicPane { initTabPane(); tabbedPane = tabbedPaneBuilder.withHeadRatio(0.65f).build(); - add(column( - cell(tabbedPane) - ).getComponent()); + add(cell(tabbedPane).weight(1).getComponent()); } protected void initTabPane() { diff --git a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java index d26f837737..705a9f9eb9 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java @@ -1,5 +1,6 @@ package com.fr.design.style.background.gradient; +import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIUtils; import com.fr.base.background.GradientBackground; import com.fr.design.gui.ibutton.UIRadioButton; @@ -76,7 +77,7 @@ public class GradientBackgroundPane extends BackgroundDetailPane { ) ).getComponent(); - jpanel.setPreferredSize(new Dimension(600, 450)); + jpanel.setPreferredSize(FineUIScale.scale(new Dimension(600, 450))); this.add(FineUIUtils.wrapComponentWithTitle(jpanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Background_Choose_Gradient_Color"))); } diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/BPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/BPane.java index 0015daaf2c..f939db88be 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/BPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/BPane.java @@ -7,9 +7,6 @@ import com.fr.design.style.background.BackgroundDetailPane; import javax.swing.*; import java.awt.*; -import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.column; - /** * Created by richie on 16/5/18. */ @@ -21,15 +18,11 @@ public abstract class BPane extends BackgroundDetailPane { protected void initComponents(int nColumn) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); JPanel typePane2 = new JPanel(); typePane2.setLayout(layoutOfTypePane(nColumn)); setChildrenOfTypePane(typePane2); - JPanel contentPane = column( - 10, - cell(FineUIUtils.wrapComponentWithTitle(typePane2, titleOfTypePane())) - ).getComponent(); + JPanel contentPane = (JPanel) FineUIUtils.wrapComponentWithTitle(typePane2, titleOfTypePane()); this.add(contentPane, BorderLayout.NORTH); setChildrenOfContentPane(contentPane); diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java index 8863236b90..6a9ed7bee9 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java @@ -1,6 +1,7 @@ package com.fr.design.style.background.impl; -import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fine.theme.light.ui.FineRoundBorder; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.Style; import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground; @@ -56,7 +57,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane { // preview pane previewPane = new ImagePreviewPane(); previewPane.addChangeListener(imageSizeChangeListener); - + previewPane.setOpaque(false); // init image file chooser. imageFileChooser = new ImageFileChooser(); @@ -68,13 +69,14 @@ public class ImageBackgroundPane extends BackgroundDetailPane { cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))), row( 10, - cell(new JScrollPane(previewPane)).weight(0.65).with(it -> { - it.getViewport().setBackground(Color.WHITE); - it.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UIManager.getColor("defaultBorderColor"))); - }), - cell(initSelectFilePane()).weight(0.1) - ).with(it -> it.setPreferredSize(new Dimension(it.getWidth(), 400))) - ).with(it -> it.setBorder(new ScaledEmptyBorder(10,10,10,10))).getComponent()); + cell(new JScrollPane(previewPane)).with(it -> { + it.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + it.getViewport().setOpaque(false); + it.setBorder(new FineRoundBorder()); + }).weight(1), + cell(initSelectFilePane()) + ).weight(1) + ).getComponent()); } public JPanel initSelectFilePane() { @@ -94,7 +96,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane { extendRadioButton.addActionListener(layoutActionListener); adjustRadioButton.addActionListener(layoutActionListener); - JPanel jp = new JPanel(new GridLayout(4, 1, 15, 15)); + JPanel jp = new JPanel(new GridLayout(4, 1, 10, 10)); for (UIRadioButton button : imageLayoutButtons()) { jp.add(button); } @@ -104,14 +106,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane { layoutBG.add(extendRadioButton); layoutBG.add(adjustRadioButton); defaultRadioButton.setSelected(true); - return column( - 15, - cell(selectPictureButton), - column( - 15, - cell(jp) - ) - ).getComponent(); + return column(10, cell(selectPictureButton), cell(jp)).getComponent(); } protected UIRadioButton[] imageLayoutButtons() { diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/NullBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/NullBackgroundPane.java index 8945e8c87f..976744e3b3 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/NullBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/NullBackgroundPane.java @@ -1,27 +1,52 @@ package com.fr.design.style.background.impl; +import com.fine.theme.utils.FineUIScale; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.style.background.BackgroundDetailPane; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Background; +import com.fr.general.locale.image.I18nImage; import javax.swing.*; import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; + +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; + /** * Null background pane. */ public class NullBackgroundPane extends BackgroundDetailPane { + private static final String NULL_BACKGROUND = "/com/fr/design/images/background/null_background.png"; + private static final Image DEFAULT_NULL_BACKGROUND_IMAGE; + + static { + DEFAULT_NULL_BACKGROUND_IMAGE = I18nImage.getImage(NULL_BACKGROUND); + } + public NullBackgroundPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); UILabel centerLabel = new UILabel( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Background_Is_Null")); - this.add(centerLabel); + ImagePanel imagePane = new ImagePanel(); + JPanel pane = column( + 10, + flex(), + cell(imagePane), + cell(centerLabel), + flex() + ).getComponent(); centerLabel.setHorizontalAlignment(SwingConstants.CENTER); + add(pane, BorderLayout.CENTER); } public void populate(Background background) { @@ -35,4 +60,30 @@ public class NullBackgroundPane extends BackgroundDetailPane { public void addChangeListener(ChangeListener changeListener) { // do nothing. } + + /** + * 水平居中绘制 Image + */ + public class ImagePanel extends JPanel { + + public ImagePanel() { + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + if (DEFAULT_NULL_BACKGROUND_IMAGE != null) { + int x = (this.getWidth() - DEFAULT_NULL_BACKGROUND_IMAGE.getWidth(null)) / 2; + g.drawImage(DEFAULT_NULL_BACKGROUND_IMAGE, x, 0, this); + } + } + + @Override + public Dimension getPreferredSize() { + if (DEFAULT_NULL_BACKGROUND_IMAGE == null) { + return super.getPreferredSize(); + } + return FineUIScale.scale(new Dimension(DEFAULT_NULL_BACKGROUND_IMAGE.getWidth(null), DEFAULT_NULL_BACKGROUND_IMAGE.getHeight(null))); + } + } } diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java index 56a90f0bc3..0671c49aa5 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java @@ -1,5 +1,6 @@ package com.fr.design.style.background.impl; +import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIUtils; import com.fr.base.GraphHelper; import com.fr.base.background.PatternBackground; @@ -18,6 +19,7 @@ import java.awt.event.ActionListener; import java.awt.geom.Rectangle2D; 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; @@ -68,27 +70,26 @@ public class PatternBackgroundPane extends BPane { protected void setChildrenOfContentPane(JPanel contentPane) { // colors - JPanel colorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Colors")); - foregroundColorPane = new ColorSelectBox(80); - foregroundColorPane.setPreferredSize(new Dimension(80, 24)); + foregroundColorPane.setPreferredSize(FineUIScale.scale(new Dimension(80, 24))); backgroundColorPane = new ColorSelectBox(80); - backgroundColorPane.setPreferredSize(new Dimension(80, 24)); + backgroundColorPane.setPreferredSize(FineUIScale.scale(new Dimension(80, 24))); foregroundColorPane.setSelectObject(Color.lightGray); backgroundColorPane.setSelectObject(Color.black); - contentPane.add(FineUIUtils.wrapComponentWithTitle(row( + contentPane.add(FineUIUtils.wrapComponentWithTitle(column( 10, row( - 10, - cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Foreground") + ":")), - cell(foregroundColorPane) - ).weight(0.1), + 60, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Foreground") + ":")).weight(0.1), + cell(foregroundColorPane).weight(0.45), + flex() + ), row( - 10, - cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background") + ":")), - cell(backgroundColorPane) - ).weight(0.1), - flex(0.1) + 60, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background") + ":")).weight(0.1), + cell(backgroundColorPane).weight(0.45), + flex() + ) ).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Colors"))); } diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java b/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java index 6d982edc05..4036a078ed 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java @@ -38,7 +38,7 @@ public class ColorAdjustPane extends JPanel implements UIObserver { public static final Color[] DEFAULT_COLORS = ChartConstants.NEW_FEATURES; - private static final int COUNT_OF_ROW = 20; + private static final int COUNT_OF_ROW = 12; private static final int MAX_BUTTON = 40; @@ -83,7 +83,7 @@ public class ColorAdjustPane extends JPanel implements UIObserver { private void createContentPane() { VerticalFlowLayout layout = new VerticalFlowLayout(0, 0, 0); layout.setAlignLeft(true); - this.setLayout(new BorderLayout()); + this.setLayout(layout); for (int i = 0, size = colorButtons.size(); i < size; i += COUNT_OF_ROW) { JPanel panel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(2, 2); @@ -126,7 +126,7 @@ public class ColorAdjustPane extends JPanel implements UIObserver { }; colorButton.addChangeListener(changeListener); - colorButton.setBorder(new ScaledEmptyBorder(0, 0, 0, 15)); + colorButton.setBorder(new ScaledEmptyBorder(0, 0, 0, 1)); return colorButton; } diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java index 9c08d62ef9..4a19d7e51f 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java @@ -1,7 +1,9 @@ package com.fr.design.style.color; 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.dialog.BasicPane; import com.fr.design.gui.frpane.FineTabbedPane; @@ -76,7 +78,7 @@ public class ColorSelectDetailPane extends BasicPane { // 颜色选择器面板 selectedPanel = new JColorChooser(this.color); - selectedPanel.setPreferredSize(new Dimension(selectedPanel.getWidth(), SELECT_PANEL_HEIGHT)); + selectedPanel.setPreferredSize(new Dimension(selectedPanel.getWidth(), FineUIScale.scale(SELECT_PANEL_HEIGHT))); selectedPanel.setPreviewPanel(new JPanel()); swatchChooserPanel = new SwatchChooserPanel(); @@ -87,7 +89,7 @@ public class ColorSelectDetailPane extends BasicPane { // 预览 previewPanel = new JPanel(new BorderLayout()); final ColorChooserPreview colorChooserPreview = new ColorChooserPreview(); - colorChooserPreview.setBackground(Color.WHITE); + colorChooserPreview.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); ColorSelectionModel model = selectedPanel.getSelectionModel(); model.addChangeListener(new ChangeListener() { @Override @@ -128,8 +130,8 @@ public class ColorSelectDetailPane extends BasicPane { cell(new UILabel(i18nText("Fine-Design_Basic_Preview"))), cell(previewPanel).with(it -> { it.setBorder(new FineRoundBorder()); - it.setPreferredSize(new Dimension(this.getPreferredSize().width, 120)); - it.setBackground(Color.WHITE); + it.setPreferredSize(new Dimension(this.getPreferredSize().width, FineUIScale.scale(120))); + it.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); }) )).with(it -> it.setBorder(new ScaledEmptyBorder(0, 10, 0, 10))) ).getComponent(); diff --git a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java index 729159c731..9d566667d1 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java +++ b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java @@ -11,6 +11,7 @@ import javax.swing.ButtonGroup; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JColorChooser; +import javax.swing.JLayeredPane; import javax.swing.JPanel; import javax.swing.SpinnerNumberModel; import javax.swing.SwingConstants; @@ -22,6 +23,9 @@ import javax.swing.event.DocumentListener; import javax.swing.text.BadLocationException; import javax.swing.text.Document; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.islider.UISlider; @@ -593,10 +597,10 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec */ protected void buildChooser() { setLayout(new BorderLayout(10, 0)); - setPreferredSize(new Dimension((int) this.getPreferredSize().getWidth(), 180)); + setPreferredSize(new Dimension((int) this.getPreferredSize().getWidth(), FineUIScale.scale(180))); add(buildRightPanel(), BorderLayout.CENTER); JPanel container = new JPanel(); - container.setLayout(new BorderLayout()); + container.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 0)); gradientPanel = createGradientPanel(); MouseAdapter ml = new MainGradientMouseListener(); @@ -612,10 +616,16 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec slider.setOrientation(SwingConstants.VERTICAL); updateSlider(); + JLayeredPane layeredPane = new JLayeredPane(); + layeredPane.add(trackPanel, JLayeredPane.DEFAULT_LAYER); + layeredPane.add(slider, JLayeredPane.PALETTE_LAYER); - container.add(gradientPanel, BorderLayout.WEST); - container.add(slider, BorderLayout.CENTER); - container.add(trackPanel, BorderLayout.EAST); + container.add(gradientPanel); + container.add(layeredPane); + + layeredPane.setPreferredSize(FineUIScale.scale(new Dimension(12, 180))); + slider.setSize(FineUIScale.scale(new Dimension(12, 180))); + trackPanel.setSize(FineUIScale.scale(new Dimension(12, 180))); add(container, BorderLayout.WEST); slider.addChangeListener(new SliderChangeListener()); @@ -691,7 +701,11 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec private Container buildRightPanel() { JPanel container = new JPanel(new BorderLayout()); - JButton pickColorButton = PickColorButtonFactory.getPickColorButton(this, PickColorButtonFactory.IconType.ICON18, true); + JButton pickColorButton = PickColorButtonFactory.getPickColorButton(this, PickColorButtonFactory.IconType.ICON24, true); + JPanel pane = new JPanel(new BorderLayout()); + pane.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + pane.add(pickColorButton); + pane.setBorder(new FineRoundBorder()); container.add(column( 10, row( @@ -702,13 +716,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec ), row( BUTTON_SPINNER_GAP, - row(fix((int) hRadio.getPreferredSize().getHeight()), cell(new UILabel("#")), flex()).with(it -> it.setPreferredSize(hRadio.getPreferredSize())), - cell(field), - column( - flex(), - cell(pickColorButton), - flex() - ) + row(fix((int) hRadio.getPreferredSize().getHeight()), cell(new UILabel("#")), flex()).with(it -> it.setPreferredSize(hRadio.getPreferredSize())), + cell(field), + cell(pane) ) ).getComponent()); @@ -780,7 +790,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec TextDocumentListener listen = new TextDocumentListener(); field = new UITextField(); - field.setPreferredSize(new Dimension(hSpinner.getPreferredSize())); + field.setPreferredSize(FineUIScale.scale(new Dimension(hSpinner.getPreferredSize()))); field.getDocument().addDocumentListener(listen); return column( diff --git a/designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java index 28fcadfab7..3d68c8469f 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java @@ -11,6 +11,7 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; +import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.utils.FineUIUtils; import com.fr.design.gui.ilable.UILabel; @@ -43,7 +44,6 @@ public class DetailColorSelectPane extends BasicPane { } public DetailColorSelectPane(boolean supportTheme) { - this.setBorder(BorderFactory.createEmptyBorder(4, 4, 0, 4)); this.setLayout(FRGUIPaneFactory.createBorderLayout()); colorSelectPane = NewColorSelectPane.createColorSelectPaneWithTheme(supportTheme); @@ -78,13 +78,13 @@ public class DetailColorSelectPane extends BasicPane { 5, row( 20, - cell(colorSelectPane.transparentButton).weight(0.2), - cell(new UILabel("" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview") + "")).weight(0.36) + cell(colorSelectPane.transparentButton).weight(0.3), + cell(new UILabel("" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview") + "")).weight(0.53) ), row( 20, - cell(colorSelectPane.theme).weight(0.2).with(it -> it.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UIManager.getColor("defaultBorderColor")))), - cell(colorPreviewPane).weight(0.36).with(it -> it.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UIManager.getColor("defaultBorderColor")))) + cell(colorSelectPane.theme).weight(0.3).with(it -> it.setBorder(new FineRoundBorder())), + cell(colorPreviewPane).weight(0.53).with(it -> it.setBorder(new FineRoundBorder())) ) ).getComponent(); this.add(FineUIUtils.wrapComponentWithTitle(center, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color"))); diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index 54824dd0cc..771a07d1d2 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -298,6 +298,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { transparentButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); transparentButton.addActionListener(e -> doTransparent()); transparentButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); + transparentJpanel.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); transparentJpanel.add(transparentButton, BorderLayout.CENTER); transparentJpanel.setBorder(new ScaledEmptyBorder(6, 6, 6, 6)); this.add(transparentJpanel, BorderLayout.NORTH); diff --git a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java index f394801c89..a808d373fc 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java +++ b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java @@ -1,12 +1,13 @@ package com.fr.design.style.color; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.SpecialUIButton; import com.fr.design.gui.ibutton.UIBasicButtonUI; import javax.swing.JButton; import javax.swing.JComponent; -import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Graphics; @@ -20,9 +21,7 @@ import java.awt.event.MouseEvent; class PickColorButtonFactory { private static int iconSize; private static final int SIZE_16 = 16; - private static final int SIZE_18 = 18; - private static IconType iconType; - private static Image iconImage; + private static final int SIZE_24 = 24; /** * 生成取色按钮 @@ -33,17 +32,16 @@ class PickColorButtonFactory { */ static JButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) { final SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); - PickColorButtonFactory.iconType = iconType; + pickColorButton.setIcon(new LazyIcon("color_picker")); + pickColorButton.setOpaque(false); if (iconType == IconType.ICON16) { - iconImage = BaseUtils.readImage("/com/fr/design/images/gui/colorPicker/colorPicker16.png"); iconSize = SIZE_16; } else { - iconImage = BaseUtils.readImage("/com/fr/design/images/gui/colorPicker/colorPicker18.png"); - iconSize = SIZE_18; + iconSize = SIZE_24; pickColorButton.setBorderPainted(false); } - pickColorButton.setPreferredSize(new Dimension(iconSize, iconSize)); + pickColorButton.setPreferredSize(FineUIScale.scale(new Dimension(iconSize, iconSize))); pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); // 不能使用 ActionListener,否则设计器工具栏中的取色按钮会有问题(REPORT-13654) @@ -64,30 +62,13 @@ class PickColorButtonFactory { * 取色按钮可使用的图标尺寸 */ public enum IconType { - ICON16, ICON18 + ICON16, ICON24 } private static class WhiteButtonUI extends UIBasicButtonUI { @Override public void paint(Graphics g, JComponent c) { super.paint(g, c); - Dimension size = c.getSize(); - g.setColor(Color.WHITE); - g.fillRoundRect(0, 0, size.width - 1, size.height - 1, 1, 1); - g.setColor(new Color(153, 153, 153)); // #999999 - g.drawRoundRect(0, 0, size.width - 1, size.height - 1, 1, 1); - if (iconType == IconType.ICON16) { - g.drawImage( - iconImage, - (size.width - iconImage.getWidth(null)) / 2, - (size.height - iconImage.getHeight(null)) / 2, - iconImage.getWidth(null), - iconImage.getHeight(null), - null - ); - } else { - g.drawImage(iconImage, 0, 0, iconSize, iconSize, null); - } } } } diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 7be733b2b5..67d3e19690 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -1,5 +1,8 @@ package com.fr.env; +import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; @@ -76,6 +79,9 @@ public class RemoteEnvPane extends BasicBeanPane { private UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); private UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); private UILabel uiLabel = new UILabel(); + private final int FIRST_COL_WIDTH = 72; + private final int SECOND_COL_WIDTH = 68; + /** * 是否启用 https 勾选框 @@ -251,50 +257,22 @@ public class RemoteEnvPane extends BasicBeanPane { public RemoteEnvPane() { // 配置内容面板 JPanel contentPanel = new JPanel(new BorderLayout()); - contentPanel.setBorder( - BorderFactory.createCompoundBorder( - new EmptyBorder(6, 0, 0, 0), - UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Config"))) - ); - // 服务器地址地址 final JPanel configPanel = new JPanel(new BorderLayout()); - configPanel.setBorder( - BorderFactory.createCompoundBorder( - new EmptyBorder(15, 0, 0, 0), - BorderFactory.createTitledBorder( - new ModLineBorder(ModLineBorder.TOP), - Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Server") - ) - ) - ); - - - certPathLabel.setHorizontalAlignment(SwingConstants.RIGHT); - certSecretKeyLabel.setHorizontalAlignment(SwingConstants.RIGHT); + certPathLabel.setHorizontalAlignment(SwingConstants.LEFT); + certSecretKeyLabel.setHorizontalAlignment(SwingConstants.LEFT); packConfigPanel(configPanel); // 服务器账号配置 JPanel accountPanel = new JPanel(new BorderLayout()); - - - accountPanel.setBorder(BorderFactory.createCompoundBorder( - new EmptyBorder(15, 0, 0, 0), - BorderFactory.createTitledBorder( - new ModLineBorder(ModLineBorder.TOP), - Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Platform_Account") - ) - )); - + accountPanel.setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); packAccountPanel(accountPanel); - // 测试链接按钮 JPanel testPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); testPanel.setBorder(BorderFactory.createEmptyBorder()); - testPanel.setPreferredSize(new Dimension(437, 20)); UIButton testConnectionButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Test_Connection")); testConnectionButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Datasource_Test_Connection")); @@ -306,14 +284,15 @@ public class RemoteEnvPane extends BasicBeanPane { }); testPanel.add(testConnectionButton); - contentPanel.add(configPanel, BorderLayout.NORTH); contentPanel.add(accountPanel, BorderLayout.CENTER); - contentPanel.add(packRememberPwdConfigPanel(), BorderLayout.SOUTH); + UILabel label = new UILabel(); + FineUIUtils.wrapBoldLabelWithUnderline(label); + contentPanel.add(label, BorderLayout.SOUTH); JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.add(contentPanel, BorderLayout.NORTH); + panel.add(FineUIUtils.wrapComponentWithTitle(contentPanel, Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Config")), BorderLayout.NORTH); panel.add(testPanel, BorderLayout.CENTER); - panel.setPreferredSize(new Dimension(440, 600)); + panel.setPreferredSize(new Dimension(FineUIScale.scale(440), (int) panel.getPreferredSize().getHeight())); UIScrollPane scrollPane = new UIScrollPane(panel); this.setLayout(new BorderLayout()); this.add(scrollPane); @@ -395,43 +374,42 @@ public class RemoteEnvPane extends BasicBeanPane { private void packConfigPanel(JPanel configPanel) { - - // 主机名 UILabel hostNameLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Host_IP")); - hostNameLabel.setHorizontalAlignment(SwingConstants.RIGHT); + hostNameLabel.setHorizontalAlignment(SwingConstants.LEFT); // 端口 UILabel portLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Port")); - portLabel.setHorizontalAlignment(SwingConstants.RIGHT); + portLabel.setHorizontalAlignment(SwingConstants.LEFT); // web应用 UILabel webAppNameLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Web_Name")); - webAppNameLabel.setHorizontalAlignment(SwingConstants.RIGHT); + webAppNameLabel.setHorizontalAlignment(SwingConstants.LEFT); // servlet UILabel servletNameLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Servlet_Name")); - servletNameLabel.setHorizontalAlignment(SwingConstants.RIGHT); + servletNameLabel.setHorizontalAlignment(SwingConstants.LEFT); // 主机位置 UILabel remoteEnvURLLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_URL")); - remoteEnvURLLabel.setHorizontalAlignment(SwingConstants.RIGHT); + remoteEnvURLLabel.setHorizontalAlignment(SwingConstants.LEFT); + + //远程服务器 + UILabel remoteServerLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Server")); + remoteServerLabel.setHorizontalAlignment(SwingConstants.LEFT); enableSubDocListener(); JPanel urlPanel = TableLayoutHelper.createGapTableLayoutPane( new Component[][]{ - new Component[]{hostNameLabel, hostNameInput}, - new Component[]{portLabel, portInput}, - new Component[]{webAppNameLabel, webAppNameInput}, - new Component[]{servletNameLabel, servletNameInput}, - new Component[]{remoteEnvURLLabel, remoteEnvURLInput} + new Component[]{remoteServerLabel, hostNameLabel, hostNameInput}, + new Component[]{new UILabel(), portLabel, portInput}, + new Component[]{new UILabel(), webAppNameLabel, webAppNameInput}, + new Component[]{new UILabel(), servletNameLabel, servletNameInput}, + new Component[]{new UILabel(), remoteEnvURLLabel, remoteEnvURLInput} }, new double[]{PREFERRED, PREFERRED, PREFERRED, PREFERRED, PREFERRED}, - new double[]{PREFERRED, FILL}, - 5, + new double[]{FIRST_COL_WIDTH, SECOND_COL_WIDTH, FILL}, + 14, 10 - ); - TableLayoutHelper.modifyTableLayoutIndexVGap(urlPanel, 0, 10); - JTextPane urlTipsPane = new JTextPane(); urlTipsPane.setEditable(false); urlTipsPane.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Server_Config_Tips")); @@ -482,7 +460,6 @@ public class RemoteEnvPane extends BasicBeanPane { private void packHttpsConfigPanel() { - double[] rows = new double[]{PREFERRED}; boolean httpsEnabled = httpsCheckbox.isSelected(); @@ -491,13 +468,13 @@ public class RemoteEnvPane extends BasicBeanPane { } JPanel content = TableLayoutHelper.createGapTableLayoutPane( new Component[][]{ - new Component[]{httpsCheckbox, new JPanel()}, - new Component[]{certPathLabel, httpsCertFileInputPanel}, - new Component[]{certSecretKeyLabel, certSecretKeyInput} + new Component[]{httpsCheckbox, new JPanel(), new UILabel()}, + new Component[]{new UILabel(), certPathLabel, httpsCertFileInputPanel}, + new Component[]{new UILabel(), certSecretKeyLabel, certSecretKeyInput} }, rows, - new double[]{PREFERRED, FILL}, - 5, + new double[]{FIRST_COL_WIDTH, SECOND_COL_WIDTH, FILL}, + 14, 10 ); httpsConfigPanel.add(content, BorderLayout.CENTER); @@ -508,10 +485,13 @@ public class RemoteEnvPane extends BasicBeanPane { // 用户名 UILabel userNameLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Account_Username")); - userNameLabel.setHorizontalAlignment(SwingConstants.RIGHT); + userNameLabel.setHorizontalAlignment(SwingConstants.LEFT); // 密码 UILabel passwordLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Account_Password")); - passwordLabel.setHorizontalAlignment(SwingConstants.RIGHT); + passwordLabel.setHorizontalAlignment(SwingConstants.LEFT); + + UILabel accountLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Remotex_Env_Platform_Account")); + accountLabel.setHorizontalAlignment(SwingConstants.LEFT); //输入密码的时候检测下大写锁定 passwordInput.addMouseListener(new MouseAdapter() { @@ -527,42 +507,25 @@ public class RemoteEnvPane extends BasicBeanPane { }); Component[][] accountComponents = new Component[][]{ - new Component[]{userNameLabel, usernameInput}, - new Component[]{passwordLabel, passwordInput} + new Component[]{accountLabel, userNameLabel, usernameInput}, + new Component[]{new UILabel(), passwordLabel, passwordInput}, + new Component[]{new UILabel(), new UILabel(), rememberPwdCheckbox} }; JPanel content = TableLayoutHelper.createGapTableLayoutPane(accountComponents, - new double[]{PREFERRED, PREFERRED}, - new double[]{PREFERRED, FILL}, - 5, + new double[]{PREFERRED, PREFERRED, PREFERRED}, + new double[]{FIRST_COL_WIDTH, SECOND_COL_WIDTH, FILL}, + 14, 10 ); - TableLayoutHelper.modifyTableLayoutIndexVGap(content, 0, 10); - accountPanel.add(content, BorderLayout.CENTER); } - private JPanel packRememberPwdConfigPanel() { - - JPanel panel = TableLayoutHelper.createGapTableLayoutPane( - new Component[][]{ - new Component[]{rememberPwdCheckbox} - }, - new double[]{PREFERRED}, - new double[]{PREFERRED}, - 5, - 10 - ); - TableLayoutHelper.modifyTableLayoutIndexHGap(panel, 0, 50); - return panel; - } - private JPanel createHttpsCertFileInputPanel() { JPanel inputPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); inputPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); inputPanel.add(certPathInput, BorderLayout.CENTER); inputPanel.add(fileChooserButton, BorderLayout.EAST); - fileChooserButton.setPreferredSize(new Dimension(20, 20)); fileChooserButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { diff --git a/designer-base/src/main/resources/com/fine/theme/icon/colorPicker.svg b/designer-base/src/main/resources/com/fine/theme/icon/colorPicker.svg new file mode 100644 index 0000000000..2c6425c37c --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/colorPicker.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/pageQuery.svg b/designer-base/src/main/resources/com/fine/theme/icon/pageQuery.svg new file mode 100644 index 0000000000..4b0ee94ec5 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/pageQuery.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/pages.svg b/designer-base/src/main/resources/com/fine/theme/icon/pages.svg deleted file mode 100644 index afc2ecb557..0000000000 --- a/designer-base/src/main/resources/com/fine/theme/icon/pages.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/newLine.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/newLine.svg new file mode 100644 index 0000000000..6236b57ed3 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/newLine.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page.svg new file mode 100644 index 0000000000..6ba88c97d1 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/page.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/pages.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/pages.svg new file mode 100644 index 0000000000..8df4d04b25 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/pages.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/selectedAll.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/selectedAll.svg new file mode 100644 index 0000000000..64350dc681 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/selectedAll.svg @@ -0,0 +1,8 @@ + + + + + + + + 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 ff985b133a..7bc179770b 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 @@ -29,7 +29,8 @@ "recycle": "recycle.svg", "time": "time.svg", "logo": "logo.svg", - "pages": "pages.svg", + "page_query": "pageQuery.svg", + "color_picker": "colorPicker.svg", "digitalPlatform": "digitalPlatform.svg", "tables": "tables.svg", "views": "views.svg", @@ -249,6 +250,10 @@ "scale": "toolbar/scale.svg", "printerOffset": "toolbar/printerOffset.svg", "customButton": "toolbar/customButton.svg", + "page": "toolbar/page.svg", + "pages": "toolbar/pages.svg", + "new_line": "toolbar/newLine.svg", + "selected_all": "toolbar/selectedAll.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 d7d205bf0d..2bbc5c2f2d 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 @@ -128,6 +128,7 @@ defaultBorderFocusShadow = #2576ef19 defaultBorderFocusWidth = 0 brand.normal=#2576EF color.brand4=#84B1F6 +default.background = @background background.normal=#FFFFFF text.white=#ffffff text.placeholder=fade(@foreground, 40%) 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 0949b792a4..48ba6f2d5e 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 @@ -5,6 +5,7 @@ package com.fr.design.mainframe; import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.base.chart.BaseChartCollection; import com.fr.chart.chartattr.ChartCollection; @@ -43,9 +44,9 @@ public class ChartPropertyPane extends BaseChartPropertyPane { protected void initComponent() { this.setLayout(new BorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + this.setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); // 外部轮廓大小固定,适配滚动面板 - this.setPreferredSize(FineUIScale.scale(new Dimension(getWidth(), 900))); + this.setPreferredSize(new Dimension(getWidth(), FineUIScale.scale(900))); } @Override diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java index be065a429b..1103d4b348 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java @@ -1,6 +1,9 @@ package com.fr.design.module; 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.base.BaseUtils; import com.fr.base.ChartEmptyDataStyleConf; import com.fr.base.Style; @@ -27,6 +30,7 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.SwingWorker; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Image; @@ -42,7 +46,7 @@ import static com.fine.swing.ui.layout.Layouts.row; * Created by mengao on 2017/11/23. */ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { - private static final int WIDTH = 150; + private static final int WIDTH = 100; private static final int HEIGHT = 26; private static final int FIVE = 5; private static final int TEN = 10; @@ -91,7 +95,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { private void initEmptyData() { emptyData = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")}); emptyData.setSelectedIndex(0); - emptyData.setPreferredSize(new Dimension(WIDTH, HEIGHT)); + emptyData.setPreferredSize(FineUIScale.scale(new Dimension(WIDTH, HEIGHT))); emptyData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -104,7 +108,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { private void initImageData() { imageData = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"), Toolkit.i18nText("Fine-Design_Chart_Mode_Custom")}); imageData.setSelectedIndex(0); - imageData.setPreferredSize(new Dimension(WIDTH, HEIGHT)); + imageData.setPreferredSize(FineUIScale.scale(new Dimension(WIDTH, HEIGHT))); imageData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -121,15 +125,19 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { // preview pane JPanel previewContainerPane = new JPanel(new BorderLayout()); centerPane.add(previewContainerPane, BorderLayout.CENTER); - centerPane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Preview"))), BorderLayout.NORTH); - JPanel previewOwnerPane = new JPanel(new BorderLayout()); + UILabel label = new UILabel((Toolkit.i18nText("Fine-Design_Basic_Preview"))); + label.setBorder(new ScaledEmptyBorder(10, 0, 10, 0)); + centerPane.add(label, BorderLayout.NORTH); + + previewPane = new ImagePreviewPane(); + JScrollPane previewOwnerPane = new JScrollPane(previewPane); previewOwnerPane.setBorder(new FineRoundBorder()); + previewOwnerPane.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + previewOwnerPane.getViewport().setOpaque(false); previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER); previewContainerPane.add(initSelectFilePane(), BorderLayout.EAST); - previewPane = new ImagePreviewPane(); - previewOwnerPane.add(new JScrollPane(previewPane)); // init image file chooser. diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java index 498e6d44ef..7368ea951d 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java @@ -1,5 +1,6 @@ package com.fr.design.module; +import com.fine.theme.utils.FineUIScale; import com.fr.base.ChartColorMatching; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -47,6 +48,8 @@ public class ChartPreFillStylePane extends BasicBeanPane { private ColorAdjustPane colorAdjustPane; private FixedGradientBar colorGradient; + private final Integer COLOR_ADJUST_PANE_WIDTH = 240; + private final Integer COLOR_ADJUST_PANE_HEIGHT = 88; public ChartPreFillStylePane() { initComponents(); @@ -58,7 +61,6 @@ public class ChartPreFillStylePane extends BasicBeanPane { groupButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Custom_Color"), Toolkit.i18nText("Fine-Design_Chart_Gradient_Color")}); groupButton.setSelectedIndex(0); changeColorSetPane = new JPanel(cardLayout = new CardLayout()); - changeColorSetPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); changeColorSetPane.add(colorGradient = new FixedGradientBarNoTheme(4, 150), "gradient"); changeColorSetPane.add(colorAdjustPane = new ColorAdjustPane(), "acc"); cardLayout.show(changeColorSetPane, "acc"); @@ -76,7 +78,10 @@ public class ChartPreFillStylePane extends BasicBeanPane { cell(groupButton).weight(0.1), flex(0.2) ), - cell(changeColorSetPane) + row( + cell(changeColorSetPane).with(it -> it.setPreferredSize(FineUIScale.scale(new Dimension(COLOR_ADJUST_PANE_WIDTH, COLOR_ADJUST_PANE_HEIGHT)))), + flex() + ) ).getComponent()); } diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java index 876864a421..cd9863fc7e 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java @@ -1,5 +1,6 @@ package com.fr.design.module; +import com.fine.theme.light.ui.FineRoundBorder; import com.fr.base.ChartColorMatching; import com.fr.chart.base.ChartUtils; import com.fr.chart.chartattr.Bar2DPlot; @@ -55,17 +56,16 @@ public class ChartPreStylePane extends BasicBeanPane { chartComponent = new ChartComponent(); chartComponent.populate(cc); - chartComponent.setPreferredSize(new Dimension(441, 356)); chartComponent.setSupportEdit(false); this.add(column( - 20, + 10, cell(fillStylePane), column( 10, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))), - cell(chartComponent) - ) + cell(chartComponent).weight(1).with(it -> it.setBorder(new FineRoundBorder())) + ).weight(1) ).getComponent()); initListener(ChartPreStylePane.this); diff --git a/designer-chart/src/main/resources/com/fr/design/images/background/null_background.png b/designer-chart/src/main/resources/com/fr/design/images/background/null_background.png new file mode 100644 index 0000000000..6178601812 Binary files /dev/null and b/designer-chart/src/main/resources/com/fr/design/images/background/null_background.png differ diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java index cf9a5ca165..b9c3ac37d5 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java @@ -1,6 +1,7 @@ package com.fr.design.actions.replace.ui; +import com.fine.theme.utils.FineUIScale; import com.fr.design.actions.replace.action.ITChecker; import com.fr.design.actions.replace.action.ShowSearchResultAction; @@ -38,7 +39,6 @@ import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; -import static com.fr.design.actions.replace.ui.ITTableEditorPane.editTable; import static com.fr.design.actions.replace.ui.ITTableEditorPane.getEditTable; /** @@ -148,7 +148,7 @@ public class ITReplaceMainDialog extends UIDialog { replaceComboBox.setEnabled(false); replaceComboBox.setEditable(true); northPane.getReplaceButton().setEnabled(false); - westPanel.getLeftPanel().setPreferredSize(new Dimension(ITReplaceWestPanel.LEFT_WIDTH, this.getHeight())); + westPanel.getLeftPanel().setPreferredSize(new Dimension(FineUIScale.scale(ITReplaceWestPanel.LEFT_WIDTH), this.getHeight())); ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).setPlaceholder(Toolkit.i18nText("Fine-Design_Replace_Search_Input")); ((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setPlaceholder(Toolkit.i18nText("Fine-Design_Replace_Input")); ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).addActionListener(new ActionListener() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java index 23c3d99ac3..527a74b1ed 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java @@ -1,13 +1,13 @@ package com.fr.design.actions.replace.ui; -import com.formdev.flatlaf.ui.FlatUIUtils; -import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fine.theme.utils.FineUIScale; import com.fr.design.actions.replace.info.Info; import com.fr.design.actions.replace.info.base.ITContent; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itableeditorpane.UITableEditAction; +import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itableeditorpane.UITableModelAdapter; import com.fr.design.i18n.Toolkit; @@ -17,12 +17,10 @@ import org.jetbrains.annotations.Nullable; import javax.swing.BorderFactory; import javax.swing.DefaultCellEditor; -import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.UIManager; import javax.swing.plaf.UIResource; -import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellRenderer; import java.awt.Color; import java.awt.Component; @@ -62,26 +60,14 @@ public class ITTableEditor extends UITableModelAdapter { }); - DefaultTableCellRenderer cellRenderer = new DefaultTableCellRenderer() { - @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - ((JComponent) c).setBorder(BorderFactory.createCompoundBorder( - BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")), - new ScaledEmptyBorder(0,4,0,0))); - c.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); - return c; - } - }; - - this.setDefaultRenderer(UILabel.class, cellRenderer); + this.setDefaultRenderer(UILabel.class, new UITableEditorPane.TableRenderer()); this.setDefaultEditor(ITTableButton.class, new ITTableButton()); this.setDefaultRenderer(ITTableButton.class, new ITTableButton()); this.setDefaultEditor(Boolean.class, new ITBooleanEditor()); this.setDefaultRenderer(Boolean.class, new ITBooleanRenderer()); - this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CONTENT_INDEX).setMaxWidth(50); - this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CHECKBOX_INDEX).setMaxWidth(28); + this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CONTENT_INDEX).setMaxWidth(FineUIScale.scale(50)); + this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CHECKBOX_INDEX).setMaxWidth(FineUIScale.scale(28)); this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CHECKBOX_INDEX).setCellRenderer(new ITBooleanRenderer()); } @@ -283,7 +269,11 @@ public class ITTableEditor extends UITableModelAdapter { setEnabled(!content.isReplaced()); setSelected((value != null && ((Boolean) value).booleanValue())); setUI(getUICheckBoxUI()); - setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); + if (column == table.getColumnCount() - 1) { + setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor"))); + } else { + setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); + } setBackground(Color.WHITE); return this; } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java index 4029fefe9d..bb36379e02 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java @@ -4,15 +4,12 @@ import com.fine.theme.icon.LazyIcon; import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.TRL; import com.fr.design.actions.replace.info.base.ITContent; -import com.fr.design.border.UIRoundedBorder; -import com.fr.design.constants.UIConstants; -import com.fr.design.dialog.BasicPane; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itableeditorpane.UITableEditAction; +import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itableeditorpane.UITableModelAdapter; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; @@ -21,6 +18,7 @@ import com.fr.general.GeneralUtils; import com.fr.stable.StringUtils; +import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; @@ -38,23 +36,23 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; + /** * 表格面板 * * @author Destiny.Lin * @version 11.0 * created by Destiny.Lin on 2022-08-22 + * @since + * Created On */ -public class ITTableEditorPane extends BasicPane { - - public static JTable editTable; - private UITableModelAdapter tableModel; +public class ITTableEditorPane extends UITableEditorPane { private String leftLabelName; private JPanel buttonPane; public ITTableEditorPane(UITableModelAdapter model) { - this.tableModel = model; - this.initComponent(model.createAction()); + super(model); } @@ -64,7 +62,7 @@ public class ITTableEditorPane extends BasicPane { * * @param action */ - private void initComponent(UITableEditAction[] action) { + public void initComponent(UITableEditAction[] action) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); editTable = tableModel.createTable(); editTable.addMouseListener(new MouseClickListener() { @@ -91,8 +89,8 @@ public class ITTableEditorPane extends BasicPane { } }); UIScrollPane scrollPane = new UIScrollPane(editTable); - scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC)); - this.add(scrollPane, BorderLayout.CENTER); + + add(cell(buildScrollTablePane(scrollPane)).weight(1).getComponent()); } /** @@ -223,7 +221,11 @@ public class ITTableEditorPane extends BasicPane { component.setForeground(tableHeader.getForeground()); component.setBackground(tableHeader.getBackground()); component.setFont(tableHeader.getFont()); - component.setBorder(UIManager.getBorder("TableHeader.cellBorder")); + if (column == table.getColumnCount() - 1) { + component.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor"))); + } else { + component.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); + } return component; } @@ -237,13 +239,7 @@ public class ITTableEditorPane extends BasicPane { * @param table */ public static void makeFace(JTable table) { - Dimension size = table.getTableHeader().getPreferredSize(); - size.height = 26;//设置新的表头高度 - table.getTableHeader().setBackground(FlatUIUtils.getUIColor("TableHeader.background", Color.WHITE)); - - table.getTableHeader().setPreferredSize(size); - table.getTableHeader().setDefaultRenderer(new ITHeaderRenderer(table)); } diff --git a/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java b/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java index f3cea39410..760f22dd5e 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java +++ b/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java @@ -3,6 +3,9 @@ */ package com.fr.design.cell.editor; +import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIRadioButton; @@ -36,7 +39,6 @@ import java.awt.event.ActionListener; public class BiasTextPainterCellEditor extends AbstractCellEditor { private BiasTextPainterPane biasTextPainterPane = null; - private static final double MULTIPLE = FineDesignScreen.isHighDPI() ? 2 : 1.5; /** * Constructor. @@ -87,8 +89,7 @@ public class BiasTextPainterCellEditor extends AbstractCellEditor { Window parentWindow = SwingUtilities.getWindowAncestor(grid); this.biasTextPainterPane = new BiasTextPainterPane(); - Dimension dimension = this.biasTextPainterPane.getPreferredSize(); - Dimension wrapDimension = new Dimension((int) (dimension.width * MULTIPLE), (int) (dimension.height * Math.pow(MULTIPLE, 2))); + Dimension wrapDimension = FineUIScale.scale(new Dimension(360, 172)); this.biasTextPainterPane.populate(biasTextPainter); return this.biasTextPainterPane.showWindowWithCustomSize(parentWindow, new DialogActionAdapter() { @@ -111,31 +112,14 @@ public class BiasTextPainterCellEditor extends AbstractCellEditor { private UIRadioButton choice2; public BiasTextPainterPane() { - JPanel defaultPane = this; + this.setLayout(new BorderLayout()); - //center - JPanel centerPane =FRGUIPaneFactory.createBorderLayout_S_Pane(); - defaultPane.add(centerPane, BorderLayout.CENTER); - - //text - JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0)); - centerPane.add(textPane, BorderLayout.CENTER); - - UILabel formulaLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Slope_Line_Tip", "'|'", "Season|Product")); - textPane.add(formulaLabel, BorderLayout.NORTH); - formulaLabel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 0)); - - textPane.add(Box.createVerticalStrut(2), BorderLayout.SOUTH); + UILabel formulaLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Slope_Line_Tip", "\" | \"", "Season | Product")); formulaTextArea = new UITextArea(); JScrollPane scrollPane = new JScrollPane(formulaTextArea); - // 去了scollPane的边框,否则会有两层边框,略丑 - scrollPane.setBorder(null); - textPane.add(scrollPane, BorderLayout.CENTER); - - - JPanel choicePane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); + scrollPane.setBorder(new FineRoundBorder()); + formulaTextArea.setBorder(null); choice1 = new UIRadioButton((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Slope_Line_Upper_Left_To_Lower_Right"))); choice2 = new UIRadioButton((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Slope_Line_Lower_Left_To_Upper_Right"))); @@ -146,10 +130,7 @@ public class BiasTextPainterCellEditor extends AbstractCellEditor { group.add(choice1); group.add(choice2); - choicePane.add(choice1); - choicePane.add(choice2); - - centerPane.add(choicePane, BorderLayout.SOUTH); + add(Layouts.column(10, Layouts.cell(formulaLabel).weight(0.1), Layouts.cell(scrollPane).weight(0.12), Layouts.row(5, Layouts.cell(choice1), Layouts.cell(choice2)).weight(0.12)).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/BackPane.java b/designer-realize/src/main/java/com/fr/design/condition/BackPane.java index 08a26b9de5..3c44dd80bf 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/BackPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/BackPane.java @@ -1,5 +1,8 @@ package com.fr.design.condition; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.background.ColorBackground; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; @@ -33,7 +36,7 @@ public class BackPane extends ConditionAttrSingleConditionPane super(conditionAttributesPane); backgroundLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background") + ":"); this.backgroundPreviewPane = new BackgroundPreviewLabel(); - this.backgroundPreviewPane.setPreferredSize(new Dimension(80, 20)); + this.backgroundPreviewPane.setPreferredSize(FineUIScale.scale(new Dimension(80, 20))); UIButton editBackgroundButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); editBackgroundButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -48,21 +51,22 @@ public class BackPane extends ConditionAttrSingleConditionPane }).setVisible(true); } }); + this.backgroundPreviewPane.setBorder(new FineRoundBorder()); this.backScopeComboBox = new UIComboBox(new String[] { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Cell"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Row"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Column") }); this.backgroundPreviewPane.setBackgroundObject(ColorBackground.getInstance(Color.WHITE)); - backgroundLabel.setPreferredSize(new Dimension(100, backgroundLabel.getHeight())); - this.add(row(10, cell(backgroundLabel), row( + this.setLayout(new BorderLayout()); + this.add(row(10, cell(backgroundLabel).weight(0.2), row( 10, cell(backgroundPreviewPane), cell(editBackgroundButton), - cell(backScopeComboBox), - cell(cancel)) - ).getComponent()); + cell(backScopeComboBox)).weight(0.8) + ).with(it -> it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + this.add(cancel, BorderLayout.EAST); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/BorderHighlightPane.java b/designer-realize/src/main/java/com/fr/design/condition/BorderHighlightPane.java index 4877c87c39..c65262134a 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/BorderHighlightPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/BorderHighlightPane.java @@ -1,5 +1,7 @@ package com.fr.design.condition; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.CellBorderStyle; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -29,8 +31,33 @@ public class BorderHighlightPane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + this.add(cancel, BorderLayout.EAST); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/FontPane.java b/designer-realize/src/main/java/com/fr/design/condition/FontPane.java index 5c6e6ff983..4461b3f298 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/FontPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/FontPane.java @@ -1,5 +1,7 @@ package com.fr.design.condition; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; @@ -13,6 +15,7 @@ import com.fr.report.cell.cellattr.highlight.HighlightAction; import javax.swing.BorderFactory; import javax.swing.SwingUtilities; +import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -35,7 +38,7 @@ public class FontPane extends ConditionAttrSingleConditionPane fontLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sytle_FRFont") + ":"); frFontPreviewPane = new FRFontPreviewArea(); frFontPreviewPane.setBorder(BorderFactory.createTitledBorder("")); - frFontPreviewPane.setPreferredSize(new Dimension(80, 20)); + frFontPreviewPane.setPreferredSize(FineUIScale.scale(new Dimension(80, 20))); UIButton editFRFontButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); editFRFontButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -60,15 +63,14 @@ public class FontPane extends ConditionAttrSingleConditionPane com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Column") }); this.frFontPreviewPane.setFontObject(DesignUtils.getDefaultGUIFont()); - fontLabel.setPreferredSize(new Dimension(100, fontLabel.getHeight())); - - this.add(row(10, cell(fontLabel), row( + this.setLayout(new BorderLayout()); + this.add(row(10, cell(fontLabel).weight(0.2), row( 10, cell(frFontPreviewPane), cell(editFRFontButton), - cell(fontScopeComboBox), - cell(cancel)) - ).getComponent()); + cell(fontScopeComboBox)).weight(0.8) + ).with(it -> it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + this.add(cancel, BorderLayout.EAST); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java b/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java index c00d761b25..1ef2063582 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java @@ -1,5 +1,7 @@ package com.fr.design.condition; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.style.color.ColorSelectBox; @@ -26,21 +28,21 @@ public class ForeGroundPane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + this.add(cancel, BorderLayout.EAST); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/HighLightConditionAttributesPane.java b/designer-realize/src/main/java/com/fr/design/condition/HighLightConditionAttributesPane.java index 06ec7e49b8..9e6df2abb4 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/HighLightConditionAttributesPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/HighLightConditionAttributesPane.java @@ -30,7 +30,6 @@ public class HighLightConditionAttributesPane extends ConditionAttributesPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + this.add(cancel, BorderLayout.EAST); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/NewRealValuePane.java b/designer-realize/src/main/java/com/fr/design/condition/NewRealValuePane.java index c2eb7d8f39..8d56ae275d 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/NewRealValuePane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/NewRealValuePane.java @@ -1,5 +1,6 @@ package com.fr.design.condition; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.gui.ilable.UILabel; @@ -7,7 +8,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.report.cell.cellattr.highlight.HighlightAction; import com.fr.report.cell.cellattr.highlight.ValueHighlightAction; -import java.awt.Dimension; +import java.awt.BorderLayout; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.row; @@ -25,12 +26,12 @@ public class NewRealValuePane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + this.add(cancel, BorderLayout.EAST); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/PaddingPane.java b/designer-realize/src/main/java/com/fr/design/condition/PaddingPane.java index 9bd2153514..6f0cb8f714 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/PaddingPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/PaddingPane.java @@ -1,5 +1,6 @@ package com.fr.design.condition; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.IndentationUnitProcessor; import com.fr.design.gui.icombobox.UIComboBox; @@ -16,7 +17,7 @@ import com.fr.report.cell.cellattr.highlight.HighlightAction; import com.fr.report.cell.cellattr.highlight.PaddingHighlightAction; import javax.swing.SpinnerNumberModel; -import java.awt.Dimension; +import java.awt.BorderLayout; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.column; @@ -65,15 +66,16 @@ public class PaddingPane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent()); + + this.add(column(5, cell(cancel).weight(0.5), flex(0.5)).getComponent(), BorderLayout.EAST); } private void refreshIndentationUnit() { diff --git a/designer-realize/src/main/java/com/fr/design/condition/PagePane.java b/designer-realize/src/main/java/com/fr/design/condition/PagePane.java index 37559184ee..0b3c256901 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/PagePane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/PagePane.java @@ -1,12 +1,13 @@ package com.fr.design.condition; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.report.cell.cellattr.highlight.HighlightAction; import com.fr.report.cell.cellattr.highlight.PageHighlightAction; -import java.awt.Dimension; +import java.awt.BorderLayout; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.row; @@ -31,13 +32,12 @@ public class PagePane extends ConditionAttrSingleConditionPane com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Write_Page_Before_Column") }); this.pageComboBox.setSelectedIndex(0); - pageLabel.setPreferredSize(new Dimension(100, pageLabel.getHeight())); - - this.add(row(10, cell(pageLabel), row( + this.setLayout(new BorderLayout()); + this.add(row(10, cell(pageLabel).weight(0.2), row( 10, - cell(pageComboBox), - cell(cancel)) - ).getComponent()); + cell(pageComboBox)).weight(0.8) + ).with(it -> it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + this.add(cancel, BorderLayout.EAST); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/PresentHighlightPane.java b/designer-realize/src/main/java/com/fr/design/condition/PresentHighlightPane.java index 51e02a86d3..40fa2be5ea 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/PresentHighlightPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/PresentHighlightPane.java @@ -1,5 +1,6 @@ package com.fr.design.condition; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.present.Present; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -15,7 +16,7 @@ import com.fr.report.cell.cellattr.highlight.HighlightAction; import com.fr.report.cell.cellattr.highlight.PresentHighlightAction; import javax.swing.*; -import java.awt.Dimension; +import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -85,14 +86,14 @@ public class PresentHighlightPane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + this.add(cancel, BorderLayout.EAST); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java index 3d9893dead..b3578622b3 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java @@ -1,5 +1,6 @@ package com.fr.design.condition; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.DesignerUIModeConfig; import com.fr.design.fun.ReportLengthUNITProvider; @@ -12,7 +13,7 @@ import com.fr.stable.unit.UNIT; import javax.swing.JSpinner; import javax.swing.SpinnerNumberModel; -import java.awt.Dimension; +import java.awt.BorderLayout; import java.math.BigDecimal; import static com.fine.swing.ui.layout.Layouts.cell; @@ -37,14 +38,13 @@ public abstract class WHPane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + this.add(cancel, BorderLayout.EAST); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/WidgetHighlightPane.java b/designer-realize/src/main/java/com/fr/design/condition/WidgetHighlightPane.java index 090428aad0..2d610464e9 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/WidgetHighlightPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/WidgetHighlightPane.java @@ -1,5 +1,6 @@ package com.fr.design.condition; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; @@ -17,7 +18,7 @@ import com.fr.report.cell.cellattr.highlight.HighlightAction; import com.fr.report.cell.cellattr.highlight.WidgetHighlightAction; import javax.swing.*; -import java.awt.Dimension; +import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -99,15 +100,14 @@ public class WidgetHighlightPane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + this.add(cancel, BorderLayout.EAST); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/headerfooter/HFAttributesEditDialog.java b/designer-realize/src/main/java/com/fr/design/headerfooter/HFAttributesEditDialog.java index 72dce3a204..092aa71210 100644 --- a/designer-realize/src/main/java/com/fr/design/headerfooter/HFAttributesEditDialog.java +++ b/designer-realize/src/main/java/com/fr/design/headerfooter/HFAttributesEditDialog.java @@ -3,6 +3,7 @@ */ package com.fr.design.headerfooter; +import com.fine.theme.utils.FineUIScale; import com.fr.base.BaseFormula; import com.fr.base.headerfooter.DateHFElement; import com.fr.base.headerfooter.FormulaHFElement; @@ -72,7 +73,7 @@ public class HFAttributesEditDialog extends BasicPane { JPanel topControlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); centerPane.add(topControlPane, BorderLayout.NORTH); - JPanel topControlButtonPane =FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); + JPanel topControlButtonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 6, 0)); topControlPane.add(topControlButtonPane, BorderLayout.WEST); @@ -124,7 +125,7 @@ public class HFAttributesEditDialog extends BasicPane { UIButton formulaButton = new UIButton("..."); formulaPane.add(formulaButton); formulaButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula") + "..."); - formulaButton.setPreferredSize(new Dimension(25, formulaContentField.getPreferredSize().height)); + formulaButton.setPreferredSize(new Dimension(FineUIScale.scale(25), formulaContentField.getPreferredSize().height)); formulaButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { @@ -212,7 +213,7 @@ public class HFAttributesEditDialog extends BasicPane { this.revalidate(); add(column( cell(centerPane), - cell(tabbedPaneBuilder.withHeadRatio(0.25f).build()) + cell(tabbedPaneBuilder.withHeadRatio(0.13f).build()).weight(1) ).getComponent()); if (isInsert) { this.moveLeftButton.setEnabled(false); diff --git a/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterEditPane.java b/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterEditPane.java index 45c2883aa9..ab1efae885 100644 --- a/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterEditPane.java @@ -4,6 +4,8 @@ package com.fr.design.headerfooter; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; @@ -102,6 +104,9 @@ public class HeaderFooterEditPane extends JPanel { hfPreviewPane = new HFPreviewPane(); scrollPreviewPane = new JScrollPane(hfPreviewPane); + scrollPreviewPane.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + scrollPreviewPane.getVerticalScrollBar().setOpaque(false); + scrollPreviewPane.getHorizontalScrollBar().setOpaque(false); ChangeListener contentChangeListener = new ChangeListener() { public void stateChanged(ChangeEvent e) { @@ -136,14 +141,14 @@ public class HeaderFooterEditPane extends JPanel { JPanel centerPane = column( 10, - cell(createToolbar()).weight(0.07), + cell(createToolbar()), cell(controlContentPane).weight(0.3), column( 2, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))).weight(0.1), - cell(scrollPreviewPane).weight(1.2) - ).weight(0.6) - ).with(it -> it.setBorder(new ScaledEmptyBorder(10,10,10,10))).getComponent(); + cell(scrollPreviewPane).weight(1.2).with(it -> it.setBorder(new FineRoundBorder())) + ).weight(0.75) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0,10,0,0))).getComponent(); this.add(centerPane, BorderLayout.CENTER); } @@ -267,7 +272,9 @@ public class HeaderFooterEditPane extends JPanel { titleLabel.setHorizontalAlignment(SwingConstants.LEFT); - sectionPane.add(new JScrollPane(hfContainer), BorderLayout.CENTER); + JScrollPane containerScroll = new JScrollPane(hfContainer); + containerScroll.setBorder(new FineRoundBorder()); + sectionPane.add(containerScroll, BorderLayout.CENTER); return sectionPane; } @@ -414,7 +421,6 @@ public class HeaderFooterEditPane extends JPanel { */ private void setCurrentHFContainer(HFContainer hfContainer) { currentHFContainer = hfContainer; - currentHFContainer.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); } class HFPreviewPane extends JPanel implements Scrollable { diff --git a/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java b/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java index 44730fa268..a6e3000e61 100644 --- a/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java +++ b/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java @@ -4,7 +4,10 @@ package com.fr.design.headerfooter; 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.base.BaseUtils; import com.fr.base.PaperSize; import com.fr.base.ScreenResolution; @@ -56,6 +59,7 @@ public abstract class HeaderFooterPane extends BasicPane { reportHFYypeList .addListSelectionListener(reportHFTypeSelectionListener); reportHFYypeList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + reportHFYypeList.setBorder(BorderFactory.createCompoundBorder(new FineRoundBorder(), new ScaledEmptyBorder(4, 4, 4, 4))); JScrollPane hfTypeListScrollPane = new JScrollPane(reportHFYypeList); leftPane.add(hfTypeListScrollPane, BorderLayout.CENTER); @@ -78,14 +82,13 @@ public abstract class HeaderFooterPane extends BasicPane { centerPane.add(definePane, BorderLayout.NORTH); defineCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_HF_Whether_To_Define_The_Selected_Type"), true); //是否定义选中的类型 - definePane.add(defineCheckBox); + definePane.add(defineCheckBox, BorderLayout.WEST); + defineCheckBox.setBorder(new ScaledEmptyBorder(0,10,0,0)); defineCheckBox.addChangeListener(defineChangeListener); // HeaderFooterEditPane. headerFooterEditPane = new HeaderFooterEditPane(); centerPane.add(headerFooterEditPane, BorderLayout.CENTER); - headerFooterEditPane.setBorder(BorderFactory - .createLineBorder(GUICoreUtils.getTitleLineBorderColor())); } /** @@ -203,7 +206,7 @@ public abstract class HeaderFooterPane extends BasicPane { if (value != null && value instanceof Integer) { int reportHFType = (Integer) value; - this.setIcon(new LazyIcon("logo")); + this.setIcon(new LazyIcon("cpt_icon")); if (reportHFType == ReportConstants.REPORTPAGE_DEFAULT) { this.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_HF_Default_Page")); } else if (reportHFType == ReportConstants.REPORTPAGE_FIRST) { @@ -219,13 +222,18 @@ public abstract class HeaderFooterPane extends BasicPane { if (reportHFHash != null) { Object obj = reportHFHash.get(new Integer(reportHFType)); if (obj == null) { - this.setIcon(new LazyIcon("logo").disabled()); + this.setIcon(new LazyIcon("cpt_icon").disabled()); } } } return this; } + + @Override + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, FineUIScale.scale(24)); + } }; diff --git a/designer-realize/src/main/java/com/fr/design/headerfooter/ImagePane.java b/designer-realize/src/main/java/com/fr/design/headerfooter/ImagePane.java index 008c851b85..9f78d366a8 100644 --- a/designer-realize/src/main/java/com/fr/design/headerfooter/ImagePane.java +++ b/designer-realize/src/main/java/com/fr/design/headerfooter/ImagePane.java @@ -45,14 +45,13 @@ public class ImagePane extends BasicPane { this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); //preview pane. - JPanel previewPane = new JPanel(new BorderLayout()); imagePreviewPane = new ImagePreviewPane(); - previewPane.add(new JScrollPane(imagePreviewPane)); - + JScrollPane previewPane = new JScrollPane(imagePreviewPane); previewPane.setBorder(new FineRoundBorder()); previewPane.setPreferredSize(new Dimension(FineUIScale.scale(500), FineUIScale.scale(400))); previewPane.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); - + imagePreviewPane.setOpaque(false); + previewPane.getViewport().setOpaque(false); //select image JPanel rightPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -65,14 +64,14 @@ public class ImagePane extends BasicPane { imageFileChooser.setMultiSelectionEnabled(false); this.add(column( - 3, + 5, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))), row( 10, cell(previewPane).weight(0.9), cell(rightPane).weight(0.2) - ) - ).with(it -> it.setBorder(new ScaledEmptyBorder(10,10,10,10))).getComponent()); + ).weight(1) + ).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java index 6a47ee48c3..c0679a7053 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -1,6 +1,6 @@ package com.fr.design.mainframe; -import com.formdev.flatlaf.ui.FlatUIUtils; +import com.fine.theme.utils.FineUIScale; import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.beans.BasicBeanPane; import com.fr.design.file.HistoryTemplateListPane; @@ -136,8 +136,8 @@ public class AuthorityToolBarPane extends BasicBeanPane extends BasicBeanPane it.setPreferredSize(new Dimension(it.getWidth(), FineUIScale.scale(300)))), + cell(extend), + cell(FineUIUtils.wrapComponentWithTitle(description, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attention"))) + ).weight(1).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Delivery_Parameter"))) + ).getComponent()); + } + + private UIButton initUIButton(String text) { + UIButton browseButton = new UIButton(text); + browseButton.setPreferredSize(FineUIScale.scale(new Dimension(48, 24))); browseButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Click_this_button")); - + addListener(browseButton); + return browseButton; + } + + private void addListener(UIButton browseButton) { browseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { FILEChooserPane fileChooser = FILEChooserPane.getInstance(true, false); int chooseResult = fileChooser.showOpenDialog(SubReportPane.this); if(chooseResult == FILEChooserPane.OK_OPTION ||chooseResult == FILEChooserPane.JOPTIONPANE_OK_OPTION ) { - + chooseFILE = fileChooser.getSelectedFILE(); if (chooseFILE != null && chooseFILE.exists()) { pathTextField.setText(chooseFILE.prefix() + chooseFILE.getPath()); } else { FineJOptionPane.showConfirmDialog(SubReportPane.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sub_Report_Message1"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sub_Report_ToolTips"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); - chooseFILE = null; + chooseFILE = null; pathTextField.setText(""); } - } + } } }); - this.add(northPane, BorderLayout.NORTH); - - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(centerPane, BorderLayout.CENTER); - centerPane.setLayout(FRGUIPaneFactory.createM_BorderLayout()); - centerPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 5)); - kvPane = new ReportletParameterViewPane(); - centerPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Delivery_Parameter"),null)); - JPanel kcPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - kcPane.add(kvPane); - extend = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Extends_Report_Parameters")); - kcPane.add(extend, BorderLayout.SOUTH); - centerPane.add(kcPane, BorderLayout.CENTER); - UITextArea description = new UITextArea(2, 1); - centerPane.add(description, BorderLayout.SOUTH); - description.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sub_Report_Description")); - description.setEditable(false); - description.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attention"), null)); - } - + } + @Override protected String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Insert_Sub_Report"); 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 729b1e66b6..03452d97e9 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 @@ -753,7 +753,7 @@ public class EditToolBar extends BasicPane { super.setSelectedIndex(newSelectedIndex, fireChanged); } }; - bgColorButtonGroup.setPreferredSize(FineUIScale.scale(new Dimension(135, bgColorButtonGroup.getPreferredSize().height))); + bgColorButtonGroup.setPreferredSize(new Dimension(FineUIScale.scale(135), bgColorButtonGroup.getPreferredSize().height)); return row(10, cell(headLabel).weight(0.15), cell(bgColorButtonGroup).weight(0.3), flex(0.55)).getComponent(); } }