Browse Source

插件可视化参数设置

master
richie 6 years ago
parent
commit
c0229ae74e
  1. 24
      src/main/java/com/fr/conf/demo/simple/PluginInitializeFilterBridge.java
  2. 10
      src/main/java/com/fr/conf/demo/simple/PluginLocaleFinderBridge.java
  3. 45
      src/main/java/com/fr/conf/demo/simple/account/PluginSimpleConfig.java
  4. 12
      src/main/resources/com/fr/conf/demo/simple/locale/conf.properties
  5. 12
      src/main/resources/com/fr/conf/demo/simple/locale/conf_zh_CN.properties

24
src/main/java/com/fr/conf/demo/simple/PluginInitializeFilterBridge.java

@ -0,0 +1,24 @@
package com.fr.conf.demo.simple;
import com.fr.conf.demo.simple.account.PluginSimpleConfig;
import com.fr.decision.fun.impl.AbstractEmbedRequestFilterProvider;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class PluginInitializeFilterBridge extends AbstractEmbedRequestFilterProvider {
@Override
public void init(FilterConfig filterConfig) {
PluginSimpleConfig.getInstance();
}
@Override
public void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain filterChain) throws IOException, ServletException {
}
}

10
src/main/java/com/fr/conf/demo/simple/PluginLocaleFinderBridge.java

@ -0,0 +1,10 @@
package com.fr.conf.demo.simple;
import com.fr.stable.fun.impl.AbstractLocaleFinder;
public class PluginLocaleFinderBridge extends AbstractLocaleFinder {
@Override
public String find() {
return "com/fr/conf/demo/simple/locale/conf";
}
}

45
src/main/java/com/fr/conf/demo/simple/PluginSimpleConfig.java → src/main/java/com/fr/conf/demo/simple/account/PluginSimpleConfig.java

@ -1,4 +1,4 @@
package com.fr.conf.demo.simple;
package com.fr.conf.demo.simple.account;
import com.fr.config.ConfigContext;
import com.fr.config.DefaultConfiguration;
@ -12,7 +12,7 @@ import com.fr.intelli.record.Original;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.stable.StringUtils;
@Visualization(category = "Plugin")
@Visualization(category = "Plugin-Config_Group")
@EnableMetrics
public class PluginSimpleConfig extends DefaultConfiguration {
@ -26,12 +26,22 @@ public class PluginSimpleConfig extends DefaultConfiguration {
return config;
}
@Identifier(value = "text", name = "Plugin-Config_Property_Text", description = "Plugin-Config_Property_Text_Description", group = "Plugin", status = Status.SHOW)
@Identifier(value = "text", name = "Plugin-Config_Property_Text", description = "Plugin-Config_Property_Text_Description", status = Status.SHOW)
private Conf<String> text = Holders.simple(StringUtils.EMPTY);
@Identifier(value = "count", name = "Plugin-Config_Property_Count", description = "Config_Property_Count_Description", group = "Plugin", status = Status.SHOW)
@Identifier(value = "count", name = "Plugin-Config_Property_Count", description = "Plugin-Config_Property_Count_Description", status = Status.SHOW)
private Conf<Integer> count = Holders.simple(100);
@Identifier(value = "price", name = "Plugin-Config_Property_Price", description = "Plugin-Config_Property_Price_Description", status = Status.SHOW)
private Conf<Double> price = Holders.simple(1000.0);
@Identifier(value = "time", name = "Plugin-Config_Property_Time", description = "Plugin-Config_Property_Time_Description", status = Status.SHOW)
private Conf<Long> time = Holders.simple(99999999L);
@Identifier(value = "student", name = "Plugin-Config_Property_Student", description = "Plugin-Config_Property_Student_Description", status = Status.SHOW)
private Conf<Boolean> student = Holders.simple(true);
public String getText() {
return text.get();
}
@ -48,11 +58,38 @@ public class PluginSimpleConfig extends DefaultConfiguration {
this.count.set(count);
}
public double getPrice() {
return price.get();
}
public void setPrice(double price) {
this.price.set(price);
}
public long getTime() {
return time.get();
}
public void setTime(long time) {
this.time.set(time);
}
public boolean isStudent() {
return student.get();
}
public void setStudent(boolean student) {
this.student.set(student);
}
@Override
public Object clone() throws CloneNotSupportedException {
PluginSimpleConfig cloned = (PluginSimpleConfig) super.clone();
cloned.text = (Conf<String>) text.clone();
cloned.count = (Conf<Integer>) count.clone();
cloned.price = (Conf<Double>) price.clone();
cloned.time = (Conf<Long>) time.clone();
cloned.student = (Conf<Boolean>) student.clone();
return cloned;
}
}

12
src/main/resources/com/fr/conf/demo/simple/locale/conf.properties

@ -0,0 +1,12 @@
Plugin-Config_Demo=Plugin Demo
Plugin-Config_Property_Text=Account
Plugin-Config_Property_Count=Count
Plugin-Config_Property_Text_Description=This is a text property.
Plugin-Config_Property_Count_Description=This is a int property.
Plugin-Config_Group=Plugin
Plugin-Config_Property_Price=Price
Plugin-Config_Property_Price_Description=This is a price property.
Plugin-Config_Property_Time=Time
Plugin-Config_Property_Time_Description=This is a time proeprty.
Plugin-Config_Property_Student=Student
Plugin-Config_Property_Student_Description=This is a bool property.

12
src/main/resources/com/fr/conf/demo/simple/locale/conf_zh_CN.properties

@ -0,0 +1,12 @@
Plugin-Config_Demo=\u793A\u4F8B\u63D2\u4EF6
Plugin-Config_Property_Text=\u8D26\u53F7
Plugin-Config_Property_Count=\u6570\u91CF
Plugin-Config_Property_Text_Description=\u8FD9\u662F\u4E00\u4E2A\u6587\u672C\u7C7B\u578B\u7684\u914D\u7F6E\u5C5E\u6027\u3002
Plugin-Config_Property_Count_Description=\u8FD9\u662F\u4E00\u4E2A\u6574\u6570\u7C7B\u578B\u7684\u914D\u7F6E\u5C5E\u6027\u3002
Plugin-Config_Group=\u63D2\u4EF6\u914D\u7F6E
Plugin-Config_Property_Price=\u4EF7\u683C
Plugin-Config_Property_Price_Description=\u8FD9\u662F\u7528\u6765\u8BBE\u7F6E\u4EF7\u683C\u7684\u3002
Plugin-Config_Property_Time=\u65F6\u95F4
Plugin-Config_Property_Time_Description=\u8FD9\u662F\u7528\u6765\u8BBE\u7F6E\u6709\u6548\u65F6\u95F4\u7684
Plugin-Config_Property_Student=\u5B66\u751F
Plugin-Config_Property_Student_Description=\u8FD9\u662F\u7528\u6765\u8BBE\u7F6E\u662F\u5426\u4E3A\u5B66\u751F\u7684\u3002
Loading…
Cancel
Save