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