Browse Source

update

pull/1/head
Dailer 6 years ago
parent
commit
ec38313aa7
  1. 118
      build.xml
  2. 18
      plugin.xml
  3. 38
      src/com/fr/plugin/decision/theme/original/OriginalComponent.java
  4. 42
      src/com/fr/plugin/decision/theme/original/OriginalTheme.java
  5. 69
      src/com/fr/plugin/decision/theme/original/web/js/config.js
  6. 97
      src/com/fr/plugin/decision/theme/original/web/js/modules.js
  7. 141
      src/com/fr/plugin/decision/theme/original/web/js/modules.model.js
  8. 0
      src/com/fr/plugin/decision/theme/original/web/style.css
  9. 299
      src/com/fr/plugin/decision/theme/original/web/theme.js

118
build.xml

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="jar" name="plugin">
<!-- JDK路径,根据自己机器上实际位置修改-->
<property name="jdk.home" value="C:\Program Files\Java\jdk1.8.0_171"/>
<property name="libs" value="${basedir}/lib"/>
<property name="publicLibs" value=""/>
<property name="destLoc" value="."/>
<property name="classes" value="classes"/>
<xmlproperty file="${basedir}/plugin.xml"/>
<property name="current-version" value="${plugin.version}"/>
<!-- 插件版本-->
<property name="plugin-version" value="${current-version}"/>
<!-- 插件名字-->
<property name="plugin-name" value="theme-original"/>
<property name="plugin-jar" value="fr-plugin-${plugin-name}-${plugin-version}.jar"/>
<target name="prepare">
<delete dir="${classes}"/>
<delete dir="fr-plugin-${plugin-name}-${plugin-version}"/>
<xmlproperty file="${basedir}/plugin.xml"/>
<delete dir="${destLoc}/${plugin.name}"/>
</target>
<path id="compile.classpath">
<fileset dir="${libs}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${publicLibs}">
<include name="**/*.jar"/>
</fileset>
</path>
<patternset id="resources4Jar">
<exclude name="**/.settings/**"/>
<exclude name=".classpath"/>
<exclude name=".project"/>
<exclude name="**/*.java"/>
<exclude name="**/*.db"/>
<exclude name="**/*.g"/>
<exclude name="**/package.html"/>
</patternset>
<target name="copy_resources">
<echo message="从${resources_from}拷贝图片,JS,CSS等资源文件"/>
<delete dir="tmp"/>
<copy todir="tmp">
<fileset dir="${resources_from}\src">
<patternset refid="resources4Jar"/>
</fileset>
</copy>
<copy todir="${classes}">
<fileset dir="tmp"/>
</copy>
<delete dir="tmp"/>
</target>
<target name="compile_javas">
<echo message="编译${compile_files}下的Java文件"/>
<javac destdir="${classes}" debug="false" optimize="on" source="${source_jdk_version}"
target="${target_jdk_version}"
fork="true" memoryMaximumSize="512m" listfiles="false" srcdir="${basedir}"
executable="${compile_jdk_version}/bin/javac">
<src path="${basedir}/src"/>
<exclude name="**/.svn/**"/>
<compilerarg line="-encoding UTF8 "/>
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="jar_classes">
<echo message="打Jar包:${jar_name}"/>
<delete file="${basedir}/${jar_name}"/>
<jar jarfile="${basedir}/${jar_name}">
<fileset dir="${classes}">
</fileset>
</jar>
</target>
<target name="super_jar" depends="prepare">
<antcall target="copy_resources">
<param name="resources_from" value="${basedir}"/>
</antcall>
<antcall target="compile_javas">
<param name="source_jdk_version" value="1.6"/>
<param name="target_jdk_version" value="1.6"/>
<param name="compile_jdk_version" value="${jdk.home}"/>
<param name="compile_files" value="${basedir}/src"/>
</antcall>
<echo message="compile plugin success!"/>
<antcall target="jar_classes">
<param name="jar_name" value="${plugin-jar}"/>
</antcall>
<delete dir="${classes}"/>
</target>
<target name="jar" depends="super_jar">
<antcall target="zip"/>
</target>
<target name="zip">
<property name="plugin-folder" value="fr-plugin-${plugin-name}-${plugin-version}"/>
<echo message="----------zip files----------"/>
<mkdir dir="${plugin-folder}"/>
<copy todir="${plugin-folder}">
<fileset dir=".">
<include name="${plugin-jar}"/>
<include name="plugin.xml"/>
</fileset>
</copy>
<zip destfile="${basedir}/${plugin-folder}.zip" basedir=".">
<include name="${plugin-folder}/*.jar"/>
<include name="${plugin-folder}/plugin.xml"/>
</zip>
<xmlproperty file="${basedir}/plugin.xml"/>
<move file="${plugin-folder}.zip" todir="${destLoc}/${plugin.name}"/>
</target>
</project>

18
plugin.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin>
<id>com.fr.plugin.decision.theme.original</id>
<name><![CDATA[复古主题]]></name>
<active>no</active>
<version>1.0</version>
<env-version>10.0</env-version>
<jartime>2018-10-10</jartime>
<vendor>dailer</vendor>
<description><![CDATA[测试]]></description>
<change-notes><![CDATA[
]]></change-notes>
<extra-decision>
<ThemeVariousProvider class="com.fr.plugin.decision.theme.original.OriginalTheme"/>
</extra-decision>
<function-recorder class="com.fr.plugin.decision.theme.original.OriginalTheme"/>
</plugin>

38
src/com/fr/plugin/decision/theme/original/OriginalComponent.java

@ -0,0 +1,38 @@
package com.fr.plugin.decision.theme.original;
import com.fr.decision.config.AppearanceConfig;
import com.fr.web.struct.Component;
import com.fr.web.struct.category.ScriptPath;
import com.fr.web.struct.category.StylePath;
import com.fr.web.struct.Filter;
/**
* Created by Zed on 2018/10/12.
*/
public class OriginalComponent extends Component {
public static final OriginalComponent KEY = new OriginalComponent();
private OriginalComponent() {
}
@Override
public ScriptPath script() {
return ScriptPath.build("/com/fr/plugin/decision/theme/original/web/theme.js");
}
@Override
public StylePath style() {
return StylePath.build("/com/fr/plugin/decision/theme/original/web/style.css");
}
@Override
public Filter filter() {
return new Filter() {
public boolean accept() {
return "com.fr.plugin.decision.theme.original".equals(AppearanceConfig.getInstance().getThemeId());
}
};
}
}

42
src/com/fr/plugin/decision/theme/original/OriginalTheme.java

@ -0,0 +1,42 @@
package com.fr.plugin.decision.theme.original;
import com.fr.decision.fun.impl.AbstractThemeVariousProvider;
import com.fr.decision.web.MainComponent;
import com.fr.plugin.transform.ExecuteFunctionRecord;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.web.struct.Atom;
/**
* Created by dailer on 18/10/10.
*/
@FunctionRecorder(localeKey = "OriginalTheme")
public class OriginalTheme extends AbstractThemeVariousProvider {
@Override
public Atom attach() {
return MainComponent.KEY;
}
@Override
public Atom client() {
return OriginalComponent.KEY;
}
@Override
@ExecuteFunctionRecord
public String name() {
return "OriginalTheme";
}
@Override
public String text() {
return "复古";
}
@Override
public String coverPath() {
return "";
}
}

69
src/com/fr/plugin/decision/theme/original/web/js/config.js

@ -0,0 +1,69 @@
!(function () {
BI.module("my.theme", {
version: 1.0,
components: ["dec.menu"],
constants: ["dec.constant.config"],
services: ["dec.service.tabs"],
models: [""]
});
BI.config("dec.constant.config", function (config) {
config.theme.config4Frame.west.width = 240;
config.theme.config4EntryPane.pinable = false;
return config;
});
Dec.injection.injectLayoutStrategy({
layout: function (config, header, footer, menu, body) {
return {
type: "bi.absolute",
items: [
{
el: {
type: "bi.absolute",
items: [
{
el: body,
top: 0, bottom: 0, right: 0,
left: config.west.invisible ? 0 : config.west.width
}, {
el: menu,
top: 0, bottom: 0,
left: 0
}
]
},
top: 40, left: 0, right: 0, bottom: 0
}, {
el: header,
height: 40,
top: 0, left: 0, right: 0
}
]
};
}
});
Dec.injection.injectMenu({
widget: function (config) {
return {
type: "dec.workbench.panel",
width: 240
};
}
});
Dec.injection.injectBody({
widget: function () {
return {
type: "dec.workbench.tabs"
};
}
});
BI.config("dec.workbench.directory", function (ob) {
return BI.extend(ob, {type: "dec.theme.modules"});
});
}());

97
src/com/fr/plugin/decision/theme/original/web/js/modules.js

@ -0,0 +1,97 @@
!(function () {
var Nav = BI.inherit(BI.Widget, {
props: {
baseCls: "dec-management-nav dec-popover",
pinedPane: false
},
_store: function () {
return BI.Models.getModel("dec.model.modules");
},
watch: {
selectedManageNav: function (v) {
this.tree.setValue(v);
},
items: function () {
this.populate(this.model.items);
}
},
beforeInit: function (render) {
this.store.initData(render);
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical",
hgap: 10,
items: [
{
type: "bi.custom_tree",
cls: "dec-text",
ref: function (_ref) {
self.tree = _ref;
},
el: {
type: "bi.loader",
next: false,
el: {
type: "bi.button_tree",
chooseType: 0,
layouts: [{
type: "bi.vertical",
vgap: 5
}]
}
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self.store.openTab(this.getValue()[0]);
}
}],
itemsCreator: function (op, callback) {
if (!op.node) {
self.store.initRootNodes(function (items) {
callback(items);
});
} else {
self.store.getSubItemsByPId(op.node.id, op.node.layer + 1, function (items) {
callback(items);
});
}
},
items: this._formatItems(this.model.items, 0)
}
]
};
},
// 解析层级结构的树数据.即带有children字段的
_formatItems: function (nodes, layer) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {layer: layer};
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "dec.nav.node";
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
} else {
extend.type = "dec.nav.item";
BI.defaults(node, extend);
}
});
return nodes;
},
populate: function (nodes) {
nodes = this._formatItems(nodes, 0);
this.tree.populate(nodes);
}
});
Nav.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE";
BI.shortcut("dec.theme.modules", Nav);
}());

141
src/com/fr/plugin/decision/theme/original/web/js/modules.model.js

@ -0,0 +1,141 @@
(function () {
var Model = BI.inherit(Fix.Model, {
_init: function () {
this.platform = Dec.globleModel;
},
state: function () {
return {
modules: [],
reports: []
};
},
context: ["isPin"],
computed: {
selectedManageNav: function () {
return this.platform.selectedManageNav;
},
items: function () {
var self = this;
var constant = BI.Constants.getConstant("dec.constant.management.navigation");
var results = [];
results = BI.concat(results, this.model.reports);
results.push({
id: "decision-management-root",
value: "decision-management-root",
isParent: true,
open: true,
cls: "setting-font",
text: BI.i18nText("Dec-Authority_PlatformModule")
});
BI.each(constant, function (index, item) {
var match = BI.find(self.model.modules, function (index, i) {
return item.id === i.id;
});
if (match) {
results.push(BI.extend({}, match, item));
}
});
BI.each(results, function (index, item) {
if (item.value === self.platform.selectedManageNav && (item.pId === "decision-management-maintenance")) {
BI.some(results, function (index, i) {
if (i.id === "decision-management-maintenance") {
i.open = true;
return true;
}
});
}
if (item.value === self.model.selectedManageNav) {
item.selected = true;
}
if (!item.pId) {
item.pId = "management";
}
});
BI.each(constant, function (index, item) {
if (item.dev) {
results.push(BI.extend({}, item));
}
});
return BI.Tree.transformToTreeFormat(results);
}
},
actions: {
initData: function (callback) {
this.initDecisionModules();
this.initReports(callback);
},
initDecisionModules: function () {
var self = this;
Dec.Plugin.getManagementModules(function (modules) {
self.model.modules = modules;
});
},
initReports: function (callback) {
var self = this;
Dec.Utils.getWorkbenchSubDirectoryById(DecCst.DIRECTORY_TREE_ROOT_ID, function (res) {
self.model.reports = self._formatReportItems(res.data);
callback();
});
},
getSubItemsByPId: function (pId, layer, callback) {
var self = this;
Dec.Plugin.getEntriesByPid(pId, function (res) {
BI.some(self.model.reports, function (index, item) {
if (item.id === pId) {
item.open = true;
return true;
}
});
self.model.reports = self.model.reports.concat(self._formatReportItems(res.data));
});
},
openTab: function (tab) {
var module = BI.find(BI.Constants.getConstant("dec.constant.management.navigation"), function (index, item) {
return item.value === tab;
});
var report = BI.find(this.model.reports, function (index, item) {
return item.value === tab;
});
if (module) {
// Dec.Plugin.tabPane.addItem(card.text, card.value, card.cardType);
BI.Services.getService("dec.service.tabs").addItem(module);
} else {
BI.Services.getService("dec.service.tabs").addItem(report);
// this._openReports(tab);
}
}
},
_formatReportItems: function (nodes) {
var self = this;
var iconClsMap = BI.Constants.getConstant("dec.constant.look.icons.map");
var temps = BI.deepClone(nodes);
BI.each(temps, function (i, node) {
var extend = {
value: node.id
};
var cls = iconClsMap[node.nodeIcon];
if (cls) {
extend.iconCls = cls;
} else {
extend.iconCls = node.isParent ? "dir-panel-folder-font" : "dir-panel-template-font";
}
BI.defaults(node, extend);
});
return temps;
}
});
BI.model("dec.model.modules", Model);
}());

0
src/com/fr/plugin/decision/theme/original/web/style.css

299
src/com/fr/plugin/decision/theme/original/web/theme.js

@ -0,0 +1,299 @@
/*! fine-decision-webui 2018-10-14 15:29:23 */
!(function () {
BI.config("dec.constant.config", function (config) {
config.theme.config4Frame.west.width = 240;
config.theme.config4EntryPane.pinable = false;
return config;
});
Dec.injection.injectLayoutStrategy({
layout: function (config, header, footer, menu, body) {
return {
type: "bi.absolute",
items: [
{
el: {
type: "bi.absolute",
items: [
{
el: body,
top: 0, bottom: 0, right: 0,
left: config.west.invisible ? 0 : config.west.width
}, {
el: menu,
top: 0, bottom: 0,
left: 0
}
]
},
top: 40, left: 0, right: 0, bottom: 0
}, {
el: header,
height: 40,
top: 0, left: 0, right: 0
}
]
};
}
});
Dec.injection.injectMenu({
widget: function (config) {
return {
type: "dec.workbench.panel",
width: 240
};
}
});
Dec.injection.injectBody({
widget: function () {
return {
type: "dec.workbench.tabs"
};
}
});
BI.Plugin.registerWidget("dec.workbench.directory", function (ob) {
return BI.extend(ob, {type: "dec.theme.modules"});
});
}());
!(function () {
var Nav = BI.inherit(BI.Widget, {
props: {
baseCls: "dec-management-nav dec-popover",
pinedPane: false
},
_store: function () {
return BI.Models.getModel("dec.model.modules");
},
watch: {
selectedManageNav: function (v) {
this.tree.setValue(v);
},
items: function () {
this.populate(this.model.items);
}
},
beforeInit: function (render) {
this.store.initData(render);
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical",
hgap: 10,
items: [
{
type: "bi.custom_tree",
cls: "dec-text",
ref: function (_ref) {
self.tree = _ref;
},
el: {
type: "bi.loader",
next: false,
el: {
type: "bi.button_tree",
chooseType: 0,
layouts: [{
type: "bi.vertical",
vgap: 5
}]
}
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self.store.openTab(this.getValue()[0]);
}
}],
itemsCreator: function (op, callback) {
if (!op.node) {
self.store.initRootNodes(function (items) {
callback(items);
});
} else {
self.store.getSubItemsByPId(op.node.id, op.node.layer + 1, function (items) {
callback(items);
});
}
},
items: this._formatItems(this.model.items, 0)
}
]
};
},
// 解析层级结构的树数据.即带有children字段的
_formatItems: function (nodes, layer) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {layer: layer};
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "dec.nav.node";
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
} else {
extend.type = "dec.nav.item";
BI.defaults(node, extend);
}
});
return nodes;
},
populate: function (nodes) {
nodes = this._formatItems(nodes, 0);
this.tree.populate(nodes);
}
});
Nav.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE";
BI.shortcut("dec.theme.modules", Nav);
}());
(function () {
var Model = BI.inherit(Fix.Model, {
_init: function () {
this.platform = Dec.globleModel;
},
state: function () {
return {
modules: [],
reports: []
};
},
context: ["isPin"],
computed: {
selectedManageNav: function () {
return this.platform.selectedManageNav;
},
items: function () {
var self = this;
var constant = BI.Constants.getConstant("dec.constant.management.navigation");
var results = [];
results = BI.concat(results, this.model.reports);
results.push({
id: "decision-management-root",
value: "decision-management-root",
isParent: true,
open: true,
cls: "setting-font",
text: BI.i18nText("Dec-Authority_PlatformModule")
});
BI.each(constant, function (index, item) {
var match = BI.find(self.model.modules, function (index, i) {
return item.id === i.id;
});
if (match) {
results.push(BI.extend({}, match, item));
}
});
BI.each(results, function (index, item) {
if (item.value === self.platform.selectedManageNav && (item.pId === "decision-management-maintenance")) {
BI.some(results, function (index, i) {
if (i.id === "decision-management-maintenance") {
i.open = true;
return true;
}
});
}
if (item.value === self.model.selectedManageNav) {
item.selected = true;
}
if (!item.pId) {
item.pId = "management";
}
});
BI.each(constant, function (index, item) {
if (item.dev) {
results.push(BI.extend({}, item));
}
});
return BI.Tree.transformToTreeFormat(results);
}
},
actions: {
initData: function (callback) {
this.initDecisionModules();
this.initReports(callback);
},
initDecisionModules: function () {
var self = this;
Dec.Plugin.getManagementModules(function (modules) {
self.model.modules = modules;
});
},
initReports: function (callback) {
var self = this;
Dec.Utils.getWorkbenchSubDirectoryById(DecCst.DIRECTORY_TREE_ROOT_ID, function (res) {
self.model.reports = self._formatReportItems(res.data);
callback();
});
},
getSubItemsByPId: function (pId, layer, callback) {
var self = this;
Dec.Plugin.getEntriesByPid(pId, function (res) {
BI.some(self.model.reports, function (index, item) {
if (item.id === pId) {
item.open = true;
return true;
}
});
self.model.reports = self.model.reports.concat(self._formatReportItems(res.data));
});
},
openTab: function (tab) {
var module = BI.find(BI.Constants.getConstant("dec.constant.management.navigation"), function (index, item) {
return item.value === tab;
});
var report = BI.find(this.model.reports, function (index, item) {
return item.value === tab;
});
if (module) {
// Dec.Plugin.tabPane.addItem(card.text, card.value, card.cardType);
BI.Services.getService("dec.service.tabs").addItem(module);
} else {
BI.Services.getService("dec.service.tabs").addItem(report);
// this._openReports(tab);
}
}
},
_formatReportItems: function (nodes) {
var self = this;
var iconClsMap = BI.Constants.getConstant("dec.constant.look.icons.map");
var temps = BI.deepClone(nodes);
BI.each(temps, function (i, node) {
var extend = {
value: node.id
};
var cls = iconClsMap[node.nodeIcon];
if (cls) {
extend.iconCls = cls;
} else {
extend.iconCls = node.isParent ? "dir-panel-folder-font" : "dir-panel-template-font";
}
BI.defaults(node, extend);
});
return temps;
}
});
BI.model("dec.model.modules", Model);
}());
Loading…
Cancel
Save