|
|
|
@ -7,6 +7,7 @@ import com.fr.design.ui.ModernUIPane;
|
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
import com.fr.plugin.chart.base.AttrTooltipContent; |
|
|
|
|
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; |
|
|
|
|
import com.fr.plugin.chart.base.format.AttrTooltipFormat; |
|
|
|
|
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; |
|
|
|
|
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; |
|
|
|
|
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; |
|
|
|
@ -49,6 +50,8 @@ public class VanChartFieldListPane extends JPanel {
|
|
|
|
|
this.richEditorPane = richEditorPane; |
|
|
|
|
|
|
|
|
|
initFieldListListener(); |
|
|
|
|
initDefaultFieldButton(); |
|
|
|
|
|
|
|
|
|
registerAttrListener(); |
|
|
|
|
|
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
@ -58,58 +61,37 @@ public class VanChartFieldListPane extends JPanel {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createDefaultFieldPane() { |
|
|
|
|
JPanel defaultField = new JPanel(); |
|
|
|
|
JPanel fieldPane = new JPanel(); |
|
|
|
|
|
|
|
|
|
defaultField.setLayout(new GridLayout(0, 1, 1, 0)); |
|
|
|
|
createDefaultButtonGroup(defaultField); |
|
|
|
|
fieldPane.setLayout(new GridLayout(0, 1, 1, 0)); |
|
|
|
|
|
|
|
|
|
List<VanChartFieldButton> defaultFieldButtonList = getDefaultFieldButtonList(); |
|
|
|
|
addDefaultFieldButton(fieldPane); |
|
|
|
|
|
|
|
|
|
defaultField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldButtonList.size() * FIELD_ADD_H)); |
|
|
|
|
defaultField.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); |
|
|
|
|
fieldPane.setPreferredSize(new Dimension(FIELD_ADD_W, getDefaultFieldButtonList().size() * FIELD_ADD_H)); |
|
|
|
|
fieldPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); |
|
|
|
|
|
|
|
|
|
return defaultField; |
|
|
|
|
return fieldPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void createDefaultButtonGroup(JPanel field) { |
|
|
|
|
categoryNameButton = createCategoryFieldButton(); |
|
|
|
|
seriesNameButton = createSeriesFieldButton(); |
|
|
|
|
valueButton = createValueFieldButton(); |
|
|
|
|
percentButton = createPercentFieldButton(); |
|
|
|
|
protected void initDefaultFieldButton() { |
|
|
|
|
categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), |
|
|
|
|
new AttrTooltipCategoryFormat(), false, fieldListener); |
|
|
|
|
|
|
|
|
|
field.add(categoryNameButton); |
|
|
|
|
field.add(seriesNameButton); |
|
|
|
|
field.add(valueButton); |
|
|
|
|
field.add(percentButton); |
|
|
|
|
} |
|
|
|
|
seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), |
|
|
|
|
new AttrTooltipSeriesFormat(), false, fieldListener); |
|
|
|
|
|
|
|
|
|
// 不同图表的name和id不一样
|
|
|
|
|
protected VanChartFieldButton createCategoryFieldButton() { |
|
|
|
|
String name = Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"); |
|
|
|
|
String id = new AttrTooltipCategoryFormat().getFormatJSONKey(); |
|
|
|
|
valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), |
|
|
|
|
new AttrTooltipValueFormat(), false, fieldListener); |
|
|
|
|
|
|
|
|
|
return new VanChartFieldButton(name, id, false, fieldListener); |
|
|
|
|
percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"), |
|
|
|
|
new AttrTooltipPercentFormat(), false, fieldListener); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected VanChartFieldButton createSeriesFieldButton() { |
|
|
|
|
String name = Toolkit.i18nText("Fine-Design_Chart_Series_Name"); |
|
|
|
|
String id = new AttrTooltipSeriesFormat().getFormatJSONKey(); |
|
|
|
|
|
|
|
|
|
return new VanChartFieldButton(name, id, false, fieldListener); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected VanChartFieldButton createValueFieldButton() { |
|
|
|
|
String name = Toolkit.i18nText("Fine-Design_Chart_Use_Value"); |
|
|
|
|
String id = new AttrTooltipValueFormat().getFormatJSONKey(); |
|
|
|
|
|
|
|
|
|
return new VanChartFieldButton(name, id, false, fieldListener); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected VanChartFieldButton createPercentFieldButton() { |
|
|
|
|
String name = Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); |
|
|
|
|
String id = new AttrTooltipPercentFormat().getFormatJSONKey(); |
|
|
|
|
|
|
|
|
|
return new VanChartFieldButton(name, id, false, fieldListener); |
|
|
|
|
protected void addDefaultFieldButton(JPanel fieldPane) { |
|
|
|
|
fieldPane.add(categoryNameButton); |
|
|
|
|
fieldPane.add(seriesNameButton); |
|
|
|
|
fieldPane.add(valueButton); |
|
|
|
|
fieldPane.add(percentButton); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createTableFieldPane() { |
|
|
|
@ -122,7 +104,7 @@ public class VanChartFieldListPane extends JPanel {
|
|
|
|
|
tableField.setLayout(new GridLayout(0, 1, 1, 0)); |
|
|
|
|
|
|
|
|
|
for (String name : tableFieldNameList) { |
|
|
|
|
VanChartFieldButton fieldButton = new VanChartFieldButton(name, name, true, fieldListener); |
|
|
|
|
VanChartFieldButton fieldButton = new VanChartFieldButton(name, getTableTooltipFormat(name), true, fieldListener); |
|
|
|
|
|
|
|
|
|
tableField.add(fieldButton); |
|
|
|
|
tableFieldButtonList.add(fieldButton); |
|
|
|
@ -133,6 +115,11 @@ public class VanChartFieldListPane extends JPanel {
|
|
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 生成新增字段对应的format
|
|
|
|
|
private AttrTooltipFormat getTableTooltipFormat(String fieldName) { |
|
|
|
|
return new AttrTooltipCategoryFormat(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected List<VanChartFieldButton> getDefaultFieldButtonList() { |
|
|
|
|
List<VanChartFieldButton> defaultFieldButtonList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
@ -252,10 +239,6 @@ public class VanChartFieldListPane extends JPanel {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String getFieldRichText(String fieldName, String fieldId) { |
|
|
|
|
return "<p><span>" + fieldName + "</span></p>"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void populate(AttrTooltipContent tooltipContent) { |
|
|
|
|
populateDefaultField(tooltipContent); |
|
|
|
|
populateTableField(tooltipContent); |
|
|
|
@ -265,10 +248,19 @@ public class VanChartFieldListPane extends JPanel {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void populateDefaultField(AttrTooltipContent tooltipContent) { |
|
|
|
|
categoryNameButton.setFormat(tooltipContent.getRichTextCategoryFormat().getFormat()); |
|
|
|
|
seriesNameButton.setFormat(tooltipContent.getRichTextSeriesFormat().getFormat()); |
|
|
|
|
valueButton.setFormat(tooltipContent.getRichTextValueFormat().getFormat()); |
|
|
|
|
percentButton.setFormat(tooltipContent.getRichTextPercentFormat().getFormat()); |
|
|
|
|
populateButtonFormat(categoryNameButton, tooltipContent.getRichTextCategoryFormat()); |
|
|
|
|
populateButtonFormat(seriesNameButton, tooltipContent.getRichTextSeriesFormat()); |
|
|
|
|
populateButtonFormat(valueButton, tooltipContent.getRichTextValueFormat()); |
|
|
|
|
populateButtonFormat(percentButton, tooltipContent.getRichTextPercentFormat()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void populateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) { |
|
|
|
|
if (button == null || format == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
button.setEnable(format.isEnable()); |
|
|
|
|
button.setFormat(format.getFormat()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void populateTableField(AttrTooltipContent tooltipContent) { |
|
|
|
@ -281,13 +273,22 @@ public class VanChartFieldListPane extends JPanel {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void updateDefaultField(AttrTooltipContent tooltipContent) { |
|
|
|
|
tooltipContent.getRichTextCategoryFormat().setFormat(categoryNameButton.getFormat()); |
|
|
|
|
tooltipContent.getRichTextSeriesFormat().setFormat(seriesNameButton.getFormat()); |
|
|
|
|
tooltipContent.getRichTextValueFormat().setFormat(valueButton.getFormat()); |
|
|
|
|
tooltipContent.getRichTextPercentFormat().setFormat(percentButton.getFormat()); |
|
|
|
|
updateButtonFormat(categoryNameButton, tooltipContent.getRichTextCategoryFormat()); |
|
|
|
|
updateButtonFormat(seriesNameButton, tooltipContent.getRichTextSeriesFormat()); |
|
|
|
|
updateButtonFormat(valueButton, tooltipContent.getRichTextValueFormat()); |
|
|
|
|
updateButtonFormat(percentButton, tooltipContent.getRichTextPercentFormat()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void updateTableField(AttrTooltipContent tooltipContent) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void updateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) { |
|
|
|
|
if (button == null || format == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
format.setEnable(button.isEnable()); |
|
|
|
|
format.setFormat(button.getFormat()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|