]> gitweb @ CieloNegro.org - task-reporter.git/blob - src/main/scala/jp/ymir/taskReporter/ui/TaskEditor.scala
wip
[task-reporter.git] / src / main / scala / jp / ymir / taskReporter / ui / TaskEditor.scala
1 package jp.ymir.taskReporter.ui
2 import com.toedter.calendar._
3 import java.awt.Insets
4 import jp.ymir.taskReporter.core._
5 import scala.swing._
6
7 class TaskEditor extends GridBagPanel {
8   import GridBagPanel.Anchor._
9   import GridBagPanel.Fill._
10
11   val commonInsets = new Insets(2, 3, 2, 3)
12
13   add(
14     new Label("報告日"),
15     new Constraints { gridx = 0; gridy = 0 })
16   add(
17     Component.wrap(new JDateChooser() {
18       setDateFormatString("yyyy-MM-dd")
19       getJCalendar().setTodayButtonVisible(true)
20       getJCalendar().setWeekOfYearVisible(false)
21     }),
22     new Constraints() {
23       gridx = 1; gridy = 0; anchor = West
24       ipadx = 3; ipady = 3; insets = commonInsets
25     })
26
27   add(
28     new Label("チケットID"),
29     new Constraints { gridx = 0; gridy = 1 })
30   add(
31     new TextField(6) {
32       val isDigit = (c : Char) => c >= '0' && c <= '9'
33       inputVerifier = _ => wrapString(text).forall(isDigit)
34       peer.setMargin(commonInsets)
35     },
36     new Constraints() {
37       gridx = 1; gridy = 1; anchor = West; insets = commonInsets
38     })
39
40   add(
41     new Label("作業名"),
42     new Constraints { gridx = 0; gridy = 2 })
43   add(
44     new TextField() {
45       peer.setMargin(commonInsets)
46     },
47     new Constraints() {
48       gridx = 1; gridy = 2; fill = Horizontal; weightx = 1.0
49       insets = commonInsets
50     })
51
52   add(
53     new Label("作業完了予定年月日"),
54     new Constraints { gridx = 0; gridy = 3 })
55   add(
56     Component.wrap(new JDateChooser() {
57       setDateFormatString("yyyy-MM-dd")
58       getJCalendar().setTodayButtonVisible(true)
59       getJCalendar().setWeekOfYearVisible(false)
60     }),
61     new Constraints() {
62       gridx = 1; gridy = 3; anchor = West
63       ipadx = 3; ipady = 3; insets = commonInsets
64     })
65
66   add(
67     new Label("タスク期限"),
68     new Constraints { gridx = 0; gridy = 4 })
69   add(
70     Component.wrap(new JDateChooser() {
71       setDateFormatString("yyyy-MM-dd")
72       getJCalendar().setTodayButtonVisible(true)
73       getJCalendar().setNullDateButtonVisible(true)
74       getJCalendar().setWeekOfYearVisible(false)
75     }),
76     new Constraints() {
77       gridx = 1; gridy = 4; anchor = West
78       ipadx = 3; ipady = 3; insets = commonInsets
79     })
80
81   add(
82     new Label("状態"),
83     new Constraints { gridx = 0; gridy = 5 })
84   add(
85     new ComboBox[Task.Status](Task.Status.all),
86     new Constraints {
87       gridx = 1; gridy = 5; anchor = West
88       ipadx = 3; ipady = 3; insets = commonInsets
89     })
90
91   add(
92     new Label("説明"),
93     new Constraints { gridx = 0; gridy = 6 })
94   add(
95     new ScrollPane(
96       new TextArea() {
97         rows = 5
98         peer.setMargin(commonInsets)
99       }),
100     new Constraints() {
101       gridx = 1; gridy = 6; fill = Horizontal; weightx = 1.0
102       insets = commonInsets
103     })
104 }