forked from fanruan/design
白岳
3 years ago
45 changed files with 470 additions and 517 deletions
@ -0,0 +1,85 @@
|
||||
package com.fr.design.mainframe.theme.edit.chart; |
||||
|
||||
import com.fr.base.theme.settings.ThemedChartStyle; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.style.background.gradient.FixedGradientBarWithPopMenu; |
||||
|
||||
import java.util.List; |
||||
import java.awt.Color; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-09-17 |
||||
*/ |
||||
public class ChartSeriesStylePane extends AbstractChartStylePane { |
||||
|
||||
private UIButtonGroup<Integer> colorTypeButton; |
||||
private FixedGradientBarWithPopMenu gradientBar; |
||||
|
||||
protected void initComponents() { |
||||
colorTypeButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Custom_Color"), |
||||
Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual")}); |
||||
gradientBar = new FixedGradientBarWithPopMenu(4, 130); |
||||
initListener(); |
||||
} |
||||
|
||||
protected Component[][] getComponent() { |
||||
return new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), colorTypeButton}, |
||||
new Component[]{null, gradientBar} |
||||
}; |
||||
} |
||||
|
||||
protected double[] getRows(double p) { |
||||
return new double[]{p, p, p}; |
||||
} |
||||
|
||||
private void initListener() { |
||||
colorTypeButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkTypeButton(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void checkTypeButton() { |
||||
gradientBar.setVisible(colorTypeButton.getSelectedIndex() == 1); |
||||
gradientBar.setPreferredSize(colorTypeButton.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Series"); |
||||
} |
||||
|
||||
public void populate(ThemedChartStyle chartStyle) { |
||||
if (chartStyle.getThemedChartSeriesColor().isCombineColor()) { |
||||
colorTypeButton.setSelectedIndex(0); |
||||
} else { |
||||
colorTypeButton.setSelectedIndex(1); |
||||
gradientBar.updateColor(chartStyle.getThemedChartSeriesColor().getBeginColor(), chartStyle.getThemedChartSeriesColor().getEndColor()); |
||||
} |
||||
checkTypeButton(); |
||||
} |
||||
|
||||
|
||||
public void populateGradientBar(List<Color> colors) { |
||||
gradientBar.updateColor(colors.get(0), colors.get(1)); |
||||
this.repaint(); |
||||
} |
||||
|
||||
public void update(ThemedChartStyle chartStyle) { |
||||
chartStyle.getThemedChartSeriesColor().setCombineColor(colorTypeButton.getSelectedIndex() == 0); |
||||
chartStyle.getThemedChartSeriesColor().setBeginColor(gradientBar.getSelectColorPointBtnP1().getColorInner()); |
||||
chartStyle.getThemedChartSeriesColor().setEndColor(gradientBar.getSelectColorPointBtnP2().getColorInner()); |
||||
} |
||||
} |
@ -1,49 +0,0 @@
|
||||
package com.fr.design.mainframe.theme.edit.chart; |
||||
|
||||
import com.fr.base.theme.settings.ThemedChartStyle; |
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import java.awt.Component; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-09-16 |
||||
*/ |
||||
public class ChartTitleStylePane extends AbstractChartStylePane { |
||||
|
||||
//字体样式
|
||||
private ChartFontPane chartFontPane; |
||||
|
||||
protected void initComponents() { |
||||
chartFontPane = new ChartFontPane() { |
||||
public String getUILabelText() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Title_Character"); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
protected Component[][] getComponent() { |
||||
return new Component[][]{ |
||||
new Component[]{chartFontPane, null} |
||||
}; |
||||
} |
||||
|
||||
protected double[] getRows(double p) { |
||||
return new double[]{p}; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Report_Title"); |
||||
} |
||||
|
||||
public void populate(ThemedChartStyle chartStyle) { |
||||
chartFontPane.populate(chartStyle.getTitleFont()); |
||||
} |
||||
|
||||
|
||||
public void update(ThemedChartStyle chartStyle) { |
||||
chartStyle.setTitleFont(chartFontPane.update()); |
||||
} |
||||
} |
@ -0,0 +1,53 @@
|
||||
package com.fr.design.style.background.gradient; |
||||
|
||||
import com.fr.base.background.ColorBackground; |
||||
import com.fr.design.style.color.NewColorSelectPane; |
||||
|
||||
import javax.swing.JPanel; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2021-08-19 |
||||
*/ |
||||
public class FixedGradientBarWithPopMenu extends FixedGradientBar { |
||||
|
||||
private NewColorSelectPane colorPane; |
||||
|
||||
public FixedGradientBarWithPopMenu(int minvalue, int maxvalue) { |
||||
super(minvalue, maxvalue); |
||||
} |
||||
|
||||
protected void clickButton(int select) { |
||||
setIndex(select); |
||||
showPopupMenu(); |
||||
} |
||||
|
||||
public JPanel initWindowPane(double preferredWidth) { |
||||
// 下拉的时候重新生成面板,刷新最近使用颜色
|
||||
colorPane = new NewColorSelectPane(false) { |
||||
@Override |
||||
public void setVisible(boolean b) { |
||||
super.setVisible(b); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean selectRealTime() { |
||||
return false; |
||||
} |
||||
}; |
||||
colorPane.addChangeListener(new ChangeListener() { |
||||
public void stateChanged(ChangeEvent e) { |
||||
hidePopupMenu(); |
||||
setColor(((NewColorSelectPane) e.getSource()).getColor()); |
||||
getList().get(getIndex()).setColorInner(getColor()); |
||||
fireDisplayComponent(ColorBackground.getInstance(getColor())); |
||||
FixedGradientBarWithPopMenu.this.stateChanged(); |
||||
} |
||||
}); |
||||
return colorPane; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue