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.
63 lines
1.7 KiB
63 lines
1.7 KiB
4 years ago
|
package com.tptj.demo.hg.connection.decision;
|
||
|
|
||
|
import com.fanruan.api.util.StringKit;
|
||
|
import com.fr.decision.fun.impl.AbstractUniversalConnectionProvider;
|
||
|
import com.fr.json.JSONObject;
|
||
|
import com.fr.web.struct.Atom;
|
||
|
import com.fr.web.struct.Component;
|
||
|
import com.fr.web.struct.browser.RequestClient;
|
||
|
import com.fr.web.struct.category.ScriptPath;
|
||
|
import com.tptj.demo.hg.connection.conn.DemoConnection;
|
||
|
|
||
|
/**
|
||
|
* @author 秃破天际
|
||
|
* @version 10.0
|
||
|
* Created by 秃破天际 on 2021-03-31
|
||
|
**/
|
||
|
public class WebDemo extends AbstractUniversalConnectionProvider<DemoConnection> {
|
||
|
|
||
|
@Override
|
||
|
public String nameForConnection() {
|
||
|
return "demo_con";
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public String iconPathForConnection() {
|
||
|
return "/com/tptj/demo/hg/connection/images/icon.png";
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Class<DemoConnection> classForConnection() {
|
||
|
return DemoConnection.class;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Atom client() {
|
||
|
return new Component() {
|
||
|
@Override
|
||
|
public ScriptPath script(RequestClient client) {
|
||
|
return ScriptPath.build("com/tptj/demo/hg/connection/js/main.js");
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public JSONObject serialize(DemoConnection connection) {
|
||
|
return JSONObject.create().put("key",connection.getKey());
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public DemoConnection deserialize(DemoConnection old, JSONObject config ){
|
||
|
DemoConnection conn = new DemoConnection();
|
||
|
conn.setKey(config.optString("key", StringKit.EMPTY));
|
||
|
if( null != old ){
|
||
|
conn.setId( old.getId() );
|
||
|
conn.setCreator( old.getCreator() );
|
||
|
}
|
||
|
return conn;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|