Browse Source

可配置没有数据界面&&css&&类型界面添加组件

master
zheng 6 years ago
parent
commit
d3210051c5
  1. 9
      .gitignore
  2. 96
      plugin-demochart.iml
  3. 29
      src/com/fr/plugin/demo/DemoChart.java
  4. 27
      src/com/fr/plugin/demo/DemoTypePane.java
  5. 6
      src/com/fr/plugin/demo/DemoUI.java
  6. 4
      src/com/fr/plugin/demo/demo.css

9
.gitignore vendored

@ -0,0 +1,9 @@
*.iml
*.xml
!plugin.xml
!build.xml
.idea/
.DS_Store
*.jar
*.zip
plugin-demochart.iml

96
plugin-demochart.iml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/../env/webroot/WEB-INF/plugins/plugin-com.fr.plugin.demoChart-1.0.0/classes" />
<output url="file://$MODULE_DIR$/../env/webapps/webroot/WEB-INF/plugins/plugin-com.fr.plugin.demo.DemoChart-1.0.0/classes" />
<output-test url="file://$MODULE_DIR$/../env/webroot/WEB-INF/classes/test/plugin-demochart" />
<exclude-output />
<content url="file://$MODULE_DIR$">
@ -9,27 +9,93 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="lib-core" level="project" />
<orderEntry type="library" name="lib-design" level="project" />
<orderEntry type="library" name="lib-others" level="project" />
<orderEntry type="library" name="Maven: com.fr.activator:fine-activator-sdk:10.0" level="project" />
<orderEntry type="library" name="Maven: com.fr.activator:fine-activator:10.0-RELEASE-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.fr.core:fine-core-sdk:10.0" level="project" />
<orderEntry type="library" name="Maven: com.fr.core:fine-core:10.0-RELEASE-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.fr.datasource:base-datasource-sdk:10.0" level="project" />
<orderEntry type="library" name="Maven: com.fr.datasource:fine-datasource:10.0-RELEASE-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.fr.decision:decision-report-sdk:10.0" level="project" />
<orderEntry type="library" name="Maven: com.fr.decision:fine-decision-sdk:10.0" level="project" />
<orderEntry type="library" name="Maven: com.fr.decision:fine-decision:10.0-RELEASE-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.fr.schedule:fine-schedule-sdk:10.0" level="project" />
<orderEntry type="library" name="Maven: com.fr.schedule:fine-schedule:10.0-RELEASE-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.fr.schedule:schedule-report:10.0" level="project" />
<orderEntry type="library" name="Maven: com.fr.third.build:ant:1.0" level="project" />
<orderEntry type="library" name="Maven: com.fr.third.driver:ojdbc:14" level="project" />
<orderEntry type="library" name="Maven: com.fr.third.server:servlet-api:3.0" level="project" />
<orderEntry type="library" name="Maven: com.fr.third:fine-third:10.0-RELEASE-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.fr.webui:fine-webui:10.0-RELEASE-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp-ws:3.0.1" level="project" />
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:3.0.1" level="project" />
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.6.0" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-all:4.1.22" level="project" />
<orderEntry type="library" name="Maven: io.socket:engine.io-client:0.7.0" level="project" />
<orderEntry type="library" name="Maven: io.socket:socket.io-client:0.7.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:bootstrap:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:commons-daemon:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-annotations-api:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-api:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-catalina-ant:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-catalina-ha:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-catalina:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-coyote:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-dbcp:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-el-api:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-i18n-es:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-i18n-fr:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-i18n-ja:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jasper-el:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jasper:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jdbc:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jsp-api:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-juli:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-servlet-api:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-tribes:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-util:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-websocket-api:7.0.86" level="project" />
<orderEntry type="library" name="Maven: org.easymock:easymock:3.5.1" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jdt.core.compiler:ecj:4.4.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: org.json:json:20090211" level="project" />
<orderEntry type="library" name="Maven: org.objenesis:objenesis:2.6" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.7" level="project" />
<orderEntry type="library" name="Maven: org.swingexplorer:swag:1.0" level="project" />
<orderEntry type="library" name="Maven: org.swingexplorer:swexpl:1.0" level="project" />
<orderEntry type="module" module-name="base-platform" />
<orderEntry type="module" module-name="chart-base" />
<orderEntry type="module" module-name="chart-chartattr" />
<orderEntry type="module" module-name="chart-chartdata" />
<orderEntry type="module" module-name="chart-chartglyph" />
<orderEntry type="module" module-name="chart-web" />
<orderEntry type="module" module-name="designer" />
<orderEntry type="module" module-name="designer_base" />
<orderEntry type="module" module-name="designer_chart" />
<orderEntry type="module" module-name="designer_form" />
<orderEntry type="module" module-name="design" />
<orderEntry type="module" module-name="design-i18n" />
<orderEntry type="module" module-name="design-i18n-chart" />
<orderEntry type="module" module-name="design-i18n-report" />
<orderEntry type="module" module-name="designer-base" />
<orderEntry type="module" module-name="designer-chart" />
<orderEntry type="module" module-name="designer-form" />
<orderEntry type="module" module-name="designer-realize" />
<orderEntry type="module" module-name="engine" />
<orderEntry type="module" module-name="engine-chart" />
<orderEntry type="module" module-name="engine-chart-base" />
<orderEntry type="module" module-name="engine-chart-chartattr" />
<orderEntry type="module" module-name="engine-chart-chartdata" />
<orderEntry type="module" module-name="engine-chart-chartglyph" />
<orderEntry type="module" module-name="engine-chart-sdk" />
<orderEntry type="module" module-name="engine-chart-web" />
<orderEntry type="module" module-name="engine-cross" />
<orderEntry type="module" module-name="engine-enhancement" />
<orderEntry type="module" module-name="engine-file" />
<orderEntry type="module" module-name="engine-i18n" />
<orderEntry type="module" module-name="engine-page" />
<orderEntry type="module" module-name="engine-remote" />
<orderEntry type="module" module-name="engine-platform" />
<orderEntry type="module" module-name="engine-platform-sdk" />
<orderEntry type="module" module-name="engine-report" />
<orderEntry type="module" module-name="engine-report-sdk" />
<orderEntry type="module" module-name="engine-view" />
<orderEntry type="module" module-name="engine-workspace-server" />
<orderEntry type="module" module-name="engine-write" />
<orderEntry type="module" module-name="fine-report-designer" />
<orderEntry type="module" module-name="fine-report-engine" />
<orderEntry type="module" module-name="fine-report-engine-sdk" />
<orderEntry type="module" module-name="finereport-maven" />
<orderEntry type="module" module-name="fmobile" />
<orderEntry type="module" module-name="form" />
<orderEntry type="module" module-name="fsbakrestore" />
@ -37,5 +103,7 @@
<orderEntry type="module" module-name="fservice" />
<orderEntry type="module" module-name="fsmonitor" />
<orderEntry type="module" module-name="fsworkflow" />
<orderEntry type="module" module-name="i18n-engine" />
<orderEntry type="module" module-name="plugin-chart-bigscreen" />
</component>
</module>

29
src/com/fr/plugin/demo/DemoChart.java

@ -6,7 +6,6 @@ import com.fr.extended.chart.ExtendedHelper;
import com.fr.extended.chart.HyperLinkPara;
import com.fr.extended.chart.export.ExportProcessor;
import com.fr.extended.chart.export.JSExportProcessor;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.json.JSON;
import com.fr.json.JSONArray;
@ -36,6 +35,16 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
private ThemeType themeType = ThemeType.DARK;
private boolean threeDimensional = false;
public boolean isThreeDimensional() {
return threeDimensional;
}
public void setThreeDimensional(boolean threeDimensional) {
this.threeDimensional = threeDimensional;
}
public ThemeType getThemeType() {
return themeType;
}
@ -56,6 +65,7 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
protected void readAttr(XMLableReader reader) {
super.readAttr(reader);
this.setThemeType(ThemeType.parseInt(reader.getAttrAsInt("theme", 0)));
this.setThreeDimensional(reader.getAttrAsBoolean("threeD", false));
this.setTitleFormula(ExtendedHelper.readFormula(reader, "title"));
}
@ -63,6 +73,7 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
protected void writeAttr(XMLPrintWriter writer) {
super.writeAttr(writer);
writer.attr("theme", getThemeType().ordinal());
writer.attr("threeD", isThreeDimensional());
ExtendedHelper.writeFormula(this.getTitleFormula(), writer, "title");
}
@ -73,12 +84,13 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
result.setTitleFormula(this.getTitleFormula().clone());
}
result.setThemeType(this.getThemeType());
result.setThreeDimensional(this.isThreeDimensional());
return result;
}
@Override
public int hashCode() {
return super.hashCode() + AssistUtils.hashCode(this.getTitleFormula(), this.getThemeType());
return super.hashCode() + AssistUtils.hashCode(this.getTitleFormula(), this.getThemeType(), this.isThreeDimensional());
}
@Override
@ -87,6 +99,7 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
&& ob instanceof DemoChart
&& AssistUtils.equals(this.getTitleFormula(), ((DemoChart) ob).getTitleFormula())
&& AssistUtils.equals(this.getThemeType(), ((DemoChart) ob).getThemeType())
&& AssistUtils.equals(this.isThreeDimensional(), ((DemoChart) ob).isThreeDimensional())
;
}
@ -114,16 +127,19 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
JSONArray array = JSONFactory.createJSON(JSON.ARRAY);
double maxValue = Double.MIN_VALUE;
if (dataConfig != null) {
List<Object> xValues = dataConfig.getX().getValues();
List<Object> yValues = dataConfig.getY().getValues();
List<Object> zValues = dataConfig.getZ().getValues();
double maxValue = Double.MIN_VALUE;
for (int i = 0, len = xValues.size(); i < len; i++) {
maxValue = Math.max(GeneralUtils.objectToNumber(zValues.get(i)).doubleValue(), maxValue);
array.put(JSONFactory.createJSON(JSON.ARRAY).put(xValues.get(i)).put(yValues.get(i)).put(zValues.get(i)));
}
}
jsonObject.put("series", JSONFactory.createJSON(JSON.OBJECT).put("type", "bar3D").put("data", array)
.put("bevelSize", 0.2).put("bevelSmoothness", 2).put("shading", "color"));
@ -148,6 +164,13 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
};
}
@Override
protected String[] requiredCSS() {
return new String[]{
"com/fr/plugin/demo/demo.css"
};
}
@Override
protected String wrapperName() {
return "demoWrapper";

27
src/com/fr/plugin/demo/DemoTypePane.java

@ -1,11 +1,17 @@
package com.fr.plugin.demo;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.extended.chart.ExtendedTypePane;
import javax.swing.JPanel;
import java.awt.Component;
/**
* Created by shine on 2018/4/19.
*/
public class DemoTypePane extends ExtendedTypePane<DemoChart> {
private UIButtonGroup buttonGroup;
@Override
protected String[] getTypeIconPath() {
return new String[]{
@ -31,4 +37,25 @@ public class DemoTypePane extends ExtendedTypePane<DemoChart> {
protected void setType(DemoChart chart, int index) {
chart.setThemeType(ThemeType.parseInt(index));
}
@Override
protected Component[][] getPaneComponents(JPanel typePane) {
buttonGroup = new UIButtonGroup(new String[]{"3d", "2d"});
return new Component[][]{
new Component[]{typePane},
new Component[]{buttonGroup}
};
}
@Override
protected void populate(DemoChart chart) {
super.populate(chart);
buttonGroup.setSelectedIndex(chart.isThreeDimensional() ? 0 : 1);
}
@Override
protected void update(DemoChart chart) {
super.update(chart);
chart.setThreeDimensional(buttonGroup.getSelectedIndex() == 0);
}
}

6
src/com/fr/plugin/demo/DemoUI.java

@ -2,6 +2,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.ChartDataPane;
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;
@ -28,6 +29,11 @@ public class DemoUI extends AbstractExtendedChartUIProvider {
return new DemoReportDataPane();
}
// @Override
// public ChartDataPane getChartDataPane(AttributeChangeListener listener) {
// return null;
// }
@Override
public String getIconPath() {
return "com/fr/plugin/demo/icon.png";

4
src/com/fr/plugin/demo/demo.css

@ -0,0 +1,4 @@
.demo-style {
width: 400px;
height: 300px;
}
Loading…
Cancel
Save