* IMPORTANT: This code isn't a good example of how to write a view.
* It's just here to prove how the exception handlers work.
* Take a look at the application context to see how the exception handler(s) are configured.
*/
protected JComponent createControl() {
TableLayoutBuilder layoutBuilder = new TableLayoutBuilder();
layoutBuilder.cell(new JLabel("This page demonstrates the exception handling."));
layoutBuilder.row();
layoutBuilder.cell(new JLabel("Push the buttons and see which exception handler gets choosen."));
layoutBuilder.row();
layoutBuilder.cell(new JLabel("That defines the log level and the dialog shown."));
layoutBuilder.row();
layoutBuilder.unrelatedGapRow();
JButton badCredentials = new JButton(new AbstractAction("Login with bad credentials"){
public void actionPerformed(ActionEvent e) {
loginWithBadCredentials();
}
});
layoutBuilder.cell(badCredentials);
layoutBuilder.row();
layoutBuilder.relatedGapRow();
JButton accessDenied = new JButton(new AbstractAction("Do something you don't have access to"){
public void actionPerformed(ActionEvent e) {
denyAccess();
}
});
layoutBuilder.cell(accessDenied);
layoutBuilder.row();
layoutBuilder.relatedGapRow();
JButton invalidPerson = new JButton(new AbstractAction("Validate a person with a null name and age 1981"){
public void actionPerformed(ActionEvent e) {
validateInvalidPerson();
}
});
layoutBuilder.cell(invalidPerson);
layoutBuilder.row();
layoutBuilder.relatedGapRow();
JButton nullPointer = new JButton(new AbstractAction("Cause a NumberFormatException"){
public void actionPerformed(ActionEvent e) {
causeNumberFormatException();
}
});
layoutBuilder.cell(nullPointer);
layoutBuilder.row();
layoutBuilder.relatedGapRow();
JButton stackOverflow = new JButton(new AbstractAction("Cause a stack overflow error"){
public void actionPerformed(ActionEvent e) {
causeStackOverflow();
}
});
layoutBuilder.cell(stackOverflow);
layoutBuilder.row();
JPanel panel = layoutBuilder.getPanel();
panel.setBorder(GuiStandardUtils.createEvenlySpacedBorder(UIConstants.ONE_SPACE));
return panel;
}