AbstractEditForm.this.error(parentPage.translateParams(ex));
}
}
};
cancelButton.setDefaultFormProcessing(false); // No validation of the
final SingleButtonPanel cancelButtonPanel = new SingleButtonPanel(actionButtons.newChildId(), cancelButton, getString("cancel"),
SingleButtonPanel.CANCEL);
actionButtons.add(cancelButtonPanel);
}
{
final Button markAsDeletedButton = new Button("button", new Model<String>("markAsDeleted")) {
@Override
public final void onSubmit()
{
try {
parentPage.markAsDeleted();
} catch (final UserException ex) {
AbstractEditForm.this.error(parentPage.translateParams(ex));
}
}
};
markAsDeletedButton.add(AttributeModifier.replace("onclick", "return showDeleteQuestionDialog();"));
markAsDeletedButtonPanel = new SingleButtonPanel(actionButtons.newChildId(), markAsDeletedButton, getString("markAsDeleted"),
SingleButtonPanel.DELETE);
actionButtons.add(markAsDeletedButtonPanel);
}
{
final Button deleteButton = new Button("button", new Model<String>("delete")) {
@Override
public final void onSubmit()
{
try {
parentPage.delete();
} catch (final UserException ex) {
AbstractEditForm.this.error(parentPage.translateParams(ex));
}
}
};
deleteButton.add(AttributeModifier.replace("onclick", "return showDeleteQuestionDialog();"));
deleteButtonPanel = new SingleButtonPanel(actionButtons.newChildId(), deleteButton, getString("delete"), SingleButtonPanel.DELETE);
deleteButton.setDefaultFormProcessing(false);
actionButtons.add(deleteButtonPanel);
}
{
final Button resetButton = new Button("button", new Model<String>("reset")) {
@Override
public final void onSubmit()
{
try {
parentPage.reset();
} catch (final UserException ex) {
AbstractEditForm.this.error(parentPage.translateParams(ex));
}
}
};
final SingleButtonPanel resetButtonPanel = new SingleButtonPanel(actionButtons.newChildId(), resetButton, getString("reset"),
SingleButtonPanel.RESET);
resetButtonPanel.setVisible(false);
actionButtons.add(resetButtonPanel);
}
{
updateButton = new Button("button", new Model<String>("update")) {
@Override
public final void onSubmit()
{
try {
parentPage.update();
} catch (final UserException ex) {
AbstractEditForm.this.error(parentPage.translateParams(ex));
}
}
};
updateButtonPanel = new SingleButtonPanel(actionButtons.newChildId(), updateButton, getString("update"));
actionButtons.add(updateButtonPanel);
}
{
updateAndNextButton = new Button("button", new Model<String>("updateAndNext")) {
@Override
public final void onSubmit()
{
try {
parentPage.updateAndNext();
} catch (final UserException ex) {
AbstractEditForm.this.error(parentPage.translateParams(ex));
}
}
};
updateAndNextButtonPanel = new SingleButtonPanel(actionButtons.newChildId(), updateAndNextButton, getString("updateAndNext"));
actionButtons.add(updateAndNextButtonPanel);
}
{
createButton = new Button("button", new Model<String>("create")) {
@Override
public final void onSubmit()
{
try {
parentPage.create();
} catch (final UserException ex) {
AbstractEditForm.this.error(parentPage.translateParams(ex));
}
}
};
createButtonPanel = new SingleButtonPanel(actionButtons.newChildId(), createButton, getString("create"));
actionButtons.add(createButtonPanel);
}
{
undeleteButton = new Button("button", new Model<String>("undelete")) {
@Override
public final void onSubmit()
{
try {
parentPage.undelete();
} catch (final UserException ex) {
AbstractEditForm.this.error(parentPage.translateParams(ex));
}
}
};
undeleteButtonPanel = new SingleButtonPanel(actionButtons.newChildId(), undeleteButton, getString("undelete"));
actionButtons.add(undeleteButtonPanel);
}
markDefaultButtons();
updateButtonVisibility();
}