}
gridBuilder.newGridPanel();
{
// Abstract
final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.abstract"));
fs.add(new MaxLengthTextArea(TextAreaPanel.WICKET_ID, new PropertyModel<String>(data, "abstractText")));
}
{
// Comment
final FieldsetPanel fs = gridBuilder.newFieldset(getString("comment"));
fs.add(new MaxLengthTextArea(TextAreaPanel.WICKET_ID, new PropertyModel<String>(data, "comment")));
}
if (isNew() == false) {
{
// Lend out
final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.lending")).suppressLabelForWarning();
fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
/**
* @see org.apache.wicket.model.Model#getObject()
*/
@Override
public String getObject()
{
if (data.getLendOutBy() == null) {
return "";
}
final StringBuffer buf = new StringBuffer();
// Show full user name:
buf.append(data.getLendOutBy().getFullname());
if (data.getLendOutDate() != null) {
buf.append(", ");
// Show lend out date:
buf.append(DateTimeFormatter.instance().getFormattedDate(data.getLendOutDate()));
}
return buf.toString();
}
}) {
/**
* @see org.apache.wicket.Component#isVisible()
*/
@Override
public boolean isVisible()
{
return data.getLendOutBy() != null;
}
});
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("lendout")) {
@Override
public final void onSubmit()
{
parentPage.lendOut();
}
}, getString("book.lendOut"), SingleButtonPanel.NORMAL));
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("returnBook")) {
@Override
public final void onSubmit()
{
parentPage.returnBook();
}
}, getString("book.returnBook"), SingleButtonPanel.DANGER) {
/**
* @see org.apache.wicket.Component#isVisible()
*/
@Override
public boolean isVisible()
{
return data.getLendOutBy() != null;
}
});
}
{
// Lend out comment
final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.lendOutNote"));
fs.add(new MaxLengthTextArea(TextAreaPanel.WICKET_ID, new PropertyModel<String>(data, "lendOutComment")));
}
}
}