Item parent = layout.getParent();
if ( parent != null && parent.getParent() != null) {
parent.getParent().removeItem( parent );
}
PortalService service = null;
EventManager eventManager = null;
try {
service = (PortalService)this.manager.lookup(PortalService.ROLE);
ProfileManager profileManager = service.getComponentManager().getProfileManager();
if ( layout instanceof CopletLayout ) {
// full screen?
if ( layout.equals(profileManager.getEntryLayout()) ) {
Event event = new FullScreenCopletEvent(((CopletLayout)layout).getCopletInstanceData(), null);
eventManager = (EventManager)this.manager.lookup(EventManager.ROLE);
eventManager.getPublisher().publish(event);
service.getComponentManager().getLinkService().addEventToLink(event);
}
CopletFactory factory = service.getComponentManager().getCopletFactory();
factory.remove( ((CopletLayout)layout).getCopletInstanceData());
}
profileManager.unregister(layout);
} catch (ServiceException ce) {
throw new ProcessingException("Unable to lookup portal service.", ce);