protected void GetFields() { if (_PreviousPersonnel == null) return; _PreviousPersonnel.setName(_NameTextField.getText()); _PreviousPersonnel.setCallsign(_CallsignTextField.getText()); _PreviousPersonnel.setRank((Rank) _RankCombo.getSelectedItem()); _PreviousPersonnel.setRating((Rating) _RatingCombo.getSelectedItem()); _PreviousPersonnel.setNotes(_NotesTextArea.getText()); }
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals("AddPersonnel")) { AddNewPersonnel(); } if (command.equals("RemovePersonnel")) {} if (command.equals("RandomName")) { SetRandomName(); } if (command.equalsIgnoreCase("AssetAssignment")) { PersonnelAssetAssignmentDialog dlg = new PersonnelAssetAssignmentDialog(_CurrentPersonnel.getName(), _Unit); dlg.setLocationRelativeTo(this); dlg.setModal(true); dlg.setVisible(true); if (dlg.wasAssetAssigned()) { try { UnitManager.getInstance().saveUnit(_Unit); SetFields(); } catch (Exception ex) { ex.printStackTrace(); } } } }
protected void SetFields() { if (_CurrentPersonnel != null) { _NameTextField.setText(_CurrentPersonnel.getName()); _CallsignTextField.setText(_CurrentPersonnel.getCallsign()); _RankCombo.setSelectedIndex(_CurrentPersonnel.getRank().ordinal()); _RatingCombo.setSelectedIndex(_CurrentPersonnel.getRating().ordinal()); _JobTypeCombo.setSelectedIndex(_CurrentPersonnel.getJobType().ordinal()); _AssetAssignmentTextField.setText( _Unit.getAssetDetailForAssetAssignedToPersonnel(_CurrentPersonnel.getName())); _NotesTextArea.setText(_CurrentPersonnel.getNotes()); } else { _NameTextField.setText(""); _CallsignTextField.setText(""); _RankCombo.setSelectedIndex(-1); _HomePlanetCombo.setSelectedIndex(-1); _RatingCombo.setSelectedIndex(-1); _JobTypeCombo.setSelectedIndex(-1); _AssetAssignmentTextField.setText(""); _NotesTextArea.setText(""); } }