Package org.richfaces.component

Examples of org.richfaces.component.DialogOpenEvent


        MethodBinding binding = actionSource.getAction();
        if(!(binding instanceof DialogMethodBinding)) {
          actionSource.setAction(new DialogMethodBinding(binding, (ActionPrefixHolder)component));
        }
       
        DialogOpenEvent dialogEvent = new DialogOpenEvent(component);
       
    if(!"close".equals(action) && !"closeall".equals(action)) {
     
      /*
       * Button has been pressed.
       * Child dialog is to be open.
       * We need to send a standard ActionEvent to
       * let JSF to pass all the lifecycle up to
       * the end of invoke application phase where
       * we will interfere and change the navigation logic.
       */
      DialogContext parentContext = DialogContextManager.getInstance(context).getActiveContext();
      DialogContextManager.getInstance(context).setActiveRequest(dialogId);
      if(parentContext != null && parentContext != dcontext) parentContext.addChildContext(dcontext);
      dcontext.setLocked(false);

      Object type = component.getAttributes().get("type");
         if (null == type || ! "reset".equalsIgnoreCase((String)type) ) {
///           String mode = ((UIDialogAction)component).getMode();
           ActionEvent event;
           event = new ActionEvent(component);
           component.queueEvent(event);
           if(component instanceof ViewIdHolder) {
             component.queueEvent( new AjaxEvent(component));
//             ((UIDialogWindow)component).initViewId();
//             AjaxContext.getCurrentInstance(context).setViewIdHolder((ViewIdHolder)component);
//             return;
           }

         } else {
         component.queueEvent( new AjaxEvent(component));
       }
    } else {
      /*
       * Child dialog has just been closed.
       * It simulates action of this component
       * by AJAX request from js function closeDialog()
       * Parameter 'targetViewId' is id of view
       * that would be shown in dialog window if it had not
       * to be closed. Now it is saved in event
       * to be substituted for view root of this window.
       */
      String targetViewId = (String)context.getExternalContext().getRequestParameterMap().get("targetViewId");
      if(targetViewId != null) {
        dialogEvent.setSourceViewId(targetViewId);
      }
      DialogContext parentContext = dcontext.getParentContext();
      dcontext.deactivate();
          if(parentContext != null) {
        DialogContextManager.getInstance(context).setActiveRequest(parentContext.getDialogId());
          } else if("closeall".equals(action)) {
          DialogContextManager.getInstance(context).setActiveRequest(null);
      } else {
          DialogContextManager.getInstance(context).setActiveRequest(null);
      }

          component.queueEvent(new DialogWindowClosedEvent(component));
         
       component.queueEvent( new AjaxEvent(component));
       dialogEvent.setClose(true);
    }
   
    /*
     * Queue event that will be processed during
     * invoke application phase after navigation handler
     * has calculated and set new view id.
     * See UIDialogWindow.processDialogOpen for details
     * of processing this event to change navigation logic.
     */
    dialogEvent.queue();
  }
 
View Full Code Here


      return;
    }
    String dialogId = component.getClientId(context);
    String action = (String)context.getExternalContext().getRequestParameterMap().get("action");
    DialogContext dcontext = DialogContextManager.getInstance(context).getContext(dialogId);
        DialogOpenEvent dialogEvent = new DialogOpenEvent(component);
       
    if(!"close".equals(action) && !"closeall".equals(action)) {
      DialogContext parentContext = DialogContextManager.getInstance(context).getActiveContext();
      DialogContextManager.getInstance(context).setActiveRequest(dialogId);
      if(parentContext != null && parentContext != dcontext) parentContext.addChildContext(dcontext);
      dcontext.setLocked(false);
      ViewHandler vh = UIDialogAction.getViewHandler(context);
      String targetActionURL = (String)((UIDialogWindow)component).getValue();
      targetActionURL = vh.getActionURL(context, targetActionURL);
          dcontext.setDialogPath(targetActionURL);
       component.queueEvent( new AjaxEvent(component));
       context.renderResponse();
    } else {
      String targetViewId = (String)context.getExternalContext().getRequestParameterMap().get("targetViewId");
      if(targetViewId != null) {
        dialogEvent.setSourceViewId(targetViewId);
      }
      DialogContext parentContext = dcontext.getParentContext();
      dcontext.deactivate();
          if(parentContext != null) {
        DialogContextManager.getInstance(context).setActiveRequest(parentContext.getDialogId());
          } else if("closeall".equals(action)) {
          DialogContextManager.getInstance(context).setActiveRequest(null);
      } else {
          DialogContextManager.getInstance(context).setActiveRequest(null);
      }
       dialogEvent.setClose(true);
       dialogEvent.queue();
       component.queueEvent( new AjaxEvent(component));
    }
   
  }
View Full Code Here

TOP

Related Classes of org.richfaces.component.DialogOpenEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.