]> gitweb @ CieloNegro.org - task-reporter.git/commitdiff
wip
authorPHO <pho@cielonegro.org>
Wed, 8 Oct 2014 10:25:54 +0000 (19:25 +0900)
committerPHO <pho@cielonegro.org>
Wed, 8 Oct 2014 10:25:54 +0000 (19:25 +0900)
build.sbt
lib/jcalendar-1.4.jar [new file with mode: 0644]
src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala
src/main/scala/jp/ymir/taskReporter/ui/TaskEditor.scala [new file with mode: 0644]

index ebb6b47bcc8746aa7809a08e94f4cab6cabb1c7d..f92aaa87e6f303bb8d318da8628336eccefd1a22 100644 (file)
--- a/build.sbt
+++ b/build.sbt
@@ -8,6 +8,11 @@ libraryDependencies <+=
 libraryDependencies +=
   "org.scala-tools.sbinary" %% "sbinary" % "0.4.2"
 
+/* There is also manual dependencies in ./lib:
+ *
+ * - JCalendar <http://toedter.com/jcalendar/>
+ */
+
 scalacOptions ++= Seq("-deprecation", "-unchecked", "-encoding", "UTF-8")
 
 assemblySettings
diff --git a/lib/jcalendar-1.4.jar b/lib/jcalendar-1.4.jar
new file mode 100644 (file)
index 0000000..617a335
Binary files /dev/null and b/lib/jcalendar-1.4.jar differ
index d59493b8f93b33020b282f8ace109bd3ca82a329..f8ecc2f2c6db592e1965b42c1342a689470abb5d 100644 (file)
@@ -128,44 +128,47 @@ class MainFrame(reportFile: Option[File]) extends Frame {
               }
           }
         })
+      rightComponent = new TaskEditor {
+        border = BorderFactory.createEmptyBorder(5, 5, 5, 5)
+      }
     }
 
     leftComponent = new BorderPanel {
       border = BorderFactory.createEmptyBorder(5, 5, 5, 5)
 
-      val reportsScroll = new ScrollPane(
-        new Table() {
-          peer setFillsViewportHeight true
-          peer setModel reportSet
-          listenTo(frame)
-          reactions += {
-            case FileOpened(f) =>
-              if (rowCount > 0) {
-                selection.rows += rowCount - 1 // Select the last report
-              }
-          }
-          selection.reactions += {
-            case TableRowsSelected(_, _, false) =>
-              selection.rows.size match {
-                case 1 =>
-                  val report = reportSet(selection.rows.head)
-                  frame publish ReportSelected(report)
-                case _ =>
-                  frame publish ReportDeselected()
-              }
-          }
-        })
-      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
+      add(
+        new ScrollPane(
+          new Table() {
+            peer setFillsViewportHeight true
+            peer setModel reportSet
+            listenTo(frame)
+            reactions += {
+              case FileOpened(f) =>
+                if (rowCount > 0) {
+                  selection.rows += rowCount - 1 // Select the last report
+                }
+            }
+            selection.reactions += {
+              case TableRowsSelected(_, _, false) =>
+                selection.rows.size match {
+                  case 1 =>
+                    val report = reportSet(selection.rows.head)
+                    frame publish ReportSelected(report)
+                  case _ =>
+                    frame publish ReportDeselected()
+                }
+            }
+          }), BorderPanel.Position.Center)
+
+      add(
+        new FlowPanel(FlowPanel.Alignment.Left)() {
+          contents += new Button(new Action("Add") {
+            def apply = {} // FIXME
+          })
+          contents += new Button(new Action("Delete...") {
+            def apply = {} // FIXME
+          })
+        }, BorderPanel.Position.South)
 
       preferredSize = minimumSize
     }
diff --git a/src/main/scala/jp/ymir/taskReporter/ui/TaskEditor.scala b/src/main/scala/jp/ymir/taskReporter/ui/TaskEditor.scala
new file mode 100644 (file)
index 0000000..95a3a67
--- /dev/null
@@ -0,0 +1,50 @@
+package jp.ymir.taskReporter.ui
+import com.toedter.calendar._
+import java.awt.Insets
+import scala.swing._
+
+class TaskEditor extends GridBagPanel {
+  import GridBagPanel.Anchor._
+  import GridBagPanel.Fill._
+
+  val commonInsets = new Insets(2, 3, 2, 3)
+
+  add(
+    new Label("報告日"),
+    new Constraints() { gridx = 0; gridy = 0 })
+  add(
+    Component.wrap(new JDateChooser() {
+      setDateFormatString("yyyy-MM-dd")
+      getJCalendar().setTodayButtonVisible(true)
+      getJCalendar().setWeekOfYearVisible(false)
+    }),
+    new Constraints() {
+      gridx = 1; gridy = 0; anchor = West
+      ipadx = 3; ipady = 3; insets = commonInsets
+    })
+
+  add(
+    new Label("チケットID"),
+    new Constraints() { gridx = 0; gridy = 1 })
+  add(
+    new TextField(6) {
+      val isDigit = (c : Char) => c >= '0' && c <= '9'
+      inputVerifier = _ => wrapString(text).forall(isDigit)
+      peer.setMargin(commonInsets)
+    },
+    new Constraints() {
+      gridx = 1; gridy = 1; anchor = West; insets = commonInsets
+    })
+
+  add(
+    new Label("作業名"),
+    new Constraints() { gridx = 0; gridy = 2 })
+  add(
+    new TextField() {
+      peer.setMargin(commonInsets)
+    },
+    new Constraints() {
+      gridx = 1; gridy = 2; fill = Horizontal; weightx = 1.0
+      insets = commonInsets
+    })
+}