You can do it with javascript.

Make a trigger that closes the modalwindow and then opens a new one by
firing a new javascript call.

Here is an example:

          final FriendlyAjaxEventBehavior ajaxEventBehavior;
          add(ajaxEventBehavior = new
FriendlyAjaxEventBehavior(JavaScriptConstants.ONCLICK) {
            @Override
            protected void onEvent(AjaxRequestTarget target) {
              showModalWindow(target);
            }
            /**
             * @see
org.apache.wicket.behavior.AbstractBehavior#isEnabled(org.apache.wicket.Component)
             */
            @Override
            public boolean isEnabled(Component component) {
              return super.isEnabled(component) &&
(!getWorkShiftCellStateController().isInline()) &&
workShiftCellStateController.getWorkShiftDayController().getWorkShiftCellDimensionController().isEditorMode()
                && workShiftCellStateController.isAllowedToModify();
            }
          });

And you can fire it manually:

            add(fireFriendlyAjaxEventBehavior(ajaxEventBehavior));

/**
   * @param ajaxEventBehavior
   * @return GenericTailJavaScriptBehavior
   */
  public GenericTailJavaScriptBehavior fireFriendlyAjaxEventBehavior(final
FriendlyAjaxEventBehavior ajaxEventBehavior) {
    try {
      return new GenericTailJavaScriptBehavior("") {
        /**
         * @see
com.tustor.common.wicket.behaviors.GenericTailJavaScriptBehavior#getJavaScript()
         */
        @Override
        public String getJavaScript() {
          return ajaxEventBehavior.getCallbackScript().toString();
        }
        /**
         * @see org.apache.wicket.behavior.AbstractBehavior#isTemporary()
         */
        @Override
        public boolean isTemporary() {
          return true;
        }
      };
    } finally {
      setAdded(null); // Consume it
    }
  }

**
Martin

2011/8/9 Archana <archanaacharya.adhik...@gmail.com>

> Hi All,
>
> In my current application there is a need to open a Modal window with in a
> Modal window and close the parent Modal window, once the child Modal window
> opens. Currently from one page on click of a icon the Modal window 1 is
> opening. Modal window 1 has few other components along with few buttons. On
> click of a create button another Modal window Modal window 2 opens.
>
> 1. The need is to close the Modal window 1 when the Modal window 2 opens.
> But for Modal window 2, the parent is Modal window 1. So if I close the
> Modal window 1, Modal window 2 does not open. *Is there a way by which I
> can
> close Modal window 1, when Modal window 2 open.*
>
> 2. If I can not close the parent Modal window, I want to hide the Modal
> window 1, when the Modal window 2 open. I tried the setVisible() for Modal
> window 1. but it did not work. *Is there a way by which I can hide the
> Modal
> window 1 or at least deactivate the Modal window 1, when the Modal window 2
> opens.*
>
> Both the Modal windows uses Panel. I am using wicket 1.4.
>
> -----
> Thanks & Regards,
> Archana
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Modal-window-issue-tp3731060p3731060.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to