From fc149e355937c9206e3a3c388b182ee5a1b81205 Mon Sep 17 00:00:00 2001 From: PHO Date: Mon, 20 Oct 2014 13:39:25 +0900 Subject: [PATCH] wip --- .../jp/ymir/taskReporter/ui/MainFrame.scala | 36 +++++---- .../jp/ymir/taskReporter/ui/TaskEditor.scala | 73 +++++++++++-------- 2 files changed, 62 insertions(+), 47 deletions(-) diff --git a/src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala b/src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala index da35f39..a09aa5d 100644 --- a/src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala +++ b/src/main/scala/jp/ymir/taskReporter/ui/MainFrame.scala @@ -3,7 +3,6 @@ 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 @@ -13,6 +12,7 @@ import javax.swing.filechooser.FileNameExtensionFilter import jp.ymir.taskReporter._ import jp.ymir.taskReporter.core._ import scala.swing._ +import scala.swing.Swing._ import scala.swing.event._ class MainFrame(reportFile: Option[File]) extends Frame { @@ -94,13 +94,10 @@ class MainFrame(reportFile: Option[File]) extends Frame { oneTouchExpandable = true resizeWeight = 0 // Let the left pane be fixed - rightComponent = new SplitPane { - peer.setOrientation(JSplitPane.VERTICAL_SPLIT) - continuousLayout = true - oneTouchExpandable = true - resizeWeight = 0.5 + rightComponent = new BoxPanel(Orientation.Vertical) { + border = EmptyBorder(5, 5, 5, 5) - leftComponent = new ScrollPane( + contents += new ScrollPane( new Table() { peer setFillsViewportHeight true listenTo(frame) @@ -128,18 +125,25 @@ class MainFrame(reportFile: Option[File]) extends Frame { } } }) -/* rightComponent = new BoxPanel(Orientation.Vertical) { - contents += new TaskEditor { - border = BorderFactory.createEmptyBorder(5, 5, 5, 5) - } - */ - rightComponent = new TaskEditor { - border = BorderFactory.createEmptyBorder(5, 5, 5, 5) + contents += VStrut(5) + contents += new Separator(Orientation.Horizontal) + contents += VStrut(5) + contents += new TaskEditor + contents += VStrut(5) + contents += new Separator(Orientation.Horizontal) + contents += VStrut(5) + contents += new FlowPanel(FlowPanel.Alignment.Left)() { + contents += new Button(new Action("New") { + def apply = {} // FIXME + }) + contents += new Button(new Action("Delete...") { + def apply = {} // FIXME + }) } } leftComponent = new BorderPanel { - border = BorderFactory.createEmptyBorder(5, 5, 5, 5) + border = EmptyBorder(5, 5, 5, 5) add( new ScrollPane( @@ -167,7 +171,7 @@ class MainFrame(reportFile: Option[File]) extends Frame { add( new FlowPanel(FlowPanel.Alignment.Left)() { - contents += new Button(new Action("Add") { + contents += new Button(new Action("New...") { def apply = {} // FIXME }) contents += new Button(new Action("Delete...") { diff --git a/src/main/scala/jp/ymir/taskReporter/ui/TaskEditor.scala b/src/main/scala/jp/ymir/taskReporter/ui/TaskEditor.scala index 17b77dd..c0761df 100644 --- a/src/main/scala/jp/ymir/taskReporter/ui/TaskEditor.scala +++ b/src/main/scala/jp/ymir/taskReporter/ui/TaskEditor.scala @@ -8,97 +8,108 @@ class TaskEditor extends GridBagPanel { import GridBagPanel.Anchor._ import GridBagPanel.Fill._ - val commonInsets = new Insets(2, 3, 2, 3) + private val commonInsets = new Insets(2, 3, 2, 3) + val date = Component.wrap(new JDateChooser() { + setDateFormatString("yyyy-MM-dd") + getJCalendar().setTodayButtonVisible(true) + getJCalendar().setWeekOfYearVisible(false) + }) add( new Label("報告日"), new Constraints { gridx = 0; gridy = 0 }) add( - Component.wrap(new JDateChooser() { - setDateFormatString("yyyy-MM-dd") - getJCalendar().setTodayButtonVisible(true) - getJCalendar().setWeekOfYearVisible(false) - }), + date, new Constraints() { gridx = 1; gridy = 0; anchor = West ipadx = 3; ipady = 3; insets = commonInsets }) + date.minimumSize = date.preferredSize + val ticketID = new TextField(6) { + val isDigit = (c : Char) => c >= '0' && c <= '9' + inputVerifier = _ => wrapString(text).forall(isDigit) + peer.setMargin(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) - }, + ticketID, new Constraints() { gridx = 1; gridy = 1; anchor = West; insets = commonInsets }) + ticketID.minimumSize = ticketID.preferredSize + val title = new TextField() { + peer.setMargin(commonInsets) + } add( new Label("作業名"), new Constraints { gridx = 0; gridy = 2 }) add( - new TextField() { - peer.setMargin(commonInsets) - }, + title, new Constraints() { gridx = 1; gridy = 2; fill = Horizontal; weightx = 1.0 insets = commonInsets }) + val expectedCompletionDate = Component.wrap(new JDateChooser() { + setDateFormatString("yyyy-MM-dd") + getJCalendar().setTodayButtonVisible(true) + getJCalendar().setWeekOfYearVisible(false) + }) add( new Label("作業完了予定年月日"), new Constraints { gridx = 0; gridy = 3 }) add( - Component.wrap(new JDateChooser() { - setDateFormatString("yyyy-MM-dd") - getJCalendar().setTodayButtonVisible(true) - getJCalendar().setWeekOfYearVisible(false) - }), + expectedCompletionDate, new Constraints() { gridx = 1; gridy = 3; anchor = West ipadx = 3; ipady = 3; insets = commonInsets }) + expectedCompletionDate.minimumSize = expectedCompletionDate.preferredSize + val deadline = Component.wrap(new JDateChooser() { + setDateFormatString("yyyy-MM-dd") + getJCalendar().setTodayButtonVisible(true) + getJCalendar().setNullDateButtonVisible(true) + getJCalendar().setWeekOfYearVisible(false) + }) add( new Label("タスク期限"), new Constraints { gridx = 0; gridy = 4 }) add( - Component.wrap(new JDateChooser() { - setDateFormatString("yyyy-MM-dd") - getJCalendar().setTodayButtonVisible(true) - getJCalendar().setNullDateButtonVisible(true) - getJCalendar().setWeekOfYearVisible(false) - }), + deadline, new Constraints() { gridx = 1; gridy = 4; anchor = West ipadx = 3; ipady = 3; insets = commonInsets }) + deadline.minimumSize = deadline.preferredSize + val status = new ComboBox[Task.Status](Task.Status.all) add( new Label("状態"), new Constraints { gridx = 0; gridy = 5 }) add( - new ComboBox[Task.Status](Task.Status.all), + status, new Constraints { gridx = 1; gridy = 5; anchor = West ipadx = 3; ipady = 3; insets = commonInsets }) + val description = new ScrollPane(new TextArea() { + rows = 5 + peer.setMargin(commonInsets) + }) add( new Label("説明"), new Constraints { gridx = 0; gridy = 6 }) add( - new ScrollPane( - new TextArea() { - rows = 5 - peer.setMargin(commonInsets) - }), + description, new Constraints() { gridx = 1; gridy = 6; fill = Horizontal; weightx = 1.0 insets = commonInsets }) + description.minimumSize = description.preferredSize } -- 2.40.0