EN · DE · RU · FR · ES

#326: SwingAbstractWizardWindow.kt

projectforge-application/src/main/kotlin/org/projectforge/setup/wizard/swing/SwingAbstractWizardWindow.kt Type: Kotlin · Role: Setup Wizard · Source: projectforge-application/src/main/kotlin/org/projectforge/setup/wizard/swing/SwingAbstractWizardWindow.kt 97 lines · 39 code · 35 comments · 23 blank
Source code file at projectforge-application/src/main/kotlin/org/projectforge/setup/wizard/swing/SwingAbstractWizardWindow.kt containing Kotlin code for the Setup Wizard layer.

Code Structure

Classes: SwingAbstractWizardWindow

Supertype(s): JPanel

Functions (6): getButtons, getContentPanel, aboutToDisplay, displaying, aboutToHide, redraw

Properties (6): mainPanel, context, contentPanel, buttonPanel, titlePanel, panel

Imports: 5 packages

Package: org.projectforge.setup.wizard.swing

Source Code (abridged)

package org.projectforge.setup.wizard.swing

import java.awt.GridBagConstraints
import java.awt.GridBagLayout
import javax.swing.JButton
import javax.swing.JLabel
import javax.swing.JPanel

abstract class SwingAbstractWizardWindow(context: SwingGUIContext,
                                         title: String) : JPanel() {
    val mainPanel: JPanel

    protected val context: SwingGUIContext

    private val contentPanel: JPanel

    private val buttonPanel: JPanel

    init {
        this.context = context
        mainPanel = JPanel(GridBagLayout())

        val titlePanel = JPanel()
        //LayoutUtils.addEmptySpace(titlePanel)
        titlePanel.add(JLabel(title))
        //LayoutUtils.addEmptySpace(titlePanel)
        mainPanel.add(titlePanel, SwingUtils.constraints(0, 0))

        contentPanel = getContentPanel()
        //contentPanel.layoutData = GridLayout.createLayoutData(GridLayout.Alignment.FILL, GridLayout.Alignment.FILL, true, true)
        mainPanel.add(contentPanel, SwingUtils.constraints(0, 1))

        mainPanel.add(JLabel(""), SwingUtils.constraints(0, 2, fill = GridBagConstraints.BOTH, weighty = 1.0))
        buttonPanel = SwingUtils.createButtonBar(context, true, *getButtons())
        mainPanel.add(buttonPanel, SwingUtils.constraints(0, 3, fill = GridBagConstraints.HORIZONTAL))
    }

    open fun getButtons(): Array<JButton> {
        return arrayOf()
    }

    open fun getContentPanel(): JPanel {
        val panel = JPanel()
        //panel.addComponent(EmptySpace())
        return panel
    }


    fun aboutToDisplay() {

        // Place code here that will be executed before the
        // panel is displayed.

    }

    fun displaying() {

        // Place code here that will be executed when the
        // panel is displayed.

    }

    fun aboutToHide() {

        // Place code here that will be executed when the
        // panel is hidden.

    }

    /**
     * Will be called if window is shown again.
     */
    open fun redraw() {}
}

Git History

868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
5f7ef41b8 Copyright 2021 -> 2022