diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java index 67be5cc9aa..64aaeb9c07 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.theme.utils; import com.fr.base.NameStyle; import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.settings.ThemedCellStyle; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.mainframe.JTemplate; import com.fr.report.cell.DefaultTemplateCellElement; @@ -37,7 +38,7 @@ public class DefaultThemedTemplateCellElementCase { ThemedCellStyle themedCellStyle = theme.getCellStyleList().getUse4Default(); if (themedCellStyle != null) { NameStyle nameStyle = NameStyle.getPassiveInstance(themedCellStyle.getName(), themedCellStyle.getStyle()); - cellElement.setStyle(nameStyle); + cellElement.setStyle(DesignModeContext.isDuchampMode() ? nameStyle.getRealStyle() : nameStyle); } } return cellElement; 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 ad99b90835..f5ff739fa6 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 @@ -1,6 +1,7 @@ package com.fr.design.style.color; import com.fr.base.BaseUtils; +import com.fr.chart.base.ChartConstants; import com.fr.design.DesignerEnvManager; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -12,8 +13,6 @@ import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.util.ArrayList; -import java.util.List; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; @@ -23,6 +22,8 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.List; /** * 配色方案选择组合色之后,可以调整颜色的组件 @@ -33,18 +34,7 @@ import java.awt.image.BufferedImage; */ public class ColorAdjustPane extends JPanel implements UIObserver { - public static final Color[] DEFAULT_COLORS = { - new Color(99, 178, 238), - new Color(118, 218, 145), - new Color(248, 203, 127), - new Color(248, 149, 136), - new Color(124, 214, 207), - new Color(145, 146, 171), - new Color(120, 152, 225), - new Color(239, 166, 102), - new Color(237, 221, 134), - new Color(153, 135, 206), - }; + public static final Color[] DEFAULT_COLORS = ChartConstants.NEW_FEATURES; private static final int COUNT_OF_ROW = 8; 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 a6ce45a534..b3bfca329c 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 @@ -27,6 +27,7 @@ import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.vanchart.VanChart; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; /** @@ -166,22 +167,28 @@ public class DefaultStyleHelper4Van { private static void dealChartColor(VanChartPlot vanChartPlot) { ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance(); Object preStyle = manager.getPreStyle(DefaultStyleConstants.COLORS); + ColorFillStyle colorFillStyle = new ColorFillStyle(); 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()); + } else { + //服务器上没有图表配色 + //需要指定配色属性为自定义组合色,否则会被兼容成跟随主题 + // com.fr.plugin.chart.attr.plot.VanChartPlot.compatibleFillStyle + colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC); + colorFillStyle.setColorList(Arrays.asList(ChartConstants.NEW_FEATURES)); + } - AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle(); - if (plotFillStyle == null) { - plotFillStyle = new AttrFillStyle(); - vanChartPlot.setPlotFillStyle(plotFillStyle); - } - plotFillStyle.setColorFillStyle(colorFillStyle); + AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle(); + if (plotFillStyle == null) { + plotFillStyle = new AttrFillStyle(); + vanChartPlot.setPlotFillStyle(plotFillStyle); } + plotFillStyle.setColorFillStyle(colorFillStyle); } private static void dealBorder(VanChartPlot vanChartPlot) { diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java index d746c4066b..3a50c38705 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java @@ -20,8 +20,11 @@ import com.fr.form.ui.*; import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; +import com.fr.stable.AssistUtils; import javax.swing.*; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; @@ -198,6 +201,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener } }); this.setPreferredSize(new Dimension(100, 20)); + this.initPopupMenuListener(userDefined); } public void setSelectedItemByWidgetClass(Class clazz) { @@ -218,7 +222,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener super.setSelectedItem(anObject); } - private Vector getWidgetsName(boolean userDefined) { + private Vector getWidgetsName(boolean userDefined) { WidgetOption[] reportWidgetInstance = getWidgetOptions(); Vector items = new Vector(); @@ -262,7 +266,45 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener } private WidgetOption[] getWidgetOptions() { - return (WidgetOption[]) ArrayUtils.addAll(WidgetOption.getReportWidgetInstance(), ExtraDesignClassManager.getInstance().getCellWidgetOptions()); + return ArrayUtils.addAll(WidgetOption.getReportWidgetInstance(), ExtraDesignClassManager.getInstance().getCellWidgetOptions()); + } + + private void initPopupMenuListener(boolean userDefined) { + this.addPopupMenuListener(new PopupMenuListener() { + + @Override + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + // 下拉刷新下列表 + Vector widgetsName = getWidgetsName(userDefined); + if (modelChanged(widgetsName)) { + refreshBoxItems(widgetsName); + } + } + + @Override + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + + } + + @Override + public void popupMenuCanceled(PopupMenuEvent e) { + + } + }); + } + + private boolean modelChanged(Vector widgetsName) { + DefaultComboBoxModel model = (DefaultComboBoxModel) getModel(); + int modelSize = model.getSize(); + if (modelSize != widgetsName.size()) { + return true; + } + for (int i = 0; i < modelSize; i++) { + if (!AssistUtils.equals(model.getElementAt(i), widgetsName.elementAt(i))) { + return true; + } + } + return false; } }