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.
74 lines
2.0 KiB
74 lines
2.0 KiB
package com.tptj.demo.hg.hyperlink.provider; |
|
|
|
import com.fr.intelli.record.Focus; |
|
import com.fr.js.Hyperlink; |
|
import com.fr.record.analyzer.EnableMetrics; |
|
import com.fr.stable.StringUtils; |
|
import com.fr.stable.web.Repository; |
|
import com.fr.stable.xml.XMLPrintWriter; |
|
import com.fr.stable.xml.XMLableReader; |
|
|
|
/** |
|
* @author 秃破天际 |
|
* @version 10.0 |
|
* Created by 秃破天际 on 2021-05-17 |
|
**/ |
|
@EnableMetrics |
|
public class DemoHyperlink extends Hyperlink { |
|
private String key; |
|
private String value; |
|
@Override |
|
@Focus(id="com.tptj.demo.hg.hyperlink.provider.v10",text="DemoHyperlink") |
|
protected String actionJS(Repository repository) { |
|
return "alert(\""+key+"="+value+"\");"; |
|
} |
|
|
|
public String getKey() { |
|
return key; |
|
} |
|
|
|
public void setKey(String key) { |
|
this.key = key; |
|
} |
|
|
|
public String getValue() { |
|
return value; |
|
} |
|
|
|
public void setValue(String value) { |
|
this.value = value; |
|
} |
|
private static final String XML_TAG = "DemoHyperlink"; |
|
@Override |
|
public void writeXML( XMLPrintWriter writer ){ |
|
super.writeXML(writer); |
|
writer.startTAG(XML_TAG) |
|
.attr("key",key) |
|
.attr("value",value).end(); |
|
} |
|
|
|
@Override |
|
public void readXML(XMLableReader reader){ |
|
super.readXML(reader); |
|
String tag = reader.getTagName(); |
|
if( XML_TAG.equals(tag) ){ |
|
key = reader.getAttrAsString("key", StringUtils.EMPTY); |
|
value = reader.getAttrAsString("value", StringUtils.EMPTY); |
|
} |
|
} |
|
|
|
@Override |
|
public Object clone() throws CloneNotSupportedException { |
|
DemoHyperlink rt = (DemoHyperlink)super.clone(); |
|
rt.setKey( this.getKey() ); |
|
rt.setValue( this.getValue() ); |
|
return rt; |
|
} |
|
|
|
@Override |
|
public boolean equals(Object obj){ |
|
return obj instanceof DemoHyperlink |
|
&& StringUtils.equals( ((DemoHyperlink)obj).getKey(),getKey() ) |
|
&& StringUtils.equals( ((DemoHyperlink)obj).getValue(),getValue() ); |
|
} |
|
}
|
|
|