If you are experiencing an issue please mention the full platform your issue applies to:
I am having challenge on how to pass this result into another form in table format:(Source,Destination,Station,Date,Time,LINK).
i have implemented getters and setter for the result.
public void findTran(String Name,String Port,String Source,String Dest,String Stat,String Date,String Check){
ConnectionRequest req;
req = new ConnectionRequest(){
Map<String, Object> h;
@Override
protected void postResponse(){
Display.getInstance().callSerially(() -> {
Double status = (Double) h.get("status");
System.out.println(status);
//String tranName = appUser.getTransource();
if (!"".equals(status) && status == 1.0) {
showForm("FindResult", null);
}else{
//((Dialog) Display.getInstance().getCurrent()).dispose();
Dialog.show("Error", "There is no match", "OK", null);
}
});
}
@Override
protected void readResponse(InputStream input) throws IOException{
JSONParser p = new JSONParser();
//InputStreamReader inp = new InputStreamReader(input);
InputStreamReader inp = new InputStreamReader(input, "UTF-8");
h = p.parseJSON(inp);
Double status = (Double) h.get("status");
System.out.println(status);
System.out.println("" + h);
if(status == 1.0){
ArrayList<HashMap<String, String>> info = (ArrayList<HashMap<String, String>>) h.get("info");
for (int i = 0; i < info.size(); i++) {
HashMap<String, String> object = (HashMap<String, String>) info.get(i);
String transource = (String) object.get("tranSource");
System.out.println(transource);
String trandest = (String) object.get("tranDest");
System.out.println(trandest);
String transtation = (String) object.get("tranStation");
System.out.println(transtation);
String trandate = (String) object.get("tranDate");
System.out.println(trandate);
String trantime = (String) object.get("tranTime");
System.out.println(trantime);
if (!"".equals(transource)) {
appUser = new AppUsers(transource,trandest,transtation,trandate,trantime);
} else {
}
}
}
}
};
req.setUrl("/info.php");
req.setPost(false);
req.setContentType("application/json");
req.setHttpMethod("GET");
req.addArgument("tranName", Name);
req.addArgument("tranPort", Port);
req.addArgument("tranSource", Source);
req.addArgument("tranDest", Dest);
req.addArgument("tranStation", Stat);
req.addArgument("tranDate", Date);
req.addArgument("tranCheck", Check);
InfiniteProgress prog = new InfiniteProgress();
Dialog dlg = prog.showInifiniteBlocking();
req.setDisposeOnCompletion(dlg);
//NetworkManager.getInstance().addToQueue(req);
NetworkManager.getInstance().addToQueueAndWait(req);
}
public class AppUsers {
private String transource;
private String trandest;
private String transtation;
private String trandate;
private String trantime;
public String getTransource() {
return transource;
}
public void setTransource(String transource) {
this.transource = transource;
}
public String getTrandest() {
return trandest;
}
public void setTrandest(String trandest) {
this.trandest = trandest;
}
public String getTranstation() {
return transtation;
}
public void setTranstation(String transtation) {
this.transtation = transtation;
}
public String getTrandate() {
return trandate;
}
public void setTrandate(String trandate) {
this.trandate = trandate;
}
public String getTrantime() {
return trantime;
}
public void setTrantime(String trantime) {
this.trantime = trantime;
}
public AppUsers(String transource, String trandest, String transtation, String trandate,String trantime){
this.transource = transource;
this.trandest = trandest;
this.transtation = transtation;
this.trandate = trandate;
this.trantime = trantime;
}
}
How can i display the result on the FindResult form i created using designer.