trainDialogueJPanel.setup(world, viewLists, callbacks, modelRoot);
trainDialogueJPanel.setup(world, viewLists, modelRoot);
    public void setup() {    	this.w = modelRoot.getWorld();    	this.vl = modelRoot.getViewLists();                moveReceiver = modelRoot.getReceiver();                if (w == null)            throw new NullPointerException();        if (vl == null)            throw new NullPointerException();                this.world = w;        viewLists = vl;                //Setup the various dialogue boxes.        // setup the terrain info dialogue.        terrainInfo = new TerrainInfoJPanel();        terrainInfo.setup(w, vl);                // setup the supply and demand at station dialogue.        stationInfo = new StationInfoJPanel();        stationInfo.setup(modelRoot);                // setup the 'show controls' dialogue        showControls = new HtmlJPanel(DialogueBoxController.class.getResource("/jfreerails/client/view/game_controls.html"));        showControls.setup(w, vl, this.closeCurrentDialogue);                about = new HtmlJPanel(DialogueBoxController.class.getResource("/jfreerails/client/view/about.htm"));        about.setup(w, vl, this.closeCurrentDialogue);                how2play = new HtmlJPanel(DialogueBoxController.class.getResource("/jfreerails/client/view/how_to_play.htm"));        how2play.setup(w, vl, this.closeCurrentDialogue);                //Set up select engine dialogue.        selectEngine = new SelectEngineJPanel();        selectEngine.setCancelButtonActionListener(this.closeCurrentDialogue);        selectEngine.setup(w, vl, new ActionListener() {                        public void actionPerformed(ActionEvent arg0) {                closeContent();                showSelectWagons();            }                    });        newspaper = new NewsPaperJPanel();        newspaper.setup(w, vl, closeCurrentDialogue);                selectWagons = new SelectWagonsJPanel();                final ReadOnlyWorld finalROW = this.world;        //So that inner class can reference it.        selectWagons.setup(w, vl, new ActionListener() {                        public void actionPerformed(ActionEvent arg0) {                WorldIterator wi = new NonNullElements(KEY.STATIONS, finalROW);                if (wi.next()) {                                        StationModel station = (StationModel) wi.getElement();                                        ProductionAtEngineShop before = station.getProduction();                    int engineType = selectEngine.getEngineType();                    int[] wagonTypes = selectWagons.getWagons();                    ProductionAtEngineShop after =                    new ProductionAtEngineShop(engineType, wagonTypes);                                        Move m =                    new ChangeProductionAtEngineShopMove(                    before,                    after,                    wi.getIndex());                    moveReceiver.processMove(m);                }                closeContent();            }                    });                trainDialogueJPanel = new TrainDialogueJPanel();        trainDialogueJPanel.setup(world, viewLists, callbacks, modelRoot);        trainDialogueJPanel.setTrainDetailsButtonActionListener( new ActionListener() {                        public void actionPerformed(ActionEvent arg0) {                closeContent();                showTrainList();            }                    });    }