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
7bb15c1a
Commit
7bb15c1a
authored
7 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
Fixed
#137
- report table weird behaviour
parent
3f80de99
No related branches found
No related tags found
1 merge request
!142
merge v1_3_0 into master
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/de/deadlocker8/budgetmaster/ui/ReportController.java
+114
-34
114 additions, 34 deletions
src/de/deadlocker8/budgetmaster/ui/ReportController.java
with
114 additions
and
34 deletions
src/de/deadlocker8/budgetmaster/ui/ReportController.java
+
114
−
34
View file @
7bb15c1a
...
...
@@ -6,8 +6,6 @@ import java.io.IOException;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.Optional
;
...
...
@@ -47,6 +45,7 @@ import javafx.scene.control.TableColumn.CellDataFeatures;
import
javafx.scene.control.TableView
;
import
javafx.scene.control.cell.PropertyValueFactory
;
import
javafx.scene.layout.AnchorPane
;
import
javafx.scene.layout.HBox
;
import
javafx.scene.paint.Color
;
import
javafx.stage.FileChooser
;
import
javafx.stage.Modality
;
...
...
@@ -103,24 +102,34 @@ public class ReportController implements Refreshable
private
void
initColumnPosition
()
{
TableColumn
<
ReportItem
,
Integer
>
columnPosition
=
new
TableColumn
<>(
"Nr."
);
TableColumn
<
ReportItem
,
Integer
>
columnPosition
=
new
TableColumn
<>();
columnPosition
.
setUserData
(
ColumnType
.
POSITION
);
columnPosition
.
setCellValueFactory
(
new
PropertyValueFactory
<
ReportItem
,
Integer
>(
"position"
));
columnPosition
.
setStyle
(
"-fx-alignment: CENTER;"
);
HBox
hboxColumnPosition
=
new
HBox
();
hboxColumnPosition
.
setAlignment
(
Pos
.
CENTER
);
hboxColumnPosition
.
setSpacing
(
3
);
CheckBox
checkBoxPositions
=
new
CheckBox
();
checkBoxPositions
.
setSelected
(
true
);
hboxColumnPosition
.
getChildren
().
add
(
checkBoxPositions
);
Label
labelColumnPosition
=
new
Label
(
"Nr."
);
hboxColumnPosition
.
getChildren
().
add
(
labelColumnPosition
);
checkBoxPositions
.
selectedProperty
().
addListener
((
a
,
b
,
c
)->{
String
style
=
c
?
"
-fx-alignment: CENTER;
"
:
"-fx-background-color: salmon;
-fx-alignment: CENTER;
"
;
c
olumnPosition
.
setStyle
(
style
);
String
style
=
c
?
""
:
"-fx-background-color: salmon;"
;
hboxC
olumnPosition
.
setStyle
(
style
);
columnFilter
.
toggleColumn
(
ColumnType
.
POSITION
,
c
);
});
columnPosition
.
setGraphic
(
checkBox
Position
s
);
columnPosition
.
setGraphic
(
hboxColumn
Position
);
tableView
.
getColumns
().
add
(
columnPosition
);
}
private
void
initColumnDate
()
{
TableColumn
<
ReportItem
,
String
>
columnDate
=
new
TableColumn
<>(
"Datum"
);
TableColumn
<
ReportItem
,
String
>
columnDate
=
new
TableColumn
<>();
columnDate
.
setUserData
(
ColumnType
.
DATE
);
columnDate
.
setCellValueFactory
(
new
Callback
<
TableColumn
.
CellDataFeatures
<
ReportItem
,
String
>,
ObservableValue
<
String
>>()
{
...
...
@@ -144,21 +153,31 @@ public class ReportController implements Refreshable
}
});
columnDate
.
setStyle
(
"-fx-alignment: CENTER;"
);
HBox
hboxColumnDate
=
new
HBox
();
hboxColumnDate
.
setAlignment
(
Pos
.
CENTER
);
hboxColumnDate
.
setSpacing
(
3
);
CheckBox
checkBoxDate
=
new
CheckBox
();
checkBoxDate
.
setSelected
(
true
);
hboxColumnDate
.
getChildren
().
add
(
checkBoxDate
);
Label
labelComlumnDate
=
new
Label
(
"Datum"
);
hboxColumnDate
.
getChildren
().
add
(
labelComlumnDate
);
checkBoxDate
.
selectedProperty
().
addListener
((
a
,
b
,
c
)->{
String
style
=
c
?
"
-fx-alignment: CENTER;
"
:
"-fx-background-color: salmon;
-fx-alignment: CENTER;
"
;
c
olumnDate
.
setStyle
(
style
);
String
style
=
c
?
""
:
"-fx-background-color: salmon;"
;
hboxC
olumnDate
.
setStyle
(
style
);
columnFilter
.
toggleColumn
(
ColumnType
.
DATE
,
c
);
});
columnDate
.
setGraphic
(
checkBox
Date
);
columnDate
.
setGraphic
(
hboxColumn
Date
);
columnDate
.
setComparator
(
new
DateComparator
());
tableView
.
getColumns
().
add
(
columnDate
);
}
private
void
initColumnIsRepeating
()
{
TableColumn
<
ReportItem
,
Boolean
>
columnIsRepeating
=
new
TableColumn
<>(
"Wiederholend"
);
TableColumn
<
ReportItem
,
Boolean
>
columnIsRepeating
=
new
TableColumn
<>();
columnIsRepeating
.
setUserData
(
ColumnType
.
REPEATING
);
columnIsRepeating
.
setCellValueFactory
(
new
PropertyValueFactory
<
ReportItem
,
Boolean
>(
"repeating"
));
columnIsRepeating
.
setCellFactory
(
new
Callback
<
TableColumn
<
ReportItem
,
Boolean
>,
TableCell
<
ReportItem
,
Boolean
>>()
...
...
@@ -194,20 +213,31 @@ public class ReportController implements Refreshable
}
});
columnIsRepeating
.
setStyle
(
"-fx-alignment: CENTER;"
);
HBox
hboxColumnIsRepeating
=
new
HBox
();
hboxColumnIsRepeating
.
setAlignment
(
Pos
.
CENTER
);
hboxColumnIsRepeating
.
setSpacing
(
3
);
CheckBox
checkBoxRepeating
=
new
CheckBox
();
checkBoxRepeating
.
setSelected
(
true
);
hboxColumnIsRepeating
.
getChildren
().
add
(
checkBoxRepeating
);
Label
labelColumnIsRepeating
=
new
Label
(
"Wiederholend"
);
hboxColumnIsRepeating
.
getChildren
().
add
(
labelColumnIsRepeating
);
checkBoxRepeating
.
selectedProperty
().
addListener
((
a
,
b
,
c
)->{
String
style
=
c
?
"
-fx-alignment: CENTER;
"
:
"-fx-background-color: salmon;
-fx-alignment: CENTER;
"
;
c
olumnIsRepeating
.
setStyle
(
style
);
String
style
=
c
?
""
:
"-fx-background-color: salmon;"
;
hboxC
olumnIsRepeating
.
setStyle
(
style
);
columnFilter
.
toggleColumn
(
ColumnType
.
REPEATING
,
c
);
});
columnIsRepeating
.
setGraphic
(
checkBoxRepeating
);
columnIsRepeating
.
setGraphic
(
hboxColumnIsRepeating
);
tableView
.
getColumns
().
add
(
columnIsRepeating
);
}
private
void
initColumnCategory
()
{
TableColumn
<
ReportItem
,
String
>
columnCategory
=
new
TableColumn
<>(
"Kategorie"
);
TableColumn
<
ReportItem
,
String
>
columnCategory
=
new
TableColumn
<>();
columnCategory
.
setUserData
(
ColumnType
.
CATEGORY
);
columnCategory
.
setCellValueFactory
(
new
Callback
<
TableColumn
.
CellDataFeatures
<
ReportItem
,
String
>,
ObservableValue
<
String
>>()
{
...
...
@@ -223,54 +253,84 @@ public class ReportController implements Refreshable
}
});
columnCategory
.
setStyle
(
"-fx-alignment: CENTER;"
);
HBox
hboxColumnCategory
=
new
HBox
();
hboxColumnCategory
.
setAlignment
(
Pos
.
CENTER
);
hboxColumnCategory
.
setSpacing
(
3
);
CheckBox
checkBoxCategory
=
new
CheckBox
();
checkBoxCategory
.
setSelected
(
true
);
hboxColumnCategory
.
getChildren
().
add
(
checkBoxCategory
);
Label
labelColumnCategory
=
new
Label
(
"Kategorie"
);
hboxColumnCategory
.
getChildren
().
add
(
labelColumnCategory
);
checkBoxCategory
.
selectedProperty
().
addListener
((
a
,
b
,
c
)->{
String
style
=
c
?
"
-fx-alignment: CENTER;
"
:
"-fx-background-color: salmon;
-fx-alignment: CENTER;
"
;
c
olumnCategory
.
setStyle
(
style
);
String
style
=
c
?
""
:
"-fx-background-color: salmon;"
;
hboxC
olumnCategory
.
setStyle
(
style
);
columnFilter
.
toggleColumn
(
ColumnType
.
CATEGORY
,
c
);
});
columnCategory
.
setGraphic
(
checkBox
Category
);
columnCategory
.
setGraphic
(
hboxColumn
Category
);
tableView
.
getColumns
().
add
(
columnCategory
);
}
private
void
initColumnName
()
{
TableColumn
<
ReportItem
,
Integer
>
columnName
=
new
TableColumn
<>(
"Name"
);
TableColumn
<
ReportItem
,
Integer
>
columnName
=
new
TableColumn
<>();
columnName
.
setUserData
(
ColumnType
.
NAME
);
columnName
.
setCellValueFactory
(
new
PropertyValueFactory
<
ReportItem
,
Integer
>(
"name"
));
columnName
.
setStyle
(
"-fx-alignment: CENTER;"
);
HBox
hboxColumnName
=
new
HBox
();
hboxColumnName
.
setAlignment
(
Pos
.
CENTER
);
hboxColumnName
.
setSpacing
(
3
);
CheckBox
checkBoxName
=
new
CheckBox
();
checkBoxName
.
setSelected
(
true
);
hboxColumnName
.
getChildren
().
add
(
checkBoxName
);
Label
labelColumnName
=
new
Label
(
"Name"
);
hboxColumnName
.
getChildren
().
add
(
labelColumnName
);
checkBoxName
.
selectedProperty
().
addListener
((
a
,
b
,
c
)->{
String
style
=
c
?
"
-fx-alignment: CENTER;
"
:
"-fx-background-color: salmon;
-fx-alignment: CENTER;
"
;
c
olumnName
.
setStyle
(
style
);
String
style
=
c
?
""
:
"-fx-background-color: salmon;"
;
hboxC
olumnName
.
setStyle
(
style
);
columnFilter
.
toggleColumn
(
ColumnType
.
NAME
,
c
);
});
columnName
.
setGraphic
(
checkBox
Name
);
columnName
.
setGraphic
(
hboxColumn
Name
);
tableView
.
getColumns
().
add
(
columnName
);
}
private
void
initColumnDescription
()
{
TableColumn
<
ReportItem
,
String
>
columnDescription
=
new
TableColumn
<>(
"Notiz"
);
TableColumn
<
ReportItem
,
String
>
columnDescription
=
new
TableColumn
<>();
columnDescription
.
setUserData
(
ColumnType
.
DESCRIPTION
);
columnDescription
.
setCellValueFactory
(
new
PropertyValueFactory
<
ReportItem
,
String
>(
"description"
));
columnDescription
.
setStyle
(
"-fx-alignment: CENTER;"
);
HBox
hboxColumnDescription
=
new
HBox
();
hboxColumnDescription
.
setAlignment
(
Pos
.
CENTER
);
hboxColumnDescription
.
setSpacing
(
3
);
CheckBox
checkBoxDescription
=
new
CheckBox
();
checkBoxDescription
.
setSelected
(
true
);
hboxColumnDescription
.
getChildren
().
add
(
checkBoxDescription
);
Label
labelColumnDescription
=
new
Label
(
"Notiz"
);
hboxColumnDescription
.
getChildren
().
add
(
labelColumnDescription
);
checkBoxDescription
.
selectedProperty
().
addListener
((
a
,
b
,
c
)->{
String
style
=
c
?
"
-fx-alignment: CENTER;
"
:
"-fx-background-color: salmon;
-fx-alignment: CENTER;
"
;
c
olumnDescription
.
setStyle
(
style
);
String
style
=
c
?
""
:
"-fx-background-color: salmon;"
;
hboxC
olumnDescription
.
setStyle
(
style
);
columnFilter
.
toggleColumn
(
ColumnType
.
DESCRIPTION
,
c
);
});
columnDescription
.
setGraphic
(
checkBox
Description
);
columnDescription
.
setGraphic
(
hboxColumn
Description
);
tableView
.
getColumns
().
add
(
columnDescription
);
}
private
void
initColumnRating
()
{
TableColumn
<
ReportItem
,
Integer
>
columnRating
=
new
TableColumn
<>(
"Bewertung"
);
TableColumn
<
ReportItem
,
Integer
>
columnRating
=
new
TableColumn
<>();
columnRating
.
setUserData
(
ColumnType
.
RATING
);
columnRating
.
setCellValueFactory
(
new
PropertyValueFactory
<
ReportItem
,
Integer
>(
"amount"
));
columnRating
.
setCellFactory
(
new
Callback
<
TableColumn
<
ReportItem
,
Integer
>,
TableCell
<
ReportItem
,
Integer
>>()
...
...
@@ -305,21 +365,31 @@ public class ReportController implements Refreshable
}
});
columnRating
.
setStyle
(
"-fx-alignment: CENTER;"
);
HBox
hboxColumnRating
=
new
HBox
();
hboxColumnRating
.
setAlignment
(
Pos
.
CENTER
);
hboxColumnRating
.
setSpacing
(
3
);
CheckBox
checkBoxRating
=
new
CheckBox
();
checkBoxRating
.
setSelected
(
true
);
hboxColumnRating
.
getChildren
().
add
(
checkBoxRating
);
Label
labelColumnRating
=
new
Label
(
"Bewertung"
);
hboxColumnRating
.
getChildren
().
add
(
labelColumnRating
);
checkBoxRating
.
selectedProperty
().
addListener
((
a
,
b
,
c
)->{
String
style
=
c
?
"
-fx-alignment: CENTER;
"
:
"-fx-background-color: salmon;
-fx-alignment: CENTER;
"
;
c
olumnRating
.
setStyle
(
style
);
String
style
=
c
?
""
:
"-fx-background-color: salmon;"
;
hboxC
olumnRating
.
setStyle
(
style
);
columnFilter
.
toggleColumn
(
ColumnType
.
RATING
,
c
);
});
columnRating
.
setGraphic
(
checkBox
Rating
);
columnRating
.
setGraphic
(
hboxColumn
Rating
);
columnRating
.
setComparator
(
new
RatingComparator
());
tableView
.
getColumns
().
add
(
columnRating
);
}
private
void
initColumnAmount
()
{
TableColumn
<
ReportItem
,
String
>
columnAmount
=
new
TableColumn
<>(
"Betrag"
);
TableColumn
<
ReportItem
,
String
>
columnAmount
=
new
TableColumn
<>();
columnAmount
.
setUserData
(
ColumnType
.
AMOUNT
);
columnAmount
.
setCellValueFactory
(
new
Callback
<
TableColumn
.
CellDataFeatures
<
ReportItem
,
String
>,
ObservableValue
<
String
>>()
{
...
...
@@ -333,14 +403,24 @@ public class ReportController implements Refreshable
}
});
columnAmount
.
setStyle
(
"-fx-alignment: CENTER;"
);
HBox
hboxColumnAmount
=
new
HBox
();
hboxColumnAmount
.
setAlignment
(
Pos
.
CENTER
);
hboxColumnAmount
.
setSpacing
(
3
);
CheckBox
checkBoxAmount
=
new
CheckBox
();
checkBoxAmount
.
setSelected
(
true
);
hboxColumnAmount
.
getChildren
().
add
(
checkBoxAmount
);
Label
labelColumnAmount
=
new
Label
(
"Betrag"
);
hboxColumnAmount
.
getChildren
().
add
(
labelColumnAmount
);
checkBoxAmount
.
selectedProperty
().
addListener
((
a
,
b
,
c
)->{
String
style
=
c
?
"
-fx-alignment: CENTER;
"
:
"-fx-background-color: salmon;
-fx-alignment: CENTER;
"
;
c
olumnAmount
.
setStyle
(
style
);
String
style
=
c
?
""
:
"-fx-background-color: salmon;"
;
hboxC
olumnAmount
.
setStyle
(
style
);
columnFilter
.
toggleColumn
(
ColumnType
.
AMOUNT
,
c
);
});
columnAmount
.
setGraphic
(
checkBox
Amount
);
columnAmount
.
setGraphic
(
hboxColumn
Amount
);
tableView
.
getColumns
().
add
(
columnAmount
);
}
...
...
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