Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
idatt1002_2023_9
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Kluge Svendsrud
idatt1002_2023_9
Commits
90881c6f
Commit
90881c6f
authored
2 years ago
by
Harry Linrui XU
Browse files
Options
Downloads
Patches
Plain Diff
Disable buttons once budget period is done
parent
85a09f6a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!58
Dynamic daysleft
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/no/ntnu/idatt1002/demo/controller/MainMenuController.java
+9
-7
9 additions, 7 deletions
...no/ntnu/idatt1002/demo/controller/MainMenuController.java
src/main/resources/view/MainMenuNew.fxml
+1
-1
1 addition, 1 deletion
src/main/resources/view/MainMenuNew.fxml
with
10 additions
and
8 deletions
src/main/java/no/ntnu/idatt1002/demo/controller/MainMenuController.java
+
9
−
7
View file @
90881c6f
...
@@ -52,14 +52,11 @@ public class MainMenuController {
...
@@ -52,14 +52,11 @@ public class MainMenuController {
@FXML
@FXML
private
DatePicker
date
;
private
DatePicker
date
;
@FXML
private
Button
expenseBtn
;
@FXML
@FXML
private
Button
foodBtn
;
private
Button
foodBtn
;
@FXML
@FXML
private
Button
incomeBtn
;
private
Button
income
Expense
Btn
;
@FXML
@FXML
private
ProgressBar
mainBar
;
private
ProgressBar
mainBar
;
...
@@ -126,6 +123,13 @@ public class MainMenuController {
...
@@ -126,6 +123,13 @@ public class MainMenuController {
//Make calendar uneditable
//Make calendar uneditable
formatDatePicker
();
formatDatePicker
();
if
(
generalBudget
.
getDaysLeftOfBudgetPeriod
()
==
0
)
{
daysLeftLbl
.
setOpacity
(
0
);
//Disable buttons once budget period has passed
foodBtn
.
setDisable
(
true
);
incomeExpenseBtn
.
setDisable
(
true
);
budgetBtn
.
setDisable
(
true
);
}
daysLeftLbl
.
setText
(
"Days left of budget: "
+
generalBudget
.
getDaysLeftOfBudgetPeriod
());
daysLeftLbl
.
setText
(
"Days left of budget: "
+
generalBudget
.
getDaysLeftOfBudgetPeriod
());
}
}
...
@@ -303,9 +307,7 @@ public class MainMenuController {
...
@@ -303,9 +307,7 @@ public class MainMenuController {
FXMLLoader
loader
=
new
FXMLLoader
();
FXMLLoader
loader
=
new
FXMLLoader
();
if
(
event
.
getSource
()
==
foodBtn
)
{
if
(
event
.
getSource
()
==
foodBtn
)
{
loader
.
setLocation
(
getClass
().
getResource
(
"/view/SuggestRecipes.fxml"
));
loader
.
setLocation
(
getClass
().
getResource
(
"/view/SuggestRecipes.fxml"
));
}
else
if
(
event
.
getSource
()
==
expenseBtn
)
{
}
else
if
(
event
.
getSource
()
==
incomeExpenseBtn
)
{
loader
.
setLocation
(
getClass
().
getResource
(
"/view/IncomeAndExpenses.fxml"
));
}
else
if
(
event
.
getSource
()
==
incomeBtn
)
{
loader
.
setLocation
(
getClass
().
getResource
(
"/view/IncomeAndExpenses.fxml"
));
loader
.
setLocation
(
getClass
().
getResource
(
"/view/IncomeAndExpenses.fxml"
));
}
else
if
(
event
.
getSource
()
==
budgetBtn
)
{
}
else
if
(
event
.
getSource
()
==
budgetBtn
)
{
loader
.
setLocation
(
getClass
().
getResource
(
"/view/BudgetNewest.fxml"
));
loader
.
setLocation
(
getClass
().
getResource
(
"/view/BudgetNewest.fxml"
));
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/view/MainMenuNew.fxml
+
1
−
1
View file @
90881c6f
...
@@ -127,7 +127,7 @@
...
@@ -127,7 +127,7 @@
<String
fx:value=
"font"
/>
<String
fx:value=
"font"
/>
</styleClass>
</styleClass>
</Button>
</Button>
<Button
fx:id=
"incomeBtn"
alignment=
"TOP_CENTER"
contentDisplay=
"TOP"
mnemonicParsing=
"false"
onAction=
"#switchScene"
prefHeight=
"100.0"
prefWidth=
"175.0"
stylesheets=
"@../style.css"
text=
"Income/expenses"
>
<Button
fx:id=
"income
Expense
Btn"
alignment=
"TOP_CENTER"
contentDisplay=
"TOP"
mnemonicParsing=
"false"
onAction=
"#switchScene"
prefHeight=
"100.0"
prefWidth=
"175.0"
stylesheets=
"@../style.css"
text=
"Income/expenses"
>
<graphic>
<graphic>
<ImageView
fitHeight=
"75.0"
fitWidth=
"75.0"
pickOnBounds=
"true"
preserveRatio=
"true"
>
<ImageView
fitHeight=
"75.0"
fitWidth=
"75.0"
pickOnBounds=
"true"
preserveRatio=
"true"
>
<image>
<image>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment