Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BudgetMaster
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
Model registry
Operate
Environments
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
Robert Goldmann
BudgetMaster
Commits
f60c3821
Commit
f60c3821
authored
8 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
implemented date picker for chart categories
parent
972c92c6
No related branches found
No related tags found
2 merge requests
!104
merge v_1_2_0 into master
,
!100
merge charts into v_1_2_0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/de/deadlocker8/budgetmaster/ui/ChartController.java
+60
-11
60 additions, 11 deletions
src/de/deadlocker8/budgetmaster/ui/ChartController.java
src/de/deadlocker8/budgetmaster/ui/ChartTab.fxml
+9
-0
9 additions, 0 deletions
src/de/deadlocker8/budgetmaster/ui/ChartTab.fxml
with
69 additions
and
11 deletions
src/de/deadlocker8/budgetmaster/ui/ChartController.java
+
60
−
11
View file @
f60c3821
package
de.deadlocker8.budgetmaster.ui
;
import
java.time.LocalDate
;
import
java.util.ArrayList
;
import
org.joda.time.DateTime
;
import
de.deadlocker8.budgetmaster.logic.CategoryInOutSum
;
import
de.deadlocker8.budgetmaster.logic.ServerConnection
;
import
de.deadlocker8.budgetmaster.logic.chartGenerators.PieChartGenerator
;
import
fontAwesome.FontIcon
;
import
fontAwesome.FontIconType
;
import
javafx.fxml.FXML
;
import
javafx.scene.control.Accordion
;
import
javafx.scene.control.Button
;
import
javafx.scene.control.DateCell
;
import
javafx.scene.control.DatePicker
;
import
javafx.scene.layout.AnchorPane
;
import
javafx.scene.layout.HBox
;
import
javafx.scene.paint.Color
;
import
javafx.util.Callback
;
import
logger.Logger
;
public
class
ChartController
implements
Refreshable
...
...
@@ -20,6 +29,7 @@ public class ChartController implements Refreshable
@FXML
private
HBox
hboxChartCategories
;
@FXML
private
DatePicker
datePickerEnd
;
@FXML
private
AnchorPane
anchorPaneChartMonth
;
@FXML
private
Button
buttonChartCategoriesShow
;
private
Controller
controller
;
...
...
@@ -27,22 +37,46 @@ public class ChartController implements Refreshable
{
this
.
controller
=
controller
;
// TODO design, chart chooser
anchorPaneMain
.
setStyle
(
"-fx-background-color: #F4F4F4;"
);
hboxChartCategories
.
setStyle
(
"-fx-background-color: #F4F4F4;"
);
anchorPaneChartMonth
.
setStyle
(
"-fx-background-color: #F4F4F4;"
);
}
FontIcon
iconShow
=
new
FontIcon
(
FontIconType
.
CHECK
);
iconShow
.
setSize
(
16
);
iconShow
.
setColor
(
Color
.
WHITE
);
buttonChartCategoriesShow
.
setStyle
(
"-fx-background-color: #2E79B9;"
);
buttonChartCategoriesShow
.
setGraphic
(
iconShow
);
datePickerEnd
.
setDayCellFactory
(
new
Callback
<
DatePicker
,
DateCell
>()
{
@Override
public
void
refresh
()
public
DateCell
call
(
DatePicker
param
)
{
return
new
DateCell
()
{
@Override
public
void
updateItem
(
LocalDate
item
,
boolean
empty
)
{
super
.
updateItem
(
item
,
empty
);
if
(
item
.
isBefore
(
datePickerStart
.
getValue
().
plusDays
(
1
)))
{
setDisable
(
true
);
setStyle
(
"-fx-background-color: #ffc0cb;"
);
}
}
};
}
});
}
public
void
chartCategoriesShow
()
{
// TODO example
// TODO date range chooser
// TODO check wether starDate and EndDate are included and are working correctly
DateTime
startDate
=
DateTime
.
parse
(
datePickerStart
.
getValue
().
toString
());
DateTime
endDate
=
DateTime
.
parse
(
datePickerEnd
.
getValue
().
toString
());
try
{
ServerConnection
connection
=
new
ServerConnection
(
controller
.
getSettings
());
ArrayList
<
CategoryInOutSum
>
sums
=
connection
.
getCategoryInOutSumForMonth
(
controller
.
getCurrentDate
().
withDayOfMonth
(
1
),
controller
.
getCurr
en
t
Date
().
dayOfMonth
().
withMaximumValue
()
);
ArrayList
<
CategoryInOutSum
>
sums
=
connection
.
getCategoryInOutSumForMonth
(
startDate
,
en
d
Date
);
hboxChartCategories
.
getChildren
().
clear
();
...
...
@@ -56,6 +90,21 @@ public class ChartController implements Refreshable
catch
(
Exception
e
)
{
Logger
.
error
(
e
);
//TODO
//controller.showConnectionErrorAlert(e.getMessage());
}
}
@Override
public
void
refresh
()
{
//chart categories
LocalDate
startDate
=
LocalDate
.
parse
(
controller
.
getCurrentDate
().
withDayOfMonth
(
1
).
toString
(
"yyyy-MM-dd"
));
LocalDate
endDate
=
LocalDate
.
parse
(
controller
.
getCurrentDate
().
dayOfMonth
().
withMaximumValue
().
toString
(
"yyy-MM-dd"
));
datePickerStart
.
setValue
(
startDate
);
datePickerEnd
.
setValue
(
endDate
);
chartCategoriesShow
();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/de/deadlocker8/budgetmaster/ui/ChartTab.fxml
+
9
−
0
View file @
f60c3821
...
...
@@ -2,6 +2,7 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Accordion?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.DatePicker?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TitledPane?>
...
...
@@ -41,6 +42,14 @@
</font>
</Label>
<DatePicker
fx:id=
"datePickerEnd"
/>
<Button
fx:id=
"buttonChartCategoriesShow"
mnemonicParsing=
"false"
onAction=
"#chartCategoriesShow"
>
<font>
<Font
name=
"System Bold"
size=
"12.0"
/>
</font>
<HBox.margin>
<Insets
left=
"15.0"
/>
</HBox.margin>
</Button>
</children>
<HBox.margin>
<Insets
left=
"15.0"
/>
...
...
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