| | |
| SR-JRC | a java richclient framework |
| create an entityeditorEditor-class An editor or a detailview is commonly a window, which pops up at certain user interaction with an overview (i.e. mouse doubleclick or selecting a toolbar icon, or the like). In special cases it may be useful, to integrate the detailview in the mainview. Then So we start with the declaration of a sample editor for addresses:
public class AddressesDetails extends AbstractDetailsView<Addresses> {
private static final long serialVersionUID = 1L;
public AddressesDetails(String id, Addresses instance) {
super(id, instance);
}
@Override
public JComponent createView() {
...
}
} That's all - for a simple detailview. A big point of development time will be consumed by buildding forms, that should be returned by I'm convinced, that a good starting point is a paper draft of the desired form. That way you think about the elements and their dimensions ...
FormLayout layout = new FormLayout("...");
PanelBuilder builder = new PanelBuilder(layout);
builder.setDefaultDialogBorder();
CellConstraints cc = new CellConstraints();
return builder.getPanel(); The core of JGoodies forms black magic is The extension of SRJRCFrames consists of the management of texts and form components. For both issues an application service will be used:
builder.addLabel(msgSource.getMessage("Addresses." + Addresses.FLD_CITY,
null,
"Addresses." + Addresses.FLD_CITY,
null), cc.xy(1, 1));
if (msgSource == null)
msgSource = ApplicationServiceProvider.getService(
MessageSource.class);
if (componentFactory == null)
componentFactory = ApplicationServiceProvider.getService(
FormComponentFactory.class);
The Superclass
JTextField tCity = componentFactory.createTextField(
getPresentationModel().
getBufferedModel(Addresses.FLD_CITY));
builder.add(tCity, cc.xyw(3, 1, 5));
A form component may occupy several cells of the form. That's what the |