Skip to content
Snippets Groups Projects
Commit 620dbd87 authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

Add buttons to add/remove all selected zones of a pad

parent b02a1c87
Branches
Tags
No related merge requests found
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
<option name="ignoredFiles"> <option name="ignoredFiles">
<set> <set>
<option value="$PROJECT_DIR$/PlayWall/PlayWallComponents/pom.xml" /> <option value="$PROJECT_DIR$/PlayWall/PlayWallComponents/pom.xml" />
<option value="$PROJECT_DIR$/PlayWallPlugins/PlayWallPluginContentPlayer/pom.xml" />
</set> </set>
</option> </option>
</component> </component>
......
...@@ -13,3 +13,5 @@ plugin.content.player.settings.default_name=Zone ...@@ -13,3 +13,5 @@ plugin.content.player.settings.default_name=Zone
plugin.content.pad.settings.lastFrame.label=Letztes Frame halten plugin.content.pad.settings.lastFrame.label=Letztes Frame halten
plugin.content.pad.settings.lastFrame.checkbox=Aktiv plugin.content.pad.settings.lastFrame.checkbox=Aktiv
plugin.content.pad.settings.zone=Zonen plugin.content.pad.settings.zone=Zonen
plugin.content.pad.settings.zone.addAll=Alle anw\u00E4hlen
plugin.content.pad.settings.zone.removeAll=Alle abw\u00E4hlen
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.CheckBox?> <?import javafx.scene.control.*?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import org.controlsfx.control.CheckListView?> <?import org.controlsfx.control.CheckListView?>
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> <AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children> <children>
<VBox layoutX="237.0" layoutY="-18.0" spacing="14.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <VBox layoutX="237.0" layoutY="-18.0" spacing="14.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children> <children>
...@@ -18,7 +17,13 @@ ...@@ -18,7 +17,13 @@
<HBox spacing="14.0"> <HBox spacing="14.0">
<children> <children>
<Label alignment="CENTER_RIGHT" prefWidth="150.0" text="%plugin.content.pad.settings.zone" /> <Label alignment="CENTER_RIGHT" prefWidth="150.0" text="%plugin.content.pad.settings.zone" />
<CheckListView prefHeight="150.0" fx:id="zoneListView" /> <CheckListView fx:id="zoneListView" prefHeight="150.0" />
<VBox spacing="14.0">
<children>
<Button fx:id="addAllZonesButton" onAction="#onAddAllZonesHandler" mnemonicParsing="false" text="%plugin.content.pad.settings.zone.addAll" />
<Button fx:id="removeAllZonesButton" onAction="#onRemoveAllZonesHandler" mnemonicParsing="false" text="%plugin.content.pad.settings.zone.removeAll" />
</children>
</VBox>
</children> </children>
</HBox> </HBox>
</children> </children>
......
...@@ -7,8 +7,9 @@ import de.tobias.playpad.pad.Pad ...@@ -7,8 +7,9 @@ import de.tobias.playpad.pad.Pad
import de.tobias.playpad.plugin.content.ContentPluginMain import de.tobias.playpad.plugin.content.ContentPluginMain
import de.tobias.playpad.plugin.content.settings.PlayerInstance import de.tobias.playpad.plugin.content.settings.PlayerInstance
import de.tobias.playpad.viewcontroller.PadSettingsTabViewController import de.tobias.playpad.viewcontroller.PadSettingsTabViewController
import javafx.beans.binding.Bindings
import javafx.fxml.FXML import javafx.fxml.FXML
import javafx.scene.control.CheckBox import javafx.scene.control.{Button, CheckBox}
import org.controlsfx.control.CheckListView import org.controlsfx.control.CheckListView
import scala.jdk.CollectionConverters._ import scala.jdk.CollectionConverters._
...@@ -20,11 +21,19 @@ class ContentPlayerPadContentSettingsViewController(val pad: Pad) extends PadSet ...@@ -20,11 +21,19 @@ class ContentPlayerPadContentSettingsViewController(val pad: Pad) extends PadSet
@FXML @FXML
var zoneListView: CheckListView[PlayerInstance] = _ var zoneListView: CheckListView[PlayerInstance] = _
@FXML
var addAllZonesButton: Button = _
@FXML
var removeAllZonesButton: Button = _
load("view", "ContentPadSettings", Localization.getBundle) load("view", "ContentPadSettings", Localization.getBundle)
override def init(): Unit = { override def init(): Unit = {
zoneListView.getItems.addAll(ContentPluginMain.configuration.instances) zoneListView.getItems.addAll(ContentPluginMain.configuration.instances)
addAllZonesButton.disableProperty().bind(Bindings.equal(Bindings.size(zoneListView.getCheckModel.getCheckedIndices), zoneListView.getItems.size()))
removeAllZonesButton.disableProperty().bind(Bindings.isEmpty(zoneListView.getCheckModel.getCheckedIndices))
} }
override def getName: String = Localization.getString("plugin.content.player.settings") override def getName: String = Localization.getString("plugin.content.player.settings")
...@@ -50,4 +59,14 @@ class ContentPlayerPadContentSettingsViewController(val pad: Pad) extends PadSet ...@@ -50,4 +59,14 @@ class ContentPlayerPadContentSettingsViewController(val pad: Pad) extends PadSet
val selectedZoneNames = zoneListView.getCheckModel.getCheckedItems.asScala.map(zone => zone.getName) val selectedZoneNames = zoneListView.getCheckModel.getCheckedItems.asScala.map(zone => zone.getName)
customSettings.put(ContentPlayerPadContentFactory.zones, new util.ArrayList(selectedZoneNames.asJavaCollection)) customSettings.put(ContentPlayerPadContentFactory.zones, new util.ArrayList(selectedZoneNames.asJavaCollection))
} }
@FXML
def onAddAllZonesHandler(): Unit = {
zoneListView.getCheckModel.checkAll()
}
@FXML
def onRemoveAllZonesHandler(): Unit = {
zoneListView.getCheckModel.clearChecks()
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment