Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PlayWallDesktop
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
PlayWall
PlayWallDesktop
Commits
bef250f6
Commit
bef250f6
authored
4 years ago
by
Tobias Ullerich
Browse files
Options
Downloads
Patches
Plain Diff
Add listener based style classes to touch pads
parent
7cf6e3f1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadView.java
+28
-71
28 additions, 71 deletions
...java/de/tobias/playpad/layout/touch/pad/TouchPadView.java
with
28 additions
and
71 deletions
PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadView.java
+
28
−
71
View file @
bef250f6
...
@@ -18,8 +18,10 @@ import de.tobias.playpad.pad.viewcontroller.IPadViewController;
...
@@ -18,8 +18,10 @@ import de.tobias.playpad.pad.viewcontroller.IPadViewController;
import
de.tobias.playpad.profile.Profile
;
import
de.tobias.playpad.profile.Profile
;
import
de.tobias.playpad.project.page.PadIndex
;
import
de.tobias.playpad.project.page.PadIndex
;
import
de.tobias.playpad.registry.NoSuchComponentException
;
import
de.tobias.playpad.registry.NoSuchComponentException
;
import
de.tobias.playpad.util.NodeWalker
;
import
de.tobias.playpad.view.EmptyPadView
;
import
de.tobias.playpad.view.EmptyPadView
;
import
de.tobias.playpad.view.PseudoClasses
;
import
de.tobias.playpad.view.PseudoClasses
;
import
de.tobias.playpad.view.pad.*
;
import
javafx.beans.property.Property
;
import
javafx.beans.property.Property
;
import
javafx.css.PseudoClass
;
import
javafx.css.PseudoClass
;
import
javafx.geometry.Pos
;
import
javafx.geometry.Pos
;
...
@@ -29,6 +31,8 @@ import javafx.scene.control.ProgressBar;
...
@@ -29,6 +31,8 @@ import javafx.scene.control.ProgressBar;
import
javafx.scene.layout.*
;
import
javafx.scene.layout.*
;
import
javafx.scene.paint.Color
;
import
javafx.scene.paint.Color
;
import
static
de
.
tobias
.
playpad
.
view
.
pad
.
PadStyleClasses
.*;
public
class
TouchPadView
implements
IPadView
{
public
class
TouchPadView
implements
IPadView
{
private
Label
indexLabel
;
private
Label
indexLabel
;
...
@@ -50,10 +54,9 @@ public class TouchPadView implements IPadView {
...
@@ -50,10 +54,9 @@ public class TouchPadView implements IPadView {
private
VBox
root
;
private
VBox
root
;
private
BusyView
busyView
;
private
BusyView
busyView
;
private
VBox
cueInContainer
;
private
Label
cueInLayer
;
private
Label
cueInLayer
;
private
transient
TouchPadViewController
controller
;
// Reference to its controller
private
final
transient
TouchPadViewController
controller
;
// Reference to its controller
public
TouchPadView
()
{
public
TouchPadView
()
{
controller
=
new
TouchPadViewController
(
this
);
controller
=
new
TouchPadViewController
(
this
);
...
@@ -61,31 +64,24 @@ public class TouchPadView implements IPadView {
...
@@ -61,31 +64,24 @@ public class TouchPadView implements IPadView {
}
}
private
void
setupView
()
{
private
void
setupView
()
{
superRoot
=
new
StackPane
();
superRoot
=
new
Pad
StackPane
(
STYLE_CLASS_PAD
,
STYLE_CLASS_PAD_INDEX
);
root
=
new
VBox
();
root
=
new
Pad
VBox
(
STYLE_CLASS_PAD_BUTTON_ROOT
);
busyView
=
new
BusyView
(
superRoot
);
busyView
=
new
BusyView
(
superRoot
);
cueInLayer
=
new
Label
(
);
cueInLayer
=
Pad
Label
.
empty
(
STYLE_CLASS_PAD_CUE_IN
,
STYLE_CLASS_PAD_CUE_IN_INDEX
);
cueInLayer
.
prefHeightProperty
().
bind
(
root
.
heightProperty
());
cueInLayer
.
prefHeightProperty
().
bind
(
root
.
heightProperty
());
cueInContainer
=
new
VBox
(
cueInLayer
);
VBox
cueInContainer
=
new
VBox
(
cueInLayer
);
indexLabel
=
new
Label
();
loopLabel
=
new
Label
();
// Active über Visible
loopLabel
.
setGraphic
(
new
FontIcon
(
FontAwesomeType
.
REPEAT
));
trigger
Label
=
new
Label
(
);
index
Label
=
Pad
Label
.
empty
(
STYLE_CLASS_PAD_INFO
,
STYLE_CLASS_PAD_INFO_INDEX
);
t
riggerLabel
.
setGraphic
(
new
FontIcon
(
FontAwesomeType
.
EXTERNAL_LINK
)
);
t
imeLabel
=
PadLabel
.
empty
(
STYLE_CLASS_PAD_INFO
,
STYLE_CLASS_PAD_INFO_INDEX
);
errorLabel
=
new
Label
();
loopLabel
=
new
PadLabel
(
new
FontIcon
(
FontAwesomeType
.
REPEAT
));
errorLabel
.
setGraphic
(
new
FontIcon
(
FontAwesomeType
.
WARNING
));
triggerLabel
=
new
PadLabel
(
new
FontIcon
(
FontAwesomeType
.
EXTERNAL_LINK
));
errorLabel
=
new
PadLabel
(
new
FontIcon
(
FontAwesomeType
.
WARNING
));
timeLabel
=
new
Label
(
);
infoBox
=
new
PadHBox
(
5
);
infoBox
=
new
HBox
();
// childern in addDefaultButton()
preview
=
PadHBox
.
deepStyled
(
STYLE_CLASS_PAD_TITLE
,
STYLE_CLASS_PAD_TITLE_INDEX
);
infoBox
.
setSpacing
(
5
);
preview
=
new
HBox
();
HBox
.
setHgrow
(
preview
,
Priority
.
ALWAYS
);
HBox
.
setHgrow
(
preview
,
Priority
.
ALWAYS
);
VBox
.
setVgrow
(
preview
,
Priority
.
ALWAYS
);
VBox
.
setVgrow
(
preview
,
Priority
.
ALWAYS
);
...
@@ -93,16 +89,15 @@ public class TouchPadView implements IPadView {
...
@@ -93,16 +89,15 @@ public class TouchPadView implements IPadView {
timeLabel
.
setMaxWidth
(
Double
.
MAX_VALUE
);
timeLabel
.
setMaxWidth
(
Double
.
MAX_VALUE
);
timeLabel
.
setAlignment
(
Pos
.
CENTER_RIGHT
);
timeLabel
.
setAlignment
(
Pos
.
CENTER_RIGHT
);
playBar
=
new
ProgressBar
(
0
);
playBar
=
new
Pad
ProgressBar
(
0
,
STYLE_CLASS_PAD_PLAYBAR
,
STYLE_CLASS_PAD_PLAYBAR_INDEX
);
playBar
.
prefWidthProperty
().
bind
(
root
.
widthProperty
());
playBar
.
prefWidthProperty
().
bind
(
root
.
widthProperty
());
// Not Found Label
// Not Found Label
notFoundLabel
=
new
FontIcon
(
FontAwesomeType
.
EXCLAMATION_TRIANGLE
);
notFoundLabel
=
new
FontIcon
(
FontAwesomeType
.
EXCLAMATION_TRIANGLE
);
notFoundLabel
.
getStyleClass
().
add
(
"pad-notfound"
);
notFoundLabel
.
getStyleClass
().
clear
(
);
notFoundLabel
.
setOpacity
(
0.5
);
notFoundLabel
.
setOpacity
(
0.5
);
notFoundLabel
.
setSize
(
50
);
notFoundLabel
.
setSize
(
50
);
notFoundLabel
.
setMouseTransparent
(
true
);
notFoundLabel
.
setMouseTransparent
(
true
);
notFoundLabel
.
setVisible
(
false
);
notFoundLabel
.
setVisible
(
false
);
root
.
getChildren
().
addAll
(
infoBox
,
preview
,
playBar
);
root
.
getChildren
().
addAll
(
infoBox
,
preview
,
playBar
);
...
@@ -135,8 +130,6 @@ public class TouchPadView implements IPadView {
...
@@ -135,8 +130,6 @@ public class TouchPadView implements IPadView {
previewContent
=
connect
.
getPadContentPreview
(
pad
,
preview
);
previewContent
=
connect
.
getPadContentPreview
(
pad
,
preview
);
Node
node
=
previewContent
.
getNode
();
Node
node
=
previewContent
.
getNode
();
node
.
getStyleClass
().
addAll
(
"pad-title"
,
"pad"
+
pad
.
getPadIndex
()
+
"-title"
);
// Copy Pseudoclasses
// Copy Pseudoclasses
for
(
PseudoClass
pseudoClass
:
superRoot
.
getPseudoClassStates
())
{
for
(
PseudoClass
pseudoClass
:
superRoot
.
getPseudoClassStates
())
{
node
.
pseudoClassStateChanged
(
pseudoClass
,
true
);
node
.
pseudoClassStateChanged
(
pseudoClass
,
true
);
...
@@ -150,11 +143,6 @@ public class TouchPadView implements IPadView {
...
@@ -150,11 +143,6 @@ public class TouchPadView implements IPadView {
}
}
}
}
EmptyPadView
view
=
new
EmptyPadView
(
preview
);
EmptyPadView
view
=
new
EmptyPadView
(
preview
);
if
(
pad
!=
null
)
{
view
.
getStyleClass
().
addAll
(
"pad-title"
,
"pad"
+
pad
.
getPadIndex
()
+
"-title"
);
}
else
{
view
.
getStyleClass
().
addAll
(
"pad-title"
);
}
preview
.
getChildren
().
setAll
(
view
);
preview
.
getChildren
().
setAll
(
view
);
}
}
...
@@ -188,19 +176,8 @@ public class TouchPadView implements IPadView {
...
@@ -188,19 +176,8 @@ public class TouchPadView implements IPadView {
@Override
@Override
public
void
pseudoClassState
(
PseudoClass
pseudoClass
,
boolean
active
)
{
public
void
pseudoClassState
(
PseudoClass
pseudoClass
,
boolean
active
)
{
superRoot
.
pseudoClassStateChanged
(
pseudoClass
,
active
);
NodeWalker
.
getAllNodes
(
getRootNode
())
cueInLayer
.
pseudoClassStateChanged
(
pseudoClass
,
active
);
.
forEach
(
node
->
node
.
pseudoClassStateChanged
(
pseudoClass
,
active
));
indexLabel
.
pseudoClassStateChanged
(
pseudoClass
,
active
);
timeLabel
.
pseudoClassStateChanged
(
pseudoClass
,
active
);
loopLabel
.
getGraphic
().
pseudoClassStateChanged
(
pseudoClass
,
active
);
triggerLabel
.
getGraphic
().
pseudoClassStateChanged
(
pseudoClass
,
active
);
errorLabel
.
getGraphic
().
pseudoClassStateChanged
(
pseudoClass
,
active
);
if
(
preview
!=
null
)
{
preview
.
getChildren
().
forEach
(
i
->
i
.
pseudoClassStateChanged
(
pseudoClass
,
active
));
}
playBar
.
pseudoClassStateChanged
(
pseudoClass
,
active
);
}
}
@Override
@Override
...
@@ -247,38 +224,18 @@ public class TouchPadView implements IPadView {
...
@@ -247,38 +224,18 @@ public class TouchPadView implements IPadView {
@Override
@Override
public
void
applyStyleClasses
(
PadIndex
index
)
{
public
void
applyStyleClasses
(
PadIndex
index
)
{
superRoot
.
getStyleClass
().
addAll
(
"pad"
,
"pad"
+
index
);
NodeWalker
.
getAllNodes
(
getRootNode
())
cueInLayer
.
getStyleClass
().
addAll
(
"pad-cue-in"
,
"pad"
+
index
+
"-cue-in"
);
.
stream
()
.
filter
(
node
->
node
instanceof
PadIndexable
)
indexLabel
.
getStyleClass
().
addAll
(
"pad-index"
,
"pad"
+
index
+
"-index"
,
"pad-info"
,
"pad"
+
index
+
"-info"
);
.
forEach
(
node
->
((
PadIndexable
)
node
).
setIndex
(
index
));
timeLabel
.
getStyleClass
().
addAll
(
"pad-time"
,
"pad"
+
index
+
"-time"
,
"pad-info"
,
"pad"
+
index
+
"-info"
);
loopLabel
.
getGraphic
().
getStyleClass
().
addAll
(
"pad-icon"
,
"pad"
+
index
+
"-icon"
);
triggerLabel
.
getGraphic
().
getStyleClass
().
addAll
(
"pad-icon"
,
"pad"
+
index
+
"-icon"
);
errorLabel
.
getGraphic
().
getStyleClass
().
addAll
(
"pad-icon"
,
"pad"
+
index
+
"-icon"
);
preview
.
getChildren
().
forEach
(
i
->
i
.
getStyleClass
().
addAll
(
"pad-title"
,
"pad"
+
index
+
"-title"
));
playBar
.
getStyleClass
().
addAll
(
"pad-playbar"
,
"pad"
+
index
+
"-playbar"
);
root
.
getStyleClass
().
add
(
"pad-root"
);
}
}
@Override
@Override
public
void
removeStyleClasses
()
{
public
void
removeStyleClasses
()
{
superRoot
.
getStyleClass
().
removeIf
(
c
->
c
.
startsWith
(
"pad"
));
NodeWalker
.
getAllNodes
(
getRootNode
())
cueInLayer
.
getStyleClass
().
removeIf
(
c
->
c
.
startsWith
(
"pad"
));
.
stream
()
.
filter
(
node
->
node
instanceof
PadIndexable
)
indexLabel
.
getStyleClass
().
removeIf
(
c
->
c
.
startsWith
(
"pad"
));
.
forEach
(
node
->
((
PadIndexable
)
node
).
setIndex
(
null
));
timeLabel
.
getStyleClass
().
removeIf
(
c
->
c
.
startsWith
(
"pad"
));
loopLabel
.
getGraphic
().
getStyleClass
().
removeIf
(
c
->
c
.
startsWith
(
"pad"
));
triggerLabel
.
getGraphic
().
getStyleClass
().
removeIf
(
c
->
c
.
startsWith
(
"pad"
));
errorLabel
.
getGraphic
().
getStyleClass
().
removeIf
(
c
->
c
.
startsWith
(
"pad"
));
preview
.
getChildren
().
forEach
(
i
->
i
.
getStyleClass
().
removeIf
(
c
->
c
.
startsWith
(
"pad"
)));
playBar
.
getStyleClass
().
removeIf
(
c
->
c
.
startsWith
(
"pad"
));
root
.
getStyleClass
().
remove
(
"pad-root"
);
}
}
@Override
@Override
...
...
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