From: PHO Date: Wed, 8 Oct 2014 10:25:54 +0000 (+0900) Subject: wip X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=task-reporter.git;a=commitdiff_plain;h=f6a51dbcc510104994344140fccdeaab459eb570 wip --- diff --git a/build.sbt b/build.sbt index ebb6b47..f92aaa8 100644 --- 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 + */ + 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 index 0000000..617a335 Binary files /dev/null and b/lib/jcalendar-1.4.jar differ diff --git a/src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala b/src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala index d59493b..f8ecc2f 100644 --- a/src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala +++ b/src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala @@ -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 index 0000000..95a3a67 --- /dev/null +++ b/src/main/scala/jp/ymir/taskReporter/ui/TaskEditor.scala @@ -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 + }) +}