|
|
|
@ -1,129 +1,419 @@
|
|
|
|
|
package com.fr.van.chart.designer.component; |
|
|
|
|
|
|
|
|
|
import com.fr.design.beans.BasicBeanPane; |
|
|
|
|
import com.fr.design.dialog.BasicDialog; |
|
|
|
|
import com.fr.design.dialog.DialogActionAdapter; |
|
|
|
|
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.TableLayout; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
|
|
|
|
|
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; |
|
|
|
|
import com.fr.design.ui.ModernUIPane; |
|
|
|
|
import com.fr.plugin.chart.base.AttrTooltipContent; |
|
|
|
|
import com.fr.plugin.chart.base.AttrTooltipRichText; |
|
|
|
|
import com.fr.plugin.chart.base.format.AttrTooltipFormat; |
|
|
|
|
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
|
|
|
|
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; |
|
|
|
|
import com.fr.van.chart.designer.style.VanChartStylePane; |
|
|
|
|
|
|
|
|
|
import javax.swing.JComponent; |
|
|
|
|
import javax.swing.JFrame; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.CardLayout; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 内容界面 。数据点提示 |
|
|
|
|
* 数据点提示内容界面,含有通用设置、富文本编辑器、自定义JS界面 |
|
|
|
|
*/ |
|
|
|
|
public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent> { |
|
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 8825929000117843641L; |
|
|
|
|
|
|
|
|
|
protected UIButtonGroup<Integer> content; |
|
|
|
|
protected ValueFormatPaneWithCheckBox valueFormatPane; |
|
|
|
|
protected PercentFormatPaneWithCheckBox percentFormatPane; |
|
|
|
|
protected CategoryNameFormatPaneWithCheckBox categoryNameFormatPane; |
|
|
|
|
protected SeriesNameFormatPaneWithCheckBox seriesNameFormatPane; |
|
|
|
|
private UIButtonGroup<Integer> content; |
|
|
|
|
|
|
|
|
|
private CategoryNameFormatPaneWithCheckBox categoryNameFormatPane; |
|
|
|
|
private SeriesNameFormatPaneWithCheckBox seriesNameFormatPane; |
|
|
|
|
private ValueFormatPaneWithCheckBox valueFormatPane; |
|
|
|
|
private PercentFormatPaneWithCheckBox percentFormatPane; |
|
|
|
|
|
|
|
|
|
//监控刷新时,自动数据点提示使用
|
|
|
|
|
protected ChangedValueFormatPaneWithCheckBox changedValueFormatPane; |
|
|
|
|
protected ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane; |
|
|
|
|
private ChangedValueFormatPaneWithCheckBox changedValueFormatPane; |
|
|
|
|
private ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane; |
|
|
|
|
|
|
|
|
|
private JPanel centerPane; |
|
|
|
|
private CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane; |
|
|
|
|
private SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane; |
|
|
|
|
private ValueFormatPaneWithoutCheckBox richTextValueFormatPane; |
|
|
|
|
private PercentFormatPaneWithoutCheckBox richTextPercentFormatPane; |
|
|
|
|
private ChangedValueFormatPaneWithoutCheckBox richTextChangedValueFormatPane; |
|
|
|
|
private ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane; |
|
|
|
|
|
|
|
|
|
private JPanel centerPanel; |
|
|
|
|
private JPanel commonPanel; |
|
|
|
|
private JPanel editorPanel; |
|
|
|
|
private JPanel htmlPanel; |
|
|
|
|
private JPanel stylePanel; |
|
|
|
|
private UIButtonGroup<Integer> styleButton; |
|
|
|
|
private ChartTextAttrPane textAttrPane; |
|
|
|
|
private VanChartHtmlLabelPane htmlLabelPane; |
|
|
|
|
|
|
|
|
|
private VanChartStylePane parent; |
|
|
|
|
private JPanel showOnPane; |
|
|
|
|
|
|
|
|
|
private AttrTooltipRichText richText; |
|
|
|
|
|
|
|
|
|
public VanChartTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){ |
|
|
|
|
this.parent = parent; |
|
|
|
|
this.showOnPane = showOnPane; |
|
|
|
|
this.richText = new AttrTooltipRichText(); |
|
|
|
|
|
|
|
|
|
initFormatPane(parent, showOnPane); |
|
|
|
|
initRichTextFormatPane(parent, showOnPane); |
|
|
|
|
|
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
|
this.add(createLabelContentPane(),BorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public CategoryNameFormatPaneWithCheckBox getCategoryNameFormatPane() { |
|
|
|
|
return categoryNameFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setCategoryNameFormatPane(CategoryNameFormatPaneWithCheckBox categoryNameFormatPane) { |
|
|
|
|
this.categoryNameFormatPane = categoryNameFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public SeriesNameFormatPaneWithCheckBox getSeriesNameFormatPane() { |
|
|
|
|
return seriesNameFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setSeriesNameFormatPane(SeriesNameFormatPaneWithCheckBox seriesNameFormatPane) { |
|
|
|
|
this.seriesNameFormatPane = seriesNameFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ValueFormatPaneWithCheckBox getValueFormatPane() { |
|
|
|
|
return valueFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setValueFormatPane(ValueFormatPaneWithCheckBox valueFormatPane) { |
|
|
|
|
this.valueFormatPane = valueFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public PercentFormatPaneWithCheckBox getPercentFormatPane() { |
|
|
|
|
return percentFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setPercentFormatPane(PercentFormatPaneWithCheckBox percentFormatPane) { |
|
|
|
|
this.percentFormatPane = percentFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ChangedValueFormatPaneWithCheckBox getChangedValueFormatPane() { |
|
|
|
|
return changedValueFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setChangedValueFormatPane(ChangedValueFormatPaneWithCheckBox changedValueFormatPane) { |
|
|
|
|
this.changedValueFormatPane = changedValueFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ChangedPercentFormatPaneWithCheckBox getChangedPercentFormatPane() { |
|
|
|
|
return changedPercentFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setChangedPercentFormatPane(ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane) { |
|
|
|
|
this.changedPercentFormatPane = changedPercentFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public CategoryNameFormatPaneWithoutCheckBox getRichTextCategoryNameFormatPane() { |
|
|
|
|
return richTextCategoryNameFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setRichTextCategoryNameFormatPane(CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane) { |
|
|
|
|
this.richTextCategoryNameFormatPane = richTextCategoryNameFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public SeriesNameFormatPaneWithoutCheckBox getRichTextSeriesNameFormatPane() { |
|
|
|
|
return richTextSeriesNameFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setRichTextSeriesNameFormatPane(SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane) { |
|
|
|
|
this.richTextSeriesNameFormatPane = richTextSeriesNameFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ValueFormatPaneWithoutCheckBox getRichTextValueFormatPane() { |
|
|
|
|
return richTextValueFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setRichTextValueFormatPane(ValueFormatPaneWithoutCheckBox richTextValueFormatPane) { |
|
|
|
|
this.richTextValueFormatPane = richTextValueFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public PercentFormatPaneWithoutCheckBox getRichTextPercentFormatPane() { |
|
|
|
|
return richTextPercentFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setRichTextPercentFormatPane(PercentFormatPaneWithoutCheckBox richTextPercentFormatPane) { |
|
|
|
|
this.richTextPercentFormatPane = richTextPercentFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ChangedValueFormatPaneWithoutCheckBox getRichTextChangedValueFormatPane() { |
|
|
|
|
return richTextChangedValueFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setRichTextChangedValueFormatPane(ChangedValueFormatPaneWithoutCheckBox richTextChangedValueFormatPane) { |
|
|
|
|
this.richTextChangedValueFormatPane = richTextChangedValueFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ChangedPercentFormatPaneWithoutCheckBox getRichTextChangedPercentFormatPane() { |
|
|
|
|
return richTextChangedPercentFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setRichTextChangedPercentFormatPane(ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane) { |
|
|
|
|
this.richTextChangedPercentFormatPane = richTextChangedPercentFormatPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public AttrTooltipRichText getRichTextAttr() { |
|
|
|
|
return richText; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createLabelContentPane() { |
|
|
|
|
content = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common"), |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); |
|
|
|
|
initDetailPane(); |
|
|
|
|
initCenterPane(); |
|
|
|
|
|
|
|
|
|
initFormatPane(parent, showOnPane); |
|
|
|
|
JPanel content = new JPanel(new BorderLayout()); |
|
|
|
|
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
|
|
|
|
content.add(createButtonPane(), BorderLayout.NORTH); |
|
|
|
|
content.add(centerPanel, BorderLayout.CENTER); |
|
|
|
|
content.add(stylePanel, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
|
|
commonPanel = createCommonPanel(); |
|
|
|
|
htmlLabelPane = createHtmlLabelPane(); |
|
|
|
|
htmlLabelPane.setParent(parent); |
|
|
|
|
initContentListener(); |
|
|
|
|
|
|
|
|
|
centerPane = new JPanel(new CardLayout()){ |
|
|
|
|
@Override |
|
|
|
|
return getLabelContentPane(content); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void initDetailPane() { |
|
|
|
|
commonPanel = createCommonFormatPanel(); |
|
|
|
|
editorPanel = createRichEditorPanel(); |
|
|
|
|
htmlPanel = createHtmlPane(); |
|
|
|
|
stylePanel = createCommonStylePane(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void initCenterPane() { |
|
|
|
|
centerPanel = new JPanel(new CardLayout()) { |
|
|
|
|
public Dimension getPreferredSize() { |
|
|
|
|
if(content.getSelectedIndex() == 0){ |
|
|
|
|
if (content.getSelectedIndex() == 0) { |
|
|
|
|
return commonPanel.getPreferredSize(); |
|
|
|
|
} else if (content.getSelectedIndex() == 1) { |
|
|
|
|
return editorPanel.getPreferredSize(); |
|
|
|
|
} else { |
|
|
|
|
return new Dimension(commonPanel.getPreferredSize().width,htmlLabelPane.getPreferredSize().height); |
|
|
|
|
return htmlPanel.getPreferredSize(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
centerPane.add(htmlLabelPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); |
|
|
|
|
centerPane.add(commonPanel,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common")); |
|
|
|
|
|
|
|
|
|
double[] column = {f, e}; |
|
|
|
|
double[] row = {p,p,p}; |
|
|
|
|
centerPanel.add(commonPanel, Toolkit.i18nText("Fine-Design_Chart_Common")); |
|
|
|
|
centerPanel.add(editorPanel, Toolkit.i18nText("Fine-Design_Chart_Rich_Text")); |
|
|
|
|
centerPanel.add(htmlPanel, Toolkit.i18nText("Fine-Design_Chart_Custom")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected String getLabelContentTitle() { |
|
|
|
|
return Toolkit.i18nText("Fine-Design_Report_Text"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected JPanel getLabelContentPane(JPanel contentPane) { |
|
|
|
|
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), contentPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createButtonPane() { |
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
|
|
|
|
|
double[] column = {f, p}; |
|
|
|
|
double[] row = {p, p}; |
|
|
|
|
|
|
|
|
|
content = new UIButtonGroup<>(new String[]{ |
|
|
|
|
Toolkit.i18nText("Fine-Design_Chart_Common"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Chart_Rich_Text"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Chart_Custom") |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{null,null}, |
|
|
|
|
new Component[]{new UILabel(getLabelContentTitle()),content}, |
|
|
|
|
new Component[]{null,centerPane}, |
|
|
|
|
new Component[]{null, null}, |
|
|
|
|
new Component[]{content, null} |
|
|
|
|
}; |
|
|
|
|
initContentListener(); |
|
|
|
|
JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column); |
|
|
|
|
return getLabelContentPane(contentPane); |
|
|
|
|
|
|
|
|
|
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected String getLabelContentTitle () { |
|
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"); |
|
|
|
|
protected JPanel createCommonFormatPanel() { |
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
|
|
|
|
|
|
|
|
|
JPanel formatContent = TableLayoutHelper.createTableLayoutPane(getPaneComponents(), getRowSize(p), new double[]{f, p}); |
|
|
|
|
|
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{null, null}, |
|
|
|
|
new Component[]{new UILabel(getLabelContentTitle()), formatContent} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected JPanel getLabelContentPane(JPanel contentPane) { |
|
|
|
|
return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content"), contentPane); |
|
|
|
|
private JPanel createCommonStylePane() { |
|
|
|
|
styleButton = new UIButtonGroup<>(new String[]{ |
|
|
|
|
Toolkit.i18nText("Fine-Design_Chart_Automatic"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Chart_Custom") |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
textAttrPane = new ChartTextAttrPane() { |
|
|
|
|
protected Component[][] getComponents(JPanel buttonPane) { |
|
|
|
|
return new Component[][]{ |
|
|
|
|
new Component[]{null, null}, |
|
|
|
|
new Component[]{null, getFontNameComboBox()}, |
|
|
|
|
new Component[]{null, buttonPane} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
JPanel buttonPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), styleButton); |
|
|
|
|
|
|
|
|
|
JPanel stylePanel = new JPanel(new BorderLayout()); |
|
|
|
|
stylePanel.add(buttonPane, BorderLayout.CENTER); |
|
|
|
|
stylePanel.add(textAttrPane, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
|
|
initStyleButtonListener(); |
|
|
|
|
|
|
|
|
|
return stylePanel; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected VanChartHtmlLabelPane createHtmlLabelPane() { |
|
|
|
|
return new VanChartHtmlLabelPaneWithOutWidthAndHeight(); |
|
|
|
|
private void initStyleButtonListener() { |
|
|
|
|
styleButton.addActionListener(new ActionListener() { |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
checkStylePane(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected JPanel createCommonPanel() { |
|
|
|
|
private void checkStylePane() { |
|
|
|
|
textAttrPane.setVisible(styleButton.getSelectedIndex() == 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createRichEditorPanel() { |
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
|
|
|
|
|
|
|
|
|
double[] columnSize = {f, e}; |
|
|
|
|
double[] rowSize = {p, p, p}; |
|
|
|
|
|
|
|
|
|
JPanel formatContent = TableLayoutHelper.createTableLayoutPane(getRichTextComponents(), getRowSize(p), new double[]{f, p}); |
|
|
|
|
|
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{null, null}, |
|
|
|
|
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Content_Style")), createRichEditorButton()}, |
|
|
|
|
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Use_Format")), formatContent} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JComponent createRichEditorButton() { |
|
|
|
|
UIButton contentTextArea = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Rich_Text_Edit")); |
|
|
|
|
|
|
|
|
|
double[] columnSize = {f, p}; |
|
|
|
|
double[] rowSize = getRowSize(p); |
|
|
|
|
contentTextArea.addMouseListener(new MouseAdapter() { |
|
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
|
fireRichEditor(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return TableLayoutHelper.createTableLayoutPane(getPaneComponents(), rowSize, columnSize); |
|
|
|
|
return contentTextArea; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane){ |
|
|
|
|
private void fireRichEditor() { |
|
|
|
|
final ModernUIPane<VanChartRichEditorPane.RichEditorModel> pane = VanChartRichEditorPane.createRichEditorPane(richText); |
|
|
|
|
BasicDialog dialog = pane.showWindow(new JFrame()); |
|
|
|
|
|
|
|
|
|
pane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); |
|
|
|
|
|
|
|
|
|
dialog.addDialogActionListener(new DialogActionAdapter() { |
|
|
|
|
|
|
|
|
|
public void doOk() { |
|
|
|
|
VanChartRichEditorPane.RichEditorModel model = pane.update(); |
|
|
|
|
|
|
|
|
|
String content = model.getContent(); |
|
|
|
|
updateLocalRichText(content, model.isAuto()); |
|
|
|
|
|
|
|
|
|
SwingUtilities.getWindowAncestor(pane).setVisible(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void doCancel() { |
|
|
|
|
SwingUtilities.getWindowAncestor(pane).setVisible(false); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
dialog.setVisible(true); |
|
|
|
|
|
|
|
|
|
if (parent != null) { |
|
|
|
|
parent.attributeChanged(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createHtmlPane() { |
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
|
|
|
|
|
double[] column = {f, p}; |
|
|
|
|
double[] row = {p, p}; |
|
|
|
|
|
|
|
|
|
htmlLabelPane = createHtmlLabelPane(); |
|
|
|
|
htmlLabelPane.setParent(parent); |
|
|
|
|
|
|
|
|
|
Component[][] htmlComponents = new Component[][]{ |
|
|
|
|
new Component[]{null, null}, |
|
|
|
|
new Component[]{htmlLabelPane, null} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return TableLayout4VanChartHelper.createGapTableLayoutPane(htmlComponents, row, column); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected VanChartHtmlLabelPane createHtmlLabelPane() { |
|
|
|
|
return new VanChartHtmlLabelPaneWithOutWidthAndHeight(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { |
|
|
|
|
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane); |
|
|
|
|
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); |
|
|
|
|
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); |
|
|
|
|
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { |
|
|
|
|
richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane); |
|
|
|
|
richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane); |
|
|
|
|
richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); |
|
|
|
|
richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) { |
|
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); |
|
|
|
|
} |
|
|
|
@ -132,12 +422,21 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
|
|
|
|
|
return new double[]{p,p,p,p}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected Component[][] getPaneComponents(){ |
|
|
|
|
protected Component[][] getPaneComponents() { |
|
|
|
|
return new Component[][]{ |
|
|
|
|
new Component[]{categoryNameFormatPane,null}, |
|
|
|
|
new Component[]{seriesNameFormatPane,null}, |
|
|
|
|
new Component[]{valueFormatPane,null}, |
|
|
|
|
new Component[]{percentFormatPane,null}, |
|
|
|
|
new Component[]{categoryNameFormatPane, null}, |
|
|
|
|
new Component[]{seriesNameFormatPane, null}, |
|
|
|
|
new Component[]{valueFormatPane, null}, |
|
|
|
|
new Component[]{percentFormatPane, null}, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected Component[][] getRichTextComponents() { |
|
|
|
|
return new Component[][]{ |
|
|
|
|
new Component[]{richTextCategoryNameFormatPane, null}, |
|
|
|
|
new Component[]{richTextSeriesNameFormatPane, null}, |
|
|
|
|
new Component[]{richTextValueFormatPane, null}, |
|
|
|
|
new Component[]{richTextPercentFormatPane, null}, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -152,16 +451,20 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void checkCardPane() { |
|
|
|
|
CardLayout cardLayout = (CardLayout) centerPane.getLayout(); |
|
|
|
|
if (content.getSelectedIndex() == 1) { |
|
|
|
|
cardLayout.show(centerPane,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); |
|
|
|
|
CardLayout cardLayout = (CardLayout) centerPanel.getLayout(); |
|
|
|
|
if (content.getSelectedIndex() == 2) { |
|
|
|
|
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Custom")); |
|
|
|
|
if(isDirty()){ |
|
|
|
|
setCustomFormatterText(); |
|
|
|
|
setDirty(false); |
|
|
|
|
} |
|
|
|
|
} else if (content.getSelectedIndex() == 1) { |
|
|
|
|
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Rich_Text")); |
|
|
|
|
} else { |
|
|
|
|
cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common")); |
|
|
|
|
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Common")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
stylePanel.setVisible(content.getSelectedIndex() != 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void setCustomFormatterText() { |
|
|
|
@ -169,8 +472,13 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public boolean isDirty() { |
|
|
|
|
return categoryNameFormatPane.isDirty() || seriesNameFormatPane.isDirty() || valueFormatPane.isDirty() || percentFormatPane.isDirty() |
|
|
|
|
|| (changedValueFormatPane != null && changedValueFormatPane.isDirty()) || (changedValueFormatPane != null && changedPercentFormatPane.isDirty()); |
|
|
|
|
|
|
|
|
|
return categoryNameFormatPane.isDirty() |
|
|
|
|
|| seriesNameFormatPane.isDirty() |
|
|
|
|
|| valueFormatPane.isDirty() |
|
|
|
|
|| percentFormatPane.isDirty() |
|
|
|
|
|| (changedValueFormatPane != null && changedValueFormatPane.isDirty()) |
|
|
|
|
|| (changedValueFormatPane != null && changedPercentFormatPane.isDirty()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setDirty(boolean isDirty) { |
|
|
|
@ -199,28 +507,103 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
content.setSelectedIndex(attrTooltipContent.isCommon() ? 0 : 1); |
|
|
|
|
if (attrTooltipContent.isCommon()) { |
|
|
|
|
content.setSelectedIndex(0); |
|
|
|
|
} else if (attrTooltipContent.isRichText()) { |
|
|
|
|
content.setSelectedIndex(1); |
|
|
|
|
} else { |
|
|
|
|
content.setSelectedIndex(2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (attrTooltipContent.isCustom()) { |
|
|
|
|
styleButton.setSelectedIndex(1); |
|
|
|
|
} else { |
|
|
|
|
styleButton.setSelectedIndex(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.textAttrPane.populate(attrTooltipContent.getTextAttr()); |
|
|
|
|
|
|
|
|
|
populateFormatPane(attrTooltipContent); |
|
|
|
|
populateRichEditor(attrTooltipContent); |
|
|
|
|
|
|
|
|
|
htmlLabelPane.populate(attrTooltipContent.getHtmlLabel()); |
|
|
|
|
if(!attrTooltipContent.isCommon()){ |
|
|
|
|
setDirty(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
checkCardPane(); |
|
|
|
|
checkStylePane(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { |
|
|
|
|
categoryNameFormatPane.populate(attrTooltipContent.getCategoryFormat()); |
|
|
|
|
seriesNameFormatPane.populate(attrTooltipContent.getSeriesFormat()); |
|
|
|
|
valueFormatPane.populate(attrTooltipContent.getValueFormat()); |
|
|
|
|
percentFormatPane.populate(attrTooltipContent.getPercentFormat()); |
|
|
|
|
VanChartFormatPaneWithCheckBox[] formatPaneGroup = new VanChartFormatPaneWithCheckBox[]{ |
|
|
|
|
categoryNameFormatPane, |
|
|
|
|
seriesNameFormatPane, |
|
|
|
|
valueFormatPane, |
|
|
|
|
percentFormatPane, |
|
|
|
|
changedValueFormatPane, |
|
|
|
|
changedPercentFormatPane |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if (changedValueFormatPane != null) { |
|
|
|
|
changedValueFormatPane.populate(attrTooltipContent.getChangedValueFormat()); |
|
|
|
|
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ |
|
|
|
|
attrTooltipContent.getCategoryFormat(), |
|
|
|
|
attrTooltipContent.getSeriesFormat(), |
|
|
|
|
attrTooltipContent.getValueFormat(), |
|
|
|
|
attrTooltipContent.getPercentFormat(), |
|
|
|
|
attrTooltipContent.getChangedValueFormat(), |
|
|
|
|
attrTooltipContent.getChangedPercentFormat() |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
for (int i = 0, len = formatPaneGroup.length; i < len; i++) { |
|
|
|
|
VanChartFormatPaneWithCheckBox formatPane = formatPaneGroup[i]; |
|
|
|
|
AttrTooltipFormat format = formatGroup[i]; |
|
|
|
|
|
|
|
|
|
if (formatPane != null && format != null) { |
|
|
|
|
formatPane.populate(format); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (changedPercentFormatPane != null) { |
|
|
|
|
changedPercentFormatPane.populate(attrTooltipContent.getChangedPercentFormat()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { |
|
|
|
|
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ |
|
|
|
|
richTextCategoryNameFormatPane, |
|
|
|
|
richTextSeriesNameFormatPane, |
|
|
|
|
richTextValueFormatPane, |
|
|
|
|
richTextPercentFormatPane, |
|
|
|
|
richTextChangedValueFormatPane, |
|
|
|
|
richTextChangedPercentFormatPane |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ |
|
|
|
|
attrTooltipContent.getRichTextCategoryFormat(), |
|
|
|
|
attrTooltipContent.getRichTextSeriesFormat(), |
|
|
|
|
attrTooltipContent.getRichTextValueFormat(), |
|
|
|
|
attrTooltipContent.getRichTextPercentFormat(), |
|
|
|
|
attrTooltipContent.getRichTextChangedValueFormat(), |
|
|
|
|
attrTooltipContent.getRichTextChangedPercentFormat() |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
populateRichTextFormat(formatPaneGroup, formatGroup); |
|
|
|
|
populateRichText(attrTooltipContent.getRichTextAttr()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void populateRichTextFormat(VanChartFormatPaneWithCheckBox[] formatPaneGroup, AttrTooltipFormat[] formatGroup) { |
|
|
|
|
for (int i = 0, len = formatPaneGroup.length; i < len; i++) { |
|
|
|
|
VanChartFormatPaneWithCheckBox formatPane = formatPaneGroup[i]; |
|
|
|
|
AttrTooltipFormat format = formatGroup[i]; |
|
|
|
|
|
|
|
|
|
if (formatPane != null && format != null) { |
|
|
|
|
formatPane.populate(format); |
|
|
|
|
|
|
|
|
|
// 填充面板时,更新富文本编辑器参数
|
|
|
|
|
formatPane.updateFormatParams(richText.getParams(), format.getJs()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void populateRichText(AttrTooltipRichText tooltipRichText) { |
|
|
|
|
if (tooltipRichText != null) { |
|
|
|
|
updateLocalRichText(tooltipRichText.getContent(), tooltipRichText.isAuto()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -228,9 +611,13 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
|
|
|
|
|
AttrTooltipContent attrTooltipContent = createAttrTooltip(); |
|
|
|
|
|
|
|
|
|
attrTooltipContent.setCommon(content.getSelectedIndex() == 0); |
|
|
|
|
attrTooltipContent.setRichText(content.getSelectedIndex() == 1); |
|
|
|
|
attrTooltipContent.setCustom(styleButton.getSelectedIndex() == 1); |
|
|
|
|
attrTooltipContent.setTextAttr(this.textAttrPane.update()); |
|
|
|
|
|
|
|
|
|
updateFormatPane(attrTooltipContent); |
|
|
|
|
|
|
|
|
|
updateRichEditor(attrTooltipContent); |
|
|
|
|
updateTooltipRichText(attrTooltipContent); |
|
|
|
|
updateFormatsWithPaneWidth(attrTooltipContent); |
|
|
|
|
|
|
|
|
|
htmlLabelPane.update(attrTooltipContent.getHtmlLabel()); |
|
|
|
@ -243,11 +630,18 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { |
|
|
|
|
categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat()); |
|
|
|
|
seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat()); |
|
|
|
|
valueFormatPane.update(attrTooltipContent.getValueFormat()); |
|
|
|
|
percentFormatPane.update(attrTooltipContent.getPercentFormat()); |
|
|
|
|
|
|
|
|
|
if (categoryNameFormatPane != null) { |
|
|
|
|
categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat()); |
|
|
|
|
} |
|
|
|
|
if (seriesNameFormatPane != null) { |
|
|
|
|
seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat()); |
|
|
|
|
} |
|
|
|
|
if (valueFormatPane != null) { |
|
|
|
|
valueFormatPane.update(attrTooltipContent.getValueFormat()); |
|
|
|
|
} |
|
|
|
|
if (percentFormatPane != null) { |
|
|
|
|
percentFormatPane.update(attrTooltipContent.getPercentFormat()); |
|
|
|
|
} |
|
|
|
|
if (changedValueFormatPane != null) { |
|
|
|
|
changedValueFormatPane.update(attrTooltipContent.getChangedValueFormat()); |
|
|
|
|
} |
|
|
|
@ -256,6 +650,40 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { |
|
|
|
|
if (richTextCategoryNameFormatPane != null) { |
|
|
|
|
richTextCategoryNameFormatPane.update(attrTooltipContent.getRichTextCategoryFormat()); |
|
|
|
|
} |
|
|
|
|
if (richTextSeriesNameFormatPane != null) { |
|
|
|
|
richTextSeriesNameFormatPane.update(attrTooltipContent.getRichTextSeriesFormat()); |
|
|
|
|
} |
|
|
|
|
if (richTextValueFormatPane != null) { |
|
|
|
|
richTextValueFormatPane.update(attrTooltipContent.getRichTextValueFormat()); |
|
|
|
|
} |
|
|
|
|
if (richTextPercentFormatPane != null) { |
|
|
|
|
richTextPercentFormatPane.update(attrTooltipContent.getRichTextPercentFormat()); |
|
|
|
|
} |
|
|
|
|
if (richTextChangedValueFormatPane != null) { |
|
|
|
|
richTextChangedValueFormatPane.update(attrTooltipContent.getRichTextChangedValueFormat()); |
|
|
|
|
} |
|
|
|
|
if (richTextChangedPercentFormatPane != null) { |
|
|
|
|
richTextChangedPercentFormatPane.update(attrTooltipContent.getRichTextChangedPercentFormat()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateLocalRichText(String content, boolean isAuto) { |
|
|
|
|
richText.setContent(content); |
|
|
|
|
richText.setAuto(isAuto); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateTooltipRichText(AttrTooltipContent attrTooltipContent) { |
|
|
|
|
if (attrTooltipContent != null) { |
|
|
|
|
AttrTooltipRichText tooltipRichText = attrTooltipContent.getRichTextAttr(); |
|
|
|
|
tooltipRichText.setContent(richText.getContent()); |
|
|
|
|
tooltipRichText.setAuto(richText.isAuto()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* CHART-1295 |
|
|
|
|
* 通过格式的面板宽度来判断在自定义js代码中是否显示this.seriesName字符串。 |
|
|
|
|