-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add function to hide previous
JFXDialog
before showing a new one, u…
…se `WeakReference` and `WeakHashMap` to store singletons
- Loading branch information
Showing
28 changed files
with
123 additions
and
75 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
thirdparty/ktfx-controlsfx-commons/src/main/kotlin/ktfx/controlsfx/Platform.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
@file:JvmName("ControlsfxPlatformKt") | ||
@file:Suppress("NOTHING_TO_INLINE") | ||
|
||
package ktfx.controlsfx | ||
|
||
import org.controlsfx.tools.Platform | ||
|
||
/** Returns true if this is running on Windows. */ | ||
public inline fun isPlatformWindows(): Boolean = Platform.getCurrent() == Platform.WINDOWS | ||
public fun isPlatformWindows(): Boolean = Platform.getCurrent() == Platform.WINDOWS | ||
|
||
/** Returns true if this is running on OSX. */ | ||
public inline fun isPlatformOsx(): Boolean = Platform.getCurrent() == Platform.OSX | ||
public fun isPlatformOsx(): Boolean = Platform.getCurrent() == Platform.OSX | ||
|
||
/** Returns true if this is running on Unix. */ | ||
public inline fun isPlatformUnix(): Boolean = Platform.getCurrent() == Platform.UNIX | ||
public fun isPlatformUnix(): Boolean = Platform.getCurrent() == Platform.UNIX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
thirdparty/ktfx-jfoenix-commons/src/main/kotlin/ktfx/jfoenix/dialogs/JfxDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package ktfx.jfoenix.dialogs | ||
|
||
import com.jfoenix.controls.JFXDialog | ||
import javafx.scene.layout.StackPane | ||
import java.util.WeakHashMap | ||
|
||
private val shownDialogs = WeakHashMap<StackPane, JFXDialog>() | ||
|
||
/** | ||
* Track a previously shown dialog within a container to close it before showing a new dialog. | ||
* | ||
* @param container parent layout, or the dialog's default container. | ||
*/ | ||
public fun JFXDialog.showSingle(container: StackPane = dialogContainer) { | ||
shownDialogs[container] | ||
?.takeIf { it in container.children } | ||
?.close() | ||
shownDialogs[container] = apply { show() } | ||
} |
Oops, something went wrong.