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

13
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;
public ChartColorAdjustPane() {
this(DEFAULT_COLORS);
}
@ -70,10 +68,6 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver {
createContentPane();
}
public void updateColor() {
updateColor(DEFAULT_COLORS);
}
public void updateColor(Color[] colors) {
createColorButton(colors);
relayout();
@ -124,8 +118,9 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver {
private void createColorButton(Color[] colors) {
colorButtons.clear();
for (Color color : colors) {
colorButtons.add(createColorButton(color));
int size = Math.min(colors.length, MAX_BUTTON);
for (int i = 0; i < size; i++) {
colorButtons.add(createColorButton(colors[i]));
}
}
@ -219,7 +214,9 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver {
hidePopupMenu();
Color color = ((ColorSelectPane) e.getSource()).getColor();
fireDisplayComponent(ColorBackground.getInstance(color));
if(colorButtons.size() < MAX_BUTTON) {
colorButtons.add(createColorButton(color));
}
ChartColorAdjustPane.this.stateChanged();
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
public void populateBean(AttrFillStyle condition) {
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) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);//默认
} else {

Loading…
Cancel
Save