示例#1
0
 public void execute(Event<UIAddAttachment> event) throws Exception {
   UIAddAttachment component = event.getSource();
   EventUIComponent eventUIComponent = component.getTargetAttachEvent();
   UIPortletApplication portlet = component.getAncestorOfType(UIPortletApplication.class);
   UIComponent targerComponent = portlet.findComponentById(eventUIComponent.getId());
   Event<UIComponent> xEvent =
       targerComponent.createEvent(
           eventUIComponent.getEventName(), Event.Phase.PROCESS, event.getRequestContext());
   if (!StringUtils.isEmpty(getSelectedFile(event))) {
     processEvent(event);
   } else {
     event
         .getRequestContext()
         .getUIApplication()
         .addMessage(
             new ApplicationMessage(
                 "UIAddAttachment.msg.not-a-file", null, ApplicationMessage.WARNING));
     ((PortalRequestContext) event.getRequestContext().getParentAppRequestContext())
         .ignoreAJAXUpdateOnPortlets(true);
     return;
   }
   if (xEvent != null) {
     xEvent.broadcast();
   }
   UIPopupWindow uiPopupWindow = event.getSource().getParent();
   uiPopupWindow.setRendered(false);
   uiPopupWindow.setUIComponent(null);
   event.getRequestContext().addUIComponentToUpdateByAjax(uiPopupWindow.getParent());
 }