Browse Source

接口更新

master
richie 5 years ago
parent
commit
cbac97b44b
  1. BIN
      lib/finekit-10.0.jar
  2. 35
      plugin.xml
  3. 33
      src/main/java/com/fr/plugin/widget/ztree/core/ZTree.java
  4. 25
      src/main/java/com/fr/plugin/widget/ztree/core/ZTreeNode.java
  5. 9
      src/main/java/com/fr/plugin/widget/ztree/tools/ZTreeConstants.java
  6. 52
      src/main/java/com/fr/plugin/widget/ztree/ui/XZTree.java
  7. 1
      src/main/java/com/fr/plugin/widget/ztree/ui/editor/AccessibleZTreeModelEditor.java
  8. 1
      src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeCascadeWrapper.java
  9. 1
      src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeStyleEditor.java
  10. 1
      src/main/java/com/fr/plugin/widget/ztree/ui/editor/ZTreeStyleWrapper.java

BIN
lib/finekit-10.0.jar

Binary file not shown.

35
plugin.xml

@ -1,25 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plugin>
<id>com.fr.plugin.widget.ztree</id>
<name><![CDATA[急速下拉树控件]]></name>
<main-package>com.fr.plugin.widget</main-package>
<active>yes</active>
<version>7.1</version>
<env-version>8.0</env-version>
<jartime>2016-03-20</jartime>
<vendor>solution.richie</vendor>
<version>2.0</version>
<env-version>10.0</env-version>
<jartime>2019-09-16</jartime>
<vendor>richie</vendor>
<price>1000</price>
<description><![CDATA[ztree实现的下拉树控件,仅支持在参数界面和表单中使用]]></description>
<change-notes><![CDATA[
<p>[2015-12-02]完善反馈信息</p>
<p>[2015-12-09]修复点击滚动条会导致下拉菜单消失的问题</p>
<p>[2015-12-09]修复插件在tomcat服务器下无法使用的问题</p>
<p>[2015-12-10]级联选择的时候,会自动加载所有的子孙节点</p>
<p>[2015-12-10]修复级联选择的时候,没有选择父亲节点只是也会加载孙子节点的问题</p>
<p>[2015-12-10]增加级联选项,可以选择不级联,级联到子节点,级联到所有节点</p>
<p>[2015-12-11]增加弹出层高度设置属性;弹出层宽度跟随控件宽度</p>
<p>[2016-01-15]修正弹出层会被图表遮住无法选择的问题</p>
<p>[2016-03-20]修复了超级大bug</p>
<p>[2016-04-11]修复了无法试用的bug</p>
<p>[2016-04-11]在设计器里面可以无限试用</p>
[2019-09-17]让插件依赖FineKit<br/>
[2016-04-11]修复了无法试用的bug<br/>
[2016-03-20]修复了超级大bug<br/>
[2016-01-15]修正弹出层会被图表遮住无法选择的问题<br/>
[2015-12-11]增加弹出层高度设置属性;弹出层宽度跟随控件宽度<br/>
[2015-12-10]增加级联选项,可以选择不级联,级联到子节点,级联到所有节点<br/>
[2015-12-10]修复级联选择的时候,没有选择父亲节点只是也会加载孙子节点的问题<br/>
[2015-12-10]级联选择的时候,会自动加载所有的子孙节点<br/>
[2015-12-09]修复插件在tomcat服务器下无法使用的问题<br/>
[2015-12-09]修复点击滚动条会导致下拉菜单消失的问题<br/>
[2015-12-02]完善反馈信息<br/>
]]></change-notes>
<extra-core>
<LocaleFinder class="com.fr.plugin.widget.ztree.ZTreeLocaleFinder"/>
@ -33,4 +35,5 @@
<ParameterWidgetOptionProvider class="com.fr.plugin.widget.ztree.core.ZTreeMarkInForm"/>
<FormWidgetOptionProvider class="com.fr.plugin.widget.ztree.core.ZTreeMarkInForm"/>
</extra-designer>
<function-recorder class="com.fr.plugin.widget.ztree.core.ZTree"/>
</plugin>

33
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");

25
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<String, Object> layerMap = new HashMap<String, Object>();
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();

9
src/main/java/com/fr/plugin/widget/ztree/tools/ZTreeConstants.java

@ -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";
}

52
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);

1
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;

1
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;

1
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;

1
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;

Loading…
Cancel
Save