From ef86abec5ae2a96c5d27acc2d895c98cbf132453 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 8 Oct 2021 09:42:58 +0800 Subject: [PATCH 1/5] =?UTF-8?q?REPORT-63310=20=E5=B7=B2=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E7=9A=84=E6=97=A0=E8=BE=B9=E6=A1=86tab=E5=9D=97=E5=9C=A8?= =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E5=86=85=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=A7=E5=B0=8F=E5=90=8E=EF=BC=8C=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=94=9F=E6=88=90=E4=BA=86=E9=BB=98=E8=AE=A4=E9=BB=91?= =?UTF-8?q?=E8=89=B2=E8=BE=B9=E6=A1=86=20&=20REPORT-59963=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4Tab=E5=9D=97=E6=A0=B7=E5=BC=8F=E4=BC=9A=E5=AF=BC?= =?UTF-8?q?=E8=87=B4Tab=E6=A0=87=E9=A2=98=E8=83=8C=E6=99=AF=E8=89=B2?= =?UTF-8?q?=E9=87=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 11.0上修复了一个相同的问题REPORT-59963,需要在10.0 上也提交下 调整Tab块样式导致样式刷新时,标题栏的样式均被初始化 【改动思路】 1. Tab组件虽然在样式面板上没有设置标题样式的设置项,即 TitlePacker,但依然使用了标题样式相关的字段,如背景, 是否显示标题栏等,这些标题相关的字段不能在调整样式时被重置, 所以需要在Tab的StylePane中始终保持 2. Tab组件的样式数据初始化应该在数据模型层完成 --- .../creator/cardlayout/XWCardLayout.java | 18 ------------------ .../gui/xpane/CardTagLayoutStylePane.java | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java index e1d4a416e7..578b509ec0 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java @@ -62,10 +62,6 @@ public class XWCardLayout extends XLayoutContainer { public static final String DEFAULT_NAME = "cardlayout"; - - //默认蓝色标题背景 - private static final Color TITLE_COLOR = new Color(51, 132, 240); - public XWCardLayout(WCardLayout widget, Dimension initSize) { super(widget, initSize); } @@ -399,24 +395,10 @@ public class XWCardLayout extends XLayoutContainer { @Override public void refreshStylePreviewEffect() { BorderPacker style = toData().getBorderStyle(); - initBorderTitleStyle(style); refreshBorderAndBackgroundStylePreviewEffect(); clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)); } - private void initBorderTitleStyle(BorderPacker style) { - //初始化默认标题样式 - if (!initFlag) { - return; - } - - style.setType(LayoutBorderStyle.TITLE); - style.setBorder(Constants.LINE_THIN); - TitlePacker widgetTitle = style.getTitle(); - widgetTitle.setBackground(ColorBackground.getInstance(TITLE_COLOR)); - initFlag = false; - } - //隐藏或显示标题部分 protected void clearOrShowTitleLayout(boolean isTitleStyle) { XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) this.getBackupParent(); diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java index 37db551027..ab953166cf 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java @@ -3,6 +3,8 @@ */ package com.fr.design.gui.xpane; +import com.fr.form.ui.LayoutBorderStyle; + import javax.swing.JPanel; /** @@ -10,6 +12,8 @@ import javax.swing.JPanel; */ public class CardTagLayoutStylePane extends LayoutStylePane { + private LayoutBorderStyle backupStyleFromPopulating = new LayoutBorderStyle(); + @Override protected JPanel createTitleStylePane(){ JPanel panel = super.createTitleStylePane(); @@ -21,4 +25,18 @@ public class CardTagLayoutStylePane extends LayoutStylePane { protected JPanel createBackgroundStylePane(boolean supportCornerRadius) { return super.createBackgroundStylePane(false); } + + @Override + public void populateBean(LayoutBorderStyle style) { + this.backupStyleFromPopulating = style; + super.populateBean(style); + } + + @Override + public LayoutBorderStyle updateBean() { + LayoutBorderStyle style = super.updateBean(); + style.setTitle(backupStyleFromPopulating.getTitle()); + style.setType(backupStyleFromPopulating.getType()); + return style; + } } From 18d681ac3600342cdad48a788ea6a02e5c36aad9 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 26 Nov 2021 15:59:51 +0800 Subject: [PATCH 2/5] =?UTF-8?q?REPORT-63192=20=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=AB=AF=E7=94=9F=E6=88=90=E7=BB=84=E4=BB=B6=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E7=9A=84=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BA=E5=BF=85=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 监听下必填项设置:组件分类 【改动思路】 同上 --- .../com/fr/design/share/ui/generate/ShareMainPane.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index 5639b5957d..9ac98286e8 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -409,6 +409,15 @@ public class ShareMainPane extends JPanel { childClassify.clearBoxItems(); childClassify.refreshBoxItems(children); } + + notifyRequiredSettingChanged(new ChangeEvent(parentClassify)); + } + }); + + childClassify.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(parentClassify)); } }); From 6f797af38e5dbc2aaf20b8d3e160258043cefdaf Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 30 Nov 2021 14:54:37 +0800 Subject: [PATCH 3/5] =?UTF-8?q?REPORT-63524=20=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E5=9F=8B=E7=82=B9=EF=BC=8C?= =?UTF-8?q?=E7=8E=B0=E5=9C=A8=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=AB=AF=E5=BC=B9?= =?UTF-8?q?=E5=87=BA=E5=8F=AF=E6=9B=B4=E6=96=B0=E5=BC=B9=E7=AA=97=E6=97=B6?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=A7=A6=E5=8F=91=E5=9F=8B=E7=82=B9=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 将响应获取组件更新信息结果的动作抽离出来 【改动思路】 同上 --- .../share/ui/local/LocalWidgetRepoPane.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java index 0d0cff5706..169b4b5e79 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java @@ -393,15 +393,19 @@ public class LocalWidgetRepoPane extends BasicPane { public void onFetchedAfter(boolean success, Map remoteLatestWidgets) { if (success) { List updatableWidgetProviders = LocalWidgetRepoUpdater.getInstance().getUpdatableWidgetProviders(); - updateTipPane.setVisible(updatableWidgetProviders.size() > 0); - if (updatableWidgetProviders.size() > 0) { - refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT); - } + onRemoteWidgetUpdatesChanged(updatableWidgetProviders.size() > 0); } } }); } + public void onRemoteWidgetUpdatesChanged(boolean hasUpdates) { + updateTipPane.setVisible(hasUpdates); + if (hasUpdates) { + refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT); + } + } + public void doQuitUpdateComponents() { LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance(); updater.clearUpdate(); From 5a407a44914a8fbfa88e9c27aab5629eb0c389cc Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Tue, 30 Nov 2021 18:10:15 +0800 Subject: [PATCH 4/5] =?UTF-8?q?REPORT-60163=20=E5=85=AC=E5=BC=8F=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E4=BC=98=E5=8C=962.0=201.=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=202.=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=9F=8B=E7=82=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 16 ++-- .../function/MismatchedCharFunction.java | 9 -- .../function/MismatchedTokenFunction.java | 38 +------- .../function/TranslateTokenUtils.java | 96 +++++++++++++++++++ 4 files changed, 108 insertions(+), 51 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 189b9e0426..27018e6e01 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -341,7 +341,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { @Override public void focusGained(FocusEvent e) { // 获得焦点时 安装 - installAutoCompletion(); + if (autoCompletion == null && autoCompletionCheck.isSelected()) { + installAutoCompletion(); + } } @Override @@ -405,13 +407,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } private void installAutoCompletion() { - if (autoCompletion == null && autoCompletionCheck.isSelected()) { - CompletionProvider provider = createCompletionProvider(); - autoCompletion = new FormulaPaneAutoCompletion(provider); - autoCompletion.setListCellRenderer(new CompletionCellRenderer()); - autoCompletion.install(formulaTextArea); - autoCompletion.installVariableTree(variableTreeAndDescriptionArea); - } + CompletionProvider provider = createCompletionProvider(); + autoCompletion = new FormulaPaneAutoCompletion(provider); + autoCompletion.setListCellRenderer(new CompletionCellRenderer()); + autoCompletion.install(formulaTextArea); + autoCompletion.installVariableTree(variableTreeAndDescriptionArea); } diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java index c25b34f67b..69ea0c81a9 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java @@ -35,10 +35,6 @@ public class MismatchedCharFunction implements Function"; } else { String[] tokenNames = (String[]) getFieldValue(exception, "tokenNames"); - return tokenType >= 0 && tokenType < tokenNames.length ? translateToken(tokenNames[tokenType]) : "<" + tokenType + ">"; + return tokenType >= 0 && tokenType < tokenNames.length ? TranslateTokenUtils.translateToken(tokenNames[tokenType]) : "<" + tokenType + ">"; } } - private String translateToken(String token) { - switch (token) { - case ("RPAREN"): - return ")"; - case ("LPAREN"): - return "("; - case ("COMMA"): - return ","; - case ("COLON"): - return ":"; - default: - return token; - } - } private Object getFieldValue(Object object, String fieldName) { try { diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java new file mode 100644 index 0000000000..1df697d071 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java @@ -0,0 +1,96 @@ +package com.fr.design.formula.exception.function; + +import com.fr.design.i18n.Toolkit; + +/** + * @author Hoky + * @date 2021/11/30 + */ +public class TranslateTokenUtils { + public static String translateToken(String token) { + switch (token) { + case ("RPAREN"): + return ")"; + case ("LPAREN"): + return "("; + case ("COMMA"): + return ","; + case ("COLON"): + return ":"; + case ("EOF"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_EOF"); + case ("DOT"): + return "."; + case ("FLOT_NUM"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Float_Number"); + case ("LOR"): + return "||"; + case ("LAND"): + return "&&"; + case ("EQUAL"): + return "="; + case ("EQUAL2"): + return "="; + case ("NOT_EQUAL"): + return "!="; + case ("NOT_EQUAL2"): + return "!="; + case ("GE"): + return ">="; + case ("LE"): + return "<="; + case ("LT"): + return "<"; + case ("PLUS"): + return "+"; + case ("MINUS"): + return "-"; + case ("STAR"): + return "*"; + case ("DIV"): + return "/"; + case ("MOD"): + return "%"; + case ("POWER"): + return "^"; + case ("LNOT"): + return "!"; + case ("WAVE"): + return "~"; + case ("LBRACK"): + return "["; + case ("SEMI"): + return ";"; + case ("RBRACK"): + return "]"; + case ("LCURLY"): + return "{"; + case ("RCURLY"): + return "}"; + case ("DCOLON"): + return ";"; + case ("INT_NUM"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Integer"); + case ("CR_ADRESS"): + return "\n"; + case ("SHARP"): + return "#"; + case ("AT"): + return "@"; + case ("QUESTION"): + return "?"; + case ("BOR"): + return "||"; + case ("BAND"): + return "&&"; + case ("Char"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Character"); + case ("DIGIT"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Digital"); + case ("XDIGIT"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Hexadecimal_Digital"); + default: + return token; + } + } +} From 922fa090ade9f0a7a0c074704e93de499aabfa9b Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 1 Dec 2021 15:42:48 +0800 Subject: [PATCH 5/5] =?UTF-8?q?CHART-22060=20fix:fvs.cpt.chart=20=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E4=BD=BF=E7=94=A8=E7=9A=84=E9=BB=98=E8=AE=A4=E9=85=8D?= =?UTF-8?q?=E8=89=B2=E5=92=8C=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=B8=8D=E5=90=8C=20=E5=90=8Cfvs.chart=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E9=85=8D=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/chart/ChartTypePane.java | 10 +-- .../impl/ChartHyperPoplinkPane.java | 12 +--- .../chart/gui/ChartTypeButtonPane.java | 9 +-- .../chart/config/DefaultStyleConstants.java | 43 +++++++----- .../chart/config/DefaultStyleHelper4Van.java | 66 +++++++++++++++---- .../type/AbstractVanChartTypePane.java | 15 +---- 6 files changed, 90 insertions(+), 65 deletions(-) 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 ffa1d5002c..1408b6a770 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 @@ -11,10 +11,9 @@ import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.info.ChartInfoCollector; -import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; -import com.fr.plugin.chart.vanchart.VanChart; +import com.fr.van.chart.config.DefaultStyleHelper4Van; import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; @@ -155,12 +154,7 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven } } - if (!ChartEditContext.supportTheme() && chart4Update instanceof VanChart) { - //主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义 - ((VanChart) chart4Update).setThemeCustom(); -// //主题中没有的 根据主题深浅色自动 的属性 默认自动 -// ((VanChart) chart4Update).setAutoThemeCustom(); - } + DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart4Update); update(chart4Update); } diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java index 855f4cbbc8..11d2e32e4d 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java @@ -12,14 +12,13 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.hyperlink.AbstractHyperLinkPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.ChartHyperEditPane; -import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; -import com.fr.plugin.chart.vanchart.VanChart; +import com.fr.van.chart.config.DefaultStyleHelper4Van; -import java.util.HashMap; import java.awt.BorderLayout; import java.awt.Dimension; +import java.util.HashMap; /** * 类说明: 图表超链 -- 弹出 悬浮窗. @@ -73,12 +72,7 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane implemen addButton.addActionListener((e) -> { String name = getNewChartName(); ChartProvider chart = getChangeStateNewChart(); - if (!ChartEditContext.supportTheme() && chart instanceof VanChart) { - //主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义 - ((VanChart) chart).setThemeCustom(); -// //主题中没有的 根据主题深浅色自动 的属性 默认自动 -// ((VanChart) chart4Update).setAutoThemeCustom(); - } + DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart); checkInForm(chart); addNewChart(chart, name, editingCollection.getChartCount()); }); diff --git a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java index 6d0de41cee..0e692f697a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java +++ b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java @@ -64,28 +64,39 @@ public class DefaultStyleConstants { static final Background BACK = null; + //新特新 + public static String COLOR_NAME_1; + //经典高亮 + private static String COLOR_NAME_2; + + static { + try { + COLOR_NAME_1 = CodeUtils.cjkDecode("\u65b0\u7279\u6027"); + COLOR_NAME_2 = CodeUtils.cjkDecode("\u7ecf\u5178\u9ad8\u4eae"); + } catch (Exception e) { + e.printStackTrace(); + } + } + static String COLORS = null; static { ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); - try { - DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u7ecf\u5178\u9ad8\u4eae"); - // 没有经典高亮, 用新特性 - if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) { - DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u65b0\u7279\u6027"); - } - // 没有新特性, 用第一个配色 - if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) { - if (config.names().hasNext()) { - - String name = GeneralUtils.objectToString(config.names().next()); - if (config.getPreStyle(name) != null) { - DefaultStyleConstants.COLORS = name; - } + + COLORS = COLOR_NAME_2; + // 没有经典高亮, 用新特性 + if (config.getPreStyle(COLORS) == null) { + COLORS = COLOR_NAME_1; + } + // 没有新特性, 用第一个配色 + if (config.getPreStyle(COLORS) == null) { + if (config.names().hasNext()) { + + String name = GeneralUtils.objectToString(config.names().next()); + if (config.getPreStyle(name) != null) { + COLORS = name; } } - } catch (Exception e) { - e.printStackTrace(); } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java index d6fc30bd5d..8421492fa8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java +++ b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java @@ -1,11 +1,14 @@ package com.fr.van.chart.config; +import com.fr.base.ChartColorMatching; +import com.fr.base.ChartPreStyleConfig; import com.fr.chart.base.AttrBorder; import com.fr.chart.base.AttrFillStyle; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.DataSheet; +import com.fr.chartx.attr.ChartProvider; import com.fr.config.predefined.ColorFillStyle; import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.plugin.chart.PiePlot4VanChart; @@ -19,6 +22,7 @@ import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.type.GaugeStyle; +import com.fr.plugin.chart.vanchart.VanChart; /** * @author shine @@ -28,8 +32,27 @@ import com.fr.plugin.chart.type.GaugeStyle; */ public class DefaultStyleHelper4Van { + private static boolean duchampMode() { + try { + return ChartEditContext.duchampMode(); + } catch (Throwable e) { + //tomcat预览 默认数据的图表 + return true; + } + } + + public static void checkChartDefaultStyle4Duchamp(ChartProvider chartProvider) { + if (!ChartEditContext.supportTheme() && chartProvider instanceof VanChart) { + //主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义 + ((VanChart) chartProvider).setThemeCustom(); + dealChartColor((VanChart) chartProvider); +// //主题中没有的 根据主题深浅色自动 的属性 默认自动 +// ((VanChart) chart4Update).setAutoThemeCustom(); + } + } + public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) { - if (!ChartEditContext.duchampMode()) { + if (!duchampMode()) { return; } dealVanPlotCommonAttr(plot); @@ -60,7 +83,7 @@ public class DefaultStyleHelper4Van { } public static VanChartAxis dealAxisDefault(VanChartAxis axis) { - if (!ChartEditContext.duchampMode()) { + if (!duchampMode()) { return axis; } axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); @@ -71,28 +94,20 @@ public class DefaultStyleHelper4Van { } public static void dealAxisAlert(VanChartAlertValue vanChartAlertValue) { - if (!ChartEditContext.duchampMode()) { + if (!duchampMode()) { return; } vanChartAlertValue.setAlertFont(DefaultStyleConstants.ALERT_FONT); } static void dealVanPlotCommonAttr(Plot plot) { - if (!ChartEditContext.duchampMode()) { + if (!duchampMode()) { return; } if (plot instanceof VanChartPlot) { VanChartPlot vanChartPlot = (VanChartPlot) plot; - ColorFillStyle colorFillStyle = new ColorFillStyle(); - colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC); - colorFillStyle.setFillStyleName(DefaultStyleConstants.COLORS); - AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle(); - if (plotFillStyle == null) { - plotFillStyle = new AttrFillStyle(); - vanChartPlot.setPlotFillStyle(plotFillStyle); - } - plotFillStyle.setColorFillStyle(colorFillStyle); + dealChartColor(vanChartPlot); if (vanChartPlot.getLegend() != null) { vanChartPlot.getLegend().setFRFont(DefaultStyleConstants.LEGEND); @@ -118,6 +133,31 @@ public class DefaultStyleHelper4Van { } + private static void dealChartColor(VanChart vanChart) { + dealChartColor(vanChart.getPlot()); + } + + private static void dealChartColor(VanChartPlot vanChartPlot) { + ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance(); + Object preStyle = manager.getPreStyle(DefaultStyleConstants.COLORS); + if (preStyle instanceof ChartColorMatching) { + ColorFillStyle colorFillStyle = new ColorFillStyle(); + //default是默认的意思,为服务器默认配色方案 + //acc为多个颜色组合 + //gradient为渐变颜色 + colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC); + colorFillStyle.setFillStyleName(DefaultStyleConstants.COLORS); + colorFillStyle.setColorList(((ChartColorMatching) preStyle).getColorList()); + + AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle(); + if (plotFillStyle == null) { + plotFillStyle = new AttrFillStyle(); + vanChartPlot.setPlotFillStyle(plotFillStyle); + } + plotFillStyle.setColorFillStyle(colorFillStyle); + } + } + private static void dealBorder(VanChartPlot vanChartPlot) { ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr(); AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java index 03faf95245..ef58809795 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java @@ -32,6 +32,7 @@ import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.base.VanChartZoom; import com.fr.plugin.chart.vanchart.VanChart; +import com.fr.van.chart.config.DefaultStyleHelper4Van; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -145,12 +146,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane