You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
2.7 KiB
99 lines
2.7 KiB
9 years ago
|
package com.fr.plugin.widget.ztree.core;
|
||
|
|
||
6 years ago
|
import com.fr.json.JSONException;//抽象
|
||
|
import com.fr.json.JSONObject;//这个换ZTree也要换,所以不能动
|
||
|
|
||
|
//open
|
||
9 years ago
|
import com.fr.stable.xml.XMLPrintWriter;
|
||
|
import com.fr.stable.xml.XMLableReader;
|
||
|
|
||
6 years ago
|
//接口
|
||
|
import com.fr.stable.xml.XMLable;
|
||
|
|
||
9 years ago
|
/**
|
||
|
* Created by richie on 15/11/18.
|
||
|
*/
|
||
|
public class ZTreeAttr implements XMLable {
|
||
|
|
||
|
public static final String XML_TAG = "ZTreeAttr";
|
||
|
private static final int DEFAULT_POPUP_HEIGHT = 240;
|
||
|
|
||
|
|
||
|
private ZTreeStyle style = ZTreeStyle.NONE;
|
||
|
|
||
|
private ZTreeCascade cascade = ZTreeCascade.DESCENDANT;
|
||
|
|
||
|
private int popupHeight = DEFAULT_POPUP_HEIGHT;
|
||
|
|
||
|
|
||
|
|
||
|
public ZTreeAttr() {
|
||
|
|
||
|
}
|
||
|
|
||
|
public ZTreeStyle getCheckStyle() {
|
||
|
return style;
|
||
|
}
|
||
|
|
||
|
public void setCheckStyle(ZTreeStyle checkStyle) {
|
||
|
this.style = checkStyle;
|
||
|
}
|
||
|
|
||
|
public ZTreeCascade getCascade() {
|
||
|
return cascade;
|
||
|
}
|
||
|
|
||
|
public void setCascade(ZTreeCascade cascade) {
|
||
|
this.cascade = cascade;
|
||
|
}
|
||
|
|
||
|
public int getPopupHeight() {
|
||
|
return popupHeight;
|
||
|
}
|
||
|
|
||
|
public void setPopupHeight(int popupHeight) {
|
||
|
this.popupHeight = popupHeight;
|
||
|
}
|
||
|
|
||
|
public void mixConfig(JSONObject jo) throws JSONException {
|
||
|
JSONObject settings = new JSONObject();
|
||
|
settings.put("data", new JSONObject().put("key", new JSONObject().put("name", "text")));
|
||
|
settings.put("check", new JSONObject().put("enable", style!= ZTreeStyle.NONE).put("chkStyle", style.toText()));
|
||
|
jo.put("setting", settings);
|
||
|
jo.put("cascade", cascade.toText());
|
||
|
jo.put("directEdit", false);
|
||
|
jo.put("popupHeight", popupHeight);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void readXML(XMLableReader reader) {
|
||
|
if (reader.isChildNode()) {
|
||
|
String tagName = reader.getTagName();
|
||
|
if (tagName.equals("Attr")) {
|
||
|
style = ZTreeStyle.parser(reader.getAttrAsString("style", ""));
|
||
|
cascade = ZTreeCascade.parser(reader.getAttrAsString("cascade", ""));
|
||
|
popupHeight = reader.getAttrAsInt("popupHeight", DEFAULT_POPUP_HEIGHT);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void writeXML(XMLPrintWriter writer) {
|
||
|
writer.startTAG("Attr");
|
||
|
if (style != ZTreeStyle.NONE) {
|
||
|
writer.attr("style", style.toText());
|
||
|
}
|
||
|
writer.attr("cascade", cascade.toText());
|
||
|
writer.attr("popupHeight", popupHeight);
|
||
|
writer.end();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Object clone() throws CloneNotSupportedException {
|
||
|
ZTreeAttr cloned = (ZTreeAttr) super.clone();
|
||
|
cloned.style = style;
|
||
|
cloned.cascade = cascade;
|
||
|
cloned.popupHeight = popupHeight;
|
||
|
return super.clone();
|
||
|
}
|
||
|
}
|