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); } } }
/** @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)); } }