You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2014/04/01 09:04:10 UTC

Re: Adding/Remiving Panels

Hi,


On Mon, Mar 31, 2014 at 1:53 PM, David Beer <da...@gmail.com> wrote:

> Hi All
>
> I am in the process of building a user account page, which will have a menu
> on the left, and the related content on the right.
>
> I would like the content on the right to be swapped depending on the
> selection on the left. As in the content on the right might well be
> generated by panels or fragments and then added to the page and the
> previous unrelated removed.
>
> Is it better to have all the code added to the html and then hide certain
> components and then re-enable them on selection and disable them or is it
> better to use a panels and a page hierarchy and to pass information between
> panels and parent page.
>

In my experience I have preferred the second approach - a mix of pages and
panels.
If you want to replace the right part with Ajax then you need to replace
panels.
If Ajax is not required then you can show a sub page that inherits the base
layout from a main page and has something custom in the right part.


>
> Any thoughts and examples are always appreciated.
>
> Thanks
>
> David
>

Re: Adding/Remiving Panels

Posted by David Beer <da...@gmail.com>.
Hi I have fixed the problem by adding setOutputMarkupPlaceholderTag(true);
to the top component.

Thanks

David


On 2 April 2014 18:55, David Beer <da...@gmail.com> wrote:

> Hi
>
> I am able to remove the panel by accessing the top most component (form)
> and setting visible to false. This removes the panel from the page, however
> I am having difficulty adding the panel back to the page. I get and Ajax
> error saying component id can't be found.
>
> The source is availble here
> https://github.com/dmbeer/wicket-bootstrap-example/tree/master/src/main/java/exampleUserAccountPage and the Panel's there.
>
> The Wicket Ajax Debug Content is as follows;
>
> *INFO: *Received ajax response (1570 characters)
> *INFO: *
>
> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component id="form1c" ><![CDATA[]]></component><component id="link_dsiable_password17" ><![CDATA[<a id="link_dsiable_password17" href="javascript:;" class="btn-link  btn">
>             Enable Password Panel
>
>         </a>]]></component><header-contribution encoding="wicket1" ><![CDATA[<head xmlns:wicket="
> http://wicket.apache.org"><link rel="stylesheet" type="text/css" href="//
> netdna.bootstrapcdn.com/bootswatch/3.1.1/spacelab/bootstrap.min.css" />
> <script type="text/javascript" src="
> http://code.jquery.com/jquery-1.11.0.min.js"></script>
>
> <script type="text/javascript" src="./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-1392391424000.js"></script>
>
> <script type="text/javascript" src="./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-ajax-jquery-ver-1392391424000.js"></script>
>
> <script type="text/javascript" src="./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-ajax-jquery-debug-ver-1392391424000.js"></script>
> <script type="text/javascript" id="wicket-ajax-debug-enable">
> /*<![CDATA[*/
> Wicket.Ajax.DebugWindow.enabled=true;
> /*]^]^>*/
> </script>
> <script type="text/javascript" id="wicket-ajax-base-url">
> /*<![CDATA[*/
> Wicket.Ajax.baseUrl="account?1";
> /*]^]^>*/
> </script>
>
> </head>]]></header-contribution><evaluate><![CDATA[(function(){Wicket.Ajax.ajax({"u":"./account?1-1.IBehaviorListener.0-link~dsiable~password","e":"click","c":"link_dsiable_password17"});})();]]></evaluate></ajax-response>
>  *INFO: *Response processed successfully.
> *INFO: *refocus last focused component not needed/allowed
> *INFO: *Received ajax response (2916 characters)
> *INFO: *
>
> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component id="form1c" ><![CDATA[<form id="form1c" method="post" action="./account?1-1.IFormSubmitListener-change~password-form" class="form-horizontal"><div style="width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden"><input type="hidden" name="form1c_hf_0" id="form1c_hf_0" /></div>
>             <div class=" form-group">
>             <label class="control-label" for="password14">Password</label>
>
>
>
>                 <input type="password" value="" name="formGroupPassword:formGroupPassword_body:password" id="password14"/>
>
>
>
>
>         </div>
>             <div class=" form-group">
>
>             <label class="control-label" for="confirmPassword15">Confirm Password</label>
>
>
>
>                 <input type="password" value="" name="formGroupConfirmPassword:formGroupConfirmPassword_body:confirmPassword" id="confirmPassword15"/>
>
>
>
>
>         </div>
>             <div class=" form-group">
>
>
>
>                 <div class="col-md-offset-2 col-md-10">
>
>                     <button type="submit" class=" btn-default btn btn-default btn" name="formGroupButton:formGroupButton_body:submit-button" id="submit_button16">
>             Submit
>         </button>
>                 </div>
>
>
>
>
>         </div>
>
>         </form>]]></component><component id="link_dsiable_password17" ><![CDATA[<a id="link_dsiable_password17" href="javascript:;" class="btn-link  btn">
>             Disable Password Change
>
>         </a>]]></component><header-contribution encoding="wicket1" ><![CDATA[<head xmlns:wicket="
> http://wicket.apache.org"><link rel="stylesheet" type="text/css" href="//
> netdna.bootstrapcdn.com/bootswatch/3.1.1/spacelab/bootstrap.min.css" />
> <script type="text/javascript" src="
> http://code.jquery.com/jquery-1.11.0.min.js"></script>
>
> <script type="text/javascript" src="./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-1392391424000.js"></script>
>
> <script type="text/javascript" src="./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-ajax-jquery-ver-1392391424000.js"></script>
>
> <script type="text/javascript" src="./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-ajax-jquery-debug-ver-1392391424000.js"></script>
> <script type="text/javascript" id="wicket-ajax-debug-enable">
> /*<![CDATA[*/
> Wicket.Ajax.DebugWindow.enabled=true;
> /*]^]^>*/
> </script>
> <script type="text/javascript" id="wicket-ajax-base-url">
> /*<![CDATA[*/
> Wicket.Ajax.baseUrl="account?1";
> /*]^]^>*/
> </script>
>
> </head>]]></header-contribution><evaluate><![CDATA[(function(){Wicket.Ajax.ajax({"u":"./account?1-1.IBehaviorListener.0-link~dsiable~password","e":"click","c":"link_dsiable_password17"});})();]]></evaluate></ajax-response>
>  *ERROR: *
> Wicket.Ajax.Call.processComponent: Component with id [[form1c]] was not found while trying to perform markup update. Make sure you called component.setOutputMarkupId(true) on the component whose markup you are trying to update.
>  *INFO: *Response processed successfully.
> *INFO: *refocus last focused component not needed/allowed
>
> How can I re-enable the component.
>
> Thanks
>
> David
>
>
>
>
> On 1 April 2014 12:37, David Beer <da...@gmail.com> wrote:
>
>> Hi Martin
>>
>> Thanks for your information here. So if I had a page which extends from a
>> base page and adds the header footer, then added the content which is
>> basically two column, in order to use a menu on the left to change some of
>> the content on the right I could use a combination of Ajax to swap the
>> content.
>>
>> Thanks
>>
>> David
>>
>>
>>
>> On 1 April 2014 08:04, Martin Grigorov <mg...@apache.org> wrote:
>>
>>> Hi,
>>>
>>>
>>> On Mon, Mar 31, 2014 at 1:53 PM, David Beer <da...@gmail.com>
>>> wrote:
>>>
>>> > Hi All
>>> >
>>> > I am in the process of building a user account page, which will have a
>>> menu
>>> > on the left, and the related content on the right.
>>> >
>>> > I would like the content on the right to be swapped depending on the
>>> > selection on the left. As in the content on the right might well be
>>> > generated by panels or fragments and then added to the page and the
>>> > previous unrelated removed.
>>> >
>>> > Is it better to have all the code added to the html and then hide
>>> certain
>>> > components and then re-enable them on selection and disable them or is
>>> it
>>> > better to use a panels and a page hierarchy and to pass information
>>> between
>>> > panels and parent page.
>>> >
>>>
>>> In my experience I have preferred the second approach - a mix of pages
>>> and
>>> panels.
>>> If you want to replace the right part with Ajax then you need to replace
>>> panels.
>>> If Ajax is not required then you can show a sub page that inherits the
>>> base
>>> layout from a main page and has something custom in the right part.
>>>
>>>
>>> >
>>> > Any thoughts and examples are always appreciated.
>>> >
>>> > Thanks
>>> >
>>> > David
>>> >
>>>
>>
>>
>

Re: Adding/Remiving Panels

Posted by David Beer <da...@gmail.com>.
Hi

I am able to remove the panel by accessing the top most component (form)
and setting visible to false. This removes the panel from the page, however
I am having difficulty adding the panel back to the page. I get and Ajax
error saying component id can't be found.

The source is availble here
https://github.com/dmbeer/wicket-bootstrap-example/tree/master/src/main/java/exampleUserAccountPage
and the Panel's there.

The Wicket Ajax Debug Content is as follows;

*INFO: *Received ajax response (1570 characters)
*INFO: *
<?xml version="1.0" encoding="UTF-8"?><ajax-response><component
id="form1c" ><![CDATA[]]></component><component
id="link_dsiable_password17" ><![CDATA[<a id="link_dsiable_password17"
href="javascript:;" class="btn-link  btn">
            Enable Password Panel
        </a>]]></component><header-contribution encoding="wicket1"
><![CDATA[<head xmlns:wicket="
http://wicket.apache.org"><link rel="stylesheet" type="text/css" href="//
netdna.bootstrapcdn.com/bootswatch/3.1.1/spacelab/bootstrap.min.css" />
<script type="text/javascript" src="
http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript"
src="./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-1392391424000.js"></script>
<script type="text/javascript"
src="./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-ajax-jquery-ver-1392391424000.js"></script>
<script type="text/javascript"
src="./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-ajax-jquery-debug-ver-1392391424000.js"></script>
<script type="text/javascript" id="wicket-ajax-debug-enable">
/*<![CDATA[*/
Wicket.Ajax.DebugWindow.enabled=true;
/*]^]^>*/
</script>
<script type="text/javascript" id="wicket-ajax-base-url">
/*<![CDATA[*/
Wicket.Ajax.baseUrl="account?1";
/*]^]^>*/
</script>
</head>]]></header-contribution><evaluate><![CDATA[(function(){Wicket.Ajax.ajax({"u":"./account?1-1.IBehaviorListener.0-link~dsiable~password","e":"click","c":"link_dsiable_password17"});})();]]></evaluate></ajax-response>
 *INFO: *Response processed successfully.
*INFO: *refocus last focused component not needed/allowed
*INFO: *Received ajax response (2916 characters)
*INFO: *
<?xml version="1.0" encoding="UTF-8"?><ajax-response><component
id="form1c" ><![CDATA[<form id="form1c" method="post"
action="./account?1-1.IFormSubmitListener-change~password-form"
class="form-horizontal"><div
style="width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden"><input
type="hidden" name="form1c_hf_0" id="form1c_hf_0" /></div>
            <div class=" form-group">
            <label class="control-label" for="password14">Password</label>


                <input type="password" value=""
name="formGroupPassword:formGroupPassword_body:password"
id="password14"/>




        </div>
            <div class=" form-group">
            <label class="control-label"
for="confirmPassword15">Confirm Password</label>


                <input type="password" value=""
name="formGroupConfirmPassword:formGroupConfirmPassword_body:confirmPassword"
id="confirmPassword15"/>




        </div>
            <div class=" form-group">



                <div class="col-md-offset-2 col-md-10">
                    <button type="submit" class=" btn-default btn
btn-default btn"
name="formGroupButton:formGroupButton_body:submit-button"
id="submit_button16">
            Submit
        </button>
                </div>




        </div>
        </form>]]></component><component id="link_dsiable_password17"
><![CDATA[<a id="link_dsiable_password17" href="javascript:;"
class="btn-link  btn">
            Disable Password Change
        </a>]]></component><header-contribution encoding="wicket1"
><![CDATA[<head xmlns:wicket="
http://wicket.apache.org"><link rel="stylesheet" type="text/css" href="//
netdna.bootstrapcdn.com/bootswatch/3.1.1/spacelab/bootstrap.min.css" />
<script type="text/javascript" src="
http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript"
src="./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-1392391424000.js"></script>
<script type="text/javascript"
src="./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-ajax-jquery-ver-1392391424000.js"></script>
<script type="text/javascript"
src="./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-ajax-jquery-debug-ver-1392391424000.js"></script>
<script type="text/javascript" id="wicket-ajax-debug-enable">
/*<![CDATA[*/
Wicket.Ajax.DebugWindow.enabled=true;
/*]^]^>*/
</script>
<script type="text/javascript" id="wicket-ajax-base-url">
/*<![CDATA[*/
Wicket.Ajax.baseUrl="account?1";
/*]^]^>*/
</script>
</head>]]></header-contribution><evaluate><![CDATA[(function(){Wicket.Ajax.ajax({"u":"./account?1-1.IBehaviorListener.0-link~dsiable~password","e":"click","c":"link_dsiable_password17"});})();]]></evaluate></ajax-response>
 *ERROR: *
Wicket.Ajax.Call.processComponent: Component with id [[form1c]] was
not found while trying to perform markup update. Make sure you called
component.setOutputMarkupId(true) on the component whose markup you
are trying to update.
 *INFO: *Response processed successfully.
*INFO: *refocus last focused component not needed/allowed

How can I re-enable the component.

Thanks

David




On 1 April 2014 12:37, David Beer <da...@gmail.com> wrote:

> Hi Martin
>
> Thanks for your information here. So if I had a page which extends from a
> base page and adds the header footer, then added the content which is
> basically two column, in order to use a menu on the left to change some of
> the content on the right I could use a combination of Ajax to swap the
> content.
>
> Thanks
>
> David
>
>
>
> On 1 April 2014 08:04, Martin Grigorov <mg...@apache.org> wrote:
>
>> Hi,
>>
>>
>> On Mon, Mar 31, 2014 at 1:53 PM, David Beer <da...@gmail.com>
>> wrote:
>>
>> > Hi All
>> >
>> > I am in the process of building a user account page, which will have a
>> menu
>> > on the left, and the related content on the right.
>> >
>> > I would like the content on the right to be swapped depending on the
>> > selection on the left. As in the content on the right might well be
>> > generated by panels or fragments and then added to the page and the
>> > previous unrelated removed.
>> >
>> > Is it better to have all the code added to the html and then hide
>> certain
>> > components and then re-enable them on selection and disable them or is
>> it
>> > better to use a panels and a page hierarchy and to pass information
>> between
>> > panels and parent page.
>> >
>>
>> In my experience I have preferred the second approach - a mix of pages and
>> panels.
>> If you want to replace the right part with Ajax then you need to replace
>> panels.
>> If Ajax is not required then you can show a sub page that inherits the
>> base
>> layout from a main page and has something custom in the right part.
>>
>>
>> >
>> > Any thoughts and examples are always appreciated.
>> >
>> > Thanks
>> >
>> > David
>> >
>>
>
>

Re: Adding/Remiving Panels

Posted by David Beer <da...@gmail.com>.
Hi Martin

Thanks for your information here. So if I had a page which extends from a
base page and adds the header footer, then added the content which is
basically two column, in order to use a menu on the left to change some of
the content on the right I could use a combination of Ajax to swap the
content.

Thanks

David



On 1 April 2014 08:04, Martin Grigorov <mg...@apache.org> wrote:

> Hi,
>
>
> On Mon, Mar 31, 2014 at 1:53 PM, David Beer <da...@gmail.com>
> wrote:
>
> > Hi All
> >
> > I am in the process of building a user account page, which will have a
> menu
> > on the left, and the related content on the right.
> >
> > I would like the content on the right to be swapped depending on the
> > selection on the left. As in the content on the right might well be
> > generated by panels or fragments and then added to the page and the
> > previous unrelated removed.
> >
> > Is it better to have all the code added to the html and then hide certain
> > components and then re-enable them on selection and disable them or is it
> > better to use a panels and a page hierarchy and to pass information
> between
> > panels and parent page.
> >
>
> In my experience I have preferred the second approach - a mix of pages and
> panels.
> If you want to replace the right part with Ajax then you need to replace
> panels.
> If Ajax is not required then you can show a sub page that inherits the base
> layout from a main page and has something custom in the right part.
>
>
> >
> > Any thoughts and examples are always appreciated.
> >
> > Thanks
> >
> > David
> >
>