@Override
 public void popout(TabLabelView tab) {
   if (dataTabs.hasTab(tab)) {
     int index = dataTabs.popTab(tab);
     view.removeDataTab(index);
     TabPanelPresenter p = dataTabs.getPresenter(tab);
     p.removed();
     String datakey = ((DataPanelPresenterImpl) p).getDataKey();
     DataTablePlace place = new DataTablePlace();
     place.setDataKey(datakey);
     popoutDataTab(place, tab.hashCode());
   } else if (visTabs.hasTab(tab)) {
     int index = visTabs.popTab(tab);
     view.removeVisTab(index);
     TabPanelPresenter p = visTabs.getPresenter(tab);
     p.removed();
     if (p instanceof ConfusionMatrixPresenterImpl) {
       ConfusionMatrixPresenterImpl cp = (ConfusionMatrixPresenterImpl) p;
       ConfusionMatrixPlace place = new ConfusionMatrixPlace();
       place.setRandomForest(cp.getRandomForest());
       popoutConfusionMatrixTab(place, tab.hashCode());
     } else {
       TreePanelPresenterImpl tp = (TreePanelPresenterImpl) p;
       TreeVisPlace place = new TreeVisPlace();
       place.setDataKey(tp.getDatakey());
       place.setModelKey(tp.getModelkey());
       place.setTree(tp.getTreeIndex());
       popoutTreeVisTab(place, tab.hashCode());
     }
   } else {
     logger.log(Level.SEVERE, "Unknown tab!");
   }
 }
 public void addConfusionMatrixTab(RF rf, RFView rfview, RFBuilder b) {
   ConfusionMatrixPresenterImpl presenter =
       new ConfusionMatrixPresenterImpl(new ConfusionMatrixViewImpl(), eventBus, rf, b);
   presenter.setData(rfview);
   presenter.getView().forestFinish(rfview.getNtree());
   // String title = "Confusion Matrix<br>" + rf.getDataKey() + "<br>" + rf.getModelKey();
   String title = "Confusion Matrix<br>" + parseDatakey(rf.getDataKey());
   TabLabelView label = new TabLabelViewImpl();
   label.setLabel(title);
   label.setPresenter(this);
   view.addVisTab(presenter.getView(), label);
   visTabs.addTab(label, presenter);
 }
 @Override
 public void addConfusionMatrixTab(RF rf, RFBuilder b) {
   ConfusionMatrixViewImpl matrixView = new ConfusionMatrixViewImpl();
   matrixView.setResponseVariable(b.getResponseVariable());
   ConfusionMatrixPresenterImpl presenter =
       new ConfusionMatrixPresenterImpl(matrixView, eventBus, rf, b);
   // String title = "Confusion Matrix<br>" + rf.getDataKey() + "<br>" + rf.getModelKey();
   String title = "Confusion Matrix<br>" + parseDatakey(rf.getDataKey());
   TabLabelView label = new TabLabelViewImpl();
   label.setLabel(title);
   label.setPresenter(this);
   view.addVisTab(presenter.getView(), label);
   visTabs.addTab(label, presenter);
 }
 public void popinVisPanel(String id) {
   logger.log(Level.INFO, "Adding vis panel back in!");
   TabLabelView tab = visTabs.unpopTab(Integer.parseInt(id));
   TabPanelPresenter p = visTabs.getPresenter(tab);
   // FIXME: reusing presenters/view does not work yet...
   // p.added();
   visTabs.deleteTab(tab);
   if (p instanceof ConfusionMatrixPresenterImpl) {
     ConfusionMatrixPresenterImpl cp = (ConfusionMatrixPresenterImpl) p;
     addConfusionMatrixTab(cp.getRandomForest(), cp.getData(), cp.getBuilder());
   } else {
     TreePanelPresenterImpl tp = (TreePanelPresenterImpl) p;
     addVisTab(tp.getDatakey(), tp.getModelkey(), tp.getTreeIndex());
   }
 }