Browse Source

CHART-13535 更改预定义样式之后,刷新配色面板

feature/big-screen
白岳 5 years ago
parent
commit
92f454fb39
  1. 5
      designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java
  2. 8
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java
  3. 34
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java

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

@ -82,6 +82,11 @@ public class ColorSchemeComboBox extends UIComboBox {
return colorSchemes;
}
public void refresh() {
this.colorSchemes = getColorSchemesFromConfig();
this.setModel(new DefaultComboBoxModel(colorSchemes.keySet().toArray()));
}
public ColorInfo getSelectColorInfo() {
String selectedItem = (String) getSelectedItem();
return colorSchemes.get(selectedItem);

8
designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java

@ -54,6 +54,12 @@ public class ChartPreStyleAction extends UpdateAction {
if (frame != null) {
frame.repaint();
}
new Thread() {
@Override
public void run() {
DesignerContext.getDesignerBean("vanChartFillStyle").refreshBeanElement();
}
}.start();
}
}));
}
@ -61,7 +67,7 @@ public class ChartPreStyleAction extends UpdateAction {
pane.populateBean();
dialog.setVisible(true);
}
public static final MenuKeySet CHART_DEFAULT_STYLE = new MenuKeySet() {

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

@ -13,13 +13,17 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.DesignerBean;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane;
import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
@ -31,7 +35,7 @@ import java.awt.event.ActionListener;
/**
* Created by mengao on 2017/8/17.
*/
public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> {
public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> implements DesignerBean {
protected ColorSchemeComboBox styleSelectBox;
@ -124,6 +128,8 @@ public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> {
VanChartFillStylePane.this.revalidate();
}
});
DesignerContext.setDesignerBean("vanChartFillStyle", this);
}
protected void initLayout() {
@ -231,7 +237,31 @@ public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> {
def.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem()));
return def;
} else {
return updateDefaultColor();
return updateModifyColor();
}
}
private AttrFillStyle updateModifyColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo();
boolean isGradient = selectColorInfo.isGradient();
List<Color> colors = selectColorInfo.getColors();
condition.setColorList(colors);
condition.setCustomFillStyle(true);
condition.setColorStyle(isGradient ? ChartConstants.COLOR_GRADIENT : ChartConstants.COLOR_ACC);
return condition;
}
/**
* 刷新组件对象
*/
public void refreshBeanElement() {
AttrFillStyle attrFillStyle = updateBean();
styleSelectBox.refresh();
populateBean(attrFillStyle);
GUICoreUtils.repaint(this);
}
}

Loading…
Cancel
Save