Skip to content

Commit 1b0464b

Browse files
committed
Merge branch 'Fix-completed-assets-text' into 'main'
Fixed completed task button to change style See merge request Maurycyt/idlearn!71
2 parents 95e37fd + 913dbe7 commit 1b0464b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scenes/src/main/java/mimuw/idlearn/scenes/controllers/TaskSelectionController.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ public class TaskSelectionController extends GenericController {
2424
@FXML
2525
private BorderPane mainBorderPane;
2626

27-
private void connectButtonToCoding(Button codeBtn, String taskTitle, boolean isCompleted) {
27+
private void connectButtonToCoding(Label taskLabel, Button codeBtn, String taskTitle, boolean isCompleted) {
2828
// make the style change dynamically
2929
PointsGiver.connectToTaskCompletion(event -> {
3030
String incomingText = (String)event.value();
31-
if (incomingText.equals(codeBtn.getText()))
31+
32+
if (incomingText.equals(taskLabel.getText()))
3233
ResourceHandler.setStyleForUnlockedAsset(codeBtn);
3334
});
3435
if (isCompleted)
@@ -70,15 +71,15 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
7071
try {
7172
GridPane gridPane = FXMLLoader.load(ResourceHandler.TaskGridPane);
7273
gridPane.setStyle("-fx-cursor: hand"); // adding this here as the hand cursor doesn't work in the children for some reason
73-
74+
//FIXME: the codeBtn has the "unclickableButton" class
7475
var label = (Label)gridPane.getChildren().get(0);
7576
var codeBtn = (Button)gridPane.getChildren().get(2);
7677
var testsBtn = (Button)gridPane.getChildren().get(1);
7778

7879
label.setText(taskTitle);
7980
label.setStyle("-fx-font-size: 20px");
8081
label.setWrapText(true);
81-
connectButtonToCoding(codeBtn, taskTitle, completedTasks.contains(taskTitle));
82+
connectButtonToCoding(label, codeBtn, taskTitle, completedTasks.contains(taskTitle));
8283
connectButtonToTestSolving(testsBtn, taskTitle);
8384

8485
tasksVBox.getChildren().add(gridPane);

0 commit comments

Comments
 (0)