1 package jp.ymir.taskReporter.ui
2 import com.toedter.calendar._
4 import jp.ymir.taskReporter.core._
7 class TaskEditor extends GridBagPanel {
8 import GridBagPanel.Anchor._
9 import GridBagPanel.Fill._
11 private val commonInsets = new Insets(2, 3, 2, 3)
13 val date = Component.wrap(new JDateChooser() {
14 setDateFormatString("yyyy-MM-dd")
15 getJCalendar().setTodayButtonVisible(true)
16 getJCalendar().setWeekOfYearVisible(false)
20 new Constraints { gridx = 0; gridy = 0 })
24 gridx = 1; gridy = 0; anchor = West
25 ipadx = 3; ipady = 3; insets = commonInsets
27 date.minimumSize = date.preferredSize
29 val ticketID = new TextField(6) {
30 val isDigit = (c : Char) => c >= '0' && c <= '9'
31 inputVerifier = _ => wrapString(text).forall(isDigit)
32 peer.setMargin(commonInsets)
36 new Constraints { gridx = 0; gridy = 1 })
40 gridx = 1; gridy = 1; anchor = West; insets = commonInsets
42 ticketID.minimumSize = ticketID.preferredSize
44 val title = new TextField() {
45 peer.setMargin(commonInsets)
49 new Constraints { gridx = 0; gridy = 2 })
53 gridx = 1; gridy = 2; fill = Horizontal; weightx = 1.0
57 val expectedCompletionDate = Component.wrap(new JDateChooser() {
58 setDateFormatString("yyyy-MM-dd")
59 getJCalendar().setTodayButtonVisible(true)
60 getJCalendar().setWeekOfYearVisible(false)
63 new Label("作業完了予定年月日"),
64 new Constraints { gridx = 0; gridy = 3 })
66 expectedCompletionDate,
68 gridx = 1; gridy = 3; anchor = West
69 ipadx = 3; ipady = 3; insets = commonInsets
71 expectedCompletionDate.minimumSize = expectedCompletionDate.preferredSize
73 val deadline = Component.wrap(new JDateChooser() {
74 setDateFormatString("yyyy-MM-dd")
75 getJCalendar().setTodayButtonVisible(true)
76 getJCalendar().setNullDateButtonVisible(true)
77 getJCalendar().setWeekOfYearVisible(false)
81 new Constraints { gridx = 0; gridy = 4 })
85 gridx = 1; gridy = 4; anchor = West
86 ipadx = 3; ipady = 3; insets = commonInsets
88 deadline.minimumSize = deadline.preferredSize
90 val status = new ComboBox[Task.Status](Task.Status.all)
93 new Constraints { gridx = 0; gridy = 5 })
97 gridx = 1; gridy = 5; anchor = West
98 ipadx = 3; ipady = 3; insets = commonInsets
101 val description = new ScrollPane(new TextArea() {
103 peer.setMargin(commonInsets)
107 new Constraints { gridx = 0; gridy = 6 })
111 gridx = 1; gridy = 6; fill = Horizontal; weightx = 1.0
112 insets = commonInsets
114 description.minimumSize = description.preferredSize