parent
1ac13f80d5
commit
bc43b33536
|
@ -246,20 +246,10 @@ class RootController : Controller() {
|
||||||
dialogDelete.showAndWait()
|
dialogDelete.showAndWait()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
fun updateTexture(name: String, tags: Array<String>) {
|
||||||
* send a changed texture to the server
|
val newTexture = selectedTextureModel.data.copy(
|
||||||
* @param chips the new tag list
|
tags = tags,
|
||||||
*/
|
name = name
|
||||||
fun updateTexture(chips: ObservableList<String>) {
|
|
||||||
val uuid = UUID.randomUUID()
|
|
||||||
val newTexture = Texture(
|
|
||||||
uuid,
|
|
||||||
selectedTextureModel.data.name,
|
|
||||||
chips.toTypedArray(),
|
|
||||||
selectedTextureModel.data.format,
|
|
||||||
selectedTextureModel.data.resolution,
|
|
||||||
selectedTextureModel.data.addedOn,
|
|
||||||
selectedTextureModel.data.textureHash
|
|
||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
con.updateTexture(
|
con.updateTexture(
|
||||||
|
@ -274,6 +264,7 @@ class RootController : Controller() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show all available textures at start
|
* show all available textures at start
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package org.hso.texturesyncclient.view.mainView
|
package org.hso.texturesyncclient.view.mainView
|
||||||
|
|
||||||
|
import com.jfoenix.controls.JFXButton
|
||||||
import com.jfoenix.controls.JFXChipView
|
import com.jfoenix.controls.JFXChipView
|
||||||
|
import com.jfoenix.controls.JFXTextField
|
||||||
import javafx.geometry.Insets
|
import javafx.geometry.Insets
|
||||||
import javafx.geometry.Orientation
|
import javafx.geometry.Orientation
|
||||||
import javafx.scene.image.Image
|
import javafx.scene.image.Image
|
||||||
|
@ -15,15 +17,14 @@ class DetailView : View() {
|
||||||
val preview = Preview3D()
|
val preview = Preview3D()
|
||||||
val cvTags = JFXChipView<String>()
|
val cvTags = JFXChipView<String>()
|
||||||
|
|
||||||
val nameInfo = label().addClass("metadata")
|
val nameInfo = JFXTextField().addClass("metadata")
|
||||||
val resolutionInfo = label().addClass("metadata")
|
val resolutionInfo = label().addClass("metadata")
|
||||||
val formatInfo = label().addClass("metadata")
|
val formatInfo = label().addClass("metadata")
|
||||||
val dateInfo = label().addClass("metadata")
|
val dateInfo = label().addClass("metadata")
|
||||||
|
|
||||||
|
val submitButton = JFXButton("Ändern").addClass("btn-orange")
|
||||||
|
|
||||||
val metadataPanel = gridpane {
|
val metadataPanel = gridpane {
|
||||||
|
|
||||||
isVisible = false
|
|
||||||
|
|
||||||
row {
|
row {
|
||||||
label("Name ").addClass("metadata")
|
label("Name ").addClass("metadata")
|
||||||
add(nameInfo)
|
add(nameInfo)
|
||||||
|
@ -42,11 +43,6 @@ class DetailView : View() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
// set a default texture
|
|
||||||
preview.setTexture(Image("icons/TextureSync_Icon_256x256.jpeg"))
|
|
||||||
}
|
|
||||||
|
|
||||||
override val root = form {
|
override val root = form {
|
||||||
minWidth = 250.0
|
minWidth = 250.0
|
||||||
background = Background(BackgroundFill(Paint.valueOf("#3a3a3a"), CornerRadii.EMPTY, Insets.EMPTY))
|
background = Background(BackgroundFill(Paint.valueOf("#3a3a3a"), CornerRadii.EMPTY, Insets.EMPTY))
|
||||||
|
@ -68,6 +64,17 @@ class DetailView : View() {
|
||||||
add(cvTags)
|
add(cvTags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
field {
|
||||||
|
add(submitButton)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
// set a default texture
|
||||||
|
preview.setTexture(Image("icons/TextureSync_Icon_256x256.jpeg"))
|
||||||
|
submitButton.useMaxWidth = true
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -78,8 +78,19 @@ class MainView : View("TextureSync") {
|
||||||
mvc.btnImportAction()
|
mvc.btnImportAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: on chipview update on name update
|
||||||
|
|
||||||
detailView.cvTags.chips.onChange {
|
detailView.cvTags.chips.onChange {
|
||||||
|
detailView.submitButton.isVisible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
detailView.nameInfo.textProperty().onChange {
|
||||||
|
detailView.submitButton.isVisible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
detailView.submitButton.setOnAction {
|
||||||
mvc.updateTags()
|
mvc.updateTags()
|
||||||
|
detailView.submitButton.isVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
//keyboard actions
|
//keyboard actions
|
||||||
|
|
|
@ -2,10 +2,10 @@ package org.hso.texturesyncclient.view.mainView
|
||||||
|
|
||||||
import javafx.collections.ObservableList
|
import javafx.collections.ObservableList
|
||||||
import javafx.scene.image.Image
|
import javafx.scene.image.Image
|
||||||
import org.hso.texturesyncclient.model.GUIModel
|
|
||||||
import tornadofx.Controller
|
|
||||||
import org.hso.texturesyncclient.controller.RootController
|
import org.hso.texturesyncclient.controller.RootController
|
||||||
|
import org.hso.texturesyncclient.model.GUIModel
|
||||||
import org.hso.texturesyncclient.model.Texture
|
import org.hso.texturesyncclient.model.Texture
|
||||||
|
import tornadofx.Controller
|
||||||
|
|
||||||
class MainViewController : Controller() {
|
class MainViewController : Controller() {
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class MainViewController : Controller() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setMeta(name: String, res: String, format: String, date: String) {
|
fun setMeta(name: String, res: String, format: String, date: String) {
|
||||||
with( mv.detailView) {
|
with(mv.detailView) {
|
||||||
nameInfo.text = name
|
nameInfo.text = name
|
||||||
formatInfo.text = format
|
formatInfo.text = format
|
||||||
resolutionInfo.text = date
|
resolutionInfo.text = date
|
||||||
|
@ -46,14 +46,17 @@ class MainViewController : Controller() {
|
||||||
lockUpdate = true //allow update with onChange
|
lockUpdate = true //allow update with onChange
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getTags(): ObservableList<String>{
|
fun getTags(): ObservableList<String> {
|
||||||
return cvTags.chips
|
return cvTags.chips
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateTags() {
|
fun updateTags() {
|
||||||
if (lockUpdate) { //the chipView was changed by the user
|
if (lockUpdate) { //the chipView was changed by the user
|
||||||
println("Tags changed")
|
println("Tags changed")
|
||||||
rootc.updateTexture(cvTags.chips)
|
rootc.updateTexture(
|
||||||
|
tags = cvTags.chips.toTypedArray(),
|
||||||
|
name = mv.detailView.nameInfo.text
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,12 +87,14 @@ class MainViewController : Controller() {
|
||||||
.ifPresent { x -> folderView.children.remove(x) }
|
.ifPresent { x -> folderView.children.remove(x) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setVisibleMetaTags(bool: Boolean){
|
fun setVisibleMetaTags(bool: Boolean) {
|
||||||
if(bool){
|
if (bool) {
|
||||||
mv.detailView.metadataPanel.isVisible = true
|
mv.detailView.metadataPanel.isVisible = true
|
||||||
|
mv.detailView.submitButton.isVisible = false
|
||||||
cvTags.isVisible = true
|
cvTags.isVisible = true
|
||||||
}else{
|
} else {
|
||||||
mv.detailView.metadataPanel.isVisible = false
|
mv.detailView.metadataPanel.isVisible = false
|
||||||
|
mv.detailView.submitButton.isVisible = false
|
||||||
cvTags.isVisible = false
|
cvTags.isVisible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,26 @@
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* *
|
* *
|
||||||
* DetailView *
|
* Buttons *
|
||||||
|
* *
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
.btn-blue {
|
||||||
|
-fx-button-type: RAISED;
|
||||||
|
-fx-background-color: #3c3f41;
|
||||||
|
-fx-text-fill: #2b7bbb;
|
||||||
|
-fx-padding: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-orange {
|
||||||
|
-fx-button-type: RAISED;
|
||||||
|
-fx-background-color: #b15b2e;
|
||||||
|
-fx-text-fill: #3c3f41;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* *
|
||||||
|
* DetailView *
|
||||||
* *
|
* *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue