public void actionPerformed(ActionEvent e) { if (e.getActionCommand() == "New") { // Unit a = UnitManager.getInstance().GenerateUnit((Player)null, "Fixme!!!", // (MechUnitParameters)null, Rating.GREEN); // UnitManager.RequestEdit(a); // SwingUtilities.invokeLater(new // factorymanager.database.data.managers.UnitEditRequestor(a)); } if (e.getActionCommand() == "Remove") { Unit a = m_UnitListPanel.GetSelectedUnit(); if (a != null) { int Result = JOptionPane.showInternalConfirmDialog( this, "Are you sure you wish to delete this Unit?", "Remove Unit", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (Result == JOptionPane.YES_OPTION) { UnitManager.getInstance().deleteUnit(a.getName()); } } } if (e.getActionCommand() == "Edit") { Unit a = m_UnitListPanel.GetSelectedUnit(); if (a != null) { // UnitManager.RequestEdit(a); } } }
public void mouseClicked(MouseEvent me) { int Index = _PersonnelTable.getSelectedRow(); _CurrentPersonnel = _Unit.getPersonnel().elementAt(Index); if (_CurrentPersonnel != _PreviousPersonnel) { GetFields(); _PreviousPersonnel = _CurrentPersonnel; SetFields(); } }
/** @param args */ public static void main(String[] args) { try { PropertyUtil.loadSystemProperties("bt/system.properties"); BattlemechManager bm = new BattlemechManager(); Vector<String> unitNames = UnitManager.getInstance().getUnitNames(); for (String unitName : unitNames) { Unit u = UnitManager.getInstance().getUnit(unitName); System.out.println(u.getName() + System.lineSeparator()); for (Battlemech mech : u.getBattlemechs()) { BattlemechRepairReport brr = bm.createRepairReport(mech, 7); System.out.println(brr.toString()); } System.out.println(System.lineSeparator()); System.out.println(System.lineSeparator()); } } catch (Exception ex) { System.out.print(ExceptionUtil.getExceptionStackTrace(ex)); } }
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(""); } }