Browse Source

CHART-20536 图表预定义配色,升级兼容后,主题配色面板内容固定不变

【问题原因】
1. 兼容主题支持当前图表预定义配色
2. 图表预定义配色的数量导致主题色中实际颜色的数量可能
超过八个(但用户在界面上只能看到并编辑前八个),因此
需要调整下颜色选择面板等组件

【改动思路】
同上
persist/11.0
Starryi 3 years ago
parent
commit
e26869085a
  1. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListExtendedPane.java
  2. 9
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java
  3. 2
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

7
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListExtendedPane.java

@ -66,10 +66,7 @@ public class ColorListExtendedPane extends JPanel implements MouseListener {
public void populate(List<Color> colors) { public void populate(List<Color> colors) {
if (colors.size() > 0) { if (colors.size() > 0) {
colorList.clear(); colorList.clear();
for (int i = 0; i < colorCount; i++) { colorList.addAll(colors);
Color color = colors.get(i % colorCount);
colorList.add(color);
}
repaint(); repaint();
} }
} }
@ -132,7 +129,7 @@ public class ColorListExtendedPane extends JPanel implements MouseListener {
super.paint(g); super.paint(g);
Color oldColor = g.getColor(); Color oldColor = g.getColor();
for (int i = 0; i < colorList.size(); i++) { for (int i = 0; i < colorCount; i++) {
int x = i * (boxSize + boxGap); int x = i * (boxSize + boxGap);
for (int j = 0; j < extendedCount; j++) { for (int j = 0; j < extendedCount; j++) {
Color color = extendedColorComputer.computeExtendedColor(colorList.get(i), j, extendedCount); Color color = extendedColorComputer.computeExtendedColor(colorList.get(i), j, extendedCount);

9
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java

@ -88,12 +88,15 @@ public class ColorListPane extends JPanel implements UIObserver {
} }
public void populate(List<Color> colors) { public void populate(List<Color> colors) {
for (int i = 0; i < colors.size() && i < colorList.size(); i++) { colorList.clear();
Color color = colors.get(i % colorCount); for (int i = 0; i < colors.size(); i++) {
colorList.set(i, color); Color color = colors.get(i);
colorList.add(color);
if (i < colorCount) {
colorButtons.get(i).setSelectObject(color); colorButtons.get(i).setSelectObject(color);
} }
} }
}
public List<Color> update() { public List<Color> update() {
return new ArrayList<>(colorList); return new ArrayList<>(colorList);

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

@ -206,7 +206,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
} }
} }
} }
if (standardColors == null || standardColors.size() != 8) { if (standardColors == null || standardColors.size() < 8) {
return; return;
} }

Loading…
Cancel
Save