Browse Source

调整富文本参数更新的位置

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
dfdfdd573e
  1. 56
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  2. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java
  3. 20
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java
  4. 7
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java

56
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java

@ -16,7 +16,11 @@ 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.AttrTooltipRichText; import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.TableFieldCollection; import com.fr.plugin.chart.base.TableFieldCollection;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat; 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;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
@ -50,7 +54,9 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 数据点提示内容界面含有通用设置富文本编辑器自定义JS界面 * 数据点提示内容界面含有通用设置富文本编辑器自定义JS界面
@ -436,15 +442,14 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} }
private void fireRichEditor() { private void fireRichEditor() {
AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr(); AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr();
ModernUIPane<VanChartRichEditorModel> richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); ModernUIPane<VanChartRichEditorModel> richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText);
VanChartRichTextPane richTextPane = new VanChartRichTextPane(getTableFieldNames(), richEditorPane); VanChartRichTextPane richTextPane = this.createRichTextPane(getTableFieldNames(), richEditorPane);
BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane);
// 更新字段格式和汇总方式
richTextPane.populateBean(this.richTextTooltipContent); richTextPane.populateBean(this.richTextTooltipContent);
// 更新富文本编辑器内容
richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText));
richTextDialog.addDialogActionListener(new DialogActionAdapter() { richTextDialog.addDialogActionListener(new DialogActionAdapter() {
@ -486,6 +491,42 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return parent.getDataModelColumnNames(); return parent.getDataModelColumnNames();
} }
protected VanChartRichTextPane createRichTextPane(List<String> tableFieldNames, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
return new VanChartRichTextPane(tableFieldNames, richEditorPane);
}
protected void refreshRichTextFormat(AttrTooltipRichText richText) {
String[] fieldNames = new String[]{
Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Use_Value"),
Toolkit.i18nText("Fine-Design_Chart_Use_Percent")
};
AttrTooltipFormat[] fieldFormats = new AttrTooltipFormat[]{
new AttrTooltipCategoryFormat(),
new AttrTooltipSeriesFormat(),
new AttrTooltipValueFormat(),
new AttrTooltipPercentFormat()
};
Map<String, String> params = new HashMap<>();
for (int i = 0, len = fieldNames.length; i < len; i++) {
params.put(fieldNames[i], fieldFormats[i].getJs());
}
List<String> tableFieldNames = this.getTableFieldNames();
if (tableFieldNames != null) {
for (String fieldName : tableFieldNames) {
params.put(fieldName, fieldName);
}
}
richText.setParams(params);
}
private JPanel createHtmlPane() { private JPanel createHtmlPane() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -734,11 +775,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
attrTooltipContent.getRichTextChangedPercentFormat() attrTooltipContent.getRichTextChangedPercentFormat()
}; };
// 传递富文本格式
updateTooltipFormat(richTextTooltipContent, attrTooltipContent); updateTooltipFormat(richTextTooltipContent, attrTooltipContent);
// 更新富文本可用参数 // populateRichTextFormat(richTextTooltipContent.getRichTextAttr());
populateRichTextFormat(formatPaneGroup, formatGroup); refreshRichTextFormat(richTextTooltipContent.getRichTextAttr());
// 更新富文本初始参数
populateRichText(attrTooltipContent.getRichTextAttr()); populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent); checkRichEditorState(attrTooltipContent);

4
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java

@ -84,6 +84,10 @@ public class VanChartFieldButton extends JPanel {
return showDataFunction; return showDataFunction;
} }
public String getFormatJs() {
return this.tooltipFormat.getJs();
}
private void initComponents(String fieldName, VanChartFieldListener listener) { private void initComponents(String fieldName, VanChartFieldListener listener) {
fieldButton = new UIToggleButton(fieldName) { fieldButton = new UIToggleButton(fieldName) {

20
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java

@ -67,6 +67,26 @@ public class VanChartFieldListPane extends JPanel {
this.add(createTableFieldPane(), BorderLayout.SOUTH); this.add(createTableFieldPane(), BorderLayout.SOUTH);
} }
public void setCategoryNameButton(VanChartFieldButton categoryNameButton) {
this.categoryNameButton = categoryNameButton;
}
public void setSeriesNameButton(VanChartFieldButton seriesNameButton) {
this.seriesNameButton = seriesNameButton;
}
public void setValueButton(VanChartFieldButton valueButton) {
this.valueButton = valueButton;
}
public void setPercentButton(VanChartFieldButton percentButton) {
this.percentButton = percentButton;
}
public VanChartFieldListener getFieldListener() {
return fieldListener;
}
private JPanel createDefaultFieldPane() { private JPanel createDefaultFieldPane() {
JPanel fieldPane = new JPanel(); JPanel fieldPane = new JPanel();

7
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java

@ -28,7 +28,7 @@ public class VanChartRichTextPane extends BasicBeanPane<AttrTooltipContent> {
public VanChartRichTextPane(List<String> tableFieldNames, ModernUIPane<VanChartRichEditorModel> richEditor) { public VanChartRichTextPane(List<String> tableFieldNames, ModernUIPane<VanChartRichEditorModel> richEditor) {
fieldAttrPane = new VanChartFieldAttrPane(); fieldAttrPane = new VanChartFieldAttrPane();
fieldListPane = new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); fieldListPane = createFieldListPane(tableFieldNames, fieldAttrPane, richEditor);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(createFieldContentPane(), BorderLayout.CENTER); this.add(createFieldContentPane(), BorderLayout.CENTER);
@ -59,6 +59,11 @@ public class VanChartRichTextPane extends BasicBeanPane<AttrTooltipContent> {
return fieldPane; return fieldPane;
} }
protected VanChartFieldListPane createFieldListPane(List<String> tableFieldNames, VanChartFieldAttrPane fieldAttrPane,
ModernUIPane<VanChartRichEditorModel> richEditor) {
return new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor);
}
private JPanel createRichEditorPane(JPanel richEditor) { private JPanel createRichEditorPane(JPanel richEditor) {
JPanel richEditorPane = new JPanel(); JPanel richEditorPane = new JPanel();

Loading…
Cancel
Save