package jcgp.gui.population; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; import jcgp.JCGP; import jcgp.backend.population.Population; import jcgp.backend.resources.Resources; public class PopulationPane extends TabPane { public PopulationPane(JCGP jcgp) { super(); setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); remakeTabs(jcgp.getPopulation(), jcgp.getResources()); } public void remakeTabs(Population population, Resources resources) { getTabs().clear(); Tab tab; ChromosomePane cp; for (int i = 0; i < resources.getInt("popSize"); i++) { cp = new ChromosomePane(population.getChromosome(i), resources); tab = new Tab("Chr " + i); tab.setContent(cp); getTabs().add(tab); } } public void updateGenes() { for (int i = 0; i < getChildrenUnmodifiable().size(); i++) { ((ChromosomePane) getTabs().get(i).getContent()).updateGenes(); } } public void unlockOutputs() { for (int i = 0; i < getChildrenUnmodifiable().size(); i++) { ((ChromosomePane) getTabs().get(i).getContent()).unlockOutputs(); } } public void relockOutputs() { for (int i = 0; i < getChildrenUnmodifiable().size(); i++) { ((ChromosomePane) getTabs().get(i).getContent()).relockOutputs(); } } }