private void refreshRanksCombo() { // Clear everything and start over! Wee! rankModel.removeAllElements(); // Determine correct profession to pass into the loop int profession = Person.getProfessionFromPrimaryRole((choiceType.getSelectedIndex() + 1)); while (campaign.getRanks().isEmptyProfession(profession) && profession != Ranks.RPROF_MW) { profession = campaign.getRanks().getAlternateProfession(profession); } for (Rank rank : campaign.getRanks().getAllRanks()) { int p = profession; // Grab rank from correct profession as needed while (rank.getName(p).startsWith("--") && p != Ranks.RPROF_MW) { if (rank.getName(p).equals("--")) { p = campaign.getRanks().getAlternateProfession(p); } else if (rank.getName(p).startsWith("--")) { p = campaign.getRanks().getAlternateProfession(rank.getName(p)); } } if (rank.getName(p).equals("-")) { continue; } rankModel.addElement(rank.getName(p)); } choiceRanks.setModel(rankModel); choiceRanks.setSelectedIndex(0); }
private void hire() { int number = (Integer) spnNumber.getModel().getValue(); while (number > 0) { Person p = campaign.newPerson(choiceType.getSelectedIndex() + 1); p.setRankNumeric( campaign .getRanks() .getRankNumericFromNameAndProfession( p.getProfession(), (String) choiceRanks.getSelectedItem())); if (!campaign.recruitPerson(p)) { number = 0; } else { number--; } } hqView.refreshPersonnelList(); hqView.refreshPatientList(); hqView.refreshTechsList(); hqView.refreshDoctorsList(); hqView.refreshReport(); hqView.refreshFinancialTransactions(); hqView.refreshOverview(); }