|
|
|
@ -2,14 +2,16 @@ package com.fr.design.module;
|
|
|
|
|
|
|
|
|
|
import com.fr.base.ChartColorMatching; |
|
|
|
|
import com.fr.design.beans.BasicBeanPane; |
|
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
|
|
|
|
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.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane; |
|
|
|
|
import com.fr.design.style.background.gradient.FixedGradientBar; |
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Collections; |
|
|
|
@ -19,7 +21,6 @@ import java.awt.CardLayout;
|
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
import java.awt.FlowLayout; |
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
|
|
|
|
@ -35,8 +36,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
|
|
|
|
|
private JPanel changeColorSetPane; |
|
|
|
|
private CardLayout cardLayout; |
|
|
|
|
|
|
|
|
|
private UIButton accButton; |
|
|
|
|
private UIButton gradientButton; |
|
|
|
|
private UIButtonGroup groupButton; |
|
|
|
|
|
|
|
|
|
private ChartColorAdjustPane colorAdjustPane; |
|
|
|
|
private FixedGradientBar colorGradient; |
|
|
|
@ -52,25 +52,22 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
|
|
|
|
|
|
|
|
|
|
JPanel customPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
|
|
|
|
|
JPanel buttonPane = new JPanel(); |
|
|
|
|
buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT)); |
|
|
|
|
buttonPane.add(accButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Color"))); |
|
|
|
|
buttonPane.add(gradientButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gradient_Color"))); |
|
|
|
|
customPane.add(buttonPane, BorderLayout.NORTH); |
|
|
|
|
groupButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Custom_Color"), Toolkit.i18nText("Fine-Design_Chart_Gradient_Color")}); |
|
|
|
|
groupButton.setSelectedIndex(0); |
|
|
|
|
customPane.add(groupButton, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
changeColorSetPane = new JPanel(cardLayout = new CardLayout()); |
|
|
|
|
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient"); |
|
|
|
|
changeColorSetPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); |
|
|
|
|
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 150), "gradient"); |
|
|
|
|
changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc"); |
|
|
|
|
cardLayout.show(changeColorSetPane, "acc"); |
|
|
|
|
customPane.add(changeColorSetPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
accButton.setSelected(true); |
|
|
|
|
|
|
|
|
|
customPane.setPreferredSize(new Dimension(200, 200)); |
|
|
|
|
colorGradient.setPreferredSize(new Dimension(120, 30)); |
|
|
|
|
customPane.setPreferredSize(new Dimension(155, 300)); |
|
|
|
|
colorGradient.setPreferredSize(new Dimension(155, 30)); |
|
|
|
|
colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE); |
|
|
|
|
colorGradient.getSelectColorPointBtnP2().setColorInner(FixedGradientBar.NEW_CHARACTER); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double[] columnSize = {p, p}; |
|
|
|
|
double[] rowSize = {p, p, p}; |
|
|
|
@ -84,24 +81,20 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void initListener() { |
|
|
|
|
|
|
|
|
|
accButton.addActionListener(new ActionListener() { |
|
|
|
|
groupButton.addActionListener(new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
accButton.setSelected(true); |
|
|
|
|
gradientButton.setSelected(false); |
|
|
|
|
cardLayout.show(changeColorSetPane, "acc"); |
|
|
|
|
checkCardPane(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
gradientButton.addActionListener(new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
gradientButton.setSelected(true); |
|
|
|
|
accButton.setSelected(false); |
|
|
|
|
cardLayout.show(changeColorSetPane, "gradient"); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
private void checkCardPane() { |
|
|
|
|
if (groupButton.getSelectedIndex() == 0) { |
|
|
|
|
cardLayout.show(changeColorSetPane, "acc"); |
|
|
|
|
} else { |
|
|
|
|
cardLayout.show(changeColorSetPane, "gradient"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -117,8 +110,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
|
|
|
|
|
boolean isGradient = condition.getGradient(); |
|
|
|
|
List<Color> colorList = condition.getColorList(); |
|
|
|
|
if (isGradient) { |
|
|
|
|
gradientButton.setSelected(true); |
|
|
|
|
accButton.setSelected(false); |
|
|
|
|
groupButton.setSelectedIndex(1); |
|
|
|
|
cardLayout.show(changeColorSetPane, "gradient"); |
|
|
|
|
|
|
|
|
|
if (colorList.size() == 2) { |
|
|
|
@ -127,8 +119,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
|
|
|
|
|
colorGradient.repaint(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
accButton.setSelected(true); |
|
|
|
|
gradientButton.setSelected(false); |
|
|
|
|
groupButton.setSelectedIndex(0); |
|
|
|
|
cardLayout.show(changeColorSetPane, "acc"); |
|
|
|
|
|
|
|
|
|
if (colorList.isEmpty()) { |
|
|
|
@ -148,7 +139,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
|
|
|
|
|
|
|
|
|
|
List<Color> colorList = new ArrayList<Color>(); |
|
|
|
|
|
|
|
|
|
if (gradientButton.isSelected()) { |
|
|
|
|
if (groupButton.getSelectedIndex() == 1) { |
|
|
|
|
chartColorMatching.setGradient(true); |
|
|
|
|
|
|
|
|
|
Color start = colorGradient.getSelectColorPointBtnP1().getColorInner(); |
|
|
|
|