I tried to pull up the "boolean defaultVisible" parameter to the ParentPanel
, but still the same error ....
public abstract class AbstractPullDownPanel extends Panel
{
private final WebMarkupContainer content;
public AbstractPullDownPanel(String id , String title , final boolean
defaultVisible)
{
super(id);
Label titleLabel = new Label("title" , title);
content = new WebMarkupContainer("content")
{
@Override
public boolean isTransparentResolver()
{
return true;
}
};
content.setOutputMarkupPlaceholderTag(true);
content.setVisible(defaultVisible);
add(content);
final Label collapseExpandText = new Label("collapseExpandText");
collapseExpandText.setOutputMarkupPlaceholderTag(true);
if (content.isVisible())
collapseExpandText.setModel(new StringResourceModel("collapse" , this
, null));
else
collapseExpandText.setModel(new StringResourceModel("expand" , this ,
null));
Link collapseExpandLink = new AjaxFallbackLink("collapseExpandLink")
{
@Override
public void onClick(AjaxRequestTarget target)
{
if (content.isVisible())
{
target.addComponent(content.setVisible(false));
target.addComponent(collapseExpandText.setModel(new
StringResourceModel("expand" , this , null)));
//call template method
invisible();
}
else
{
target.addComponent(content.setVisible(true));
target.addComponent(collapseExpandText.setModel(new
StringResourceModel("collapse" , this , null)));
//call template method
visible();
}
}
};
add(collapseExpandLink);
collapseExpandLink.add(collapseExpandText);
collapseExpandLink.add(titleLabel);
}
2008/6/20 smallufo <[EMAIL PROTECTED]>:
> Well , let me describe more detail....
> When the user enters the page , he can successfully show/hide the content
> (ChildPanel) without problems.
> The state is stored in wicket's session.
>
> If the ChildPanel is "open"(expand/show) , and he reloads the page ,
> everything works fine.
> BUT...
> If he "close" (collapse/hide) the ChildPanel , and reloads the page , the
> runtimeException is thrown.
>
>
> I don't know how to solve this problem...
>
>
>
> 2008/6/20 smallufo <[EMAIL PROTECTED]>:
>
> Hi...
>>
>> I am using 1.3.3
>>
>> 2008/6/20 Maurice Marrink <[EMAIL PROTECTED]>:
>>
>> What wicket version are you on? There was a bug about this but is has
>>> long been fixed. https://issues.apache.org/jira/browse/WICKET-1095
>>>
>>> Maurice
>>>
>>> On Thu, Jun 19, 2008 at 9:40 PM, smallufo <[EMAIL PROTECTED]> wrote:
>>> > Hello ,
>>> > I had exactly the same problem , and solved by searching to this post.
>>> > Thanks a lot.
>>> >
>>> > BUT , today , I have another problem...
>>> >
>>> > Today , the ChildPanel can accept a new parameter : boolean
>>> defaultVisible
>>> > if true , the content will be shown;
>>> > if false , the content will be invisible , only the title bar is
>>> visible.
>>> > The title bar is defined in ParentPanel , containing a title label and
>>> a
>>> > "expand/collapse" ajax link (a toggle).
>>> >
>>> > Here comes the problem.
>>> > In the ChildPanel , if I write :
>>> > setVisible(defaultVisible);
>>> > and if the defaultVisible is false , the whole panel , including
>>> ParentPanel
>>> > (including title bar) will be invisible;
>>> > This makes users unable to make it re-appear.
>>> >
>>> > However , if I write code like this :
>>> > get("content").setVisible(defaultVisible);
>>> > ("content" is the WebMarkupContainer defined in ParentPanel returning
>>> > isTransparentResolver() TRUE)
>>> >
>>> > It will throw WicketRuntimeException while
>>> > org.apache.wicket.Page.checkRendering
>>> > org.apache.wicket.WicketRuntimeException: The component(s) below failed
>>> to
>>> > render. A common problem is that you have added a component in code but
>>> > forgot to reference it in the markup (thus the component will never be
>>> > rendered).
>>> >
>>> > How to solve it ?
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > 2008/4/6 Martijn Dashorst <[EMAIL PROTECTED]>:
>>> >
>>> >> You should do this:
>>> >>
>>> >> WMC wmc = new WMC("childContainer") {
>>> >> @override boolean isTransparentResolver() { return true; }
>>> >> };
>>> >>
>>> >> This is not a bug. If you do add() in the subclass's constructor, you
>>> >> add to the page itself. Which is how the hierarchy is constructed. By
>>> >> telling the WMC that it is a transparent resolver, you tell it to look
>>> >> for children without attached markup in its siblings.
>>> >>
>>> >> Martijn
>>> >>
>>> >> On 4/5/08, Oliver Sawade <[EMAIL PROTECTED]> wrote:
>>> >> > Hi everyone,
>>> >> > my first mail to the list, i hope this wasn`t answered million
>>> times
>>> >> > before, but the wicket users faq is empty so i couldn`t find it
>>> there ;)
>>> >> >
>>> >> > I'm using wicket1.3 to create a generic panel with the option to
>>> hide
>>> >> > everything inside when clicking an ajax-button. While the actual
>>> >> > hiding&showing works fine I'm having trouble with inheritance.
>>> >> > This example should show what I mean:
>>> >> >
>>> >> > This is my generic super panel (no ajax stuff in it here to show
>>> the
>>> >> > essential problem). The idea is, that the childContainer is set to
>>> >> > Visible:false when the button is clicked. All of this should happen
>>> in
>>> >> the
>>> >> > super class, so i don't have to care about it in the child class:
>>> >> >
>>> >> > public class testSuperPanel extends Panel {
>>> >> > public testSuperPanel(String id) {
>>> >> > super(id);
>>> >> > add(new WebMarkupContainer("childContainer"));
>>> >> > }
>>> >> > }
>>> >> >
>>> >> > The markup for testSuperPanel:
>>> >> > <wicket:panel>
>>> >> > <div wicket:id="childContainer">
>>> >> > <wicket:child/>
>>> >> > </div>
>>> >> > </wicket:panel>
>>> >> >
>>> >> > This is a sample child panel:
>>> >> >
>>> >> > public class testChildPanel extends testSuperPanel {
>>> >> > public testChildPanel(String id) {
>>> >> > super(id);
>>> >> > add(new Label("childLabel","Test!"));
>>> >> > }
>>> >> > }
>>> >> >
>>> >> > and the Markup:
>>> >> > <wicket:extend>
>>> >> > <span wicket:id="childLabel"></span>
>>> >> > </wicket:extend>
>>> >> >
>>> >> > As you see, it should simply display "Test" inside a
>>> MarkupContainer
>>> >> (which
>>> >> > could be hidden from the superClass). When i try to display this
>>> Panel
>>> >> > however I get an Exception stating that no code is added for the
>>> Label
>>> >> > "childLabel"!
>>> >> > This can be solved by adding the childLabel to the container in the
>>> >> > superClass, but thats obviously not the way it is meant to be:
>>> >> >
>>> >> > public class testSuperPanel extends Panel {
>>> >> > public testSuperPanel(String id) {
>>> >> > super(id);
>>> >> > WebMarkupContainer wmc = new
>>> >> > WebMarkupContainer("childContainer");
>>> >> > wmc.add(new Label("childLabel","Test!"));
>>> >> > add(wmc);
>>> >> > }
>>> >> > }
>>> >> >
>>> >> > So, is this a wicket bug with inheritance inside containers or am I
>>> just
>>> >> > doing things the wrong way?
>>> >> >
>>> >> > Thanks for your help!
>>> >> > best regards, Oli
>>> >> >
>>> >> >
>>> ---------------------------------------------------------------------
>>> >> > To unsubscribe, e-mail:
>>> >> > [EMAIL PROTECTED]
>>> >> > For additional commands, e-mail: [EMAIL PROTECTED]
>>> >> >
>>> >> >
>>> >>
>>> >>
>>> >> --
>>> >> Buy Wicket in Action: http://manning.com/dashorst
>>> >> Apache Wicket 1.3.2 is released
>>> >> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.2
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>>> >>
>>> >>
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>