added directory chooser for export
This commit is contained in:
parent
ae92167206
commit
ca2ad079d4
|
@ -2,18 +2,15 @@ package org.hso.texturesyncclient.controller
|
||||||
|
|
||||||
import javafx.collections.ObservableList
|
import javafx.collections.ObservableList
|
||||||
import org.hso.texturesyncclient.controller.net.Connection
|
import org.hso.texturesyncclient.controller.net.Connection
|
||||||
import org.hso.texturesyncclient.model.GUIModel
|
|
||||||
import org.hso.texturesyncclient.model.Texture
|
|
||||||
import org.hso.texturesyncclient.view.importView.ImportViewController
|
import org.hso.texturesyncclient.view.importView.ImportViewController
|
||||||
import org.hso.texturesyncclient.view.mainView.MainViewController
|
import org.hso.texturesyncclient.view.mainView.MainViewController
|
||||||
import org.hso.texturesyncclient.view.startupView.StartupViewController
|
import org.hso.texturesyncclient.view.startupView.StartupViewController
|
||||||
import tornadofx.Controller
|
import tornadofx.Controller
|
||||||
import java.net.InetAddress
|
import java.net.InetAddress
|
||||||
import java.util.*
|
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.imageio.ImageIO
|
import javax.imageio.ImageIO
|
||||||
import java.awt.image.BufferedImage
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,4 +58,6 @@ class RootController : Controller() {
|
||||||
println("Height: ${bimg.getHeight()} With: ${bimg.getWidth()}")
|
println("Height: ${bimg.getHeight()} With: ${bimg.getWidth()}")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,7 +3,15 @@ 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 org.hso.texturesyncclient.model.GUIModel
|
||||||
|
import org.hso.texturesyncclient.model.TextureFormat
|
||||||
import tornadofx.Controller
|
import tornadofx.Controller
|
||||||
|
import javafx.stage.DirectoryChooser
|
||||||
|
import javax.swing.JColorChooser.showDialog
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MainViewController : Controller() {
|
class MainViewController : Controller() {
|
||||||
|
|
||||||
|
@ -47,4 +55,32 @@ class MainViewController : Controller() {
|
||||||
println(cvTags.chips)
|
println(cvTags.chips)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* save the texture file to r
|
||||||
|
* @param data the file as a byte array
|
||||||
|
* @param name name for the file
|
||||||
|
* @param format specific file format. jpeg or png
|
||||||
|
*/
|
||||||
|
fun exportTexture(data: ByteArray, name: String, format : TextureFormat){
|
||||||
|
|
||||||
|
|
||||||
|
val directoryChooser = DirectoryChooser()
|
||||||
|
|
||||||
|
directoryChooser.title = "Export Verzeichnis wählen"
|
||||||
|
|
||||||
|
// TODO directoryChooser.setInitialDirectory(new File(System.getProperty("user.home")))
|
||||||
|
|
||||||
|
val dir = directoryChooser.showDialog(primaryStage)
|
||||||
|
|
||||||
|
if (dir != null) {
|
||||||
|
|
||||||
|
//copy data (bytesarray) with name and extension to dir
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue