fs.add(title);
}
{
// Authors
final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.authors"));
final MaxLengthTextField authors = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "authors"));
fs.add(dependentFormComponents[0] = authors);
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
// DropDownChoice bookType
final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.type"));
final LabelValueChoiceRenderer<BookType> bookTypeChoiceRenderer = new LabelValueChoiceRenderer<BookType>(this, BookType.values());
final DropDownChoice<BookType> bookTypeChoice = new DropDownChoice<BookType>(fs.getDropDownChoiceId(),
new PropertyModel<BookType>(data, "type"), bookTypeChoiceRenderer.getValues(), bookTypeChoiceRenderer);
bookTypeChoice.setNullValid(false).setRequired(true);
fs.add(bookTypeChoice);
}
{
// Year of publishing
final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.yearOfPublishing"));
final MaxLengthTextField yearOfPublishing = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data,
"yearOfPublishing"));
fs.add(dependentFormComponents[1] = yearOfPublishing);
}
{
// DropDownChoice bookStatus
final FieldsetPanel fs = gridBuilder.newFieldset(getString("status"));
final LabelValueChoiceRenderer<BookStatus> bookStatusChoiceRenderer = new LabelValueChoiceRenderer<BookStatus>(this,
BookStatus.values());
final DropDownChoice<BookStatus> bookStatusChoice = new DropDownChoice<BookStatus>(fs.getDropDownChoiceId(),
new PropertyModel<BookStatus>(data, "status"), bookStatusChoiceRenderer.getValues(), bookStatusChoiceRenderer);
bookStatusChoice.setNullValid(false).setRequired(true);
fs.add(bookStatusChoice);
}
{
// Signature
final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.signature"));
final MaxLengthTextField signature = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "signature"));
signature.add(new AbstractValidator<String>() {
private static final long serialVersionUID = 6488923290863235755L;
@Override
protected void onValidate(final IValidatable<String> validatable)
{
data.setSignature(validatable.getValue());
if (bookDao.doesSignatureAlreadyExist(data) == true) {
validatable.error(new ValidationError().addMessageKey("book.error.signatureAlreadyExists"));
}
}
});
fs.add(dependentFormComponents[2] = signature);
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
// ISBN
final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.isbn"));
fs.add(new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "isbn")));
}
{
// Keywords
final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.keywords"));
fs.add(new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "keywords")));
}
{
// Publisher
final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.publisher"));
final MaxLengthTextField publisher = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "publisher"));
fs.add(dependentFormComponents[3] = publisher);
}
{
// Editor
final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.editor"));
final MaxLengthTextField editor = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "editor"));
fs.add(dependentFormComponents[4] = editor);
}
gridBuilder.newGridPanel();
{
// Abstract