}
}
})
+ 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
}
--- /dev/null
+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
+ })
+}