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
00392c33
Commit
00392c33
authored
1 year ago
by
Tobias Ullerich
Browse files
Options
Downloads
Patches
Plain Diff
#187 - Add option to trigger cart by index
parent
1cf0f0af
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
PlayWallPlugins/PlayWallPluginWebAPI/src/main/scala/de/tobias/playpad/plugin/api/websocket/methods/CartActionMethod.scala
+15
-1
15 additions, 1 deletion
...aypad/plugin/api/websocket/methods/CartActionMethod.scala
with
15 additions
and
1 deletion
PlayWallPlugins/PlayWallPluginWebAPI/src/main/scala/de/tobias/playpad/plugin/api/websocket/methods/CartActionMethod.scala
+
15
−
1
View file @
00392c33
...
...
@@ -2,8 +2,10 @@ package de.tobias.playpad.plugin.api.websocket.methods
import
com.google.gson.JsonObject
import
de.tobias.playpad.PlayPadPlugin
import
de.tobias.playpad.pad.PadStatus
import
de.tobias.playpad.plugin.api.websocket.MethodExecutable
import
de.tobias.playpad.plugin.api.websocket.message.Message
import
de.tobias.playpad.project.page.PadIndex
import
javafx.application.Platform
import
org.eclipse.jetty.websocket.api.Session
...
...
@@ -12,11 +14,23 @@ import java.util.UUID
class
CartActionMethod
extends
MethodExecutable
{
override
def
execute
(
session
:
Session
,
message
:
Message
)
:
JsonObject
=
{
val
padId
=
UUID
.
fromString
(
message
.
payload
.
get
(
"pad"
).
getAsString
)
val
padId
=
if
(
message
.
payload
.
get
(
"padId"
)
!=
null
)
{
UUID
.
fromString
(
message
.
payload
.
get
(
"padId"
).
getAsString
)
}
else
if
(
message
.
payload
.
get
(
"padIndex"
)
!=
null
)
{
val
padIndex
=
message
.
payload
.
get
(
"padIndex"
).
getAsInt
val
currentPage
=
PlayPadPlugin
.
getInstance
().
getMainViewController
.
getPage
val
pad
=
PlayPadPlugin
.
getInstance
().
getCurrentProject
.
getPad
(
new
PadIndex
(
padIndex
,
currentPage
))
pad
.
getUuid
}
else
{
throw
new
IllegalArgumentException
(
"Neither pad nor padIndex provided"
)
}
val
currentProject
=
PlayPadPlugin
.
getInstance
().
getCurrentProject
val
pad
=
currentProject
.
getPad
(
padId
)
if
(
pad
==
null
||
pad
.
getStatus
==
PadStatus
.
EMPTY
||
pad
.
getStatus
==
PadStatus
.
ERROR
)
{
return
null
}
Platform
.
runLater
(()
=>
{
if
(
pad
.
isPlay
)
{
pad
.
stop
()
...
...
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