portletEdit.setCaption("Edit");
} else {
url.setPortletMode(PortletMode.VIEW);
portletEdit.setCaption("Done");
}
portletEdit.setResource(new ExternalResource(url.toString()));
} catch (Exception e) {
portletEdit.setEnabled(false);
Logger.getLogger(getClass().getName()).log(Level.SEVERE,
"Error creating edit mode link", e);
}
// Create Maximize/Normal link (actionUrl)
url = getSession().generateActionURL("changeState");
try {
if (inNormalState) {
url.setWindowState(WindowState.MAXIMIZED);
portletMax.setCaption("Maximize");
} else {
url.setWindowState(WindowState.NORMAL);
portletMax.setCaption("Back to normal");
}
portletMax.setResource(new ExternalResource(url.toString()));
} catch (Exception e) {
portletMax.setEnabled(false);
Logger.getLogger(getClass().getName()).log(Level.SEVERE,
"Error creating state change link", e);
}
if (someAction == null) {
url = getSession().generateActionURL("someAction");
try {
someAction = new Link("An action", new ExternalResource(
url.toString()));
main.addComponent(someAction);
} catch (Exception e) {
// Oops
System.err.println("Could not create someAction: " + e);