unknown
4 years ago
commit
bd4105be88
19 changed files with 94311 additions and 0 deletions
@ -0,0 +1,129 @@
|
||||
|
||||
apply plugin: 'java' |
||||
|
||||
|
||||
ext { |
||||
/** |
||||
* 项目中依赖的jar的路径 |
||||
* 1.如果依赖的jar需要打包到zip中,放置在lib根目录下 |
||||
* 2.如果依赖的jar仅仅是编译时需要,防止在lib下子目录下即可 |
||||
*/ |
||||
libPath = "$projectDir/../webroot/WEB-INF/lib" |
||||
|
||||
/** |
||||
* 是否对插件的class进行加密保护,防止反编译 |
||||
*/ |
||||
guard = false |
||||
|
||||
def pluginInfo = getPluginInfo() |
||||
pluginPre = "fine-plugin" |
||||
pluginName = pluginInfo.id |
||||
pluginVersion = pluginInfo.version |
||||
|
||||
outputPath = "$projectDir/../webroot/WEB-INF/plugins/plugin-" + pluginName + "-1.0/classes" |
||||
} |
||||
|
||||
group = 'com.fr.plugin' |
||||
version = '10.0' |
||||
sourceCompatibility = '8' |
||||
|
||||
sourceSets { |
||||
main { |
||||
java.outputDir = file(outputPath) |
||||
output.resourcesDir = file(outputPath) |
||||
} |
||||
} |
||||
|
||||
ant.importBuild("encrypt.xml") |
||||
//定义ant变量 |
||||
ant.projectDir = projectDir |
||||
ant.references["compile.classpath"] = ant.path { |
||||
fileset(dir: libPath, includes: '**/*.jar') |
||||
fileset(dir: ".",includes:"**/*.jar" ) |
||||
} |
||||
|
||||
classes.dependsOn('clean') |
||||
|
||||
task copyFiles(type: Copy,dependsOn: 'classes'){ |
||||
from outputPath |
||||
into "$projectDir/classes" |
||||
} |
||||
|
||||
task preJar(type:Copy,dependsOn: guard ? 'compile_encrypt_javas' : 'compile_plain_javas'){ |
||||
from "$projectDir/classes" |
||||
into "$projectDir/transform-classes" |
||||
include "**/*.*" |
||||
} |
||||
jar.dependsOn("preJar") |
||||
|
||||
classes.dependsOn("copyPluginXML") |
||||
|
||||
task copyPluginXML(type: Copy) { |
||||
print "copyed plugin.xml file" |
||||
from "$projectDir/plugin.xml" |
||||
into file("$projectDir/../webroot/WEB-INF/plugins/plugin-" + pluginName + "-1.0/") |
||||
} |
||||
task makeJar(type: Jar,dependsOn: preJar){ |
||||
from fileTree(dir: "$projectDir/transform-classes") |
||||
baseName pluginPre |
||||
appendix pluginName |
||||
version pluginVersion |
||||
destinationDir = file("$buildDir/libs") |
||||
|
||||
doLast(){ |
||||
delete file("$projectDir/classes") |
||||
delete file("$projectDir/transform-classes") |
||||
} |
||||
} |
||||
|
||||
task copyFile(type: Copy,dependsOn: ["makeJar"]){ |
||||
from "$buildDir/libs" |
||||
from("$projectDir/lib") { |
||||
include "*.jar" |
||||
} |
||||
from "$projectDir/plugin.xml" |
||||
into file("$buildDir/temp/plugin") |
||||
} |
||||
|
||||
task zip(type:Zip,dependsOn:["copyFile"]){ |
||||
from "$buildDir/temp/plugin" |
||||
destinationDir file("$buildDir/install") |
||||
baseName pluginPre |
||||
appendix pluginName |
||||
version pluginVersion |
||||
} |
||||
|
||||
//控制build时包含哪些文件,排除哪些文件 |
||||
processResources { |
||||
// exclude everything |
||||
// 用*.css没效果 |
||||
// exclude '**/*.css' |
||||
// except this file |
||||
// include 'xx.xml' |
||||
} |
||||
|
||||
/*读取plugin.xml中的version*/ |
||||
def getPluginInfo(){ |
||||
def xmlFile = file("plugin.xml") |
||||
if (!xmlFile.exists()) { |
||||
return ["id":"none", "version":"1.0.0"] |
||||
} |
||||
def plugin = new XmlParser().parse(xmlFile) |
||||
def version = plugin.version[0].text() |
||||
def id = plugin.id[0].text() |
||||
return ["id":id,"version":version] |
||||
} |
||||
|
||||
repositories { |
||||
mavenLocal() |
||||
maven { |
||||
url = uri('http://mvn.finedevelop.com/repository/maven-public/') |
||||
} |
||||
} |
||||
|
||||
dependencies { |
||||
//使用本地jar |
||||
implementation fileTree(dir: 'lib', include: ['**/*.jar']) |
||||
implementation fileTree(dir: libPath, include: ['**/*.jar']) |
||||
} |
||||
|
Binary file not shown.
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
<project> |
||||
<target name="compile_encrypt_javas" depends="copyFiles"> |
||||
<echo message="加密文件"/> |
||||
<echo message="${projectDir}"/> |
||||
<taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask"> |
||||
<classpath refid="compile.classpath"/> |
||||
</taskdef> |
||||
<pretreatment baseDir="${projectDir}"/> |
||||
</target> |
||||
<target name="compile_plain_javas" depends="copyFiles"> |
||||
</target> |
||||
</project> |
Binary file not shown.
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
<plugin> |
||||
<id>com.fr.plugin.water.plugin</id> |
||||
<name><![CDATA[水球图图表]]></name> |
||||
<active>yes</active> |
||||
<version>1.0</version> |
||||
<env-version>10.0</env-version> |
||||
<jartime>2018-07-31</jartime> |
||||
<vendor>author</vendor> |
||||
<description><![CDATA[水球图图表]]></description> |
||||
<change-notes><![CDATA[ |
||||
]]></change-notes> |
||||
|
||||
<!--注册图表-后台模型--> |
||||
<extra-chart> |
||||
<IndependentChartProvider class="com.fr.plugin.WaterChartProvider" plotID="echart.water.chart"/> |
||||
</extra-chart> |
||||
|
||||
<!--图表开发-设计器部分--> |
||||
<extra-chart-designer> |
||||
<IndependentChartUIProvider class="com.fr.plugin.WaterChartUI" plotID="echart.water.chart"/> |
||||
</extra-chart-designer> |
||||
|
||||
<function-recorder class="com.fr.plugin.WaterChartProvider"/> |
||||
</plugin> |
@ -0,0 +1,60 @@
|
||||
package com.fr.plugin; |
||||
|
||||
import com.fr.extended.chart.AbstractDataConfig; |
||||
import com.fr.extended.chart.ExtendedField; |
||||
import com.fr.stable.AssistUtils; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
|
||||
/** |
||||
* 后台图表对象用于:数据保存和界面交换数据的model |
||||
*/ |
||||
public class WaterChartConfig extends AbstractDataConfig { |
||||
|
||||
/** |
||||
* 数据字段,有一个字段保存一个 |
||||
*/ |
||||
private ExtendedField value = new ExtendedField(); |
||||
|
||||
public ExtendedField getValue() { |
||||
return value; |
||||
} |
||||
|
||||
public void setValue(ExtendedField value) { |
||||
this.value = value; |
||||
} |
||||
|
||||
@Override |
||||
protected void readAttr(XMLableReader xmLableReader) { |
||||
readExtendedField(value,"value",xmLableReader); |
||||
} |
||||
|
||||
@Override |
||||
protected void writeAttr(XMLPrintWriter xmlPrintWriter) { |
||||
writeExtendedField(value,"value",xmlPrintWriter); |
||||
} |
||||
|
||||
@Override |
||||
public ExtendedField[] dataSetFields() { |
||||
return new ExtendedField[]{ |
||||
value |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
public WaterChartConfig clone() throws CloneNotSupportedException { |
||||
WaterChartConfig result = new WaterChartConfig(); |
||||
result.setValue(this.getValue().clone()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
return super.hashCode() + AssistUtils.hashCode(this.getValue()); |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
return obj instanceof WaterChartConfig && AssistUtils.equals(this.getValue(), ((WaterChartConfig) obj).getValue()); |
||||
} |
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.fr.plugin; |
||||
|
||||
import com.fr.extended.chart.AbstractChart; |
||||
import com.fr.extended.chart.AbstractExtentChartProvider; |
||||
import com.fr.plugin.transform.ExecuteFunctionRecord; |
||||
import com.fr.plugin.transform.FunctionRecorder; |
||||
|
||||
@FunctionRecorder |
||||
public class WaterChartProvider extends AbstractExtentChartProvider { |
||||
@Override |
||||
@ExecuteFunctionRecord |
||||
protected AbstractChart createChart() { |
||||
return new WaterChat(); |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
package com.fr.plugin; |
||||
|
||||
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; |
||||
import com.fr.extended.chart.AbstractExtendedChartTableDataPane; |
||||
import com.fr.extended.chart.AbstractExtendedChartUIProvider; |
||||
import com.fr.plugin.pane.WaterChartTableDataPane; |
||||
import com.fr.plugin.pane.WaterChatReportDataContentPane; |
||||
|
||||
/** |
||||
* 写这写按照plugin顺序写,按照文档写,按照idea提示写,不要自己硬 |
||||
*/ |
||||
public class WaterChartUI extends AbstractExtendedChartUIProvider { |
||||
|
||||
/** |
||||
* 数据来选为数据集数据时使用的界面 |
||||
*/ |
||||
@Override |
||||
protected AbstractExtendedChartTableDataPane getTableDataSourcePane() { |
||||
return new WaterChartTableDataPane(); |
||||
} |
||||
/** |
||||
* 数据来选为单元格时下方的数据 |
||||
*/ |
||||
@Override |
||||
protected AbstractReportDataContentPane getReportDataSourcePane() { |
||||
return new WaterChatReportDataContentPane(); |
||||
} |
||||
|
||||
/** |
||||
* 预览图 |
||||
*/ |
||||
@Override |
||||
public String[] getDemoImagePath() { |
||||
return new String[]{ |
||||
"com/fr/plugin/web/icon/preview.PNG" |
||||
}; |
||||
} |
||||
|
||||
/* |
||||
32*32 |
||||
*/ |
||||
@Override |
||||
public String getIconPath() { |
||||
return "com/fr/plugin/web/icon/icon.png"; |
||||
} |
||||
} |
@ -0,0 +1,67 @@
|
||||
package com.fr.plugin; |
||||
|
||||
import com.fr.extended.chart.AbstractChart; |
||||
import com.fr.extended.chart.HyperLinkPara; |
||||
import com.fr.extended.chart.StringFormula; |
||||
import com.fr.json.JSONException; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.transform.ExecuteFunctionRecord; |
||||
import com.fr.stable.web.Repository; |
||||
|
||||
import java.util.List; |
||||
|
||||
public class WaterChat extends AbstractChart<WaterChartConfig> { |
||||
@Override |
||||
@ExecuteFunctionRecord |
||||
/** |
||||
* plotID 对应 |
||||
*/ |
||||
protected String getChartID() { |
||||
return "echart.water.chart"; |
||||
} |
||||
|
||||
@Override |
||||
public String getChartName() { |
||||
return "水球图"; |
||||
} |
||||
/** |
||||
* 数据源获取并解析成对应类型 |
||||
*/ |
||||
@Override |
||||
protected void addJSON(WaterChartConfig waterChartConfig, JSONObject jsonObject, Repository repository, JSONPara jsonPara) throws JSONException { |
||||
List<Object> values = waterChartConfig.getValue().getValues(); |
||||
jsonObject.put("value", values); |
||||
} |
||||
|
||||
@Override |
||||
protected String[] requiredJS() { |
||||
return new String[]{ |
||||
"com/fr/plugin/web/js/echarts.js", |
||||
"com/fr/plugin/web/js/echarts-liquidfill.js", |
||||
"com/fr/plugin/web/js/water.js" |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String wrapperName() { |
||||
return "demoWrapper"; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected String demoImagePath() { |
||||
return "com/fr/plugin/web/icon/preview.PNG"; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected HyperLinkPara[] hyperLinkParas() { |
||||
return new HyperLinkPara[0]; |
||||
} |
||||
|
||||
@Override |
||||
protected List<StringFormula> formulas() { |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,52 @@
|
||||
package com.fr.plugin.pane; |
||||
|
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.extended.chart.AbstractExtendedChartTableDataPane; |
||||
import com.fr.plugin.WaterChartConfig; |
||||
|
||||
/** |
||||
* 使用这个界面时,fr会自动生成一个数据集选择器(意味着只能单一数据源), |
||||
* 然后根据我们有多少个字段,编写多少个(1)和(2),然后渲染出来就自动生成 |
||||
*/ |
||||
public class WaterChartTableDataPane extends AbstractExtendedChartTableDataPane<WaterChartConfig> { |
||||
private UIComboBox xComboBox; |
||||
private UIComboBox xComboBox1; |
||||
/** |
||||
* (1) 说明标签 |
||||
* @return |
||||
*/ |
||||
@Override |
||||
protected String[] fieldLabels() { |
||||
return new String[]{ |
||||
"百分比数据集选择", |
||||
"第二个字段" |
||||
}; |
||||
} |
||||
/** |
||||
* (2) |
||||
* 字段选择器 |
||||
*/ |
||||
@Override |
||||
protected UIComboBox[] filedComboBoxes() { |
||||
if (xComboBox == null) { |
||||
xComboBox=new UIComboBox(); |
||||
xComboBox1=new UIComboBox(); |
||||
} |
||||
return new UIComboBox[]{ |
||||
xComboBox, |
||||
xComboBox1 |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected void populate(WaterChartConfig waterChartConfig) { |
||||
populateField(xComboBox, waterChartConfig.getValue()); |
||||
} |
||||
|
||||
@Override |
||||
protected WaterChartConfig update() { |
||||
WaterChartConfig waterChartConfig = new WaterChartConfig(); |
||||
updateField(xComboBox, waterChartConfig.getValue()); |
||||
return waterChartConfig; |
||||
} |
||||
} |
@ -0,0 +1,54 @@
|
||||
package com.fr.plugin.pane; |
||||
|
||||
import com.fr.design.formula.TinyFormulaPane; |
||||
import com.fr.extended.chart.AbstractExtendedChartReportDataPane; |
||||
import com.fr.plugin.WaterChartConfig; |
||||
|
||||
/** |
||||
* 选中单元格数据集时使用本类来执行 |
||||
*/ |
||||
public class WaterChatReportDataContentPane extends AbstractExtendedChartReportDataPane<WaterChartConfig> { |
||||
|
||||
private TinyFormulaPane xPane; |
||||
|
||||
/** |
||||
* 返回标签数量 |
||||
*/ |
||||
@Override |
||||
protected String[] fieldLabel() { |
||||
return new String[]{ |
||||
"百分比:(小数)" |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 返回公式选择器 |
||||
*/ |
||||
@Override |
||||
protected TinyFormulaPane[] formulaPanes() { |
||||
if (xPane == null) { |
||||
xPane = new TinyFormulaPane(); |
||||
} |
||||
return new TinyFormulaPane[]{ |
||||
xPane |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 更新界面 |
||||
*/ |
||||
@Override |
||||
protected void populate(WaterChartConfig waterChartConfig) { |
||||
populateField(xPane, waterChartConfig.getValue()); |
||||
} |
||||
|
||||
@Override |
||||
/** |
||||
* 更新图表模型 |
||||
*/ |
||||
protected WaterChartConfig update() { |
||||
WaterChartConfig waterChartConfig = new WaterChartConfig(); |
||||
updateField(xPane, waterChartConfig.getValue()); |
||||
return waterChartConfig; |
||||
} |
||||
} |
After Width: | Height: | Size: 368 B |
After Width: | Height: | Size: 83 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,15 @@
|
||||
// 前端图表对象
|
||||
demoWrapper = ExtendedChart.extend({ |
||||
_init:function (dom, option) { |
||||
debugger |
||||
var chart = echarts.init(dom); |
||||
var option1 = { |
||||
series: [{ |
||||
type: 'liquidFill', |
||||
data: option.value |
||||
}] |
||||
}; |
||||
chart.setOption(option1); |
||||
return chart; |
||||
} |
||||
}); |
Loading…
Reference in new issue