Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tdt4100
v2022
students
Commits
1306a43a
Commit
1306a43a
authored
Apr 03, 2022
by
Magnus Schjølberg
Browse files
Minor fixes
parent
036b0ac6
Changes
3
Hide whitespace changes
Inline
Side-by-side
selfcheckout-example/src/main/java/selfcheckout/SelfCheckoutController.java
View file @
1306a43a
package
selfcheckout
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.time.LocalDate
;
import
java.util.ArrayList
;
...
...
@@ -27,22 +26,22 @@ public class SelfCheckoutController {
private
List
<
Item
>
selectableItemsList
;
@FXML
p
ublic
Button
login
,
adminMode
,
deleteItem
,
backButton
,
checkout
,
scanReceipt
;
p
rivate
Button
login
,
adminMode
,
deleteItem
,
backButton
,
checkout
,
scanReceipt
;
@FXML
p
ublic
TextArea
checkoutText
;
p
rivate
TextArea
checkoutText
;
@FXML
p
ublic
TextField
phoneNumber
;
p
rivate
TextField
phoneNumber
;
@FXML
p
ublic
GridPane
itemGrid
;
p
rivate
GridPane
itemGrid
;
@FXML
p
ublic
ListView
<
String
>
scannedItemsList
;
p
rivate
ListView
<
String
>
scannedItemsList
;
@FXML
p
ublic
void
initialize
()
{
p
rivate
void
initialize
()
{
initializeSelectableItemsList
();
selfCheckout
=
initializeSelfCheckout
();
updateCartDisplay
();
...
...
@@ -54,7 +53,7 @@ public class SelfCheckoutController {
}
@FXML
p
ublic
void
handleLogin
()
{
p
rivate
void
handleLogin
()
{
try
{
selfCheckout
.
registerPhoneNumber
(
phoneNumber
.
getText
());
updateCartDisplay
();
...
...
@@ -66,7 +65,7 @@ public class SelfCheckoutController {
}
@FXML
p
ublic
void
handleCheckout
()
{
p
rivate
void
handleCheckout
()
{
TextInputDialog
dialog
=
new
TextInputDialog
();
dialog
.
setTitle
(
"Write receipt"
);
dialog
.
setHeaderText
(
"Gi et navn til kvitteringen slik at du kan hente den frem igjen senere"
);
...
...
@@ -99,7 +98,7 @@ public class SelfCheckoutController {
}
@FXML
p
ublic
void
handleAdminActivation
()
{
p
rivate
void
handleAdminActivation
()
{
TextInputDialog
dialog
=
new
TextInputDialog
();
dialog
.
setTitle
(
"Admin login"
);
dialog
.
setHeaderText
(
"Skriv inn admin-passord for denne enheten for å fortsette"
);
...
...
@@ -123,7 +122,7 @@ public class SelfCheckoutController {
}
@FXML
p
ublic
void
handleAdminDeactivation
()
{
p
rivate
void
handleAdminDeactivation
()
{
selfCheckout
.
deactivateAdminMode
();
adminMode
.
visibleProperty
().
set
(
true
);
backButton
.
visibleProperty
().
set
(
false
);
...
...
@@ -133,7 +132,7 @@ public class SelfCheckoutController {
}
@FXML
p
ublic
void
handleScanReceipt
()
{
p
rivate
void
handleScanReceipt
()
{
TextInputDialog
dialog
=
new
TextInputDialog
();
dialog
.
setTitle
(
"Read receipt"
);
dialog
.
setHeaderText
(
"Skriv inn navn på kvitteringen du vil scanne inn"
);
...
...
@@ -162,7 +161,7 @@ public class SelfCheckoutController {
}
@FXML
p
ublic
void
handleItemDeletion
()
{
p
rivate
void
handleItemDeletion
()
{
int
selectedIndex
=
scannedItemsList
.
getSelectionModel
().
getSelectedIndex
();
if
(
selectedIndex
!=
-
1
)
{
selfCheckout
.
removeFromCart
(
selectedIndex
);
...
...
selfcheckout-example/src/test/java/selfcheckoutmal4/.gitinclude
0 → 100644
View file @
1306a43a
snakebird-example/src/test/java/snakebird/TileTest.java
View file @
1306a43a
...
...
@@ -5,8 +5,6 @@ import static org.junit.jupiter.api.Assertions.*;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
snakebird.Tile
;
public
class
TileTest
{
private
Tile
tile
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment