]> gitweb @ CieloNegro.org - task-reporter.git/blobdiff - src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala
wip
[task-reporter.git] / src / main / scala / jp / ymir / taskReporter / ui / MainFrame.scala
index 94897af964a7dd3920c1286603d7eca46034705f..1807a064d3535292c20dee4fb8493d57b2492022 100644 (file)
@@ -44,6 +44,7 @@ class MainFrame(reportFile: Option[File]) extends Frame {
           if (r == FileChooser.Result.Approve) {
             Preferences.lastChosenDir() = chooser.selectedFile.getParentFile
             reportSet.load(chooser.selectedFile)
+            // FIXME: select the last report
           }
         }
       })
@@ -78,26 +79,53 @@ class MainFrame(reportFile: Option[File]) extends Frame {
     }
   }
 
-  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