Examples of DialogContext


Examples of org.apache.shale.dialog.DialogContext

    /** {@inheritDoc} */
    public DialogContext getParent() {

        if (this.parentDialogId != null) {
            DialogContext parent = manager.get(this.parentDialogId);
            if (parent == null) {
                throw new IllegalStateException("Dialog instance '"
                        + parentDialogId + "' was associated with this instance '"
                        + getId() + "' but is no longer available");
            }
View Full Code Here

Examples of org.apache.shale.dialog.DialogContext

        String parentId = (String) context.getExternalContext().
                getRequestParameterMap().get(Constants.PARENT_ID);
        if (dialogName != null) {

            // Create a new DialogContext instance
            DialogContext dcontext = create(context, dialogName, parentId);
            if (dcontext == null) {
                return;
            }

            // Start the new DialogContext instance
            dcontext.start(context);
            if (log.isDebugEnabled()) {
                log.debug("afterRestoreView() creating dialog context with id '"
                          + id + "' for FacesContext instance '"
                          + context + "' associated with parent dialog context id '"
                          + parentId + "' and advancing to viewId '"
View Full Code Here

Examples of org.apache.shale.dialog.DialogContext

     *
     * @param context <code>FacesContext</code> for the current request
     */
    private void beforeRenderResponse(FacesContext context) {

        DialogContext dcontext = (DialogContext)
          context.getExternalContext().getRequestMap().get(Constants.CONTEXT_BEAN);
        Map map = context.getViewRoot().getAttributes();
        if ((dcontext != null) && dcontext.isActive()) {
            if (log.isDebugEnabled()) {
                log.debug("beforeRenderResponse() saving dialog context id '"
                          + dcontext.getId()
                          + "' for FacesContext instance '"
                          + context + "'");
            }
            map.put(CONTEXT_ID_ATTR, dcontext.getId());
            Object opaqueState = dcontext.getOpaqueState();
            if (opaqueState != null) {
                map.put(CONTEXT_OPAQUE_ATTR, opaqueState);
            }
        } else {
            if (log.isTraceEnabled()) {
View Full Code Here

Examples of org.apache.shale.dialog.DialogContext

          context.getApplication().getVariableResolver().
                resolveVariable(context, Constants.MANAGER_BEAN);
        if (manager == null) {
            return null;
        }
        DialogContext parent = null;
        if (parentId != null) {
            parent = manager.get(parentId);
        }
        DialogContext dcontext = manager.create(context, dialogName, parent);
        return dcontext;

    }
View Full Code Here

Examples of org.apache.shale.dialog.DialogContext

          context.getApplication().getVariableResolver().
                resolveVariable(context, Constants.MANAGER_BEAN);
        if (manager == null) {
            return;
        }
        DialogContext dcontext = manager.get(dialogId);
        if (dcontext == null) {
            return;
        }
        if (log.isDebugEnabled()) {
            log.debug("afterPhase() restoring dialog context with id '"
                      + dialogId + "' for FacesContext instance '"
                      + context + "'");
        }
        context.getExternalContext().getRequestMap().put(Constants.CONTEXT_BEAN, dcontext);
        Object opaqueState = context.getViewRoot().getAttributes().get(CONTEXT_OPAQUE_ATTR);
        if (opaqueState != null) {
            dcontext.setOpaqueState(opaqueState);
        }

    }
View Full Code Here

Examples of org.apache.shale.dialog.DialogContext

                      + context + "', fromAction='"
                      + fromAction + "', outcome='"
                      + outcome + "')");
        }

        DialogContext dcontext = (DialogContext)
          context.getExternalContext().getRequestMap().get(Constants.CONTEXT_BEAN);
        String prefix = prefix(context);
        if (dcontext == null) {
            if ((outcome != null) && outcome.startsWith(prefix)) {
                // Create and start a new DialogContext instance
                DialogContextManager manager = (DialogContextManager)
                  context.getApplication().getVariableResolver().
                  resolveVariable(context, Constants.MANAGER_BEAN);
                dcontext =
                  manager.create(context, outcome.substring(prefix.length()));
                dcontext.start(context);
                if (log.isDebugEnabled()) {
                    log.debug("Starting dialog '"
                              + outcome.substring(prefix.length())
                              + "' for FacesContext instance '"
                              + context + "' with navigation to viewId '"
                              + context.getViewRoot().getViewId() + "'");
                }
                return;
            } else {
                // No active dialog, so delegate to the original handler
                original.handleNavigation(context, fromAction, outcome);
                return;
            }
        } else {
            // Advance the currently active DialogContext instance
            dcontext.advance(context, outcome);
            if (log.isDebugEnabled()) {
                log.debug("Advancing dialog '"
                          + dcontext.getName() + "' for FacesContext '"
                          + context + "' with navigation to viewId '"
                          + context.getViewRoot().getViewId() + "'");
            }
        }
View Full Code Here

Examples of org.apache.shale.dialog.DialogContext

    /** {@inheritDoc} */
    public DialogContext getParent() {

        if (this.parentDialogId != null) {
            DialogContext parent = manager.get(this.parentDialogId);
            if (parent == null) {
                throw new IllegalStateException("Dialog instance '"
                        + parentDialogId + "' was associated with this instance '"
                        + getId() + "' but is no longer available");
            }
View Full Code Here

Examples of org.richfaces.component.DialogContext

  public String getOnClick(FacesContext context, UIComponent component) {
    if (getUtils().isBooleanAttribute(component, "disabled")) {
      return "return false;";
    }
    DialogContext dcontext = DialogContextManager.getInstance(context).getActiveContext();

    StringBuffer superOnClick = null;
    if(UIDialogAction.isServerMode(component)) {
      String formId = DialogWindowUtils.findAncestorForm(context, component);
View Full Code Here

Examples of org.richfaces.component.DialogContext

     * Parameter action=close is set by js function closeDialog()
     * for AJAX request simulating this action.
     */
    String action = (String)context.getExternalContext().getRequestParameterMap().get("action");
   
    DialogContext dcontext = DialogContextManager.getInstance(context).getContext(dialogId);

    String posReferenceId = (String)context.getExternalContext().getRequestParameterMap().get("posReferenceId");
    ((UIDialogWindow)component).setPosExternalReferenceId(posReferenceId);

    ActionSource actionSource = (ActionSource) component;

    /*
     * Specific navigation for open/close dialogs
     * includes prefixes to outcomes. We need to
     * intercept computed outcome to extract the prefix
     * and provide JSF with outcome stripped of it.
     */
        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);
      }
View Full Code Here

Examples of org.richfaces.component.DialogContext

    }
    return sb.toString();
  }
 
  public String getDialogBox(FacesContext context, UIComponent component) throws IOException {
        DialogContext dcontext = DialogContextManager.getInstance(context).getContext(component.getClientId(context));
    String dialogPath = DialogWindowUtils.getDialogPath(context, component);
    if(dialogPath == null) return "";
    String dialogId = component.getClientId(context);
    // Added by Hans, Wed Mar  7 14:55:24 EET 2007, CH-1541
    StringBuffer options = new StringBuffer(DialogWindowUtils.getOptions(context, component, getUtils()));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.