Clear warnings
This commit is contained in:
@@ -121,4 +121,5 @@ task makePackGZ(dependsOn: jar) doLast {
|
||||
}
|
||||
|
||||
build.dependsOn makeExecutable
|
||||
build.dependsOn makePackGZ
|
||||
//build.dependsOn makePackGZ
|
||||
//Kotlin classes will be ignored by Pack200 due to class unrecognized attribute
|
||||
@@ -30,7 +30,7 @@ import javafx.scene.layout.StackPane
|
||||
import javafx.scene.layout.VBox
|
||||
import java.util.concurrent.Callable
|
||||
|
||||
class AccountItem(i: Int, width: Double, height: Double, group: ToggleGroup) : StackPane() {
|
||||
class AccountItem(i: Int, group: ToggleGroup) : StackPane() {
|
||||
@FXML lateinit var icon: Pane
|
||||
@FXML lateinit var content: VBox
|
||||
@FXML lateinit var header: StackPane
|
||||
|
||||
@@ -112,7 +112,7 @@ class AccountsPage() : StackPane(), DecoratorPage {
|
||||
}
|
||||
|
||||
private fun buildNode(i: Int, account: Account, group: ToggleGroup): Node {
|
||||
return AccountItem(i, Math.random() * 100 + 100, Math.random() * 100 + 100, group).apply {
|
||||
return AccountItem(i, group).apply {
|
||||
chkSelected.properties["account"] = account
|
||||
chkSelected.isSelected = Settings.selectedAccount == account
|
||||
lblUser.text = account.username
|
||||
|
||||
@@ -99,7 +99,7 @@ class LeftPaneController(val leftPane: VBox) {
|
||||
|
||||
fun onProfileChanged(event: ProfileChangedEvent) {
|
||||
val profile = event.value
|
||||
profile.selectedVersionProperty.addListener { observable ->
|
||||
profile.selectedVersionProperty.addListener { _ ->
|
||||
versionChanged(profile.selectedVersion)
|
||||
}
|
||||
profile.selectedVersionProperty.fireValueChangedEvent()
|
||||
@@ -122,14 +122,15 @@ class LeftPaneController(val leftPane: VBox) {
|
||||
ripplerContainer.selected = true
|
||||
profile.selectedVersion = version.id
|
||||
}
|
||||
ripplerContainer.userData = version.id to item
|
||||
ripplerContainer.properties["version"] = version.id to item
|
||||
versionsPane.children += ripplerContainer
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun versionChanged(selectedVersion: String) {
|
||||
versionsPane.children
|
||||
.filter { it is RipplerContainer && it.userData is Pair<*, *> }
|
||||
.forEach { (it as RipplerContainer).selected = (it.userData as Pair<String, VersionListItem>).first == selectedVersion }
|
||||
.filter { it is RipplerContainer && it.properties["version"] is Pair<*, *> }
|
||||
.forEach { (it as RipplerContainer).selected = (it.properties["version"] as Pair<String, VersionListItem>).first == selectedVersion }
|
||||
}
|
||||
}
|
||||
@@ -29,14 +29,16 @@ import java.util.concurrent.Callable
|
||||
class ModController {
|
||||
@FXML lateinit var scrollPane: ScrollPane
|
||||
@FXML lateinit var rootPane: VBox
|
||||
lateinit var modManager: ModManager
|
||||
lateinit var versionId: String
|
||||
private lateinit var modManager: ModManager
|
||||
private lateinit var versionId: String
|
||||
|
||||
fun initialize() {
|
||||
scrollPane.smoothScrolling()
|
||||
}
|
||||
|
||||
fun loadMods() {
|
||||
fun loadMods(modManager: ModManager, versionId: String) {
|
||||
this.modManager = modManager
|
||||
this.versionId = versionId
|
||||
Task.of(Callable {
|
||||
modManager.refreshMods(versionId)
|
||||
}).subscribe(Scheduler.JAVAFX) {
|
||||
|
||||
@@ -129,7 +129,7 @@ open class RipplerContainer(@NamedArg("container") container: Node): StackPane()
|
||||
return@Callable background
|
||||
}
|
||||
}, backgroundProperty()))
|
||||
ripplerFillProperty.addListener { o, oldVal, newVal -> this.buttonRippler.ripplerFill = newVal }
|
||||
ripplerFillProperty.addListener { _, _, newVal -> this.buttonRippler.ripplerFill = newVal }
|
||||
if (background == null || this.isJavaDefaultBackground(background)) {
|
||||
background = Background(BackgroundFill(Color.TRANSPARENT, this.defaultRadii, null))
|
||||
}
|
||||
@@ -149,11 +149,7 @@ open class RipplerContainer(@NamedArg("container") container: Node): StackPane()
|
||||
}
|
||||
|
||||
protected fun updateChildren() {
|
||||
children.add(container)
|
||||
|
||||
if (this.buttonContainer != null) {
|
||||
this.children.add(0, this.buttonContainer)
|
||||
}
|
||||
children.addAll(buttonContainer, container)
|
||||
|
||||
for (i in 1..this.children.size - 1) {
|
||||
this.children[i].isPickOnBounds = false
|
||||
@@ -161,34 +157,6 @@ open class RipplerContainer(@NamedArg("container") container: Node): StackPane()
|
||||
|
||||
}
|
||||
|
||||
fun layoutChildren(x: Double, y: Double, w: Double, h: Double) {
|
||||
if (this.invalid) {
|
||||
if (ripplerFill == null) {
|
||||
for (i in this.children.size - 1 downTo 1) {
|
||||
if (this.children[i] is Shape) {
|
||||
this.buttonRippler.ripplerFill = (this.children[i] as Shape).fill
|
||||
(this.children[i] as Shape).fillProperty().addListener { o, oldVal, newVal -> this.buttonRippler.ripplerFill = newVal }
|
||||
break
|
||||
}
|
||||
|
||||
if (this.children[i] is Label) {
|
||||
this.buttonRippler.ripplerFill = (this.children[i] as Label).textFill
|
||||
(this.children[i] as Label).textFillProperty().addListener { o, oldVal, newVal -> this.buttonRippler.ripplerFill = newVal }
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.buttonRippler.ripplerFill = ripplerFill
|
||||
}
|
||||
|
||||
this.invalid = false
|
||||
}
|
||||
|
||||
val shift = 1.0
|
||||
this.buttonContainer.resizeRelocate(layoutBounds.minX - shift, layoutBounds.minY - shift, width + 2.0 * shift, height + 2.0 * shift)
|
||||
//this.layoutLabelInArea(x, y, w, h)
|
||||
}
|
||||
|
||||
private fun isJavaDefaultBackground(background: Background): Boolean {
|
||||
try {
|
||||
val firstFill = (background.fills[0] as BackgroundFill).fill.toString()
|
||||
|
||||
@@ -46,9 +46,7 @@ class VersionPage : StackPane(), DecoratorPage {
|
||||
fun load(id: String, profile: Profile) {
|
||||
titleProperty.set("Version settings - " + id)
|
||||
|
||||
versionSettingsController.loadVersionSetting(id, profile.getVersionSetting(id))
|
||||
modController.modManager = profile.modManager
|
||||
modController.versionId = id
|
||||
modController.loadMods()
|
||||
versionSettingsController.loadVersionSetting(profile.getVersionSetting(id))
|
||||
modController.loadMods(profile.modManager, id)
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class VersionSettingsController {
|
||||
txtMetaspace.textProperty().addListener(validation(txtMetaspace))
|
||||
}
|
||||
|
||||
fun loadVersionSetting(id: String, version: VersionSetting) {
|
||||
fun loadVersionSetting(version: VersionSetting) {
|
||||
rootPane.children -= advancedSettingsPane
|
||||
|
||||
lastVersionSetting?.apply {
|
||||
|
||||
@@ -96,6 +96,7 @@ interface AbstractWizardDisplayer : WizardDisplayer {
|
||||
navigateTo(StackPane().apply { children += vbox }, Navigation.NavigationDirection.FINISH)
|
||||
|
||||
task.executor().let { executor ->
|
||||
@Suppress("NAME_SHADOWING")
|
||||
executor.taskListener = object : TaskListener {
|
||||
override fun onReady(task: Task) {
|
||||
Platform.runLater { tasksBar.progressProperty().set(finishedTasks * 1.0 / executor.totTask.get()) }
|
||||
|
||||
@@ -24,13 +24,10 @@ import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipFile
|
||||
import java.io.File
|
||||
|
||||
private fun lessThan32(b: ByteArray, x: Int): Int {
|
||||
var x = x
|
||||
while (x < b.size) {
|
||||
if (b[x] < 32)
|
||||
return x
|
||||
x++
|
||||
}
|
||||
private fun lessThan32(b: ByteArray, startIndex: Int): Int {
|
||||
for (i in startIndex until b.size)
|
||||
if (b[i] < 32)
|
||||
return i
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class ModInfo (
|
||||
val file = if (modFile.extension == DISABLED_EXTENSION)
|
||||
modFile.absoluteFile.parentFile.resolve(modFile.nameWithoutExtension)
|
||||
else modFile
|
||||
var description = "Unrecognized mod file"
|
||||
val description: String
|
||||
if (file.extension == "zip" || file.extension == "jar")
|
||||
try {
|
||||
return ForgeModMetadata.fromFile(modFile)
|
||||
|
||||
@@ -113,6 +113,7 @@ abstract class Task {
|
||||
}
|
||||
|
||||
fun executor() = TaskExecutor().submit(this)
|
||||
fun executor(taskListener: TaskListener) = TaskExecutor().submit(this).apply { this.taskListener = taskListener }
|
||||
|
||||
fun subscribe(subscriber: Task) = executor().apply {
|
||||
submit(subscriber).start()
|
||||
|
||||
Reference in New Issue
Block a user