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