public void popinDataPanel(String id) {
   logger.log(Level.INFO, "Adding data panel back in!");
   TabLabelView tab = dataTabs.unpopTab(Integer.parseInt(id));
   TabPanelPresenter p = dataTabs.getPresenter(tab);
   // FIXME: reusing presenters/view does not work yet...
   // p.added();
   dataTabs.deleteTab(tab);
   addDataTab(((DataPanelPresenterImpl) p).getDataKey());
 }
 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());
   }
 }
 @EventHandler
 public void onGroupChange(GlobalPlayerAttachmentUpdateEvent event) {
   if (event.getAttachment() instanceof StateAttachment) {
     manager.onStateUpdate(event.getPlayer());
     channel.broadcast(new RefreshPacket(event.getPlayer().getUniqueId()));
   }
 }
 @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);
 }
Exemple #7
0
  public void addTab(String title, int indicatorView, Class<?> clss, Bundle args) {
    if (title == null) {
      throw new IllegalArgumentException("title cann't be null!");
    }

    mTabManager.addTab(
        mTabHost
            .newTabSpec(title)
            .setIndicator(
                new LabelIndicatorStrategy(this, title, indicatorView)
                    .createIndicatorView(mTabHost)),
        clss,
        args);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    CompromisosVerificacion_Activity.VISTA_CARGADA = 0;
    PosicionVerificacion_Activity.VISTA_CARGADA = 0;
    PresentacionVerificacion_Activity.VISTA_CARGADA = 0;
    CombosVerificacion_Activity.VISTA_CARGADA = 0;

    setContentView(R.layout.frameng_tabs);
    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabHost.setup();

    mTabManager = new TabManager(this, mTabHost, R.id.realtabcontent);

    mTabManager.addTab(
        mTabHost.newTabSpec("Inventario").setIndicator("Inventario"),
        CompromisosVerificacion_Activity.class,
        getIntent().getExtras());
    mTabManager.addTab(
        mTabHost.newTabSpec("Posicion").setIndicator("Posici—n"),
        PosicionVerificacion_Activity.class,
        getIntent().getExtras());
    mTabManager.addTab(
        mTabHost.newTabSpec("Presentacion").setIndicator("Presentaci—n"),
        PresentacionVerificacion_Activity.class,
        getIntent().getExtras());
    mTabManager.addTab(
        mTabHost.newTabSpec("Combos").setIndicator("Combos"),
        CombosVerificacion_Activity.class,
        getIntent().getExtras());

    if (savedInstanceState != null) {
      mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab"));
    }
  }
 @Override
 public void close(TabLabelView tab) {
   if (dataTabs.hasTab(tab)) {
     int index = dataTabs.deleteTab(tab);
     view.removeDataTab(index);
     TabPanelPresenter p = dataTabs.getPresenter(tab);
     p.removed();
   } else if (visTabs.hasTab(tab)) {
     int index = visTabs.deleteTab(tab);
     view.removeVisTab(index);
     TabPanelPresenter p = visTabs.getPresenter(tab);
     p.removed();
   } else {
     logger.log(Level.SEVERE, "Unknown tab!");
   }
 }
 @EventHandler(priority = EventPriority.HIGHEST)
 public void onDisconnect(PlayerDisconnectEvent event) {
   manager.onDisconnect(event.getPlayer());
 }
 @EventHandler(priority = EventPriority.HIGHEST)
 public void onConnect(PostLoginEvent event) {
   manager.onConnect(event.getPlayer());
 }
  public static void main(String[] args) {

    System.out.println("Si vous voulez jouer en graphique, tapez 1, sinon 0.");
    Scanner lecture = new Scanner(System.in);
    graphique = lecture.nextInt();

    if (graphique == 0) {
      System.out.println("Avec combien de carrés voulez-vous jouer?");
      Scanner scan = new Scanner(System.in);
      int nbcarres = scan.nextInt();

      if (nbcarres == 4) {
        c = 3;
        l = 3;
      }

      if (nbcarres == 9) {
        c = 4;
        l = 4;
      }

      if (nbcarres == 16) {
        c = 5;
        l = 5;
      }

      if (nbcarres == 25) {
        c = 6;
        l = 6;
      }

      // Choix du type de jeu
      Scanner scn = new Scanner(System.in);
      System.out.println("Voulez-vous jouer contre un humain(0), ou un ordinateur(1)?");
      typeJeu = scn.nextInt();

      // Affichage du plateau de jeu
      TabManager tab1 = new TabManager(c, l);
      System.out.println();
      tab1.initTab();
      System.out.println();
      System.out.println();
      System.out.println();

      while (true) {
        Test1.joueur = 1;
        System.out.println("Joueur A, horizontale(h) ou verticale(v)?");
        Scanner dir = new Scanner(System.in);
        String str = dir.nextLine();
        System.out.println("ligne: ");
        int coox = dir.nextInt();
        System.out.println("colonne: ");
        int cooy = dir.nextInt();

        if (str.charAt(0) == 'h') {
          TabManager.horizontale[coox - 1][cooy - 1] = 1;
        }

        if (str.charAt(0) == 'v') {
          TabManager.verticale[coox - 1][cooy - 1] = 1;
        }

        tab1.updateTab();
        checkWin(TabManager.horizontale, TabManager.verticale);
        System.out.println("Points A: " + Test1.pointsA);
        System.out.println("Points B: " + Test1.pointsB);
        System.out.println("__________________________________________________");
        System.out.println();
        if (checkEnd(TabManager.horizontale, TabManager.verticale) == true) {
          System.out.println("La partie est finie!");
          break;
        }

        if (typeJeu == 0) {

          Test1.joueur = 2;
          System.out.println("Joueur B, horizontale(h) ou verticale(v)?");
          Scanner dire = new Scanner(System.in);
          String strg = dire.nextLine();
          System.out.println("ligne: ");
          coox = dire.nextInt();
          System.out.println("colonne: ");
          cooy = dire.nextInt();

          if (strg.charAt(0) == 'h') {
            TabManager.horizontale[coox - 1][cooy - 1] = 1;
          }

          if (strg.charAt(0) == 'v') {
            TabManager.verticale[coox - 1][cooy - 1] = 1;
          }

          tab1.updateTab();
          checkWin(TabManager.horizontale, TabManager.verticale);
          System.out.println("Points A: " + Test1.pointsA);
          System.out.println("Points B: " + Test1.pointsB);
          System.out.println("__________________________________________________");
          if (checkEnd(TabManager.horizontale, TabManager.verticale) == true) {
            System.out.println("La partie est finie!");
            break;
          }
        }

        if (typeJeu == 1) {
          Test1.joueur = 2;
          IA();
          tab1.updateTab();
          checkWin(TabManager.horizontale, TabManager.verticale);
          System.out.println("Points A: " + Test1.pointsA);
          System.out.println("Points B: " + Test1.pointsB);
          System.out.println("__________________________________________________");
          if (checkEnd(TabManager.horizontale, TabManager.verticale) == true) {
            System.out.println("La partie est finie!");
            break;
          }
        }
      }
    }

    if (graphique == 1) {

      Fenetre fen = new Fenetre();
      while (Fenetre.b == false) {
        System.out.println("");
      }
      TabManager tabg = new TabManager(c, l);
      StdDraw.setXscale(0, 40 + (Test1.c - 1) * 40);
      StdDraw.setYscale(0, 40 + (Test1.c - 1) * 40);

      fen.affichageGrille(TabManager.horizontale, TabManager.verticale);

      while (!(checkEnd(TabManager.horizontale, TabManager.verticale))) {
        Test1.joueur = 1;
        System.out.println("Joueur A");
        System.out.println(Test1.b);
        while (Test1.b == false) {
          clicSouris();
        }

        System.out.println("J1");
        checkWin(TabManager.horizontale, TabManager.verticale);
        fen.affichageGrille(TabManager.horizontale, TabManager.verticale);
        Test1.b = false;

        if (Test1.typeJeu == 0) {
          Test1.joueur = 2;
          System.out.println("Joueur B");

          while (Test1.b == false) {
            clicSouris();
          }
          System.out.println("J2");
          checkWin(TabManager.horizontale, TabManager.verticale);
          fen.affichageGrille(TabManager.horizontale, TabManager.verticale);
          Test1.b = false;

        } else {

          Test1.joueur = 2;
          IA();
          System.out.println("TOP");
          checkWin(TabManager.horizontale, TabManager.verticale);
          fen.affichageGrille(TabManager.horizontale, TabManager.verticale);
          Test1.b = false;
        }
      }

      StdDraw.clear();
      StdDraw.text(50, 80, "La partie est finie!");
      if (Test1.pointsA > Test1.pointsB) {
        StdDraw.text(50, 70, "Le joueur A remporte la partie!");
      }
      if (Test1.pointsA < Test1.pointsB) {
        StdDraw.text(50, 70, "Le joueur B remporte la partie!");
      }
      if (Test1.pointsA == Test1.pointsB) {
        StdDraw.text(50, 70, "Match Nul!");
      }
    }
  }