frame.setVisible(true);
}
public JFrame createJFrame(final AbstractForm form)
{
AbstractTitledWidget widget = new AbstractTitledWidget()
{
@Override
public JComponent createWidgetContent()
{
form.getFormModel().addPropertyChangeListener(new PropertyChangeListener()
{
public void propertyChange(PropertyChangeEvent evt)
{
System.out.println(evt.getPropertyName() + ": " + evt.getOldValue() + " -> " + evt.getNewValue());
}
});
return form.getControl();
}
@Override
public List<? extends AbstractCommand> getCommands()
{
List<AbstractCommand> commands = new ArrayList<AbstractCommand>();
commands.add(form.getCommitCommand());
commands.add(form.getRevertCommand());
return commands;
}
};
form.addValidationResultsReporter(new SimpleValidationResultsReporter(form.getFormModel().getValidationResults(), widget));
JFrame frame = new JFrame();
frame.add(widget.getComponent());
return frame;
}