Browse Source

init

master
dailer 6 years ago
parent
commit
4f3c1dec0c
  1. 13
      README.md
  2. 130
      build.xml
  3. 0
      lib/report/.gitkeep
  4. 15
      plugin.xml
  5. 20
      pom.xml
  6. BIN
      screenshorts/screenshort.gif
  7. 27
      src/main/java/com/fr/plugin/Carousel.java
  8. 29
      src/main/java/com/fr/plugin/CarouselComponent.java
  9. 50
      src/main/resources/com/fr/plugin/web/carousel.css
  10. 208
      src/main/resources/com/fr/plugin/web/carousel.js

13
README.md

@ -1,3 +1,14 @@
# decision-demo-carousel
一个全屏轮播的插件示例
一个全屏轮播的插件示例,用来演示对tabPane相关方法的使用
## 使用方法
1. 先打开几个模板.
2. 然后按下组合键 *shift+alt+f*,设置好时间,是否全屏,是否刷新,确定
3. 停止轮播,再按一次 *shift+alt+f*
## 效果图
![示例](screenshorts/screenshort.gif)

130
build.xml

@ -0,0 +1,130 @@
<?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_192"/>
<property name="libs" value="${basedir}/lib"/>
<property name="publicLibs" value=""/>
<property name="reportLibs" value="${basedir}/../webroot/WEB-INF/lib"/>
<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="carousel"/>
<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>
<fileset dir="${reportLibs}">
<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/main/resources">
<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/main/java"/>
<exclude name="**/.svn/**"/>
<compilerarg line="-encoding UTF8 "/>
<classpath refid="compile.classpath"/>
</javac>
<taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask">
<classpath refid="compile.classpath"/>
</taskdef>
<pretreatment baseDir="${basedir}"/>
</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>
<fileset dir="${libs}">
<include name="*.jar"/>
<include name="*.dll"/>
</fileset>
</copy>
<zip destfile="${basedir}/${plugin-folder}.zip" basedir=".">
<include name="${plugin-folder}/*.jar"/>
<include name="${plugin-folder}/*.dll"/>
<include name="${plugin-folder}/plugin.xml"/>
</zip>
<move file="${plugin-folder}.zip" todir="${destLoc}/install"/>
</target>
</project>

0
lib/report/.gitkeep

15
plugin.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plugin>
<id>com.fr.plugin.carousel</id>
<name><![CDATA[轮播插件]]></name>
<active>yes</active>
<version>1.0</version>
<env-version>10.0</env-version>
<jartime>2018-07-31</jartime>
<vendor>dailer</vendor>
<description><![CDATA[提供全屏及轮播功能]]></description>
<extra-decision>
<AbstractWebResourceProvider class="com.fr.plugin.Carousel"/>
</extra-decision>
<function-recorder class="com.fr.plugin.Carousel"/>
</plugin>

20
pom.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fr.plugin</groupId>
<artifactId>starter</artifactId>
<version>10.0</version>
</parent>
<packaging>jar</packaging>
<artifactId>plugin-carousel</artifactId>
<dependencies>
</dependencies>
<build>
<!---如果要更改调试插件,改这里的配置就可以了-->
<outputDirectory>${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.plugin.function.test-1.0/classes</outputDirectory>
</build>
</project>

BIN
screenshorts/screenshort.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

27
src/main/java/com/fr/plugin/Carousel.java

@ -0,0 +1,27 @@
package com.fr.plugin;
import com.fr.decision.fun.impl.AbstractWebResourceProvider;
import com.fr.decision.web.MainComponent;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.web.struct.Atom;
/**
* Created by dailer on 18/10/10.
*/
@EnableMetrics
public class Carousel extends AbstractWebResourceProvider {
@Override
public Atom attach() {
return MainComponent.KEY;
}
@Override
@Focus(id = "com.fr.plugin.carousel", text = "轮播功能", source = Original.PLUGIN)
public Atom client() {
return CarouselComponent.KEY;
}
}

29
src/main/java/com/fr/plugin/CarouselComponent.java

@ -0,0 +1,29 @@
package com.fr.plugin;
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 CarouselComponent extends Component {
public static final CarouselComponent KEY = new CarouselComponent();
private CarouselComponent() {
}
@Override
public ScriptPath script() {
return ScriptPath.build("com/fr/plugin/web/carousel.js");
}
@Override
public StylePath style() {
return StylePath.build("com/fr/plugin/web/carousel.css");
}
}

50
src/main/resources/com/fr/plugin/web/carousel.css

@ -0,0 +1,50 @@
/* fine-decision-webui 19-01-03 12:02:26 */
.demo-background {
background: #3d3780;
}
.dec-workbench-tabs {
border-radius: 8px;
overflow: hidden;
}
#wrapper.active {
transform: perspective(0.5em) rotateX(25deg);
transform-origin: bottom;
}
.demo-header {
background: #494299;
}
.demo-header .demo-sidebar-trigger .b-font {
color: #FFFFFF;
font-size: 30px;
}
.demo-header .demo-search-button .b-font,
.demo-header .favorite-font .b-font {
color: #a1a1e5;
}
.demo-header .demo-title-text {
color: #FFFFFF;
font-size: 24px;
}
.demo-sidebar {
background: #494299;
color: #a1a1e5;
font-size: 14px;
border-radius: 10px;
}
.demo-sidebar .platform-node-icon .b-font {
font-size: 35px;
color: #a1a1e5;
}
.demo-sidebar .demo-sidebar-item.active {
background-color: rgba(0, 255, 170, 0.25);
color: #fff;
border: 2px solid #00f9a6;
border-radius: 8px;
-webkit-box-shadow: 0 2px 12px 0 rgba(0, 255, 170, 0.25);
box-shadow: 0 2px 12px 0 rgba(0, 255, 170, 0.25);
}
.demo-sidebar .demo-sidebar-expander-popup {
background: #3d3780;
}

208
src/main/resources/com/fr/plugin/web/carousel.js

@ -0,0 +1,208 @@
!(function () {
var timer = null;
Dec.Plugin = Dec.Plugin || {};
Dec.Plugin.alternate = {
play: function () {
var pane = {
type: "dec.plugin.carousel.popup",
onClickConfirm: function (v) {
var service = BI.Services.getService("dec.service.tabs");
v.fullscreen && service.fullScreen();
timer = service.alternatePlay(v.time, v.refresh);
},
listeners: [
{
eventName: "EVENT_CLOSE",
action: function () {
BI.Popovers.remove("plugin-carousel-popup");
}
}
]
};
BI.Popovers.create("plugin-carousel-popup", {
type: "bi.popover",
header: "轮播设定",
body: pane,
width: 450,
height: 240,
listeners: [
{
eventName: "EVENT_CLOSE",
action: function () {
BI.Popovers.remove("plugin-carousel-popup");
}
}
]
}).open("plugin-carousel-popup");
},
stop: function () {
window.clearInterval(timer);
timer = null;
}
};
document.onkeydown = function (e) {
var keyCode = e.keyCode || e.which || e.charCode;
var shiftKey = e.shiftKey;
var altKey = e.altKey;
if (shiftKey && altKey && keyCode === 70) {
if (!timer) {
Dec.Plugin.alternate.play();
} else {
Dec.Plugin.alternate.stop();
}
e.preventDefault();
}
};
}());
!(function () {
var WIDTH = 80;
var HEIGHT = 50;
var EDITOR_Width = 300;
var Popup = BI.inherit(BI.Widget, {
props: {
baseCls: "dec-add-user-popup",
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))],
onClickConfirm: BI.emptyFn,
info: {}
},
render: function () {
var self = this;
return {
el: {
type: "bi.vtape",
tgap: -10,
items: [
{
el: this.rebuildCenter()
}, {
el: this.rebuildSouth(),
height: 44
}
]
}
};
},
rebuildSouth: function () {
var self = this, o = this.options;
var sure = BI.createWidget({
type: "bi.button",
ref: function (_ref) {
self.sure = _ref;
},
text: this.options.btns[0],
warningTitle: o.warningTitle,
height: 24,
handler: function () {
self.end();
}
});
var cancel = BI.createWidget({
type: "bi.button",
ref: function (_ref) {
self.cancel = _ref;
},
text: this.options.btns[1],
height: 24,
level: "ignore",
handler: function () {
self.close();
}
});
return {
type: "bi.right_vertical_adapt",
lgap: 10,
items: [cancel, sure]
};
},
rebuildCenter: function (center) {
var self = this, o = this.options;
var time = BI.createWidget({
type: "bi.editor",
ref: function (_ref) {
self.time = _ref;
},
cls: "bi-border",
watermark: BI.i18nText("间隔时间(s)"),
width: EDITOR_Width,
height: 24
});
var fullscrenn = BI.createWidget({
type: "bi.multi_select_item",
ref: function (_ref) {
self.fullscreen = _ref;
},
text: "是否全屏",
width: EDITOR_Width - 2,
height: 24,
value: o.info.description || ""
});
var refresh = BI.createWidget({
type: "bi.multi_select_item",
ref: function (_ref) {
self.refresh = _ref;
},
text: "切换前是否刷新模板",
width: EDITOR_Width - 2,
height: 24
});
return {
element: center,
type: "bi.vertical",
cls: "dec-add-user-popup",
items: [
{
el: {
type: "bi.vertical_adapt",
height: HEIGHT,
items: [{
type: "bi.label",
width: WIDTH,
textAlign: "left",
text: BI.i18nText("间隔时间(s)")
}, time]
},
tgap: 10
}, fullscrenn, refresh
]
};
},
getValue: function () {
return {
time: this.time.getValue(),
fullscreen: this.fullscreen.isSelected(),
refresh: this.refresh.isSelected()
};
},
close: function () {
this.fireEvent("EVENT_CLOSE");
},
end: function () {
this.options.onClickConfirm(this.getValue());
this.close();
}
});
Popup.EVENT_CLICK_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("dec.plugin.carousel.popup", Popup);
}());
Loading…
Cancel
Save