From 326116794217ca910e3be505b0da7649f1bfcd7a Mon Sep 17 00:00:00 2001 From: zheng Date: Sat, 29 Sep 2018 11:49:16 +0800 Subject: [PATCH] =?UTF-8?q?CHART-2964=20=E5=85=AC=E5=BC=8F=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/fr/plugin/demo/DemoChart.java | 19 +++++++++---------- src/com/fr/plugin/demo/DemoTitlePane.java | 5 ++--- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/com/fr/plugin/demo/DemoChart.java b/src/com/fr/plugin/demo/DemoChart.java index 2f13fcb..92c28b8 100644 --- a/src/com/fr/plugin/demo/DemoChart.java +++ b/src/com/fr/plugin/demo/DemoChart.java @@ -1,9 +1,8 @@ package com.fr.plugin.demo; -import com.fr.base.BaseFormula; import com.fr.extended.chart.AbstractChart; -import com.fr.extended.chart.ExtendedHelper; import com.fr.extended.chart.HyperLinkPara; +import com.fr.extended.chart.StringFormula; import com.fr.extended.chart.export.ExportProcessor; import com.fr.extended.chart.export.JSExportProcessor; import com.fr.general.GeneralUtils; @@ -31,7 +30,7 @@ public class DemoChart extends AbstractChart{ private static final String ID = "DEMO_CHART"; private static final String NAME = "DEMO图表"; - private BaseFormula titleFormula; + private StringFormula titleFormula = new StringFormula(); private ThemeType themeType = ThemeType.DARK; @@ -53,11 +52,11 @@ public class DemoChart extends AbstractChart{ this.themeType = themeType; } - public BaseFormula getTitleFormula() { + public StringFormula getTitleFormula() { return titleFormula; } - public void setTitleFormula(BaseFormula titleFormula) { + public void setTitleFormula(StringFormula titleFormula) { this.titleFormula = titleFormula; } @@ -66,7 +65,7 @@ public class DemoChart extends AbstractChart{ super.readAttr(reader); this.setThemeType(ThemeType.parseInt(reader.getAttrAsInt("theme", 0))); this.setThreeDimensional(reader.getAttrAsBoolean("threeD", false)); - this.setTitleFormula(ExtendedHelper.readFormula(reader, "title")); + this.getTitleFormula().readAttr("title", reader); } @Override @@ -74,7 +73,7 @@ public class DemoChart extends AbstractChart{ super.writeAttr(writer); writer.attr("theme", getThemeType().ordinal()); writer.attr("threeD", isThreeDimensional()); - ExtendedHelper.writeFormula(this.getTitleFormula(), writer, "title"); + this.getTitleFormula().writeAttr("title", writer); } @Override @@ -123,7 +122,7 @@ public class DemoChart extends AbstractChart{ protected void addJSON(DemoDataConfig dataConfig, JSONObject jsonObject, Repository repo) throws JSONException { jsonObject.put("theme", getThemeType() == ThemeType.DARK ? "dark" : "sth whatever"); - jsonObject.put("title", JSONFactory.createJSON(JSON.OBJECT).put("text", ExtendedHelper.getFormulaResult(titleFormula))); + jsonObject.put("title", JSONFactory.createJSON(JSON.OBJECT).put("text", getTitleFormula().getResult())); JSONArray array = JSONFactory.createJSON(JSON.ARRAY); @@ -229,8 +228,8 @@ public class DemoChart extends AbstractChart{ } @Override - protected List formulas() { - List list = new ArrayList(); + protected List formulas() { + List list = new ArrayList(); list.add(this.getTitleFormula()); return list; } diff --git a/src/com/fr/plugin/demo/DemoTitlePane.java b/src/com/fr/plugin/demo/DemoTitlePane.java index 3798255..2c54280 100644 --- a/src/com/fr/plugin/demo/DemoTitlePane.java +++ b/src/com/fr/plugin/demo/DemoTitlePane.java @@ -1,7 +1,6 @@ package com.fr.plugin.demo; import com.fr.design.formula.TinyFormulaPane; -import com.fr.extended.chart.ExtendedHelper; import com.fr.extended.chart.ExtendedScrollPane; import javax.swing.JPanel; @@ -14,12 +13,12 @@ public class DemoTitlePane extends ExtendedScrollPane{ private TinyFormulaPane title; @Override public void populateBean(DemoChart ob) { - title.populateBean(ExtendedHelper.formulaToString(ob.getTitleFormula())); + title.populateBean(ob.getTitleFormula().getContent()); } @Override public void updateBean(DemoChart ob) { - ob.setTitleFormula(ExtendedHelper.stringToFormula(title.updateBean())); + ob.getTitleFormula().setContent(title.updateBean()); } @Override