All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tri.util.ui.NavigableWorkspaceView.kt Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
/*-
 * #%L
 * tri.promptfx:promptfx
 * %%
 * Copyright (C) 2023 - 2024 Johns Hopkins University Applied Physics Laboratory
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package tri.util.ui

import tornadofx.Workspace
import tri.util.ANSI_RESET
import tri.util.ANSI_YELLOW
import tri.util.info
import java.util.*

/** A view that can be added to a workspace. */
interface NavigableWorkspaceView {

    val category: String
    val name: String
    val isScriptable: Boolean
//    val description: String
//    val icon: String

    /** Add the view to the workspace. */
    fun dock(workspace: Workspace)

    companion object {
        val viewPlugins: List by lazy {
            ServiceLoader.load(NavigableWorkspaceView::class.java).toList().also {
                info("Loading views...")
                it.groupBy { it.category }.toSortedMap().forEach { (category, views) ->
                    info("  - $category: $ANSI_YELLOW${views.joinToString { it.name }}$ANSI_RESET")
                }
            }
        }
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy