X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=task-reporter.git;a=blobdiff_plain;f=src%2Fmain%2Fscala%2Fjp%2Fymir%2FtaskReporter%2Fui%2FMainFrame.scala;fp=src%2Fmain%2Fscala%2Fjp%2Fymir%2FtaskReporter%2Fui%2FMainFrame.scala;h=94897af964a7dd3920c1286603d7eca46034705f;hp=957afae23826dbf8ee6b8ba8e84b273cbd58e9ab;hb=79bcb816daaaa042ec7f1855c8307d9143f61956;hpb=520a3f6ce5c36e933bfe6dd3977fa157aa506d05 diff --git a/src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala b/src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala index 957afae..94897af 100644 --- a/src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala +++ b/src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala @@ -3,6 +3,7 @@ import java.awt.Dimension import java.awt.event.ComponentAdapter import java.awt.event.ComponentEvent import java.io._ +import javax.swing.BorderFactory import javax.swing.JOptionPane import javax.swing.JSplitPane import javax.swing.KeyStroke @@ -15,7 +16,7 @@ import scala.swing._ import scala.swing.event._ class MainFrame(reportFile: Option[File]) extends Frame { - private var reportSet = new ReportSet(reportFile) + private val reportSet = new ReportSet(reportFile) title = "Task Reporter " + Main.getVersion preferredSize = Preferences.mainFrameSize() @@ -42,7 +43,7 @@ class MainFrame(reportFile: Option[File]) extends Frame { val r = chooser.showOpenDialog(null) if (r == FileChooser.Result.Approve) { Preferences.lastChosenDir() = chooser.selectedFile.getParentFile - reportSet = new ReportSet(Some(chooser.selectedFile)) + reportSet.load(chooser.selectedFile) } } }) @@ -77,27 +78,26 @@ class MainFrame(reportFile: Option[File]) extends Frame { } } - contents = new SplitPane { + val rootSplit = new SplitPane { peer.setOrientation(JSplitPane.HORIZONTAL_SPLIT) - resizeWeight = 0.3 + continuousLayout = true + oneTouchExpandable = true + resizeWeight = 0.3 leftComponent = new BorderPanel { - val title = new Label("Report date") { - horizontalAlignment = Alignment.Leading - } - layout(title) = BorderPanel.Position.North - - val scroll = new ScrollPane { - horizontalScrollBarPolicy = ScrollPane.BarPolicy.Never - verticalScrollBarPolicy = ScrollPane.BarPolicy.Always - contents = new ListView[String] { - // FIXME - // listData = - } - } + border = BorderFactory.createEmptyBorder(5, 5, 5, 5) + + val scroll = new ScrollPane( + new Table() { + peer.setModel(reportSet) + }) layout(scroll) = BorderPanel.Position.Center } } + contents = rootSplit + + // This can only be done after putting the pane on the frame. + rootSplit.dividerLocation = 0.3 centerOnScreen visible = true @@ -149,9 +149,10 @@ class MainFrame(reportFile: Option[File]) extends Frame { } Preferences.lastChosenDir() = chooser.selectedFile.getParentFile - reportSet.file = Some(chooser.selectedFile) + reportSet.save(chooser.selectedFile) + } + else { + reportSet.save } - - reportSet.save } }