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.
57 lines
1.5 KiB
57 lines
1.5 KiB
package com.tptj.demo.hg.present.kind.provider; |
|
|
|
import com.fr.base.present.AbstractPresent; |
|
import com.fr.intelli.record.Focus; |
|
import com.fr.record.analyzer.EnableMetrics; |
|
import com.fr.script.Calculator; |
|
import com.fr.stable.ColumnRow; |
|
import com.fr.stable.StringUtils; |
|
import com.fr.stable.xml.XMLPrintWriter; |
|
import com.fr.stable.xml.XMLableReader; |
|
|
|
/** |
|
* @author 秃破天际 |
|
* @version 10.0 |
|
* Created by 秃破天际 on 2021-04-29 |
|
**/ |
|
@EnableMetrics |
|
public class DemoPresent extends AbstractPresent { |
|
|
|
private String type; |
|
|
|
public String getType() { |
|
return type; |
|
} |
|
|
|
public void setType(String type) { |
|
this.type = type; |
|
} |
|
|
|
@Override |
|
@Focus(id = "com.tptj.demo.hg.present.kind.provider.v10",text = "PresentKindProvider") |
|
public Object present( Object value, Calculator calculator, ColumnRow cr ) { |
|
return "txt".equals(type) ? value + " Hello World!" : new DemoPainter(value); |
|
} |
|
|
|
private final static String XML_TAG = "DemoPresent"; |
|
|
|
@Override |
|
public void readXML( XMLableReader reader ) { |
|
String name = reader.getTagName(); |
|
if ( XML_TAG.equals(name) ) { |
|
type = reader.getAttrAsString("type", StringUtils.EMPTY); |
|
} |
|
} |
|
|
|
@Override |
|
public void writeXML( XMLPrintWriter writer ) { |
|
writer.startTAG(XML_TAG).attr("type",type).end(); |
|
} |
|
|
|
@Override |
|
public Object clone() throws CloneNotSupportedException { |
|
DemoPresent obj = (DemoPresent)super.clone(); |
|
obj.type = type; |
|
return obj; |
|
} |
|
}
|
|
|