Skip to content

Commit

Permalink
- Align the toolbar heights in the table and in the chart
Browse files Browse the repository at this point in the history
- It seems that we don't need to listen to the application font in the table header anymore.
  • Loading branch information
dbarashev committed Oct 1, 2024
1 parent 23728db commit 96c22ad
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 21 additions & 4 deletions ganttproject/src/main/java/biz/ganttproject/app/ViewPane.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package biz.ganttproject.app
import biz.ganttproject.FXUtil
import biz.ganttproject.core.option.IntegerOption
import biz.ganttproject.lib.fx.vbox
import javafx.beans.property.SimpleDoubleProperty
import javafx.embed.swing.SwingNode
import javafx.geometry.Orientation
import javafx.geometry.Rectangle2D
Expand All @@ -33,6 +34,7 @@ import javafx.scene.image.Image
import javafx.scene.image.ImageView
import javafx.scene.layout.Pane
import javafx.scene.layout.Priority
import javafx.scene.layout.Region
import net.sourceforge.ganttproject.action.GPAction
import net.sourceforge.ganttproject.chart.Chart
import net.sourceforge.ganttproject.gui.UIFacade
Expand Down Expand Up @@ -152,9 +154,9 @@ data class ViewComponents(val image: Pane, val splitPane: SplitPane, val table:
}

fun createViewComponents(
tableToolbarBuilder: ()->Node,
tableToolbarBuilder: ()-> Region,
tableBuilder: ()->Node,
chartToolbarBuilder: ()->Node,
chartToolbarBuilder: ()-> Region,
chartBuilder: ()-> JComponent,
dpiOption: IntegerOption): ViewComponents {

Expand All @@ -172,16 +174,31 @@ fun createViewComponents(

val table = tableBuilder()
val splitPane = SplitPane().also {split ->
var maxToolbarHeight = SimpleDoubleProperty(0.0)
split.orientation = Orientation.HORIZONTAL
split.items.add(vbox {
add(tableToolbarBuilder())
add(tableToolbarBuilder().also {
it.heightProperty().subscribe { v ->
if (v.toDouble() > maxToolbarHeight.value) {
maxToolbarHeight.value = v.toDouble()
}
}
it.prefHeightProperty().bind(maxToolbarHeight)
})
add(imagePane)
add(table, null, growth = Priority.ALWAYS)
})

val swingNode = SwingNode()
val right = vbox {
add(chartToolbarBuilder())
add(chartToolbarBuilder().also {
it.heightProperty().subscribe { v ->
if (v.toDouble() > maxToolbarHeight.value) {
maxToolbarHeight.value = v.toDouble()
}
}
it.prefHeightProperty().bind(maxToolbarHeight)
})
add(swingNode, null, Priority.ALWAYS)
}
SwingUtilities.invokeLater { swingNode.content = chartBuilder() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ private void initUI() {
// when they change in the settings.
// Also, there is an attempt to set the background color to the value from Swing LAF, but I am not sure
// if it is working properly.
label.fontProperty().bind(FontKt.getApplicationFont());
//label.fontProperty().bind(FontKt.getApplicationFont());
label.textFillProperty().bind(TreeTableCellsKt.getApplicationForeground());
}

Expand Down

0 comments on commit 96c22ad

Please sign in to comment.