/** * Rafraichir la liste des statuts * * @param reconstruireListe forcer la reconstruction de la liste */ private void refreshStatuts(boolean reconstruireListe) { if (ContestOrg.get().is(ContestOrg.STATE_OPEN)) { // Ne plus écouter les évenements sur la liste des statuts this.jcb_statut.removeItemListener(this); // Déterminer s'il faut inclure ou non le statut "homologué" boolean isStatutHomologueActive = ContestOrg.get().getCtrlParticipants().isStatutHomologueActive(); if (this.jtable.getSelectedRow() != -1) { // Récupérer le statut du participant sélectionné InfosModelParticipant.Statut statut = (InfosModelParticipant.Statut) this.jtable .getModel() .getValueAt( this.jtable .getRowSorter() .convertRowIndexToModel(this.jtable.getSelectedRow()), this.jtable.getModel().getColumnCount() - 1); // Reconstruire la liste des statuts ? if (statut == InfosModelParticipant.Statut.HOMOLOGUE) { if (this.index_homologue == -1) { reconstruireListe = true; isStatutHomologueActive = true; } } else if (this.index_homologue != -1 && !ContestOrg.get().getCtrlParticipants().isStatutHomologueActive()) { reconstruireListe = true; isStatutHomologueActive = false; } } // Recontruire la liste des statuts if (reconstruireListe) { this.jcb_statut.removeAllItems(); boolean typeParticipantEquipe = ContestOrg.get().getCtrlParticipants().getTypeParticipants() == InfosModelConcours.PARTICIPANTS_EQUIPES; if (isStatutHomologueActive) { this.jcb_statut.addItem( typeParticipantEquipe ? InfosModelParticipant.Statut.ABSENT.getNomEquipe() : InfosModelParticipant.Statut.ABSENT.getNomJoueur()); this.index_absent = 0; this.jcb_statut.addItem( typeParticipantEquipe ? InfosModelParticipant.Statut.PRESENT.getNomEquipe() : InfosModelParticipant.Statut.PRESENT.getNomJoueur()); this.index_present = 1; this.jcb_statut.addItem( typeParticipantEquipe ? InfosModelParticipant.Statut.HOMOLOGUE.getNomEquipe() : InfosModelParticipant.Statut.HOMOLOGUE.getNomJoueur()); this.index_homologue = 2; this.jcb_statut.addItem( typeParticipantEquipe ? InfosModelParticipant.Statut.FORFAIT.getNomEquipe() : InfosModelParticipant.Statut.FORFAIT.getNomJoueur()); this.index_forfait = 3; this.jcb_statut.addItem( typeParticipantEquipe ? InfosModelParticipant.Statut.DISQUALIFIE.getNomEquipe() : InfosModelParticipant.Statut.DISQUALIFIE.getNomJoueur()); this.index_disqualifie = 4; } else { this.jcb_statut.addItem( typeParticipantEquipe ? InfosModelParticipant.Statut.ABSENT.getNomEquipe() : InfosModelParticipant.Statut.ABSENT.getNomJoueur()); this.index_absent = 0; this.jcb_statut.addItem( typeParticipantEquipe ? InfosModelParticipant.Statut.PRESENT.getNomEquipe() : InfosModelParticipant.Statut.PRESENT.getNomJoueur()); this.index_present = 1; this.index_homologue = -1; this.jcb_statut.addItem( typeParticipantEquipe ? InfosModelParticipant.Statut.FORFAIT.getNomEquipe() : InfosModelParticipant.Statut.FORFAIT.getNomJoueur()); this.index_forfait = 2; this.jcb_statut.addItem( typeParticipantEquipe ? InfosModelParticipant.Statut.DISQUALIFIE.getNomEquipe() : InfosModelParticipant.Statut.DISQUALIFIE.getNomJoueur()); this.index_disqualifie = 3; } } // Sélectionné le statut correspondant au participant sélectionné dans le tableau if (this.jtable.getSelectedRow() != -1) { // Récupérer le statut du participant sélectionné InfosModelParticipant.Statut statut = (InfosModelParticipant.Statut) this.jtable .getModel() .getValueAt( this.jtable .getRowSorter() .convertRowIndexToModel(this.jtable.getSelectedRow()), this.jtable.getModel().getColumnCount() - 1); // Sélectionner le statut du participant dans la liste des statut if (statut == InfosModelParticipant.Statut.ABSENT) { this.jcb_statut.setSelectedIndex(this.index_absent); } else if (statut == InfosModelParticipant.Statut.PRESENT) { this.jcb_statut.setSelectedIndex(this.index_present); } else if (statut == InfosModelParticipant.Statut.HOMOLOGUE) { this.jcb_statut.setSelectedIndex(this.index_homologue); } else if (statut == InfosModelParticipant.Statut.FORFAIT) { this.jcb_statut.setSelectedIndex(this.index_forfait); } else { this.jcb_statut.setSelectedIndex(this.index_disqualifie); } } else { this.jcb_statut.setSelectedIndex(this.index_absent); } // Ecouter à nouveau les évenemtns sur la liste des statuts this.jcb_statut.addItemListener(this); } }