diff --git a/lib/finekit-10.0.jar b/lib/finekit-10.0.jar
index 393e24b..f4e30cf 100644
Binary files a/lib/finekit-10.0.jar and b/lib/finekit-10.0.jar differ
diff --git a/plugin.xml b/plugin.xml
index 4ce97c3..13c4fe3 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -1,25 +1,27 @@
-
+
+
com.fr.plugin.widget.ztree
+ com.fr.plugin.widget
yes
- 7.1
- 8.0
- 2016-03-20
- solution.richie
+ 2.0
+ 10.0
+ 2019-09-16
+ richie
1000
[2015-12-02]完善反馈信息
- [2015-12-09]修复点击滚动条会导致下拉菜单消失的问题
- [2015-12-09]修复插件在tomcat服务器下无法使用的问题
- [2015-12-10]级联选择的时候,会自动加载所有的子孙节点
- [2015-12-10]修复级联选择的时候,没有选择父亲节点只是也会加载孙子节点的问题
- [2015-12-10]增加级联选项,可以选择不级联,级联到子节点,级联到所有节点
- [2015-12-11]增加弹出层高度设置属性;弹出层宽度跟随控件宽度
- [2016-01-15]修正弹出层会被图表遮住无法选择的问题
- [2016-03-20]修复了超级大bug
- [2016-04-11]修复了无法试用的bug
- [2016-04-11]在设计器里面可以无限试用
+ [2019-09-17]让插件依赖FineKit
+ [2016-04-11]修复了无法试用的bug
+ [2016-03-20]修复了超级大bug
+ [2016-01-15]修正弹出层会被图表遮住无法选择的问题
+ [2015-12-11]增加弹出层高度设置属性;弹出层宽度跟随控件宽度
+ [2015-12-10]增加级联选项,可以选择不级联,级联到子节点,级联到所有节点
+ [2015-12-10]修复级联选择的时候,没有选择父亲节点只是也会加载孙子节点的问题
+ [2015-12-10]级联选择的时候,会自动加载所有的子孙节点
+ [2015-12-09]修复插件在tomcat服务器下无法使用的问题
+ [2015-12-09]修复点击滚动条会导致下拉菜单消失的问题
+ [2015-12-02]完善反馈信息
]]>
@@ -33,4 +35,5 @@
+
\ No newline at end of file
diff --git a/src/main/java/com/fr/plugin/widget/ztree/core/ZTree.java b/src/main/java/com/fr/plugin/widget/ztree/core/ZTree.java
index d436457..4a7acc3 100644
--- a/src/main/java/com/fr/plugin/widget/ztree/core/ZTree.java
+++ b/src/main/java/com/fr/plugin/widget/ztree/core/ZTree.java
@@ -3,18 +3,20 @@ package com.fr.plugin.widget.ztree.core;
import com.fanruan.api.i18n.I18nKit;
import com.fanruan.api.json.JSONKit;
import com.fanruan.api.net.NetworkKit;
-import com.fanruan.api.report.form.CustomWriteAbleRepeatEditor;
-import com.fanruan.api.runtime.PluginKit;
+import com.fanruan.api.report.form.category.TextWidget;
+import com.fanruan.api.util.ArrayKit;
import com.fanruan.api.xml.XmlKit;
import com.fr.form.ui.DataControl;
-import com.fr.form.ui.WidgetValue;
+import com.fr.form.ui.concept.data.ValueInitializer;
import com.fr.intelli.record.Focus;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
+import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.Calculator;
import com.fr.stable.core.NodeVisitor;
+import com.fr.stable.script.CalculatorProvider;
import com.fr.stable.web.Repository;
import com.fr.stable.web.SessionProvider;
import com.fr.stable.xml.XMLPrintWriter;
@@ -26,9 +28,9 @@ import javax.servlet.http.HttpServletRequest;
* Created by richie on 15/11/17.
*/
@EnableMetrics
-public class ZTree extends CustomWriteAbleRepeatEditor implements DataControl {
+public class ZTree extends TextWidget implements DataControl {
- private WidgetValue widgetValue;
+ private ValueInitializer widgetValue;
private ZTreeNode treeNode;
@@ -41,7 +43,7 @@ public class ZTree extends CustomWriteAbleRepeatEditor implements DataControl {
}
@Override
- public String getDataBindDefaultValue(Calculator calculator) {
+ public String getDataBindDefaultValue(CalculatorProvider calculator) {
return null;
}
@@ -61,12 +63,12 @@ public class ZTree extends CustomWriteAbleRepeatEditor implements DataControl {
}
@Override
- public void setWidgetValue(WidgetValue value) {
+ public void setWidgetValue(ValueInitializer value) {
widgetValue = value;
}
@Override
- public WidgetValue getWidgetValue() {
+ public ValueInitializer getWidgetValue() {
return widgetValue;
}
@@ -103,7 +105,7 @@ public class ZTree extends CustomWriteAbleRepeatEditor implements DataControl {
}
@Override
- public void createValueResult(DataControl widget, Calculator widgetCalculator, JSONObject widgetResult, JSONObject attrSourceCache) {
+ public void createValueResult(CalculatorProvider calculatorProvider, JSONObject jsonObject) {
}
@@ -113,6 +115,11 @@ public class ZTree extends CustomWriteAbleRepeatEditor implements DataControl {
}
+ @Override
+ public String[] dependence(CalculatorProvider calculatorProvider) {
+ return ArrayKit.EMPTY_STRING_ARRAY;
+ }
+
@Override
@Focus(id = "com.fr.plugin.widget.ztree", text = "Plugin-ZTree")
public JSONObject createJSONConfig(Repository repo, Calculator c, NodeVisitor toFindChart) throws JSONException {
@@ -124,11 +131,15 @@ public class ZTree extends CustomWriteAbleRepeatEditor implements DataControl {
}
@Override
- public JSONArray createJSONData(SessionProvider sessionIDInfor, Calculator c, HttpServletRequest req) {
+ public void mixinJSON(Repository repository, CalculatorProvider calculatorProvider, JSONObject jsonObject) {
+
+ }
+
+ public JSONArray createJSONData(SessionProvider session, CalculatorProvider c, HttpServletRequest req) {
if (treeNode == null) {
return JSONKit.createJSONArray();
}
- if ((PluginKit.isCurrentPluginAvailable())) {
+ if ((PluginContexts.currentContext().isAvailable())) {
String pv = NetworkKit.getHTTPRequestParameter(req, "pv");
int level = NetworkKit.getHTTPRequestIntParameter(req, "level", ZTreeNode.ROOT_LEVEL);
String text = NetworkKit.getHTTPRequestParameter(req, "text");
diff --git a/src/main/java/com/fr/plugin/widget/ztree/core/ZTreeNode.java b/src/main/java/com/fr/plugin/widget/ztree/core/ZTreeNode.java
index 9f3b60a..75aa5ab 100644
--- a/src/main/java/com/fr/plugin/widget/ztree/core/ZTreeNode.java
+++ b/src/main/java/com/fr/plugin/widget/ztree/core/ZTreeNode.java
@@ -1,23 +1,19 @@
package com.fr.plugin.widget.ztree.core;
-
import com.fanruan.api.cal.CalculatorKit;
import com.fanruan.api.util.GeneralKit;
import com.fanruan.api.xml.XmlKit;
-import com.fr.plugin.widget.ztree.tools.ZTreeHelper;
-
-import com.fr.script.Calculator;
-
-import com.fr.stable.xml.XMLPrintWriter;
-import com.fr.stable.xml.XMLableReader;
-
+import com.fr.data.Dictionary;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
-
-import com.fr.data.Dictionary;
+import com.fr.plugin.widget.ztree.tools.ZTreeHelper;
+import com.fr.script.Calculator;
+import com.fr.stable.script.CalculatorProvider;
import com.fr.stable.script.NameSpace;
+import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLable;
+import com.fr.stable.xml.XMLableReader;
import java.util.HashMap;
import java.util.Iterator;
@@ -75,19 +71,19 @@ public class ZTreeNode implements XMLable {
int count = 1;
ZTreeNode node = getChild();
while (node != null) {
- count++;
+ count++;
node = node.getChild();
}
return count;
}
- public JSONArray toJSONArray(Calculator c, int level, String text, String value, String pv, boolean checked) throws JSONException {
+ public JSONArray toJSONArray(CalculatorProvider c, int level, String text, String value, String pv, boolean checked) throws JSONException {
Map layerMap = new HashMap();
if (pv != null) {
String[] parentValues = pv.split("\\$\\$");
- for (int i = 0, len = parentValues.length; i < len; i ++) {
+ for (int i = 0, len = parentValues.length; i < len; i++) {
layerMap.put(GeneralKit.objectToString(i + 1), parentValues[i]);
}
}
@@ -96,7 +92,8 @@ public class ZTreeNode implements XMLable {
c.pushNameSpace(ns);
JSONArray data = new JSONArray();
- Iterator entryIt = dictionary.entrys(c);
+ Calculator calculator = c.asInstance();
+ Iterator entryIt = dictionary.entrys(calculator);
while (entryIt.hasNext()) {
Dictionary.MV mv = (Dictionary.MV) entryIt.next();
diff --git a/src/main/java/com/fr/plugin/widget/ztree/tools/ZTreeConstants.java b/src/main/java/com/fr/plugin/widget/ztree/tools/ZTreeConstants.java
deleted file mode 100644
index 317d6f3..0000000
--- a/src/main/java/com/fr/plugin/widget/ztree/tools/ZTreeConstants.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.fr.plugin.widget.ztree.tools;
-
-/**
- * Created by richie on 16/1/22.
- */
-public class ZTreeConstants {
-
- public static final String PLUGIN_ID = "com.fr.plugin.widget.ztree";
-}
\ No newline at end of file
diff --git a/src/main/java/com/fr/plugin/widget/ztree/ui/XZTree.java b/src/main/java/com/fr/plugin/widget/ztree/ui/XZTree.java
index 3b21961..e726a7f 100644
--- a/src/main/java/com/fr/plugin/widget/ztree/ui/XZTree.java
+++ b/src/main/java/com/fr/plugin/widget/ztree/ui/XZTree.java
@@ -3,11 +3,11 @@ package com.fr.plugin.widget.ztree.ui;
import com.fanruan.api.design.DesignKit;
import com.fanruan.api.design.ui.component.UITextField;
import com.fanruan.api.design.util.GUICoreKit;
-import com.fanruan.api.design.work.form.creator.XFieldEditor;
+import com.fanruan.api.design.work.form.creator.Attribute;
+import com.fanruan.api.design.work.form.creator.OpacityButton;
+import com.fanruan.api.design.work.form.creator.XFieldCreator;
import com.fanruan.api.design.work.form.editor.WidgetValueEditor;
import com.fanruan.api.design.work.form.macro.XCreatorConstants;
-import com.fanruan.api.util.ArrayKit;
-import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWScaleLayout;
import com.fr.plugin.widget.ztree.core.ZTree;
@@ -20,42 +20,40 @@ import com.fr.plugin.widget.ztree.ui.renderer.ZTreeStyleRenderer;
import javax.swing.*;
import java.awt.*;
-import java.beans.IntrospectionException;
/**
* Created by richie on 15/11/17.
*/
-public class XZTree extends XFieldEditor {
+public class XZTree extends XFieldCreator {
- private LimpidButton btn;
+ private OpacityButton btn;
public XZTree(ZTree widget, Dimension initSize) {
super(widget, initSize);
}
@Override
- public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
- CRPropertyDescriptor[] crp = new CRPropertyDescriptor[]{
- new CRPropertyDescriptor("widgetValue", this.toData().getClass()).setI18NName(
- DesignKit.i18nText("Plugin-ZTree_Widget_Value")).setEditorClass(WidgetValueEditor.class),
- new CRPropertyDescriptor("treeNode", this.toData().getClass()).setI18NName(
- DesignKit.i18nText("Plugin-ZTree_Widget_Data")).setEditorClass(ZTreeModelEditor.class).setRendererClass(
+ public Attribute[] attributes() {
+ return new Attribute[]{
+ Attribute.newAttribute("widgetValue", this.toData().getClass()).i18n(
+ DesignKit.i18nText("Plugin-ZTree_Widget_Value")).editorClass(WidgetValueEditor.class),
+ Attribute.newAttribute("treeNode", this.toData().getClass()).i18n(
+ DesignKit.i18nText("Plugin-ZTree_Widget_Data")).editorClass(ZTreeModelEditor.class).rendererClass(
ZTreeModelRenderer.class),
- new CRPropertyDescriptor("popupHeight", this.data.getClass())
- .setI18NName(DesignKit.i18nText("Plugin-ZTree_Widget_Popup_Height"))
- .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
- new CRPropertyDescriptor("selectStyle", this.toData().getClass())
- .setI18NName(DesignKit.i18nText("Plugin-ZTree_Mode"))
- .setEditorClass(ZTreeStyleEditor.class)
- .setRendererClass(ZTreeStyleRenderer.class)
- .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
- new CRPropertyDescriptor("cascade", this.data.getClass())
- .setI18NName(DesignKit.i18nText("Plugin-ZTree_Cascade"))
- .setEditorClass(ZTreeCascadeEditor.class)
- .setRendererClass(ZTreeCascadeRenderer.class)
- .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
+ Attribute.newAttribute("popupHeight", this.data.getClass())
+ .i18n(DesignKit.i18nText("Plugin-ZTree_Widget_Popup_Height"))
+ .keyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
+ Attribute.newAttribute("selectStyle", this.toData().getClass())
+ .i18n(DesignKit.i18nText("Plugin-ZTree_Mode"))
+ .editorClass(ZTreeStyleEditor.class)
+ .rendererClass(ZTreeStyleRenderer.class)
+ .keyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
+ Attribute.newAttribute("cascade", this.data.getClass())
+ .i18n(DesignKit.i18nText("Plugin-ZTree_Cascade"))
+ .editorClass(ZTreeCascadeEditor.class)
+ .rendererClass(ZTreeCascadeRenderer.class)
+ .keyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
};
- return ArrayKit.addAll(super.supportedDescriptor(), crp);
}
protected JComponent initEditor() {
@@ -64,7 +62,7 @@ public class XZTree extends XFieldEditor {
UITextField textField = new UITextField(5);
textField.setOpaque(false);
editor.add(textField, BorderLayout.CENTER);
- btn = new LimpidButton("", this.getIconPath(), toData().isVisible() ? FULL_OPACITY : HALF_OPACITY);
+ btn = new OpacityButton("", this.getIconPath(), toData().isVisible() ? FULL_OPACITY : HALF_OPACITY);
btn.setPreferredSize(new Dimension(21, 21));
btn.setOpaque(true);
editor.add(btn, BorderLayout.EAST);
diff --git a/src/main/java/com/fr/plugin/widget/ztree/ui/editor/AccessibleZTreeModelEditor.java b/src/main/java/com/fr/plugin/widget/ztree/ui/editor/AccessibleZTreeModelEditor.java
index f37ad82..d0cb9a5 100644
--- a/src/main/java/com/fr/plugin/widget/ztree/ui/editor/AccessibleZTreeModelEditor.java
+++ b/src/main/java/com/fr/plugin/widget/ztree/ui/editor/AccessibleZTreeModelEditor.java
@@ -1,6 +1,5 @@
package com.fr.plugin.widget.ztree.ui.editor;
-
import com.fanruan.api.design.work.form.basic.UneditableAccessibleEditor;
import com.fr.plugin.widget.ztree.core.ZTreeNode;
import com.fr.plugin.widget.ztree.ui.control.ZTreeControlPane;
diff --git a/src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeCascadeWrapper.java b/src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeCascadeWrapper.java
index 0ca635b..ec6c810 100644
--- a/src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeCascadeWrapper.java
+++ b/src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeCascadeWrapper.java
@@ -1,6 +1,5 @@
package com.fr.plugin.widget.ztree.ui.editor;
-
import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder;
import com.fr.plugin.widget.ztree.core.ZTreeCascade;
diff --git a/src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeStyleEditor.java b/src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeStyleEditor.java
index 1ab6530..b15e597 100644
--- a/src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeStyleEditor.java
+++ b/src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeStyleEditor.java
@@ -1,6 +1,5 @@
package com.fr.plugin.widget.ztree.ui.editor;
-
import com.fanruan.api.design.work.form.basic.Item;
import com.fanruan.api.design.work.form.basic.ItemCellEditor;
import com.fanruan.api.i18n.I18nKit;
diff --git a/src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeStyleWrapper.java b/src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeStyleWrapper.java
index 1771575..c00987c 100644
--- a/src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeStyleWrapper.java
+++ b/src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeStyleWrapper.java
@@ -1,6 +1,5 @@
package com.fr.plugin.widget.ztree.ui.editor;
-
import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder;
import com.fr.plugin.widget.ztree.core.ZTreeStyle;