From: Erik V. <ev...@us...> - 2010-02-04 21:28:07
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7192/rails/ui/swing Modified Files: ORPanel.java Log Message: Info: replaced Privates by Companies. Now covers all (private and public) company types, as defined in the XML. Info display also extended. 1830 and 1835 done, others remain. Index: ORPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORPanel.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** ORPanel.java 31 Jan 2010 22:22:34 -0000 1.44 --- ORPanel.java 4 Feb 2010 21:27:59 -0000 1.45 *************** *** 158,162 **** menuBar.add(infoMenu); ! addPrivatesInfo(); addTrainsInfo(); addPhasesInfo(); --- 158,162 ---- menuBar.add(infoMenu); ! addCompanyInfo(); addTrainsInfo(); addPhasesInfo(); *************** *** 469,507 **** } ! protected void addPrivatesInfo () { ! ! List<PrivateCompanyI> privates = orWindow.gameUIManager.getGameManager().getAllPrivateCompanies(); ! if (privates == null || privates.isEmpty()) return; ! privatesInfoMenu = new JMenu(LocalText.getText("PRIVATES")); ! privatesInfoMenu.setEnabled(true); ! infoMenu.add(privatesInfoMenu); ! JMenu item; ! List<SpecialPropertyI> sps; ! StringBuffer b = new StringBuffer("<html>"); ! String info; ! for (PrivateCompanyI p : privates) { ! sps = p.getSpecialProperties(); ! b.setLength(6); ! if (Util.hasValue(p.getLongName())) { ! appendInfoText (b, p.getLongName()); ! } ! info = p.getInfoText(); ! if (Util.hasValue(info)) { ! appendInfoText(b, info); ! } else if (sps == null || sps.isEmpty()) { ! appendInfoText(b, LocalText.getText("NoSpecialProperty")); ! } else { ! for (SpecialPropertyI sp : sps) { ! appendInfoText(b, sp.getInfo()); ! } ! } ! item = new JMenu (p.getName()); ! item.setEnabled(true); ! item.add(new JMenuItem(b.toString())); ! privatesInfoMenu.add(item); ! } } --- 469,494 ---- } ! protected void addCompanyInfo() { ! CompanyManagerI cm = orUIManager.getGameUIManager().getGameManager().getCompanyManager(); ! List<CompanyTypeI> comps = cm.getCompanyTypes(); ! JMenu compMenu, menu, item; ! ! compMenu = new JMenu(LocalText.getText("Companies")); ! compMenu.setEnabled(true); ! infoMenu.add(compMenu); ! for (CompanyTypeI type : comps) { ! menu = new JMenu (LocalText.getText(type.getName())); ! menu.setEnabled(true); ! compMenu.add(menu); ! for (CompanyI comp : type.getCompanies()) { ! item = new JMenu(comp.getName()); ! item.setEnabled(true); ! item.add(new JMenuItem(comp.getInfoText())); ! menu.add(item); ! } ! } } |