forked from hugh/demo-menu-handler
hugh
4 years ago
5 changed files with 116 additions and 7 deletions
@ -1,4 +1,8 @@
|
||||
# demo-menu-handler |
||||
|
||||
设计器菜单扩展\ |
||||
demo生效后,设计器的模板工具栏会增加一个叫demo的菜单项,点击会出现Demo Action的弹窗 |
||||
demo生效后,设计器的模板工具栏会增加一个叫demo的菜单项,点击会出现Demo Action的弹窗\ |
||||
增补IOFileAttrMark用例\ |
||||
在Demo Action中可以输入一个txt文本(当前不支持特殊符号)。\ |
||||
可以作为模板的额外属性跟模板一起保存\ |
||||
测试可以用两个模板配置不同的txt分别打开查看 |
@ -0,0 +1,64 @@
|
||||
package com.tptj.demo.hg.menu.handler; |
||||
|
||||
import com.fr.intelli.record.Focus; |
||||
import com.fr.json.JSONException; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.record.analyzer.EnableMetrics; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.fun.impl.AbstractIOFileAttrMark; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
|
||||
/** |
||||
* @author 秃破天际 |
||||
* @version 10.0 |
||||
* Created by 秃破天际 on 2021-05-20 |
||||
**/ |
||||
@EnableMetrics |
||||
public class DemoAttrMark extends AbstractIOFileAttrMark { |
||||
|
||||
public final static String XML_TAG = "DemoAttrMark"; |
||||
|
||||
private String txt; |
||||
|
||||
@Focus(id="com.tptj.demo.hg.menu.handler.v10",text = "MenuHandler") |
||||
public String getTxt() { |
||||
return txt; |
||||
} |
||||
|
||||
public void setTxt(String txt) { |
||||
this.txt = txt; |
||||
} |
||||
|
||||
@Override |
||||
public String xmlTag() { |
||||
return XML_TAG; |
||||
} |
||||
|
||||
@Override |
||||
public void readXML(XMLableReader reader) { |
||||
String tag = reader.getTagName(); |
||||
if( XML_TAG.equals(tag) ){ |
||||
txt = reader.getAttrAsString("txt", StringUtils.EMPTY); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void writeXML(XMLPrintWriter writer) { |
||||
writer.startTAG(XML_TAG).attr("txt",txt).end(); |
||||
} |
||||
|
||||
@Override |
||||
public DemoAttrMark clone() { |
||||
DemoAttrMark obj = (DemoAttrMark)super.clone(); |
||||
obj.txt = txt; |
||||
return obj; |
||||
} |
||||
|
||||
@Override |
||||
public JSONObject createJSONConfig() throws JSONException{ |
||||
JSONObject json = super.createJSONConfig(); |
||||
json.put("txt",txt); |
||||
return json; |
||||
} |
||||
} |
Loading…
Reference in new issue