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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robert Goldmann
BudgetMaster
Commits
c33ed622
Commit
c33ed622
authored
7 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
prepared ui for
#186
parent
18a0014e
No related branches found
No related tags found
1 merge request
!213
merge v1_6_0 into master
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/de/deadlocker8/budgetmaster/ui/controller/SearchController.java
+117
-1
117 additions, 1 deletion
...dlocker8/budgetmaster/ui/controller/SearchController.java
src/de/deadlocker8/budgetmaster/ui/fxml/SearchGUI.fxml
+61
-25
61 additions, 25 deletions
src/de/deadlocker8/budgetmaster/ui/fxml/SearchGUI.fxml
with
178 additions
and
26 deletions
src/de/deadlocker8/budgetmaster/ui/controller/SearchController.java
+
117
−
1
View file @
c33ed622
...
...
@@ -2,6 +2,8 @@ package de.deadlocker8.budgetmaster.ui.controller;
import
java.util.ArrayList
;
import
org.controlsfx.control.RangeSlider
;
import
de.deadlocker8.budgetmaster.logic.payment.Payment
;
import
de.deadlocker8.budgetmaster.logic.search.SearchPreferences
;
import
de.deadlocker8.budgetmaster.logic.serverconnection.ExceptionHandler
;
...
...
@@ -15,14 +17,18 @@ import fontAwesome.FontIconType;
import
javafx.application.Platform
;
import
javafx.beans.value.ChangeListener
;
import
javafx.fxml.FXML
;
import
javafx.geometry.Pos
;
import
javafx.scene.control.Button
;
import
javafx.scene.control.CheckBox
;
import
javafx.scene.control.Label
;
import
javafx.scene.control.ListCell
;
import
javafx.scene.control.ListView
;
import
javafx.scene.control.TextField
;
import
javafx.scene.control.TextFormatter
;
import
javafx.scene.input.KeyCode
;
import
javafx.scene.input.MouseEvent
;
import
javafx.scene.layout.HBox
;
import
javafx.scene.layout.Priority
;
import
javafx.scene.paint.Color
;
import
javafx.stage.Modality
;
import
javafx.stage.Stage
;
...
...
@@ -39,6 +45,12 @@ public class SearchController extends BaseController implements Styleable
@FXML
private
CheckBox
checkBoxCategoryName
;
@FXML
private
CheckBox
checkBoxTags
;
@FXML
private
TextField
textFieldSearch
;
@FXML
private
CheckBox
checkBoxSearchByAmount
;
@FXML
private
TextField
textFieldAmountMin
;
@FXML
private
TextField
textFieldAmountMax
;
@FXML
private
HBox
hboxRangeSlider
;
@FXML
private
Label
labelSeparator
;
@FXML
private
HBox
hboxSearchByAmount
;
@FXML
private
Button
buttonCancel
;
@FXML
private
Button
buttonSearch
;
@FXML
private
ListView
<
Payment
>
listView
;
...
...
@@ -107,6 +119,93 @@ public class SearchController extends BaseController implements Styleable
}
});
checkBoxSearchByAmount
.
selectedProperty
().
addListener
((
a
,
b
,
c
)->{
hboxSearchByAmount
.
setDisable
(!
c
);
});
hboxSearchByAmount
.
setDisable
(
true
);
//TODO get max from server
int
maximum
=
3500
;
RangeSlider
rangeSlider
=
new
RangeSlider
();
rangeSlider
.
setMin
(
0
);
rangeSlider
.
setMax
(
maximum
);
rangeSlider
.
setLowValue
(
rangeSlider
.
getMin
());
rangeSlider
.
setHighValue
(
rangeSlider
.
getMax
());
rangeSlider
.
setShowTickMarks
(
true
);
rangeSlider
.
setShowTickLabels
(
true
);
rangeSlider
.
setMajorTickUnit
(
getMayorTickUnit
(
maximum
));
rangeSlider
.
setMinorTickCount
(
0
);
rangeSlider
.
lowValueProperty
().
addListener
((
a
,
b
,
c
)->{
textFieldAmountMin
.
setText
(
String
.
valueOf
(
c
.
intValue
()));
});
rangeSlider
.
highValueProperty
().
addListener
((
a
,
b
,
c
)->{
textFieldAmountMax
.
setText
(
String
.
valueOf
(
c
.
intValue
()));
});
hboxRangeSlider
.
getChildren
().
add
(
rangeSlider
);
hboxRangeSlider
.
setAlignment
(
Pos
.
CENTER
);
HBox
.
setHgrow
(
rangeSlider
,
Priority
.
ALWAYS
);
textFieldAmountMin
.
setTextFormatter
(
new
TextFormatter
<>(
c
->
{
if
(
c
.
getControlNewText
().
isEmpty
())
{
return
c
;
}
if
(
c
.
getControlNewText
().
matches
(
"[0-9]*"
))
{
return
c
;
}
else
{
return
null
;
}
}));
textFieldAmountMax
.
setTextFormatter
(
new
TextFormatter
<>(
c
->
{
if
(
c
.
getControlNewText
().
isEmpty
())
{
return
c
;
}
if
(
c
.
getControlNewText
().
matches
(
"[0-9]*"
))
{
return
c
;
}
else
{
return
null
;
}
}));
textFieldAmountMin
.
setOnKeyReleased
((
event
)->{
if
(
event
.
getCode
()
==
KeyCode
.
ENTER
)
{
String
text
=
textFieldAmountMin
.
getText
();
if
(
text
!=
null
&&
!
text
.
equals
(
""
))
{
rangeSlider
.
setLowValue
(
Integer
.
parseInt
(
text
));
}
}
});
textFieldAmountMax
.
setOnKeyReleased
((
event
)->{
if
(
event
.
getCode
()
==
KeyCode
.
ENTER
)
{
String
text
=
textFieldAmountMax
.
getText
();
if
(
text
!=
null
&&
!
text
.
equals
(
""
))
{
rangeSlider
.
setHighValue
(
Integer
.
parseInt
(
text
));
}
}
});
textFieldAmountMin
.
setText
(
"0"
);
textFieldAmountMax
.
setText
(
String
.
valueOf
(
maximum
));
//TODO save search by amount to SearchPreferences
//prefill
if
(
controller
.
getSearchPreferences
()
!=
null
)
{
...
...
@@ -120,6 +219,19 @@ public class SearchController extends BaseController implements Styleable
applyStyle
();
}
private
int
getMayorTickUnit
(
int
maximum
)
{
if
(
maximum
<
10
)
return
1
;
if
(
maximum
<
100
)
return
5
;
int
length
=
String
.
valueOf
(
maximum
).
length
();
return
(
int
)
Math
.
pow
(
10
,
length
-
2
);
}
public
void
search
()
{
String
query
=
textFieldSearch
.
getText
().
trim
();
...
...
@@ -188,6 +300,10 @@ public class SearchController extends BaseController implements Styleable
@Override
public
void
applyStyle
()
{
labelSeparator
.
setStyle
(
"-fx-background-color: #CCCCCC;"
);
labelSeparator
.
setMinHeight
(
1
);
labelSeparator
.
setMaxHeight
(
1
);
buttonCancel
.
setGraphic
(
Helpers
.
getFontIcon
(
FontIconType
.
TIMES
,
17
,
Color
.
WHITE
));
buttonSearch
.
setGraphic
(
Helpers
.
getFontIcon
(
FontIconType
.
SEARCH
,
17
,
Color
.
WHITE
));
...
...
This diff is collapsed.
Click to expand it.
src/de/deadlocker8/budgetmaster/ui/fxml/SearchGUI.fxml
+
61
−
25
View file @
c33ed622
...
...
@@ -20,8 +20,14 @@
<Font
name=
"System Bold"
size=
"18.0"
/>
</font>
</Label>
<VBox
spacing=
"15.0"
>
<children>
<HBox
spacing=
"25.0"
>
<children>
<VBox
spacing=
"20.0"
HBox.hgrow=
"ALWAYS"
>
<children>
<TextField
fx:id=
"textFieldSearch"
/>
<HBox
prefHeight=
"10.0"
prefWidth=
"422.0"
spacing=
"
2
5.0"
>
<HBox
spacing=
"
1
5.0"
>
<children>
<Label
text=
"%search.by"
>
<font>
...
...
@@ -50,6 +56,36 @@
</CheckBox>
</children>
</HBox>
</children>
</VBox>
</children>
</HBox>
<Label
fx:id=
"labelSeparator"
maxWidth=
"1.7976931348623157E308"
>
<font>
<Font
size=
"1.0"
/>
</font>
</Label>
<HBox
alignment=
"CENTER_LEFT"
prefHeight=
"32.0"
prefWidth=
"377.0"
spacing=
"10.0"
>
<children>
<CheckBox
fx:id=
"checkBoxSearchByAmount"
mnemonicParsing=
"false"
text=
"Betrag eingrenzen"
>
<HBox.margin>
<Insets
right=
"25.0"
/>
</HBox.margin>
<font>
<Font
size=
"14.0"
/>
</font>
</CheckBox>
<HBox
fx:id=
"hboxSearchByAmount"
alignment=
"CENTER"
spacing=
"10.0"
HBox.hgrow=
"ALWAYS"
>
<children>
<TextField
fx:id=
"textFieldAmountMin"
prefHeight=
"25.0"
prefWidth=
"55.0"
/>
<HBox
fx:id=
"hboxRangeSlider"
prefHeight=
"32.0"
prefWidth=
"123.0"
/>
<TextField
fx:id=
"textFieldAmountMax"
prefHeight=
"25.0"
prefWidth=
"55.0"
/>
</children>
</HBox>
</children>
</HBox>
</children>
</VBox>
<ListView
fx:id=
"listView"
prefHeight=
"200.0"
prefWidth=
"200.0"
VBox.vgrow=
"ALWAYS"
/>
<HBox
alignment=
"CENTER"
prefHeight=
"30.0"
prefWidth=
"465.0"
spacing=
"10.0"
>
<children>
...
...
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