Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
Added TODO 4 in Task 1
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrencekoehler committed Nov 12, 2023
1 parent faaee87 commit a57f70e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
21 changes: 20 additions & 1 deletion vaadin-app/src/main/java/com/example/esde/views/task1/Task1.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.example.esde.views.task1;

import com.example.esde.views.MainLayout;
import com.example.esde.views.task2.Task2;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.html.H2;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextField;
Expand All @@ -20,13 +22,15 @@ public class Task1 extends VerticalLayout {
private H2 header;
private TextField textfield;
private Button button;
private Button successButton;

public Task1() {
header = createHeader();
button = createButton();
successButton = createSuccessButton();
textfield = null;

add(header, button);
add(header, button, successButton);
}

/**
Expand Down Expand Up @@ -57,4 +61,19 @@ private Button createButton() {
return button;
}

/**
* TODO 4.1: Add a method that returns a new green button (hint: change the property "background-color")
* TODO 4.2: Clicking on the button should navigate to the next task (Task2)
* (Dont forget to add the button to the layout)
*/
private Button createSuccessButton() {
Button button = new Button();
button.setText("Next Task");
button.getStyle().set("background-color","green");
button.addClickListener(buttonClickEvent -> {
getUI().ifPresent(ui -> ui.navigate(Task2.class));
});
return button;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.theme.Theme;
import com.vaadin.flow.theme.lumo.Lumo;

/**
* This will be a very simple task, change some values, create some objects, and you'll be done!
Expand Down Expand Up @@ -57,4 +55,10 @@ private Button createButton() {
return button;
}

/**
* TODO 4.1: Add a method that returns a new green button (hint: change the property "background-color")
* TODO 4.2: Clicking on the button should navigate to the next task (Task2)
* (Dont forget to add the button to the layout)
*/

}

0 comments on commit a57f70e

Please sign in to comment.