Browse Source

CHART-13274 && CHART-13285 自定义配色的调整

feature/big-screen
白岳 5 years ago
parent
commit
4646b8e6e1
  1. 4
      designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java
  2. 15
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java
  3. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java

4
designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java

@ -14,6 +14,7 @@ import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
@ -130,6 +131,9 @@ public class ColorSchemeComboBox extends UIComboBox {
NORMAL NORMAL
} }
public Set<String> getItems() {
return colorSchemes.keySet();
}
public class ColorInfo { public class ColorInfo {

15
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java

@ -58,8 +58,6 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver {
private ChangeListener changeListener; private ChangeListener changeListener;
public ChartColorAdjustPane() { public ChartColorAdjustPane() {
this(DEFAULT_COLORS); this(DEFAULT_COLORS);
} }
@ -70,10 +68,6 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver {
createContentPane(); createContentPane();
} }
public void updateColor() {
updateColor(DEFAULT_COLORS);
}
public void updateColor(Color[] colors) { public void updateColor(Color[] colors) {
createColorButton(colors); createColorButton(colors);
relayout(); relayout();
@ -124,8 +118,9 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver {
private void createColorButton(Color[] colors) { private void createColorButton(Color[] colors) {
colorButtons.clear(); colorButtons.clear();
for (Color color : colors) { int size = Math.min(colors.length, MAX_BUTTON);
colorButtons.add(createColorButton(color)); for (int i = 0; i < size; i++) {
colorButtons.add(createColorButton(colors[i]));
} }
} }
@ -219,7 +214,9 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver {
hidePopupMenu(); hidePopupMenu();
Color color = ((ColorSelectPane) e.getSource()).getColor(); Color color = ((ColorSelectPane) e.getSource()).getColor();
fireDisplayComponent(ColorBackground.getInstance(color)); fireDisplayComponent(ColorBackground.getInstance(color));
colorButtons.add(createColorButton(color)); if(colorButtons.size() < MAX_BUTTON) {
colorButtons.add(createColorButton(color));
}
ChartColorAdjustPane.this.stateChanged(); ChartColorAdjustPane.this.stateChanged();
relayout(); relayout();
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java

@ -155,7 +155,7 @@ public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> {
@Override @Override
public void populateBean(AttrFillStyle condition) { public void populateBean(AttrFillStyle condition) {
String fillStyleName = condition == null ? "" : condition.getFillStyleName(); String fillStyleName = condition == null ? "" : condition.getFillStyleName();
if (StringUtils.isBlank(fillStyleName)) {//兼容处理 if (StringUtils.isBlank(fillStyleName) || !styleSelectBox.getItems().contains(fillStyleName)) {//兼容处理
if (condition == null || condition.getColorStyle() == ChartConstants.COLOR_DEFAULT) { if (condition == null || condition.getColorStyle() == ChartConstants.COLOR_DEFAULT) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);//默认 styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);//默认
} else { } else {

Loading…
Cancel
Save