Home | History | Annotate | Download | only in tko
      1 package autotest.tko;
      2 
      3 import autotest.common.JsonRpcProxy;
      4 import autotest.common.Utils;
      5 import autotest.common.CustomHistory.HistoryToken;
      6 import autotest.tko.TableView.TableSwitchListener;
      7 import autotest.tko.TableView.TableViewConfig;
      8 
      9 import com.google.gwt.core.client.EntryPoint;
     10 import com.google.gwt.core.client.GWT;
     11 import com.google.gwt.core.client.JavaScriptObject;
     12 import com.google.gwt.core.client.GWT.UncaughtExceptionHandler;
     13 import com.google.gwt.dom.client.Element;
     14 
     15 public class EmbeddedTkoClient implements EntryPoint, TableSwitchListener {
     16     private String autotestServerUrl;
     17     private TestDetailView testDetailView; // we'll use this to generate history tokens
     18 
     19     public void onModuleLoad() {
     20         JsonRpcProxy.setDefaultBaseUrl(JsonRpcProxy.TKO_BASE_URL);
     21         testDetailView = new TestDetailView();
     22     }
     23 
     24     @SuppressWarnings("unused") // called from native
     25     private void initialize(String autotestServerUrl) {
     26         this.autotestServerUrl = autotestServerUrl;
     27         JsonRpcProxy proxy = JsonRpcProxy.createProxy(autotestServerUrl + JsonRpcProxy.TKO_BASE_URL,
     28                                                       true);
     29         JsonRpcProxy.setProxy(JsonRpcProxy.TKO_BASE_URL, proxy);
     30     }
     31 
     32     public HistoryToken getSelectTestHistoryToken(int testId) {
     33         testDetailView.updateObjectId(Integer.toString(testId));
     34         return testDetailView.getHistoryArguments();
     35     }
     36 
     37     public void onSelectTest(int testId) {
     38         String fullUrl = autotestServerUrl + "/new_tko/#" + getSelectTestHistoryToken(testId);
     39         Utils.openUrlInNewWindow(fullUrl);
     40     }
     41 
     42     public void onSwitchToTable(TableViewConfig config) {
     43         throw new UnsupportedOperationException();
     44     }
     45 }
     46