use of com.biglybt.ui.swt.pifimpl.UISWTViewCoreEventListenerEx.CloneConstructor in project BiglyBT by BiglySoftware.
the class BaseMdiEntry method exportStandAlone.
public Map<String, Object> exportStandAlone() {
Map<String, Object> result = new HashMap<>();
result.put("mdi", (this instanceof SideBarEntrySWT) ? "sidebar" : "tabbed");
String title = null;
ViewTitleInfo vti = getViewTitleInfo();
if (vti != null) {
title = (String) vti.getTitleInfoProperty(ViewTitleInfo.TITLE_TEXT);
}
if (title == null || title.length() == 0) {
title = getFullTitle();
}
result.put("title", title);
result.put("skin_ref", getSkinRef());
result.put("skin_id", skin.getSkinID());
result.put("parent_id", getParentID());
result.put("id", id);
Object data_source = getDatasourceCore();
if (data_source == null) {
data_source = getInitialDataSource();
}
if (data_source != null) {
if (data_source instanceof String) {
result.put("data_source", data_source);
} else if (data_source instanceof Integer) {
List l = new ArrayList();
l.add("i");
l.add(((Integer) data_source).longValue());
result.put("data_source", l);
} else {
result.put("data_source", DataSourceResolver.exportDataSource(data_source));
}
}
result.put("control_type", getControlType());
UISWTViewEventListener listener = getEventListener();
if (listener instanceof UISWTViewCoreEventListenerEx) {
CloneConstructor cc = ((UISWTViewCoreEventListenerEx) listener).getCloneConstructor();
String name = cc.getCloneClass().getName();
Map<String, Object> map = new HashMap<>();
map.put("name", name);
List<Object> params = cc.getParameters();
if (params != null) {
List p_types = new ArrayList<>();
List p_vals = new ArrayList<>();
map.put("p_types", p_types);
map.put("p_vals", p_vals);
for (Object p : params) {
if (p instanceof Boolean) {
p_types.add("bool");
p_vals.add(new Long(((Boolean) p) ? 1 : 0));
} else if (p instanceof Long) {
p_types.add("long");
p_vals.add(p);
} else if (p instanceof String) {
p_types.add("string");
p_vals.add(p);
} else {
Debug.out("Unsupported param type: " + p);
}
}
}
result.put("event_listener", map);
} else if (listener instanceof UISWTViewEventListenerEx) {
com.biglybt.ui.swt.pif.UISWTViewEventListenerEx.CloneConstructor cc = ((UISWTViewEventListenerEx) listener).getCloneConstructor();
PluginInterface pi = cc.getPluginInterface();
Map<String, Object> map = new HashMap<>();
map.put("plugin_id", pi.getPluginID());
map.put("plugin_name", pi.getPluginName());
map.put("ipc_method", cc.getIPCMethod());
List<Object> params = cc.getIPCParameters();
if (params != null) {
List p_types = new ArrayList<>();
List p_vals = new ArrayList<>();
map.put("p_types", p_types);
map.put("p_vals", p_vals);
for (Object p : params) {
if (p instanceof Boolean) {
p_types.add("bool");
p_vals.add(new Long(((Boolean) p) ? 1 : 0));
} else if (p instanceof Long) {
p_types.add("long");
p_vals.add(p);
} else if (p instanceof String) {
p_types.add("string");
p_vals.add(p);
} else {
Debug.out("Unsupported param type: " + p);
}
}
}
result.put("event_listener", map);
}
return (result);
}
Aggregations