Skip to content

Commit

Permalink
s/Jxxx component/JBxxx component/
Browse files Browse the repository at this point in the history
  • Loading branch information
jedesroches committed Jul 12, 2023
1 parent 0be6470 commit ed1d2c8
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ package ch.kleis.lcaplugin.ui.toolwindow
import ch.kleis.lcaplugin.actions.sankey.SankeyGraphBuilder
import ch.kleis.lcaplugin.core.graph.Graph
import ch.kleis.lcaplugin.core.lang.value.MatrixColumnIndex
import com.intellij.openapi.ui.JBMenuItem
import com.intellij.ui.components.JBLabel
import com.intellij.ui.components.JBMenu
import com.intellij.ui.jcef.JBCefBrowser
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import java.awt.BorderLayout
import javax.swing.*
import javax.swing.JMenuBar
import javax.swing.JPanel

class SankeyGraphResult(
private val graphData: Graph,
Expand All @@ -22,10 +26,10 @@ class SankeyGraphResult(
if (indicatorList.size > 1) {
val myMenuBar = JMenuBar()

myMenuBar.add(JLabel("Choose an indicator: "))
myMenuBar.add(JBLabel("Choose an indicator: "))

// First element of the list is the currently selected indicator.
val myMenu: JMenu = buildMenu(
val myMenu: JBMenu = buildMenu(
indicatorList.first(),
indicatorList,
myMenuBar,
Expand All @@ -46,11 +50,13 @@ class SankeyGraphResult(
indicatorList: List<MatrixColumnIndex>,
parent: JMenuBar,
browser: JBCefBrowser,
): JMenu {
val myMenu = JMenu(currentIndicator.getDisplayName())
): JBMenu {
val myMenu = JBMenu()
myMenu.text = currentIndicator.getDisplayName()

indicatorList.filterNot { it == currentIndicator }.forEach { indicator ->

val menuItem = JMenuItem(indicator.getDisplayName())
val menuItem = JBMenuItem(indicator.getDisplayName())
menuItem.addActionListener {
// update contents
browser.loadHTML(
Expand All @@ -59,7 +65,7 @@ class SankeyGraphResult(
// update menu
val newMenu = buildMenu(indicator, indicatorList, parent, browser)
parent.removeAll()
parent.add(JLabel("Choose an indicator: "))
parent.add(JBLabel("Choose an indicator: "))
parent.add(newMenu)
}

Expand Down

0 comments on commit ed1d2c8

Please sign in to comment.