From e93a5886c1d84f488ea770b7024d54df75e18b80 Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 20 Oct 2020 14:13:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-41753=E3=80=90=E9=A2=84=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=A0=B7=E5=BC=8F=E3=80=91=E5=A6=82=E6=9E=9C=E6=96=B0?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=BF=9C=E7=A8=8B=E8=80=81jar?= =?UTF-8?q?=EF=BC=8C=E6=98=BE=E7=A4=BA=E7=9A=84=E9=BB=98=E8=AE=A4=E9=A2=84?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E4=B8=8D=E6=98=AF=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JTemplate.java | 4 +- .../ui/PredefinedStyleEditPane.java | 54 +++++++++++++++++-- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 7943ee8ea0..fb5a0f715b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -160,8 +160,8 @@ public abstract class JTemplate> private void setPredefinedInfo(boolean isNewFile){ if (this.template.getAttrMark(PredefinedStyleAttrMark.XML_TAG) == null) { - PredefinedStyleAttrMark attrMark= new PredefinedStyleAttrMark(); - if (!isNewFile){ + PredefinedStyleAttrMark attrMark = new PredefinedStyleAttrMark(); + if (!isNewFile || !DesignUtils.checkDesignerRemoteVersion()) { attrMark.setPreferenceStyleName(InterProviderFactory.getProvider().getLocText("Fine-Engine_Predefined_Style_Compatibility")); } this.template.addAttrMark(attrMark); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java index 8a611886c2..14406e9a9f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java @@ -1,5 +1,13 @@ package com.fr.design.mainframe.predefined.ui; +import com.fr.base.ChartColorMatching; +import com.fr.base.ChartPreStyleConfig; +import com.fr.base.Style; +import com.fr.base.background.ColorBackground; +import com.fr.config.predefined.ColorFillStyle; +import com.fr.config.predefined.PredefinedCellStyle; +import com.fr.config.predefined.PredefinedCellStyleConfig; +import com.fr.config.predefined.PredefinedColorStyle; import com.fr.config.predefined.PredefinedStyle; import com.fr.config.predefined.PredefinedStyleConfig; import com.fr.config.ServerPreferenceConfig; @@ -18,6 +26,7 @@ import com.fr.design.mainframe.predefined.ui.detail.ComponentStyleSettingPane; import com.fr.design.mainframe.predefined.ui.detail.CellStyleListControlPane; import com.fr.design.mainframe.predefined.ui.preview.PredefinedStylePreviewPane; import com.fr.design.utils.DesignUtils; +import com.fr.general.FRFont; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; @@ -29,9 +38,9 @@ import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.util.ArrayList; import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; +import java.util.List; /** * Created by kerry on 2020-08-26 @@ -220,14 +229,51 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane { PredefinedStyle predefinedStyle = new PredefinedStyle(); predefinedStyle.setLightMode(isLightMode); predefinedStyle.setStyleName(this.styleNameField.getText()); - predefinedStyle.setCellStyleConfig(this.cellStyleSettingPane.updateBean()); + PredefinedCellStyleConfig cellStyleConfig = this.cellStyleSettingPane.updateBean(); + predefinedStyle.setCellStyleConfig(cellStyleConfig); + predefinedStyle.setPredefinedBackground(this.backgroundSettingPane.updateBean()); predefinedStyle.setComponentStyle(this.componentStyleSettingPane.updateBean()); - predefinedStyle.setPredefinedColorStyle(this.colorFillStylePane.update()); + + PredefinedColorStyle colorStyle = this.colorFillStylePane.update(); + updateCellStyleByColorStyle(colorStyle, cellStyleConfig); + predefinedStyle.setPredefinedColorStyle(colorStyle); predefinedStyle.setPredefinedChartStyle(this.chartStyleSettingPane.updateBean()); return predefinedStyle; } + private void updateCellStyleByColorStyle(PredefinedColorStyle colorStyle, PredefinedCellStyleConfig cellStyleConfig) { + PredefinedCellStyle headerStyle = cellStyleConfig.getStyle(com.fr.design.i18n.Toolkit.i18nText("表头")); + PredefinedCellStyle highlightStyle = cellStyleConfig.getStyle(com.fr.design.i18n.Toolkit.i18nText("高亮文本")); + ColorFillStyle colorFillStyle = colorStyle.getColorFillStyle(); + List colorList = new ArrayList<>(); + if (colorFillStyle == null || colorFillStyle.getColorList().size() == 0){ + ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); + String defaultName = config.getCurrentStyle(); + ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName); + if (defaultStyle != null) { + colorList = defaultStyle.getColorList(); + } + } else { + colorList = colorFillStyle.getColorList(); + } + if (colorList.size() < 2) { + return; + } + if (headerStyle != null) { + Style style = headerStyle.getStyle(); + Color color = colorList.get(0); + headerStyle.setStyle(style.deriveBackground(ColorBackground.getInstance(color))); + } + if (highlightStyle != null) { + Style style = highlightStyle.getStyle(); + Color color = colorList.get(1); + FRFont font = style.getFRFont(); + font.setForeground(color); + highlightStyle.setStyle(style.deriveFRFont(font)); + } + } + public boolean saveStyle() { PredefinedStyle previewObject; try { From a334634da108149dfc422461ce9cec34aa30bfde Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 20 Oct 2020 14:24:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/predefined/ui/PredefinedStyleEditPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java index 14406e9a9f..2a7b5592c3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java @@ -243,8 +243,8 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane { } private void updateCellStyleByColorStyle(PredefinedColorStyle colorStyle, PredefinedCellStyleConfig cellStyleConfig) { - PredefinedCellStyle headerStyle = cellStyleConfig.getStyle(com.fr.design.i18n.Toolkit.i18nText("表头")); - PredefinedCellStyle highlightStyle = cellStyleConfig.getStyle(com.fr.design.i18n.Toolkit.i18nText("高亮文本")); + PredefinedCellStyle headerStyle = cellStyleConfig.getStyle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); + PredefinedCellStyle highlightStyle = cellStyleConfig.getStyle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text")); ColorFillStyle colorFillStyle = colorStyle.getColorFillStyle(); List colorList = new ArrayList<>(); if (colorFillStyle == null || colorFillStyle.getColorList().size() == 0){