001 package org.springframework.richclient.samples.simple.ui;
002
003 import com.jgoodies.forms.layout.FormLayout;
004 import org.springframework.richclient.form.AbstractFocussableForm;
005 import org.springframework.richclient.form.FormModelHelper;
006 import org.springframework.richclient.form.builder.FormLayoutFormBuilder;
007 import org.springframework.richclient.samples.simple.domain.TodoItem;
008
009 import javax.swing.*;
010
011 public class TodoForm extends AbstractFocussableForm
012 {
013 public TodoForm()
014 {
015 super(FormModelHelper.createFormModel(new TodoItem(), "todoItemForm"));
016 }
017
018 protected JComponent createFormControl()
019 {
020 FormLayout layout = new FormLayout("right:pref, 4dlu, default", "default");
021 FormLayoutFormBuilder builder = new FormLayoutFormBuilder(getBindingFactory(), layout);
022
023 builder.addPropertyAndLabel("name");
024 builder.nextRow();
025 builder.addPropertyAndLabel("description");
026 builder.nextRow();
027 builder.addPropertyAndLabel("todoDate");
028
029 return builder.getPanel();
030 }
031 }