From 8b440ef2dd8c1b418170ab8429a2e1ef007e722d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Sun, 29 Sep 2024 17:00:45 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-136212=20fix:=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=9D=A2=E6=9D=BF=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/chart/ChartIcon.java | 2 +- .../com/fr/design/chart/ChartTypePane.java | 29 ++++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java b/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java index 2b51b3b9e4..dee0ee5708 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java @@ -24,7 +24,7 @@ import java.awt.Graphics2D; * 图表的缩略图Icon, 在选择图表类型界面 用到. */ public class ChartIcon implements Icon, XMLable { - private static final int WIDTH = FineUIScale.scale(215); + private static final int WIDTH = FineUIScale.scale(210); private static final int HEIGHT = FineUIScale.scale(100); diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index 1cfdde0a19..dd773eea1d 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -7,6 +7,7 @@ import com.fine.swing.ui.layout.Column; import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.chart.chartattr.ChartCollection; @@ -24,7 +25,6 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.van.chart.config.DefaultStyleHelper4Van; -import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.JLayer; @@ -74,6 +74,7 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven JLayer typeScrollPane = FineUIUtils.createCollapsibleScrollBarLayer(mainTypeList); iconViewList = new JList(); + iconViewList.setBorder(null); iconListModel = new DefaultListModel(); iconViewList.setModel(iconListModel); @@ -104,20 +105,20 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven ChartIcon chartIcon = (ChartIcon) value; UILabel centerImg = new UILabel(chartIcon); UILabel text = new UILabel(getChartName(chartIcon), SwingConstants.CENTER); - - Column component = column( - fix(5), - cell(centerImg), cell(text), - fix(5) - ).getComponent(); - Color borderColor = isSelected ? FineUIUtils.getUIColor("defaultHighlightBorderColor", "Component.focusedBorderColor") - : FineUIUtils.getUIColor("defaultBorderColor", "Component.borderColor"); + Color borderColor = isSelected ? FineUIUtils.getUIColor("defaultHighlightBorderColor", "Component.focusedBorderColor") : + FineUIUtils.getUIColor("defaultBorderColor", "Component.borderColor"); + Color fillColor = FlatUIUtils.getUIColor("fill.normal", Color.WHITE); UIRoundedBorder roundedBorder = new UIRoundedBorder(borderColor, 1, 5); - component.setBorder(BorderFactory.createCompoundBorder( - new ScaledEmptyBorder(0, 10, 10, 0), roundedBorder)); - component.setBackground(Color.WHITE); - return component; - + Column component = column( + fix(5), cell(centerImg), cell(text), fix(5) + ).with(it -> { + it.setOpaque(true); + it.setBorder(roundedBorder); + it.setBackground(fillColor); + }).getComponent(); + JPanel pane = FineLayoutBuilder.asBorderLayoutWrapped(component); + pane.setBorder(new ScaledEmptyBorder(0, 10, 10, 0)); + return pane; } return this; } From 7f61b231e526f59f941079189a473a0f810a7612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Sun, 29 Sep 2024 17:02:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-135996=20fix:=20=E8=A7=86=E8=A7=89?= =?UTF-8?q?=E4=BA=8C=E6=AC=A1=E9=AA=8C=E6=94=B6=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../theme/utils/FineComponentsFactory.java | 30 +++++++++++++++++++ .../com/fr/design/gui/style/FormatPane.java | 16 ++-------- .../fr/design/gui/style/TextFormatPane.java | 19 ++---------- 3 files changed, 34 insertions(+), 31 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java b/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java index 80cc69c932..2e8e71d393 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java @@ -1,12 +1,22 @@ package com.fine.theme.utils; import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.data.core.FormatField; +import com.fr.design.border.UIRoundedBorder; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.stable.Constants; +import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JPanel; +import javax.swing.border.Border; +import javax.swing.border.TitledBorder; + +import java.awt.Color; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.flex; @@ -62,4 +72,24 @@ public class FineComponentsFactory { flex(), cell(confirmButton), cell(cancelButton)).getComponent(); } + /** + * 创建示例文本,圆角边框&浅灰背景 + * + * @return 示例文本Label + */ + public static UILabel createSampleLabel() { + Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"); + Border interBorder = new UIRoundedBorder(labelColor, 0, 4); + + Border border = BorderFactory.createTitledBorder(interBorder, Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"), + TitledBorder.ABOVE_TOP, 0, null, labelColor); + + UILabel sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()); + sampleLabel.setHorizontalAlignment(UILabel.CENTER); + sampleLabel.setBorder(BorderFactory.createCompoundBorder(border, new ScaledEmptyBorder(2, 0, 8, 0))); + FineUIStyle.setStyle(sampleLabel, FineUIStyle.LABEL_TIP); + + return sampleLabel; + } + } diff --git a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java index 8ab812e9dc..7d3f7d5a9b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java @@ -1,9 +1,9 @@ package com.fr.design.gui.style; +import com.fine.theme.utils.FineComponentsFactory; import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIStyle; -import com.fine.theme.utils.FineUIUtils; import com.fr.base.CoreDecimalFormat; import com.fr.base.Style; import com.fr.base.TextFormat; @@ -12,8 +12,6 @@ import com.fr.data.core.FormatField.FormatContents; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit; -import com.fr.design.border.UIRoundedBorder; -import com.fr.design.constants.UIConstants; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.gui.icombobox.TextFontComboBox; @@ -28,13 +26,10 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.math.RoundingMode; -import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.SwingConstants; -import javax.swing.border.Border; -import javax.swing.border.TitledBorder; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.text.Format; @@ -161,14 +156,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse } private void initSampleLabel() { - Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"); - Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4); - String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"); - Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.LEFT, 0, null, labelColor); - sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()); - sampleLabel.setHorizontalAlignment(UILabel.CENTER); - sampleLabel.setBorder(border); - FineUIStyle.setStyle(sampleLabel, FineUIStyle.LABEL_TIP); + sampleLabel = FineComponentsFactory.createSampleLabel(); } diff --git a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java index a86bc70e05..e2d65aa91c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java @@ -1,15 +1,13 @@ package com.fr.design.gui.style; +import com.fine.theme.utils.FineComponentsFactory; import com.fine.theme.utils.FineUIStyle; -import com.fine.theme.utils.FineUIUtils; import com.fr.base.CoreDecimalFormat; import com.fr.base.Style; import com.fr.base.TextFormat; import com.fr.data.core.FormatField; import com.fr.data.core.FormatField.FormatContents; -import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.LayoutConstants; -import com.fr.design.constants.UIConstants; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.UIObserverListener; @@ -22,17 +20,11 @@ import com.fr.design.i18n.Toolkit; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.UIManager; -import javax.swing.border.Border; -import javax.swing.border.TitledBorder; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; -import java.awt.FontMetrics; -import java.awt.Graphics; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.math.RoundingMode; @@ -112,14 +104,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName } private void initPreviewLabel4GeneralFormat() { - Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"); - Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 0, 4); - String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"); - Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.ABOVE_TOP, 0, null, labelColor); - previewLabel = new UILabel(FormatField.getInstance().getFormatValue()); - previewLabel.setHorizontalAlignment(UILabel.CENTER); - previewLabel.setBorder(border); - FineUIStyle.setStyle(previewLabel, FineUIStyle.LABEL_TIP); + previewLabel = FineComponentsFactory.createSampleLabel(); } protected void initLayout() {