forked from fanruan/design
白岳
4 years ago
57 changed files with 1990 additions and 522 deletions
@ -0,0 +1,94 @@
|
||||
package com.fr.design.mainframe.predefined.ui.detail; |
||||
|
||||
import com.fr.config.predefined.PredefinedChartStyle; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.MultiTabPane; |
||||
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartAxisStylePane; |
||||
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartBackgroundStylePane; |
||||
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartDataSheetStylePane; |
||||
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartLabelStylePane; |
||||
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartLegendStylePane; |
||||
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartTitleStylePane; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-09-16 |
||||
*/ |
||||
public class ChartStyleSettingPane extends MultiTabPane<PredefinedChartStyle> { |
||||
|
||||
private ChartTitleStylePane chartTitleStylePane; |
||||
private ChartLegendStylePane chartLegendStylePane; |
||||
private ChartLabelStylePane chartLabelPane; |
||||
private ChartAxisStylePane chartAxisStylePane; |
||||
private ChartDataSheetStylePane chartDataSheetStylePane; |
||||
private ChartBackgroundStylePane chartBackgroundStylePane; |
||||
|
||||
public ChartStyleSettingPane() { |
||||
} |
||||
|
||||
@Override |
||||
protected void initLayout() { |
||||
super.initLayout(); |
||||
} |
||||
|
||||
@Override |
||||
protected List<BasicPane> initPaneList() { |
||||
this.chartTitleStylePane = new ChartTitleStylePane(); |
||||
this.chartLegendStylePane = new ChartLegendStylePane(); |
||||
this.chartLabelPane = new ChartLabelStylePane(); |
||||
this.chartAxisStylePane = new ChartAxisStylePane(); |
||||
this.chartDataSheetStylePane = new ChartDataSheetStylePane(); |
||||
this.chartBackgroundStylePane = new ChartBackgroundStylePane(); |
||||
paneList = new ArrayList<>(); |
||||
paneList.add(this.chartTitleStylePane); |
||||
paneList.add(this.chartLegendStylePane); |
||||
paneList.add(this.chartLabelPane); |
||||
paneList.add(this.chartAxisStylePane); |
||||
paneList.add(this.chartDataSheetStylePane); |
||||
paneList.add(this.chartBackgroundStylePane); |
||||
return paneList; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(PredefinedChartStyle ob) { |
||||
chartTitleStylePane.populate(ob); |
||||
chartLegendStylePane.populate(ob); |
||||
chartLabelPane.populate(ob); |
||||
chartAxisStylePane.populate(ob); |
||||
chartDataSheetStylePane.populate(ob); |
||||
chartBackgroundStylePane.populate(ob); |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(PredefinedChartStyle ob) { |
||||
|
||||
} |
||||
|
||||
|
||||
@Override |
||||
public PredefinedChartStyle updateBean() { |
||||
PredefinedChartStyle chartStyle = new PredefinedChartStyle(); |
||||
chartTitleStylePane.update(chartStyle); |
||||
chartLegendStylePane.update(chartStyle); |
||||
chartLabelPane.update(chartStyle); |
||||
chartAxisStylePane.update(chartStyle); |
||||
chartDataSheetStylePane.update(chartStyle); |
||||
chartBackgroundStylePane.update(chartStyle); |
||||
return chartStyle; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public boolean accept(Object ob) { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public void reset() { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,284 @@
|
||||
package com.fr.design.mainframe.predefined.ui.detail; |
||||
|
||||
import com.fr.base.ChartColorMatching; |
||||
import com.fr.base.ChartPreStyleConfig; |
||||
import com.fr.base.Utils; |
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.config.predefined.ColorFillStyle; |
||||
import com.fr.config.predefined.PredefinedColorStyle; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.gui.icombobox.ColorSchemeComboBox; |
||||
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.style.background.gradient.FixedGradientBar; |
||||
import com.fr.design.style.color.ColorAdjustPane; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.CardLayout; |
||||
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-15 |
||||
*/ |
||||
public class ColorFillStylePane extends BasicBeanPane<ColorFillStyle> { |
||||
|
||||
protected ColorSchemeComboBox styleSelectBox; |
||||
protected JPanel customPane; |
||||
protected JPanel changeColorSetPane; |
||||
protected FixedGradientBar colorGradient; |
||||
|
||||
protected CardLayout cardLayout; |
||||
|
||||
protected ColorAdjustPane colorAdjustPane; |
||||
|
||||
protected Color[] gradientColors; |
||||
protected Color[] accColors; |
||||
|
||||
private boolean gradientSelect = false; |
||||
|
||||
public ColorFillStylePane() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
styleSelectBox = createColorSchemeComboBox(); |
||||
customPane = new JPanel(FRGUIPaneFactory.createBorderLayout()) { |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
if (!customPane.isVisible()) { |
||||
return new Dimension(0, 0); |
||||
} |
||||
if (!gradientSelect) { |
||||
return colorAdjustPane.getPreferredSize(); |
||||
} |
||||
return colorGradient.getPreferredSize(); |
||||
} |
||||
}; |
||||
|
||||
changeColorSetPane = new JPanel(cardLayout = new CardLayout()); |
||||
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient"); |
||||
gradientColors = new Color[]{Color.WHITE, FixedGradientBar.NEW_CHARACTER}; |
||||
changeColorSetPane.add(colorAdjustPane = new ColorAdjustPane(), "acc"); |
||||
accColors = ColorAdjustPane.DEFAULT_COLORS; |
||||
cardLayout.show(changeColorSetPane, "acc"); |
||||
customPane.add(changeColorSetPane, BorderLayout.CENTER); |
||||
initListener(); |
||||
initLayout(); |
||||
|
||||
} |
||||
|
||||
protected ColorSchemeComboBox createColorSchemeComboBox() { |
||||
return new ColorSchemeComboBox(); |
||||
} |
||||
|
||||
private void initListener() { |
||||
colorAdjustPane.registerChangeListener(new UIObserverListener() { |
||||
@Override |
||||
public void doChange() { |
||||
accColors = colorAdjustPane.getColors(); |
||||
if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.COMBINATION_COLOR) { |
||||
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR); |
||||
} |
||||
ColorFillStylePane.this.revalidate(); |
||||
} |
||||
}); |
||||
colorGradient.registerChangeListener(new UIObserverListener() { |
||||
@Override |
||||
public void doChange() { |
||||
gradientColors[0] = colorGradient.getSelectColorPointBtnP1().getColorInner(); |
||||
gradientColors[1] = colorGradient.getSelectColorPointBtnP2().getColorInner(); |
||||
if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.GRADATION_COLOR) { |
||||
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR); |
||||
} |
||||
} |
||||
}); |
||||
styleSelectBox.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
styleSelectBoxChange(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
protected void styleSelectBoxChange() { |
||||
switch (styleSelectBox.getSelectType()) { |
||||
case COMBINATION_COLOR: |
||||
colorAdjustPane.updateColor(accColors); |
||||
cardLayout.show(changeColorSetPane, "acc"); |
||||
gradientSelect = false; |
||||
break; |
||||
case GRADATION_COLOR: |
||||
colorGradient.updateColor(gradientColors[0], gradientColors[1]); |
||||
cardLayout.show(changeColorSetPane, "gradient"); |
||||
gradientSelect = true; |
||||
break; |
||||
default: |
||||
ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo(); |
||||
if (selectColorInfo == null) { |
||||
return; |
||||
} |
||||
if (selectColorInfo.isGradient()) { |
||||
colorGradient.updateColor(selectColorInfo.getColors().get(0), selectColorInfo.getColors().get(1)); |
||||
cardLayout.show(changeColorSetPane, "gradient"); |
||||
gradientSelect = true; |
||||
} else { |
||||
colorAdjustPane.updateColor(selectColorInfo.getColors().toArray(new Color[]{})); |
||||
cardLayout.show(changeColorSetPane, "acc"); |
||||
gradientSelect = false; |
||||
} |
||||
break; |
||||
} |
||||
ColorFillStylePane.this.revalidate(); |
||||
} |
||||
|
||||
protected void initLayout() { |
||||
this.setLayout(new BorderLayout()); |
||||
this.add(getContentPane(), BorderLayout.CENTER); |
||||
} |
||||
|
||||
protected JPanel getContentPane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double e = 155; |
||||
double[] columnSize = {f, e}; |
||||
double[] rowSize = {p, p, p}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(contentPaneComponents(), rowSize, columnSize, 12, LayoutConstants.VGAP_LARGE); |
||||
return panel; |
||||
} |
||||
|
||||
protected Component[][] contentPaneComponents() { |
||||
return new Component[][]{ |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Template_Color")), styleSelectBox}, |
||||
new Component[]{null, customPane}, |
||||
|
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Color"); |
||||
} |
||||
|
||||
public void populateBean(PredefinedColorStyle predefinedColorStyle) { |
||||
populateBean(predefinedColorStyle.getColorFillStyle()); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(ColorFillStyle colorFillStyle) { |
||||
String fillStyleName = colorFillStyle == null ? "" : colorFillStyle.getFillStyleName(); |
||||
if (StringUtils.isBlank(fillStyleName) || !styleSelectBox.getItems().contains(fillStyleName)) { |
||||
if (colorFillStyle == null || colorFillStyle.getColorStyle() == ChartConstants.COLOR_DEFAULT) { |
||||
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);//默认
|
||||
} else { |
||||
int colorStyle = colorFillStyle.getColorStyle(); |
||||
if (colorStyle == ChartConstants.COLOR_GRADIENT) { |
||||
gradientColors[0] = colorFillStyle.getColorList().get(0); |
||||
gradientColors[1] = colorFillStyle.getColorList().get(1); |
||||
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR); |
||||
} else { |
||||
int colorSize = colorFillStyle.getColorList().size(); |
||||
accColors = new Color[colorSize]; |
||||
for (int i = 0; i < colorSize; i++) { |
||||
accColors[i] = colorFillStyle.getColorList().get(i); |
||||
} |
||||
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR); |
||||
} |
||||
} |
||||
} else { |
||||
styleSelectBox.setSelectedItem(fillStyleName); |
||||
} |
||||
} |
||||
|
||||
public PredefinedColorStyle update() { |
||||
PredefinedColorStyle predefinedColorStyle = new PredefinedColorStyle(); |
||||
predefinedColorStyle.setColorFillStyle(updateBean()); |
||||
return predefinedColorStyle; |
||||
} |
||||
|
||||
@Override |
||||
public ColorFillStyle updateBean() { |
||||
switch (styleSelectBox.getSelectType()) { |
||||
case COMBINATION_COLOR: |
||||
return updateCombinationColor(); |
||||
case GRADATION_COLOR: |
||||
return updateGradationColor(); |
||||
case DEFAULT: |
||||
return updateDefaultColor(); |
||||
default: |
||||
return updateNormalColor(); |
||||
} |
||||
} |
||||
|
||||
private ColorFillStyle updateCombinationColor() { |
||||
ColorFillStyle colorFillStyle = new ColorFillStyle(); |
||||
List<Color> colorList = colorFillStyle.getColorList(); |
||||
colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC); |
||||
for (int i = 0, length = accColors.length; i < length; i++) { |
||||
colorList.add(accColors[i]); |
||||
} |
||||
colorFillStyle.setCustomFillStyle(true); |
||||
return colorFillStyle; |
||||
} |
||||
|
||||
private ColorFillStyle updateGradationColor() { |
||||
ColorFillStyle colorFillStyle = new ColorFillStyle(); |
||||
List<Color> colorList = colorFillStyle.getColorList(); |
||||
colorFillStyle.setColorStyle(ChartConstants.COLOR_GRADIENT); |
||||
Color start = gradientColors[0]; |
||||
Color end = gradientColors[1]; |
||||
colorList.add(start); |
||||
colorList.add(end); |
||||
colorFillStyle.setCustomFillStyle(true); |
||||
return colorFillStyle; |
||||
} |
||||
|
||||
private ColorFillStyle updateDefaultColor() { |
||||
ColorFillStyle colorFillStyle = new ColorFillStyle(); |
||||
colorFillStyle.setColorStyle(ChartConstants.COLOR_DEFAULT); |
||||
return colorFillStyle; |
||||
} |
||||
|
||||
private ColorFillStyle updateNormalColor() { |
||||
ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance(); |
||||
Object preStyle = manager.getPreStyle(styleSelectBox.getSelectedItem()); |
||||
if (preStyle instanceof ChartColorMatching) { |
||||
ColorFillStyle colorFillStyle = new ColorFillStyle(); |
||||
ChartColorMatching chartColorMatching = (ChartColorMatching) preStyle; |
||||
colorFillStyle.setColorStyle(chartColorMatching.getGradient() ? ChartConstants.COLOR_GRADIENT : ChartConstants.COLOR_ACC); |
||||
List<Color> colorList = chartColorMatching.getColorList(); |
||||
if (colorList == null || colorList.size() == 0) { |
||||
colorList = Arrays.asList(ChartConstants.CHART_COLOR_ARRAY); |
||||
} |
||||
colorFillStyle.setColorList(colorList); |
||||
colorFillStyle.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem())); |
||||
return colorFillStyle; |
||||
} else { |
||||
return updateModifyColor(); |
||||
} |
||||
} |
||||
|
||||
private ColorFillStyle updateModifyColor() { |
||||
ColorFillStyle colorFillStyle = new ColorFillStyle(); |
||||
ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo(); |
||||
boolean isGradient = selectColorInfo.isGradient(); |
||||
List<Color> colors = selectColorInfo.getColors(); |
||||
colorFillStyle.setColorList(colors); |
||||
colorFillStyle.setCustomFillStyle(true); |
||||
colorFillStyle.setColorStyle(isGradient ? ChartConstants.COLOR_GRADIENT : ChartConstants.COLOR_ACC); |
||||
return colorFillStyle; |
||||
} |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
||||
|
||||
import com.fr.config.predefined.PredefinedChartStyle; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.icontainer.UIScrollPane; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-09-17 |
||||
*/ |
||||
public abstract class AbstractChartStylePane extends BasicPane { |
||||
|
||||
public AbstractChartStylePane() { |
||||
initComponents(); |
||||
initPane(); |
||||
} |
||||
|
||||
protected abstract void initComponents(); |
||||
|
||||
protected void initPane() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
double e = 155; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] columnSize = {p, e}; |
||||
JPanel gapTableLayoutPane = TableLayoutHelper.createGapTableLayoutPane(getComponent(), getRows(p), columnSize, 20, LayoutConstants.VGAP_LARGE); |
||||
gapTableLayoutPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); |
||||
UIScrollPane rightTopPane = new UIScrollPane(gapTableLayoutPane); |
||||
rightTopPane.setBorder(BorderFactory.createEmptyBorder()); |
||||
this.add(rightTopPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
protected abstract Component[][] getComponent(); |
||||
|
||||
protected abstract double[] getRows(double p); |
||||
|
||||
public abstract void populate(PredefinedChartStyle chartStyle); |
||||
|
||||
public abstract void update(PredefinedChartStyle chartStyle); |
||||
} |
@ -0,0 +1,69 @@
|
||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
||||
|
||||
import com.fr.config.predefined.PredefinedChartStyle; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
|
||||
import java.awt.Component; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-09-16 |
||||
*/ |
||||
public class ChartAxisStylePane extends AbstractChartStylePane { |
||||
|
||||
//轴标题字体样式
|
||||
private ChartFontPane titleFontPane; |
||||
|
||||
//轴标签字体样式
|
||||
private ChartFontPane labelFontPane; |
||||
|
||||
//轴线颜色
|
||||
private ColorSelectBox axisLineColor; |
||||
|
||||
protected void initComponents() { |
||||
titleFontPane = new ChartFontPane() { |
||||
public String getUILabelText() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Axis_Title_Character"); |
||||
} |
||||
}; |
||||
labelFontPane = new ChartFontPane() { |
||||
public String getUILabelText() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Character"); |
||||
} |
||||
}; |
||||
axisLineColor = new ColorSelectBox(100); |
||||
} |
||||
|
||||
protected Component[][] getComponent() { |
||||
return new Component[][]{ |
||||
new Component[]{titleFontPane, null}, |
||||
new Component[]{labelFontPane, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Axis_Line_Color")), axisLineColor} |
||||
}; |
||||
} |
||||
|
||||
protected double[] getRows(double p) { |
||||
return new double[]{p, p, p}; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis"); |
||||
} |
||||
|
||||
public void populate(PredefinedChartStyle chartStyle) { |
||||
titleFontPane.populate(chartStyle.getAxisTitleFont()); |
||||
labelFontPane.populate(chartStyle.getAxisLabelFont()); |
||||
axisLineColor.setSelectObject(chartStyle.getAxisLineColor()); |
||||
} |
||||
|
||||
|
||||
public void update(PredefinedChartStyle chartStyle) { |
||||
chartStyle.setAxisTitleFont(titleFontPane.update()); |
||||
chartStyle.setAxisLabelFont(labelFontPane.update()); |
||||
chartStyle.setAxisLineColor(axisLineColor.getSelectObject()); |
||||
} |
||||
} |
@ -0,0 +1,113 @@
|
||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
||||
|
||||
import com.fr.base.background.ImageBackground; |
||||
import com.fr.config.predefined.PredefinedChartStyle; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.VanChartGradientPane; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.general.Background; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.awt.CardLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-09-17 |
||||
*/ |
||||
public class ChartBackgroundStylePane extends AbstractChartStylePane { |
||||
|
||||
private UIComboBox typeComboBox; |
||||
private List<BackgroundQuickPane> paneList; |
||||
private JPanel centerPane; |
||||
//网格线颜色
|
||||
private ColorSelectBox mainGridColor; |
||||
|
||||
protected void initComponents() { |
||||
mainGridColor = new ColorSelectBox(100); |
||||
|
||||
typeComboBox = new UIComboBox(); |
||||
final CardLayout cardlayout = new CardLayout(); |
||||
initList(); |
||||
|
||||
centerPane = new JPanel(cardlayout) { |
||||
@Override |
||||
public Dimension getPreferredSize() {// AUGUST:使用当前面板的的高度
|
||||
int index = typeComboBox.getSelectedIndex(); |
||||
return new Dimension(super.getPreferredSize().width, paneList.get(index).getPreferredSize().height); |
||||
} |
||||
}; |
||||
for (int i = 0; i < paneList.size(); i++) { |
||||
BackgroundQuickPane pane = paneList.get(i); |
||||
typeComboBox.addItem(pane.title4PopupWindow()); |
||||
centerPane.add(pane, pane.title4PopupWindow()); |
||||
} |
||||
|
||||
typeComboBox.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem()); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
protected Component[][] getComponent() { |
||||
return new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Area_Background_Color")), typeComboBox}, |
||||
new Component[]{null, centerPane}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Grid_Line_Color")), mainGridColor} |
||||
}; |
||||
} |
||||
|
||||
protected double[] getRows(double p) { |
||||
return new double[]{p, p, p, p}; |
||||
} |
||||
|
||||
private void initList() { |
||||
paneList = new ArrayList<>(); |
||||
paneList.add(new NullBackgroundQuickPane()); |
||||
paneList.add(new ColorBackgroundQuickPane()); |
||||
paneList.add(new ImageBackgroundQuickPane(false)); |
||||
paneList.add(new VanChartGradientPane()); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"); |
||||
} |
||||
|
||||
public void populate(PredefinedChartStyle chartStyle) { |
||||
Background background = chartStyle.getChartBackground(); |
||||
for (int i = 0; i < paneList.size(); i++) { |
||||
BackgroundQuickPane pane = paneList.get(i); |
||||
if (pane.accept(background)) { |
||||
pane.populateBean(background); |
||||
typeComboBox.setSelectedIndex(i); |
||||
break; |
||||
} |
||||
} |
||||
mainGridColor.setSelectObject(chartStyle.getGridMainLineColor()); |
||||
} |
||||
|
||||
public void update(PredefinedChartStyle chartStyle) { |
||||
chartStyle.setChartBackground(paneList.get(typeComboBox.getSelectedIndex()).updateBean()); |
||||
if (chartStyle.getChartBackground() instanceof ImageBackground) { |
||||
((ImageBackground) chartStyle.getChartBackground()).setLayout(Constants.IMAGE_EXTEND); |
||||
} |
||||
chartStyle.setGridMainLineColor(mainGridColor.getSelectObject()); |
||||
} |
||||
} |
@ -0,0 +1,58 @@
|
||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
||||
|
||||
import com.fr.config.predefined.PredefinedChartStyle; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
|
||||
import java.awt.Component; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-09-17 |
||||
*/ |
||||
public class ChartDataSheetStylePane extends AbstractChartStylePane { |
||||
|
||||
//字体样式
|
||||
private ChartFontPane fontPane; |
||||
|
||||
//边框颜色
|
||||
private ColorSelectBox borderColor; |
||||
|
||||
protected void initComponents() { |
||||
fontPane = new ChartFontPane() { |
||||
public String getUILabelText() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_DataSheet_Character"); |
||||
} |
||||
}; |
||||
borderColor = new ColorSelectBox(100); |
||||
} |
||||
|
||||
protected Component[][] getComponent() { |
||||
return new Component[][]{ |
||||
new Component[]{fontPane, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Border_Color")), borderColor} |
||||
}; |
||||
} |
||||
|
||||
protected double[] getRows(double p) { |
||||
return new double[]{p, p, p}; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Sheet"); |
||||
} |
||||
|
||||
public void populate(PredefinedChartStyle chartStyle) { |
||||
fontPane.populate(chartStyle.getDataSheetFont()); |
||||
borderColor.setSelectObject(chartStyle.getDataSheetBorderColor()); |
||||
} |
||||
|
||||
|
||||
public void update(PredefinedChartStyle chartStyle) { |
||||
chartStyle.setDataSheetFont(fontPane.update()); |
||||
chartStyle.setDataSheetBorderColor(borderColor.getSelectObject()); |
||||
} |
||||
} |
@ -0,0 +1,160 @@
|
||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.FRContext; |
||||
import com.fr.base.Utils; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.GeneralUtils; |
||||
|
||||
import javax.swing.JPanel; |
||||
import javax.swing.SwingConstants; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.Font; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-09-16 |
||||
*/ |
||||
public class ChartFontPane extends BasicPane { |
||||
|
||||
public static final int FONT_START = 6; |
||||
public static final int FONT_END = 72; |
||||
private UIComboBox fontNameComboBox; |
||||
private UIComboBox fontSizeComboBox; |
||||
private UIToggleButton bold; |
||||
private UIToggleButton italic; |
||||
private UIColorButton fontColor; |
||||
private static Integer[] FONT_SIZES = new Integer[FONT_END - FONT_START + 1]; |
||||
|
||||
static { |
||||
for (int i = FONT_START; i <= FONT_END; i++) { |
||||
FONT_SIZES[i - FONT_START] = i; |
||||
} |
||||
} |
||||
|
||||
public ChartFontPane() { |
||||
initState(); |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initState() { |
||||
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); |
||||
fontSizeComboBox = new UIComboBox(FONT_SIZES); |
||||
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); |
||||
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); |
||||
fontColor = new UIColorButton(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
Component[] components = new Component[]{ |
||||
fontColor, italic, bold |
||||
}; |
||||
JPanel buttonPane = new JPanel(new BorderLayout()); |
||||
buttonPane.add(fontSizeComboBox, BorderLayout.CENTER); |
||||
buttonPane.add(GUICoreUtils.createFlowPane(components, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST); |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
this.add(getContentPane(buttonPane), BorderLayout.CENTER); |
||||
|
||||
populate(FRContext.getDefaultValues().getFRFont()); |
||||
} |
||||
|
||||
protected JPanel getContentPane(JPanel buttonPane) { |
||||
double e = 155; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] rows = {p, p, p}; |
||||
double[] columnSize = {p, e}; |
||||
UILabel text = new UILabel(getUILabelText(), SwingConstants.LEFT); |
||||
Component[][] components = { |
||||
new Component[]{null, null}, |
||||
new Component[]{text, fontNameComboBox}, |
||||
new Component[]{null, buttonPane} |
||||
}; |
||||
|
||||
return TableLayoutHelper.createGapTableLayoutPane(components, rows, columnSize, 20, LayoutConstants.VGAP_LARGE); |
||||
} |
||||
|
||||
public String getUILabelText() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Character"); |
||||
} |
||||
|
||||
public String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
public void populate(FRFont frFont) { |
||||
UIObserverListener listener = fontNameComboBox == null ? null : fontNameComboBox.getUiObserverListener(); |
||||
removeAllComboBoxListener(); |
||||
|
||||
if (frFont != null) { |
||||
fontNameComboBox.setSelectedItem(frFont.getFamily()); |
||||
bold.setSelected(frFont.isBold()); |
||||
italic.setSelected(frFont.isItalic()); |
||||
populateFontSize(frFont); |
||||
if (fontColor != null) { |
||||
fontColor.setColor(frFont.getForeground()); |
||||
} |
||||
} |
||||
|
||||
//更新结束后,注册监听器
|
||||
registerAllComboBoxListener(listener); |
||||
} |
||||
|
||||
private void populateFontSize(FRFont frFont) { |
||||
if (fontSizeComboBox != null) { |
||||
fontSizeComboBox.setSelectedItem(frFont.getSize()); |
||||
} |
||||
} |
||||
|
||||
private void removeAllComboBoxListener() { |
||||
fontNameComboBox.removeChangeListener(); |
||||
fontSizeComboBox.removeChangeListener(); |
||||
} |
||||
|
||||
private void registerAllComboBoxListener(UIObserverListener listener) { |
||||
fontNameComboBox.registerChangeListener(listener); |
||||
fontSizeComboBox.registerChangeListener(listener); |
||||
} |
||||
|
||||
/** |
||||
* 更新字 |
||||
* |
||||
* @return 更新字 |
||||
*/ |
||||
public FRFont update() { |
||||
String name = GeneralUtils.objectToString(fontNameComboBox.getSelectedItem()); |
||||
|
||||
return FRFont.getInstance(name, updateFontStyle(), updateFontSize(), fontColor.getColor()); |
||||
} |
||||
|
||||
private int updateFontStyle() { |
||||
int style = Font.PLAIN; |
||||
if (bold.isSelected() && !italic.isSelected()) { |
||||
style = Font.BOLD; |
||||
} else if (!bold.isSelected() && italic.isSelected()) { |
||||
style = Font.ITALIC; |
||||
} else if (bold.isSelected() && italic.isSelected()) { |
||||
style = 3; |
||||
} |
||||
|
||||
return style; |
||||
} |
||||
|
||||
private float updateFontSize() { |
||||
return Float.parseFloat(GeneralUtils.objectToString(fontSizeComboBox.getSelectedItem())); |
||||
} |
||||
} |
@ -0,0 +1,78 @@
|
||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
||||
|
||||
import com.fr.config.predefined.PredefinedChartStyle; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
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-16 |
||||
*/ |
||||
public class ChartLabelStylePane extends AbstractChartStylePane { |
||||
|
||||
private UIButtonGroup<Integer> autoButton; |
||||
//字体样式
|
||||
private ChartFontPane chartFontPane; |
||||
|
||||
protected void initComponents() { |
||||
autoButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), |
||||
Toolkit.i18nText("Fine-Design_Chart_Custom")}); |
||||
chartFontPane = new ChartFontPane() { |
||||
public String getUILabelText() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Label_Character"); |
||||
} |
||||
}; |
||||
initListener(); |
||||
} |
||||
|
||||
protected Component[][] getComponent() { |
||||
return new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Setting")), autoButton}, |
||||
new Component[]{chartFontPane, null} |
||||
}; |
||||
} |
||||
|
||||
protected double[] getRows(double p) { |
||||
return new double[]{p, p, p}; |
||||
} |
||||
|
||||
private void initListener() { |
||||
autoButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkPreButton(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void checkPreButton() { |
||||
chartFontPane.setVisible(autoButton.getSelectedIndex() == 1); |
||||
chartFontPane.setPreferredSize(autoButton.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label"); |
||||
} |
||||
|
||||
public void populate(PredefinedChartStyle chartStyle) { |
||||
autoButton.setSelectedIndex(chartStyle.isAutoLabelFont() ? 0 : 1); |
||||
chartFontPane.populate(chartStyle.getLabelFont()); |
||||
checkPreButton(); |
||||
} |
||||
|
||||
|
||||
public void update(PredefinedChartStyle chartStyle) { |
||||
chartStyle.setAutoLabelFont(autoButton.getSelectedIndex() == 0); |
||||
chartStyle.setLabelFont(chartFontPane.update()); |
||||
} |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
||||
|
||||
import com.fr.config.predefined.PredefinedChartStyle; |
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import java.awt.Component; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-09-16 |
||||
*/ |
||||
public class ChartLegendStylePane extends AbstractChartStylePane { |
||||
|
||||
//字体样式
|
||||
private ChartFontPane chartFontPane; |
||||
|
||||
protected void initComponents() { |
||||
chartFontPane = new ChartFontPane() { |
||||
public String getUILabelText() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Legend_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 com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend"); |
||||
} |
||||
|
||||
public void populate(PredefinedChartStyle chartStyle) { |
||||
chartFontPane.populate(chartStyle.getLegendFont()); |
||||
} |
||||
|
||||
|
||||
public void update(PredefinedChartStyle chartStyle) { |
||||
chartStyle.setLegendFont(chartFontPane.update()); |
||||
} |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
||||
|
||||
import com.fr.config.predefined.PredefinedChartStyle; |
||||
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 com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Title"); |
||||
} |
||||
|
||||
public void populate(PredefinedChartStyle chartStyle) { |
||||
chartFontPane.populate(chartStyle.getTitleFont()); |
||||
} |
||||
|
||||
|
||||
public void update(PredefinedChartStyle chartStyle) { |
||||
chartStyle.setTitleFont(chartFontPane.update()); |
||||
} |
||||
} |
@ -1,9 +1,8 @@
|
||||
package com.fr.design.chartx.component.button; |
||||
package com.fr.design.style.color; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.background.ColorBackground; |
||||
import com.fr.design.style.AbstractSelectBox; |
||||
import com.fr.design.style.color.ColorSelectPane; |
||||
|
||||
import javax.swing.JPanel; |
||||
import javax.swing.event.ChangeEvent; |
@ -0,0 +1,94 @@
|
||||
package com.fr.design.mainframe.chart.gui.style; |
||||
|
||||
import com.fr.chart.base.TextAttr; |
||||
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.TableLayout; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.JPanel; |
||||
import javax.swing.SwingConstants; |
||||
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-03 |
||||
*/ |
||||
public class ChartTextAttrPaneWithPreStyle extends ChartTextAttrPane { |
||||
|
||||
private UIButtonGroup<Integer> preButton; |
||||
private JPanel textFontPane; |
||||
|
||||
public ChartTextAttrPaneWithPreStyle() { |
||||
initListener(); |
||||
} |
||||
|
||||
protected JPanel getContentPane(JPanel buttonPane) { |
||||
preButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Predefined"), |
||||
Toolkit.i18nText("Fine-Design_Chart_Custom")}); |
||||
double f = TableLayout.FILL; |
||||
double e = getEdithAreaWidth(); |
||||
double[] columnSize = {f, e}; |
||||
double p = TableLayout.PREFERRED; |
||||
textFontPane = TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), getRowSize(), columnSize); |
||||
|
||||
double[] rowSize = {p, p, p}; |
||||
UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); |
||||
Component[][] components = { |
||||
new Component[]{null, null}, |
||||
new Component[]{text, preButton}, |
||||
new Component[]{textFontPane, null}, |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); |
||||
} |
||||
|
||||
protected double getEdithAreaWidth() { |
||||
return TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
||||
} |
||||
|
||||
protected Component[][] getComponents(JPanel buttonPane) { |
||||
return new Component[][]{ |
||||
new Component[]{null, getFontNameComboBox()}, |
||||
new Component[]{null, buttonPane} |
||||
}; |
||||
} |
||||
|
||||
private void initListener() { |
||||
preButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkPreButton(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void checkPreButton() { |
||||
textFontPane.setVisible(preButton.getSelectedIndex() == 1); |
||||
textFontPane.setPreferredSize(preButton.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); |
||||
} |
||||
|
||||
public void populate(TextAttr textAttr) { |
||||
if (textAttr.isPredefinedStyle()) { |
||||
preButton.setSelectedIndex(0); |
||||
} else { |
||||
preButton.setSelectedIndex(1); |
||||
} |
||||
super.populate(textAttr); |
||||
checkPreButton(); |
||||
} |
||||
|
||||
public void update(TextAttr textAttr) { |
||||
int selectedIndex = preButton.getSelectedIndex(); |
||||
if (selectedIndex == 0) { |
||||
textAttr.setPredefinedStyle(true); |
||||
} else { |
||||
textAttr.setPredefinedStyle(false); |
||||
} |
||||
super.update(textAttr); |
||||
} |
||||
} |
@ -0,0 +1,85 @@
|
||||
package com.fr.design.mainframe.chart.gui.style; |
||||
|
||||
import com.fr.chart.base.ColorWithPreStyle; |
||||
import com.fr.design.dialog.BasicPane; |
||||
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.TableLayout; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.JPanel; |
||||
import javax.swing.SwingConstants; |
||||
import java.awt.BorderLayout; |
||||
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-07 |
||||
*/ |
||||
public class ColorSelectBoxWithPreStyle extends BasicPane { |
||||
|
||||
private UIButtonGroup<Integer> preButton; |
||||
private ColorSelectBox colorSelectBox; |
||||
|
||||
public ColorSelectBoxWithPreStyle(int preferredWidth) { |
||||
preButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Predefined"), |
||||
Toolkit.i18nText("Fine-Design_Chart_Custom")}); |
||||
colorSelectBox = new ColorSelectBox(preferredWidth); |
||||
initContent(); |
||||
initListener(); |
||||
} |
||||
|
||||
private void initContent() { |
||||
double f = TableLayout.FILL; |
||||
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
||||
double[] columnSize = {f, e}; |
||||
double p = TableLayout.PREFERRED; |
||||
|
||||
double[] rowSize = {p, p, p}; |
||||
UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color"), SwingConstants.LEFT); |
||||
Component[][] components = { |
||||
new Component[]{text, preButton}, |
||||
new Component[]{null, colorSelectBox}, |
||||
}; |
||||
JPanel gapTableLayoutPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); |
||||
this.setLayout(new BorderLayout()); |
||||
this.add(gapTableLayoutPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private void initListener() { |
||||
preButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkPreButton(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void checkPreButton() { |
||||
colorSelectBox.setVisible(preButton.getSelectedIndex() == 1); |
||||
this.setPreferredSize(preButton.getSelectedIndex() == 1 ? new Dimension(0, 55) : new Dimension(0, 23)); |
||||
} |
||||
|
||||
public String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
public void populate(ColorWithPreStyle colorWithPreStyle) { |
||||
preButton.setSelectedIndex(colorWithPreStyle.isPredefinedStyle() ? 0 : 1); |
||||
colorSelectBox.setSelectObject(colorWithPreStyle.getColor()); |
||||
checkPreButton(); |
||||
} |
||||
|
||||
public ColorWithPreStyle update() { |
||||
ColorWithPreStyle colorWithPreStyle = new ColorWithPreStyle(); |
||||
colorWithPreStyle.setPredefinedStyle(preButton.getSelectedIndex() == 0); |
||||
colorWithPreStyle.setColor(colorSelectBox.getSelectObject()); |
||||
return colorWithPreStyle; |
||||
} |
||||
} |
@ -0,0 +1,47 @@
|
||||
package com.fr.van.chart.designer.component.background; |
||||
|
||||
import com.fr.chart.chartglyph.GeneralInfo; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.VanChartGradientPane; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-09-11 |
||||
*/ |
||||
public class VanChartBackgroundPaneWithAutoColor extends VanChartBackgroundPane { |
||||
|
||||
public VanChartBackgroundPaneWithAutoColor() { |
||||
super(); |
||||
} |
||||
|
||||
protected void initList() { |
||||
paneList.add(new NullBackgroundQuickPane() { |
||||
public String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Automatic"); |
||||
} |
||||
}); |
||||
paneList.add(new NullBackgroundQuickPane()); |
||||
paneList.add(new ColorBackgroundQuickPane()); |
||||
paneList.add(new VanChartGradientPane()); |
||||
} |
||||
|
||||
public void populateBackground(GeneralInfo attr, int begin) { |
||||
if (attr.isAutoBackground()) { |
||||
typeComboBox.setSelectedIndex(0); |
||||
return; |
||||
} |
||||
super.populateBackground(attr, begin + 1); |
||||
} |
||||
|
||||
public void updateBackground(GeneralInfo attr) { |
||||
if (typeComboBox.getSelectedIndex() == 0) { |
||||
attr.setAutoBackground(true); |
||||
return; |
||||
} |
||||
attr.setAutoBackground(false); |
||||
super.updateBackground(attr); |
||||
} |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.van.chart.designer.component.background; |
||||
|
||||
import com.fr.chart.base.BackgroundWithPreStyle; |
||||
import com.fr.chart.chartglyph.GeneralInfo; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.VanChartGradientPane; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-09-08 |
||||
*/ |
||||
public class VanChartBackgroundPaneWithPreStyle extends VanChartBackgroundPane { |
||||
|
||||
@Override |
||||
protected void initList() { |
||||
paneList.add(new NullBackgroundQuickPane() { |
||||
public String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Predefined"); |
||||
} |
||||
}); |
||||
paneList.add(new NullBackgroundQuickPane()); |
||||
paneList.add(new ColorBackgroundQuickPane()); |
||||
paneList.add(new ImageBackgroundQuickPane(false)); |
||||
paneList.add(new VanChartGradientPane()); |
||||
} |
||||
|
||||
public void populateBackground(GeneralInfo attr, int begin) { |
||||
BackgroundWithPreStyle backgroundWithPreStyle = attr.getBackgroundWithPreStyle(); |
||||
if (backgroundWithPreStyle.isPredefinedStyle()) { |
||||
typeComboBox.setSelectedIndex(0); |
||||
return; |
||||
} |
||||
super.populateBackground(attr, begin + 1); |
||||
} |
||||
|
||||
public void updateBackground(GeneralInfo attr) { |
||||
if (typeComboBox.getSelectedIndex() == 0) { |
||||
attr.getBackgroundWithPreStyle().setPredefinedStyle(true); |
||||
return; |
||||
} |
||||
attr.getBackgroundWithPreStyle().setPredefinedStyle(false); |
||||
super.updateBackground(attr); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,57 @@
|
||||
package com.fr.van.chart.designer.component.border; |
||||
|
||||
import com.fr.chart.chartglyph.GeneralInfo; |
||||
import com.fr.design.gui.icombobox.LineComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.chart.gui.style.ColorSelectBoxWithPreStyle; |
||||
import com.fr.design.utils.gui.UIComponentUtils; |
||||
import com.fr.design.widget.FRWidgetFactory; |
||||
import com.fr.stable.CoreConstants; |
||||
|
||||
import java.awt.Component; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-09-07 |
||||
*/ |
||||
public class VanChartBorderPaneWithPreStyle extends VanChartBorderPane { |
||||
|
||||
private ColorSelectBoxWithPreStyle colorSelectBoxWithPreStyle; |
||||
|
||||
public VanChartBorderPaneWithPreStyle() { |
||||
super(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
currentLineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); |
||||
colorSelectBoxWithPreStyle = new ColorSelectBoxWithPreStyle(100); |
||||
} |
||||
|
||||
protected Component[][] getUseComponent() { |
||||
UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")); |
||||
|
||||
return new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{lineStyleLabel, UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)}, |
||||
new Component[]{colorSelectBoxWithPreStyle, null}, |
||||
}; |
||||
} |
||||
|
||||
public void populate(GeneralInfo attr) { |
||||
super.populate(attr); |
||||
if (attr == null) { |
||||
return; |
||||
} |
||||
colorSelectBoxWithPreStyle.populate(attr.getColorWithPreStyle()); |
||||
} |
||||
|
||||
public void update(GeneralInfo attr) { |
||||
super.update(attr); |
||||
if (attr == null) { |
||||
attr = new GeneralInfo(); |
||||
} |
||||
attr.setColorWithPreStyle(colorSelectBoxWithPreStyle.update()); |
||||
} |
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.fr.van.chart.designer.style; |
||||
|
||||
import com.fr.van.chart.designer.component.background.VanChartBackgroundPane; |
||||
import com.fr.van.chart.designer.component.background.VanChartBackgroundPaneWithAutoColor; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-09-11 |
||||
*/ |
||||
public class MapRangeLegendPane extends VanChartRangeLegendPane { |
||||
|
||||
public MapRangeLegendPane() { |
||||
super(); |
||||
} |
||||
|
||||
public MapRangeLegendPane(VanChartStylePane parent) { |
||||
super(parent); |
||||
} |
||||
|
||||
@Override |
||||
protected VanChartBackgroundPane creatBackgroundPane(){ |
||||
return new VanChartBackgroundPaneWithAutoColor(); |
||||
} |
||||
} |
@ -1,30 +0,0 @@
|
||||
package com.fr.van.chart.designer.style.label; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.plugin.chart.base.AttrLabel; |
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
|
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* 条件属性中用到 |
||||
*/ |
||||
public class VanChartPlotLabelNoCheckPane extends VanChartPlotLabelPane { |
||||
|
||||
private static final long serialVersionUID = 8124894034484334810L; |
||||
|
||||
public VanChartPlotLabelNoCheckPane(Plot plot,VanChartStylePane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
protected void addComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
this.add(labelPane,BorderLayout.CENTER); |
||||
} |
||||
|
||||
public void populate(AttrLabel attr) { |
||||
super.populate(attr); |
||||
isLabelShow.setSelected(true); |
||||
labelPane.setVisible(true); |
||||
} |
||||
} |
@ -1,30 +0,0 @@
|
||||
package com.fr.van.chart.scatter.component.label; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.plugin.chart.base.AttrLabel; |
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
|
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* 条件属性中用到 |
||||
*/ |
||||
public class VanChartScatterPlotLabelNoCheckPane extends VanChartScatterPlotLabelPane { |
||||
|
||||
private static final long serialVersionUID = 8124894034484334810L; |
||||
|
||||
public VanChartScatterPlotLabelNoCheckPane(Plot plot, VanChartStylePane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
protected void addComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
this.add(labelPane,BorderLayout.CENTER); |
||||
} |
||||
|
||||
public void populate(AttrLabel attr) { |
||||
super.populate(attr); |
||||
isLabelShow.setSelected(true); |
||||
labelPane.setVisible(true); |
||||
} |
||||
} |
Loading…
Reference in new issue