Browse Source

REPORT-140043 -[后台] 模板主题二期图表、表格适配

feature/x
kerry 3 weeks ago
parent
commit
0b3dca931c
  1. 11
      designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java
  2. 20
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java
  3. 105
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  4. 9
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java

11
designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java

@ -5,8 +5,10 @@ import com.fr.base.chart.BaseChartCollection;
import com.fr.chartx.attr.ChartProvider; import com.fr.chartx.attr.ChartProvider;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
import com.fr.stable.collections.combination.Pair;
import com.fr.stable.fun.mark.Selectable; import com.fr.stable.fun.mark.Selectable;
import java.awt.Color;
import java.awt.Font; import java.awt.Font;
/** /**
@ -56,10 +58,19 @@ public interface DefaultValueAdjustProvider extends Selectable {
/** /**
* 修改设计可用字体默认列表 * 修改设计可用字体默认列表
*
* @return * @return
*/ */
default String[] getAvailableFontFamilyNames4Report() { default String[] getAvailableFontFamilyNames4Report() {
return Utils.getAvailableFontFamilyNames4Report(); return Utils.getAvailableFontFamilyNames4Report();
} }
/**
* 修改配色方案默认值
* @return
*/
default Pair<Color[], Color[]> adjustChartDefaultColorFill() {
return new Pair<>(new Color[0], new Color[0]);
}
} }

20
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java

@ -9,6 +9,7 @@ import com.fr.config.predefined.PredefinedColorStyle;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.gui.icombobox.ColorSchemeComboBox; import com.fr.design.gui.icombobox.ColorSchemeComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -17,7 +18,9 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.background.gradient.FixedGradientBarNoTheme; import com.fr.design.style.background.gradient.FixedGradientBarNoTheme;
import com.fr.design.style.color.ColorAdjustPane; import com.fr.design.style.color.ColorAdjustPane;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.Arrays; import java.util.Arrays;
@ -70,9 +73,20 @@ public class ColorFillStylePane extends BasicBeanPane<ColorFillStyle> {
changeColorSetPane = new JPanel(cardLayout = new CardLayout()); changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.add(colorGradient = new FixedGradientBarNoTheme(4, 130), "gradient"); changeColorSetPane.add(colorGradient = new FixedGradientBarNoTheme(4, 130), "gradient");
gradientColors = new Color[]{Color.WHITE, FixedGradientBarNoTheme.NEW_CHARACTER}; DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
changeColorSetPane.add(colorAdjustPane = new ColorAdjustPane(), "acc"); if (adjustProvider != null) {
accColors = ColorAdjustPane.DEFAULT_COLORS; Pair<Color[], Color[]> pair = adjustProvider.adjustChartDefaultColorFill();
Color[] groupColors = pair.getFirst();
colorAdjustPane = new ColorAdjustPane(groupColors);
gradientColors = pair.getSecond();
accColors = groupColors;
} else {
colorAdjustPane = new ColorAdjustPane();
gradientColors = new Color[]{Color.WHITE, FixedGradientBarNoTheme.NEW_CHARACTER};
accColors = ColorAdjustPane.DEFAULT_COLORS;
}
changeColorSetPane.add(colorAdjustPane , "acc");
cardLayout.show(changeColorSetPane, "acc"); cardLayout.show(changeColorSetPane, "acc");
customPane.add(changeColorSetPane, BorderLayout.CENTER); customPane.add(changeColorSetPane, BorderLayout.CENTER);
initListener(); initListener();

105
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

@ -4,6 +4,7 @@ import com.fr.base.FineColor;
import com.fr.base.theme.FineColorDeriveState; import com.fr.base.theme.FineColorDeriveState;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -60,6 +61,8 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
private final JPanel menuColorPane; private final JPanel menuColorPane;
private ColorCell[][] themeColorCellGrid; private ColorCell[][] themeColorCellGrid;
private ColorSelectorStyle colorSelector;
public static NewColorSelectPane createColorSelectPaneWithTheme(boolean supportTheme) { public static NewColorSelectPane createColorSelectPaneWithTheme(boolean supportTheme) {
return new NewColorSelectPane(true, supportTheme); return new NewColorSelectPane(true, supportTheme);
} }
@ -156,6 +159,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
JPanel centerPane = new JPanel(new GridLayout(1, 8, DEFAULT_COLOR_HOR_INTERVAL, 0)); JPanel centerPane = new JPanel(new GridLayout(1, 8, DEFAULT_COLOR_HOR_INTERVAL, 0));
menuColorPane.add(northPane, BorderLayout.NORTH); menuColorPane.add(northPane, BorderLayout.NORTH);
menuColorPane.add(centerPane, BorderLayout.CENTER); menuColorPane.add(centerPane, BorderLayout.CENTER);
this.colorSelector = DesignModeContext.isDuchampMode() ? ColorSelectorStyle.FVS : ColorSelectorStyle.FR;
Color[] colorArray = new Color[]{ Color[] colorArray = new Color[]{
// 8列主题色 // 8列主题色
@ -177,11 +181,11 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
themeColorCellGrid = new ColorCell[colorArray.length][DEFAULT_DERIVE_COUNT]; themeColorCellGrid = new ColorCell[colorArray.length][DEFAULT_DERIVE_COUNT];
for (int i = 0; i < colorArray.length; i++) { for (int i = 0; i < colorArray.length; i++) {
ColorCell[] colorCellColumn = new ColorCell[DEFAULT_DERIVE_COUNT]; ColorCell[] colorCellColumn = new ColorCell[DEFAULT_DERIVE_COUNT];
boolean isDefaultColor = (i == colorArray.length - 1 || i == colorArray.length - 2); ColorConfig colorConfig = colorSelector.getColorConfig(i);
Color color = colorArray[i]; Color color = colorArray[i];
Color[] deriveColorArr = FineColorDeriveState.getDeriveColorArr(color, isDefaultColor, DEFAULT_DERIVE_COUNT); Color[] deriveColorArr = colorConfig.getDeriveColorArr(color, DEFAULT_DERIVE_COUNT);
for (int j = 0; j < deriveColorArr.length; j++) { for (int j = 0; j < deriveColorArr.length; j++) {
colorCellColumn[j] = createFineColorCell(deriveColorArr[j], isDefaultColor, i, j); colorCellColumn[j] = createFineColorCell(deriveColorArr[j], !colorConfig.supportTheme, i, j);
} }
themeColorCellGrid[i] = colorCellColumn; themeColorCellGrid[i] = colorCellColumn;
} }
@ -215,13 +219,13 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
} }
} }
} }
if (standardColors == null || standardColors.size() < 8) { if (standardColors == null || standardColors.size() < 8 || standardColors.size() > 10) {
return; return;
} }
for (int i = 0; i < standardColors.size(); i++) {
for (int i = 0; i < themeColorCellGrid.length - 2; i++) { Color standardColor = standardColors.get(i);
Color color = standardColors.get(i); ColorConfig colorConfig = colorSelector.getColorConfig(i);
Color[] deriveColorArr = FineColorDeriveState.getDeriveColorArr(color, false, DEFAULT_DERIVE_COUNT); Color[] deriveColorArr = colorConfig.getDeriveColorArr(standardColor, DEFAULT_DERIVE_COUNT);
for (int j = 0; j < deriveColorArr.length; j++) { for (int j = 0; j < deriveColorArr.length; j++) {
themeColorCellGrid[i][j].setColor(deriveColorArr[j]); themeColorCellGrid[i][j].setColor(deriveColorArr[j]);
} }
@ -447,5 +451,90 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
} }
} }
private enum DeriveAlgorithm {
PLAIN_ALGORITHM {
public Color[] getDeriveColorArr(Color color, int defaultDeriveCount) {
return FineColorDeriveState.getDeriveColorArr(color, false, defaultDeriveCount);
}
},
DEFAULT_DERIVE_ALGORITHM {
public Color[] getDeriveColorArr(Color color, int defaultDeriveCount) {
return FineColorDeriveState.getDeriveColorArr(color, true, defaultDeriveCount);
}
};
public abstract Color[] getDeriveColorArr(Color color, int defaultDeriveCount);
}
private static class ColorConfig {
private boolean supportTheme;
private DeriveAlgorithm algorithm;
private ColorConfig(boolean supportTheme, DeriveAlgorithm algorithm) {
this.supportTheme = supportTheme;
this.algorithm = algorithm;
}
public static ColorConfig createThemeColorConfig(DeriveAlgorithm deriveAlgorithm) {
return new ColorConfig(true, deriveAlgorithm);
}
public static ColorConfig createThemeColorConfig(boolean supportTheme, DeriveAlgorithm deriveAlgorithm) {
return new ColorConfig(supportTheme, deriveAlgorithm);
}
public Color[] getDeriveColorArr(Color color, int defaultDeriveCount){
return algorithm.getDeriveColorArr(color, defaultDeriveCount);
}
}
private enum ColorSelectorStyle {
FR,
FVS {
public List<ColorConfig> getColorConfigs() {
ArrayList<ColorConfig> colorConfigs = new ArrayList<>();
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.DEFAULT_DERIVE_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.DEFAULT_DERIVE_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
return colorConfigs;
}
};
public List<ColorConfig> getColorConfigs() {
ArrayList<ColorConfig> colorConfigs = new ArrayList<>();
// 8列主题色
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM));
// 2列灰度色
colorConfigs.add(ColorConfig.createThemeColorConfig(false, DeriveAlgorithm.DEFAULT_DERIVE_ALGORITHM));
colorConfigs.add(ColorConfig.createThemeColorConfig(false, DeriveAlgorithm.DEFAULT_DERIVE_ALGORITHM));
return colorConfigs;
}
public ColorConfig getColorConfig(int i) {
List<ColorConfig> colorConfigs = getColorConfigs();
if (i < 0 || i > colorConfigs.size()) {
return colorConfigs.get(0);
}
return colorConfigs.get(i);
}
}
} }

9
designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java

@ -56,10 +56,11 @@ public class DefaultStyleHelper4Van {
dealChartColor((VanChart) chartProvider); dealChartColor((VanChart) chartProvider);
// //主题中没有的 根据主题深浅色自动 的属性 默认自动 // //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom(); // ((VanChart) chart4Update).setAutoThemeCustom();
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust(); }
if (adjustProvider != null) {
adjustProvider.adjustChart(chartProvider); DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
} if (adjustProvider != null) {
adjustProvider.adjustChart(chartProvider);
} }
} }

Loading…
Cancel
Save