if (r == FileChooser.Result.Approve) {
Preferences.lastChosenDir() = chooser.selectedFile.getParentFile
reportSet.load(chooser.selectedFile)
+ // FIXME: select the last report
}
}
})
}
}
- val rootSplit = new SplitPane {
+ contents = new SplitPane {
peer.setOrientation(JSplitPane.HORIZONTAL_SPLIT)
continuousLayout = true
oneTouchExpandable = true
- resizeWeight = 0.3
+ resizeWeight = 0 // Let the left pane be fixed
+
+ rightComponent = new SplitPane {
+ peer.setOrientation(JSplitPane.VERTICAL_SPLIT)
+ continuousLayout = true
+ oneTouchExpandable = true
+ resizeWeight = 0.5
+
+ leftComponent = new ScrollPane(
+ new Table() {
+ peer.setModel(new Report()) // Empty report
+ })
+ }
leftComponent = new BorderPanel {
border = BorderFactory.createEmptyBorder(5, 5, 5, 5)
- val scroll = new ScrollPane(
+ val reportsScroll = new ScrollPane(
new Table() {
peer.setModel(reportSet)
+ if (rowCount > 0) {
+ selection.rows += rowCount - 1 // Select the last report
+ }
+ selection.reactions += {
+ case TableRowsSelected(_, _, false) =>
+ // FIXME
+ }
})
- layout(scroll) = BorderPanel.Position.Center
+ layout(reportsScroll) = BorderPanel.Position.Center
+
+ val buttons = new FlowPanel(FlowPanel.Alignment.Left)() {
+ contents += new Button(new Action("Add") {
+ def apply = {} // FIXME
+ })
+ contents += new Button(new Action("Delete...") {
+ def apply = {} // FIXME
+ })
+ }
+ layout(buttons) = BorderPanel.Position.South
+
+ preferredSize = minimumSize
}
}
- contents = rootSplit
-
- // This can only be done after putting the pane on the frame.
- rootSplit.dividerLocation = 0.3
centerOnScreen
visible = true