blob: bae76475b478398b88331748e1b016446a4898dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
package jcgp.gui.population;
import javafx.geometry.VPos;
import javafx.scene.Group;
import javafx.scene.paint.Paint;
import javafx.scene.shape.Circle;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
import jcgp.backend.population.Connection;
import jcgp.gui.constants.Constants;
public abstract class GUIGene extends Group {
public enum GUIGeneState {
NEUTRAL,
HOVER,
INDIRECT_HOVER,
ACTIVE_HOVER,
LOCKED_HOVER,
SOURCE,
VALID_TARGET,
NO_CHANGE_TARGET,
INVALID_TARGET
}
protected Text text = new Text();
protected Circle mainCircle = new Circle(Constants.NODE_RADIUS, Paint.valueOf("white"));
private GUIGeneState state = GUIGeneState.NEUTRAL;
protected ChromosomePane parent;
protected int locked = 0;
public GUIGene() {
text.setFont(Font.font("Arial", 12));
text.setTextOrigin(VPos.CENTER);
text.setTextAlignment(TextAlignment.CENTER);
text.setWrappingWidth(Constants.NODE_RADIUS * 2);
text.setX(-Constants.NODE_RADIUS);
text.setVisible(true);
mainCircle.setStroke(Paint.valueOf("black"));
}
public void setState(GUIGeneState newState) {
state = newState;
}
public GUIGeneState getState() {
return state;
}
public boolean isLocked() {
return locked > 0;
}
public int getLocks() {
return locked;
}
protected abstract void setLocked(boolean value);
public abstract void addLocks(int value);
public abstract void removeLocks(int value);
public abstract void updateLines();
public abstract void setChangingConnection(Connection newConnection);
public abstract Connection getChangingConnection();
public abstract void setConnectionStates(GUIGeneState newState);
public abstract void resetState();
public abstract void setConnectionLine(GUIGene gene);
public abstract void updateText();
}
|