aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/GUI.java
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-04-01 23:00:53 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-04-01 23:00:53 +0100
commit02fd2bc7059da416937beb1abe67e5ca60379030 (patch)
tree609341fe10aaa0f2dc45a1e72eba20bd24fb1281 /src/jcgp/GUI.java
parenta757deacded0d7357a9f68462d3f2051e16004ee (diff)
Settings pane now actually controls the parameters, not much left to do.
Diffstat (limited to 'src/jcgp/GUI.java')
-rw-r--r--src/jcgp/GUI.java169
1 files changed, 0 insertions, 169 deletions
diff --git a/src/jcgp/GUI.java b/src/jcgp/GUI.java
deleted file mode 100644
index d81e760..0000000
--- a/src/jcgp/GUI.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package jcgp;
-
-import java.util.concurrent.ExecutionException;
-
-import javafx.application.Application;
-import javafx.application.Platform;
-import javafx.concurrent.Service;
-import javafx.concurrent.Task;
-import javafx.scene.Scene;
-import javafx.scene.control.Tab;
-import javafx.scene.control.TabPane;
-import javafx.scene.control.TabPane.TabClosingPolicy;
-import javafx.scene.layout.BorderPane;
-import javafx.stage.Stage;
-import jcgp.JCGP.Resources;
-import jcgp.gui.ChromosomePane;
-import jcgp.gui.console.GUIConsole;
-import jcgp.gui.settings.SettingsPane;
-
-public class GUI extends Application {
-
- /* Colours */
- /** NEUTRAL_COLOUR is the colour elements should be when no interaction is occurring
- * (no hovering, clicking, dragging or any other form of interaction). */
- public static final String NEUTRAL_COLOUR = "#FFFFFF";
- public static final String HARD_HIGHLIGHT_COLOUR = "#5496FF";
- // 89AAD6
- public static final String MEDIUM_HIGHLIGHT_COLOUR = "#75BAFF";
- public static final String SOFT_HIGHLIGHT_COLOUR = "#C7DFFF";
- // BDFFC2
- public static final String GOOD_SELECTION_COLOUR = "#38C25B";
- // FBFFB8
- public static final String NEUTRAL_SELECTION_COLOUR = "#EDEB72";
- // FF9C9C
- public static final String BAD_SELECTION_COLOUR = "#F53D3D";
-
-
- /* Sizes and distances */
- public static final double RESIZE_MARGIN = 5.0;
-
- public static final double SETTINGS_WIDTH = 200;
- public static final double CONSOLE_HEIGHT = 100;
-
- public static final double WRAP_WIDTH = 90;
-
- private static JCGP cgp;
- public static Resources resources;
-
- private BorderPane leftPane;
- private BorderPane window;
-
- private ChromosomePane[] chromosomes;
- private TabPane mainPane;
-
- private GUIConsole console = new GUIConsole();
- private SettingsPane settings;
-
- private Service<Integer> cgpService;
-
- private static boolean evolving = false;
-
- public static void main(String[] args) {
- cgp = new JCGP();
- resources = cgp.getResources();
-
- launch();
- }
-
- @Override
- public void start(Stage primaryStage) throws Exception {
-
- cgpService = new Service<Integer> () {
-
- @Override
- protected Task<Integer> createTask() {
-
- Task<Integer> t = new Task<Integer>() {
- @Override
- protected Integer call() throws Exception {
- while (!isCancelled()) {
- cgp.nextGeneration();
- }
- return null;
- }
- };
-
- return t;
- }
- };
-
- /*
- * Instantiate the various GUI elements here.
- *
- *
- */
-
- mainPane = new TabPane();
- mainPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
- chromosomes = new ChromosomePane[cgp.getResources().getInt("popSize")];
- Tab tab;
- for (int i = 0; i < chromosomes.length; i++) {
- chromosomes[i] = new ChromosomePane(cgp.getPopulation().getChromosome(i), resources);
- tab = new Tab("Chr " + i);
- tab.setContent(chromosomes[i]);
- mainPane.getTabs().add(tab);
- }
-
- settings = new SettingsPane(cgp, this);
-
- //mainPane.setPrefHeight(500);
-
- leftPane = new BorderPane();
- leftPane.setCenter(mainPane);
- leftPane.setBottom(console);
-
- window = new BorderPane();
-
- window.setCenter(leftPane);
- window.setRight(settings);
-
- //primaryStage.setMinHeight(600);
- //primaryStage.setMinWidth(800);
-
- primaryStage.setTitle("JCGP");
-
- primaryStage.setScene(new Scene(window));
- primaryStage.show();
- }
-
- public void updateNodeGrids() {
- for (int i = 0; i < chromosomes.length; i++) {
- chromosomes[i].update();
- }
- }
-
- public void playPause() {
- if (!evolving) {
- evolving = true;
- cgpService.restart();
- } else {
- cgpService.cancel();
- evolving = false;
- }
- }
-
- public void step() {
- if (!evolving) {
- Thread t = new Thread(new Task<Object>() {
- @Override
- protected Object call() throws Exception {
- cgp.nextGeneration();
- evolving = false;
- return null;
- }
- });
- evolving = true;
- t.start();
- }
- }
-
- public boolean isEvolving() {
- return evolving;
- }
-
- public Service<Integer> getCGPService() {
- return cgpService;
- }
-
-}