From b4beb7914f7eb1924c9b93121ebb83cc6569f474 Mon Sep 17 00:00:00 2001 From: zheng Date: Thu, 19 Apr 2018 20:17:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E7=95=8C=E9=9D=A2=E5=BC=80?= =?UTF-8?q?=E5=87=BA=E5=A4=9A=E7=A7=8D=E8=AF=A6=E7=BB=86=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/fr/plugin/demo/DemoChart.java | 15 ++++++++++ src/com/fr/plugin/demo/DemoTypePane.java | 34 +++++++++++++++++++++++ src/com/fr/plugin/demo/DemoUI.java | 7 +++++ src/com/fr/plugin/demo/ThemeType.java | 18 ++++++++++++ src/com/fr/plugin/demo/dark.png | Bin 0 -> 5156 bytes src/com/fr/plugin/demo/white.png | Bin 0 -> 4963 bytes 6 files changed, 74 insertions(+) create mode 100644 src/com/fr/plugin/demo/DemoTypePane.java create mode 100644 src/com/fr/plugin/demo/ThemeType.java create mode 100644 src/com/fr/plugin/demo/dark.png create mode 100644 src/com/fr/plugin/demo/white.png diff --git a/src/com/fr/plugin/demo/DemoChart.java b/src/com/fr/plugin/demo/DemoChart.java index 05c6818..de8d864 100644 --- a/src/com/fr/plugin/demo/DemoChart.java +++ b/src/com/fr/plugin/demo/DemoChart.java @@ -33,6 +33,16 @@ public class DemoChart extends AbstractChart{ private BaseFormula titleFormula; + private ThemeType themeType = ThemeType.DARK; + + public ThemeType getThemeType() { + return themeType; + } + + public void setThemeType(ThemeType themeType) { + this.themeType = themeType; + } + public BaseFormula getTitleFormula() { return titleFormula; } @@ -44,12 +54,14 @@ public class DemoChart extends AbstractChart{ @Override protected void readAttr(XMLableReader reader) { super.readAttr(reader); + this.setThemeType(ThemeType.parseInt(reader.getAttrAsInt("theme", 0))); this.setTitleFormula(ExtendedHelper.readFormula(reader, "title")); } @Override protected void writeAttr(XMLPrintWriter writer) { super.writeAttr(writer); + writer.attr("theme", getThemeType().ordinal()); ExtendedHelper.writeFormula(this.getTitleFormula(), writer, "title"); } @@ -59,6 +71,7 @@ public class DemoChart extends AbstractChart{ if (getTitleFormula() != null) { result.setTitleFormula(this.getTitleFormula().clone()); } + result.setThemeType(this.getThemeType()); return result; } @@ -67,6 +80,7 @@ public class DemoChart extends AbstractChart{ return super.equals(ob) && ob instanceof DemoChart && ComparatorUtils.equals(this.getTitleFormula(), ((DemoChart) ob).getTitleFormula()) + && ComparatorUtils.equals(this.getThemeType(), ((DemoChart) ob).getThemeType()) ; } @@ -88,6 +102,7 @@ public class DemoChart extends AbstractChart{ @ExecuteFunctionRecord @Override 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))); diff --git a/src/com/fr/plugin/demo/DemoTypePane.java b/src/com/fr/plugin/demo/DemoTypePane.java new file mode 100644 index 0000000..7467d8e --- /dev/null +++ b/src/com/fr/plugin/demo/DemoTypePane.java @@ -0,0 +1,34 @@ +package com.fr.plugin.demo; + +import com.fr.extended.chart.ExtendedTypePane; + +/** + * Created by shine on 2018/4/19. + */ +public class DemoTypePane extends ExtendedTypePane { + @Override + protected String[] getTypeIconPath() { + return new String[]{ + "com/fr/plugin/demo/dark.png", + "com/fr/plugin/demo/white.png" + }; + } + + @Override + protected String[] getTypeTipName() { + return new String[]{ + "深色主题", + "浅色主题" + }; + } + + @Override + protected int getTypeIndex(DemoChart chart) { + return chart.getThemeType().ordinal(); + } + + @Override + protected void setType(DemoChart chart, int index) { + chart.setThemeType(ThemeType.parseInt(index)); + } +} diff --git a/src/com/fr/plugin/demo/DemoUI.java b/src/com/fr/plugin/demo/DemoUI.java index 95a1571..60f6763 100644 --- a/src/com/fr/plugin/demo/DemoUI.java +++ b/src/com/fr/plugin/demo/DemoUI.java @@ -3,6 +3,7 @@ package com.fr.plugin.demo; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.extended.chart.AbstractExtendedChartTableDataPane; import com.fr.extended.chart.AbstractExtendedChartUIProvider; import com.fr.extended.chart.ExtendedOtherPane; @@ -11,6 +12,12 @@ import com.fr.extended.chart.ExtendedOtherPane; * Created by shine on 2018/3/24. */ public class DemoUI extends AbstractExtendedChartUIProvider { + + @Override + public AbstractChartTypePane getPlotTypePane() { + return new DemoTypePane(); + } + @Override protected AbstractExtendedChartTableDataPane getTableDataSourcePane() { return new DemoTableDataPane(); diff --git a/src/com/fr/plugin/demo/ThemeType.java b/src/com/fr/plugin/demo/ThemeType.java new file mode 100644 index 0000000..ae70e16 --- /dev/null +++ b/src/com/fr/plugin/demo/ThemeType.java @@ -0,0 +1,18 @@ +package com.fr.plugin.demo; + +/** + * Created by shine on 2018/4/19. + */ +public enum ThemeType { + DARK, + WHITE; + + public static ThemeType parseInt(int index) { + for (ThemeType type : ThemeType.values()) { + if (type.ordinal() == index) { + return type; + } + } + return DARK; + } +} diff --git a/src/com/fr/plugin/demo/dark.png b/src/com/fr/plugin/demo/dark.png new file mode 100644 index 0000000000000000000000000000000000000000..0e96bfbf11ac4dbf77b230829322651882d2137f GIT binary patch literal 5156 zcmcIo2Ut@{yPnh12qlyV2oib|q&JsdLy->3+Cm5xR;-9?7m&3e zqF7i26uU0yqN1o+02MTMPAKl(=RW`Az4!kIX6DT|?|k#U-B#h2c#V!+jq7o5rB{oUo)O*bgxQn9Pm>uv7%_Va_DjlLdN{ z%^B*^o#-eddnY!E;Yx7T*T5-En4X=UB}~uY*jicvCogUYPI`nzh7Dy<>6Z4&d#k~5 zylWx7r2CWC0_hV)53aZOjIfA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