Re: [jira] Resolved: (WICKET-1712) Inheritance inside a Container throws WicketRuntimeException

2009-02-03 Thread smallufo
But if I implement this Window-like panel by extending Border
I have no way to notify the collapse/expand events to the containing content
.

In my previous implementation , the AbstractPullDownPanel defines two
methods invisible()/visible() for successor to override , if they want to
handle the collapse / expand events.

But if I implement it in Border , and place the expand / collapse link to
the top of the Border .
Because the border is added to the panel , I find no way to notify the
expand/collapse events to its containing panel.

I don't know how to gracefully solve this problem just like the
AbstractPullDownPanel ... (define two methods for successor to override)

Does anybody know how to accomplish it ?

Thank you.

2009/2/1 Igor Vaynberg (JIRA) j...@apache.org


 [
 https://issues.apache.org/jira/browse/WICKET-1712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]

 Igor Vaynberg resolved WICKET-1712.
 ---

Resolution: Won't Fix
  Assignee: Igor Vaynberg

 this usecase is not supported - you are abusing istransparentresolver - it
 is not meant to toggle visibility of nested components because it does not
 really nest them.

 i would suggest using a border instead because it is meant for usecases
 just like this

  Inheritance inside a Container throws WicketRuntimeException
  
 
  Key: WICKET-1712
  URL: https://issues.apache.org/jira/browse/WICKET-1712
  Project: Wicket
   Issue Type: Bug
   Components: wicket
 Affects Versions: 1.3.3, 1.3.4
  Environment: Linux , resin-3.0.24 , Wicket 1.3.3
 Reporter: smallufo
 Assignee: Igor Vaynberg
  Attachments: AbstractPullDownPanel.html,
 AbstractPullDownPanel.java, RadioGroupPanel.html, RadioGroupPanel.java,
 TestPage.html, TestPage.java, TestSession.java
 
 
  This is related to WICKET-1095 , associating discussions can be found
 here :
  http://www.nabble.com/Inheritance-inside-a-Container-ts16514647.html
  To summarize :
  I want to make a Widget  , AbstractPullDownPanel , that I can collapse
 / expand it.
  Any panel extends AbstractPullDownPanel  will have a title bar , with
 ajax-enabled collapse / expand link in the upper right of the panel.
  When the panel is collapsed , it will leave a title bar there.
  The state of the panel (open / closed) is stored in WebSession
  Now , I have a RadioGroupPanel extends AbstractPullDownPanel .
  If it only contains an empty RadioGroup :
  RadioGroup selectDeselectGroup = new RadioGroup(selectDeselectGroup);
  Everything works fine , no matter the panel is collapsed or expanded ,
 page reloading is ok
  But if I add Radio(s) inside the RadioGroup , only when the panel is
 expanded , page-reloading is ok.
  If the panel is collapsed , page reloading will throw
 WicketRuntimeException :
  WicketMessage: 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).
  1. [MarkupContainer [Component id = selectDeselectGroup, page =
 destiny.wicket.test.TestPage, path =
 1:radioGroupPanel:selectDeselectGroup.RadioGroup, isVisible = true,
 isVersioned = false]]
  2. [MarkupContainer [Component id = selectAll, page =
 destiny.wicket.test.TestPage, path =
 1:radioGroupPanel:selectDeselectGroup:selectAll.Radio, isVisible = true,
 isVersioned = false]]
  3. [MarkupContainer [Component id = deselectAll, page =
 destiny.wicket.test.TestPage, path =
 1:radioGroupPanel:selectDeselectGroup:deselectAll.Radio, isVisible = true,
 isVersioned = false]]
  Root cause:
  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).
  1. [MarkupContainer [Component id = selectDeselectGroup, page =
 destiny.wicket.test.TestPage, path =
 1:radioGroupPanel:selectDeselectGroup.RadioGroup, isVisible = true,
 isVersioned = false]]
  2. [MarkupContainer [Component id = selectAll, page =
 destiny.wicket.test.TestPage, path =
 1:radioGroupPanel:selectDeselectGroup:selectAll.Radio, isVisible = true,
 isVersioned = false]]
  3. [MarkupContainer [Component id = deselectAll, page =
 destiny.wicket.test.TestPage, path =
 1:radioGroupPanel:selectDeselectGroup:deselectAll.Radio, isVisible = true,
 isVersioned = false]]
  at org.apache.wicket.Page.checkRendering(Page.java:1116)
  at org.apache.wicket.Page.renderPage(Page.java:914)
  at
 org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:231)
  at
 org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104)
  at
 org.apache.wicket.RequestCycle.processEventsAndRespond

Re: [jira] Resolved: (WICKET-1712) Inheritance inside a Container throws WicketRuntimeException

2009-02-03 Thread Igor Vaynberg
add(new link(collapseOrExpand) {
 onclick() {
   expanded=!expanded;
   updateState(expanded);
   Border.this.visitChildren(new IVisitor() {
public int onComponent(Component c) {
 if (c instanceof ExpandCollapseListener) {
   ((ExpandCollapseListener)c).onEvent(expanded);
   return CONTINUE_BUT_DO_NOT_GO_ANY_DEEPER;
 } else {
return CONTINUE;
 }
  }
});
 }

-igor

On Tue, Feb 3, 2009 at 9:01 AM, smallufo small...@gmail.com wrote:

 But if I implement this Window-like panel by extending Border
 I have no way to notify the collapse/expand events to the containing content
 .

 In my previous implementation , the AbstractPullDownPanel defines two
 methods invisible()/visible() for successor to override , if they want to
 handle the collapse / expand events.

 But if I implement it in Border , and place the expand / collapse link to
 the top of the Border .
 Because the border is added to the panel , I find no way to notify the
 expand/collapse events to its containing panel.

 I don't know how to gracefully solve this problem just like the
 AbstractPullDownPanel ... (define two methods for successor to override)

 Does anybody know how to accomplish it ?

 Thank you.

 2009/2/1 Igor Vaynberg (JIRA) j...@apache.org

 [
 https://issues.apache.org/jira/browse/WICKET-1712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

 Igor Vaynberg resolved WICKET-1712.
 ---

Resolution: Won't Fix
  Assignee: Igor Vaynberg

 this usecase is not supported - you are abusing istransparentresolver - it
 is not meant to toggle visibility of nested components because it does not
 really nest them.

 i would suggest using a border instead because it is meant for usecases
 just like this

  Inheritance inside a Container throws WicketRuntimeException
  
 
  Key: WICKET-1712
  URL: https://issues.apache.org/jira/browse/WICKET-1712
  Project: Wicket
   Issue Type: Bug
   Components: wicket
 Affects Versions: 1.3.3, 1.3.4
  Environment: Linux , resin-3.0.24 , Wicket 1.3.3
 Reporter: smallufo
 Assignee: Igor Vaynberg
  Attachments: AbstractPullDownPanel.html,
  AbstractPullDownPanel.java, RadioGroupPanel.html, RadioGroupPanel.java,
  TestPage.html, TestPage.java, TestSession.java
 
 
  This is related to WICKET-1095 , associating discussions can be found
  here :
  http://www.nabble.com/Inheritance-inside-a-Container-ts16514647.html
  To summarize :
  I want to make a Widget  , AbstractPullDownPanel , that I can
  collapse / expand it.
  Any panel extends AbstractPullDownPanel  will have a title bar , with
  ajax-enabled collapse / expand link in the upper right of the panel.
  When the panel is collapsed , it will leave a title bar there.
  The state of the panel (open / closed) is stored in WebSession
  Now , I have a RadioGroupPanel extends AbstractPullDownPanel .
  If it only contains an empty RadioGroup :
  RadioGroup selectDeselectGroup = new RadioGroup(selectDeselectGroup);
  Everything works fine , no matter the panel is collapsed or expanded ,
  page reloading is ok
  But if I add Radio(s) inside the RadioGroup , only when the panel is
  expanded , page-reloading is ok.
  If the panel is collapsed , page reloading will throw
  WicketRuntimeException :
  WicketMessage: 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).
  1. [MarkupContainer [Component id = selectDeselectGroup, page =
  destiny.wicket.test.TestPage, path =
  1:radioGroupPanel:selectDeselectGroup.RadioGroup, isVisible = true,
  isVersioned = false]]
  2. [MarkupContainer [Component id = selectAll, page =
  destiny.wicket.test.TestPage, path =
  1:radioGroupPanel:selectDeselectGroup:selectAll.Radio, isVisible = true,
  isVersioned = false]]
  3. [MarkupContainer [Component id = deselectAll, page =
  destiny.wicket.test.TestPage, path =
  1:radioGroupPanel:selectDeselectGroup:deselectAll.Radio, isVisible = true,
  isVersioned = false]]
  Root cause:
  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).
  1. [MarkupContainer [Component id = selectDeselectGroup, page =
  destiny.wicket.test.TestPage, path =
  1:radioGroupPanel:selectDeselectGroup.RadioGroup, isVisible = true,
  isVersioned = false]]
  2. [MarkupContainer [Component id = selectAll, page =
  destiny.wicket.test.TestPage, path =
  1:radioGroupPanel:selectDeselectGroup:selectAll.Radio, isVisible = true,
  isVersioned = false]]
  3. [MarkupContainer [Component id

Re: [jira] Resolved: (WICKET-1712) Inheritance inside a Container throws WicketRuntimeException

2009-02-03 Thread Timo Rantalaiho
On Wed, 04 Feb 2009, smallufo wrote:
 When traversalling the nodes , it cannot find any Component that implements
 ExpandCollapseListener.
 But the Panel that wrapped by the Border indeed implements
 ExpandCollapseListener

 PulldownBorder.this.visitChildren(new IVisitor()
...

 Here is the Panel that wrapped by PulldownBorder :
 
 public class MyPanel extends Panel implements ExpandCollapseListener
...

You're visiting the children of the border, which traverses
only all its children recursively. As you add the border to
the panel, the border is a child of the panel, but not the
other way around.

As the name visitChildren implies, the visitor never goes
up to its parents. 

Maybe you want 

   ExpandCollapseListener listener = ((ExpandCollapseListener) 
findParent(ExpandCollapseListener.class));

or 

  getPage().visitChildren(ExpandCollapseListener.class, new IVisitor() { ... });

(For visitChildern(), you can supply a type of the
Components you want to visit directly)

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [jira] Resolved: (WICKET-1712) Inheritance inside a Container throws WicketRuntimeException

2009-02-03 Thread smallufo
2009/2/4 Igor Vaynberg igor.vaynb...@gmail.com

 PulldownBorder border = new PulldownBorder(border , Test Title ,
 true);
   border.setTransparentResolver(true);
   add(border);

 ^ that is all wrong

 you should create a border and to it add a panel that will be
 expanded/collapsed. so the panel that is the content should be inside
 the border.


Hi
But MyPanel's  HTML is like this :

wicket:panel
  span wicket:id=border style=width:136px;
   //  blah
  /span
/wicket:panel


According to the hierarchy , I have to new a PulldownBorder and add it to
MyPanel , isn't it ?

As to the onClick() , I change to Timo Rantalaiho's suggestion :

ExpandCollapseListener listener = (ExpandCollapseListener)
findParent(ExpandCollapseListener.class);
if (listener != null)
  listener.setExpanded(expanded);

And it worked !!!


Re: [jira] Resolved: (WICKET-1712) Inheritance inside a Container throws WicketRuntimeException

2009-02-03 Thread Igor Vaynberg
PulldownBorder border = new PulldownBorder(border , Test Title ,
true);
   border.setTransparentResolver(true);
   add(border);

^ that is all wrong

you should create a border and to it add a panel that will be
expanded/collapsed. so the panel that is the content should be inside
the border.

-igor

On Tue, Feb 3, 2009 at 11:56 AM, smallufo small...@gmail.com wrote:
 Thank you for such a practical IVisitor tutorial.

 But I have another problem :
 When traversalling the nodes , it cannot find any Component that implements
 ExpandCollapseListener.
 But the Panel that wrapped by the Border indeed implements
 ExpandCollapseListener

 Can you check where goes wrong ?

 Here is the code :


 public class PulldownBorder extends Border
 {
  private final WebMarkupContainer content;

  private boolean expanded;

  public PulldownBorder(String id , String title , boolean defaultShown)
  {
super(id);

Label titleLabel = new Label(title , title );
expanded = defaultShown;

content = new WebMarkupContainer(content);

content.setOutputMarkupPlaceholderTag(true);
content.setVisible(defaultShown);
add(content);
content.add(getBodyContainer());

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)
  {
expanded=!expanded;
target.addComponent(content.setVisible(expanded));

PulldownBorder.this.visitChildren(new IVisitor()
{
  @Override
  public Object component(Component c)
  {
if (c instanceof ExpandCollapseListener)
{
  System.out.println(c +  is ExpandCollapseListener );
  ((ExpandCollapseListener)c).setExpanded(expanded);
  return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
}
else
{
  System.out.println(c +  is NOT ExpandCollapseListener );
  return CONTINUE_TRAVERSAL;
}
  }
});

if (!expanded)
  target.addComponent(collapseExpandText.setModel(new
 StringResourceModel(expand , this , null)));
else
  target.addComponent(collapseExpandText.setModel(new
 StringResourceModel(collapse , this , null)));
  }
};
add(collapseExpandLink);
collapseExpandLink.add(collapseExpandText);
collapseExpandLink.add(titleLabel);
  }
 }

 Here is the Panel that wrapped by PulldownBorder :

 public class MyPanel extends Panel implements ExpandCollapseListener
 {
  public MyPanel(String id)
  {
super(id);

PulldownBorder border = new PulldownBorder(border , Test Title ,
 true);
border.setTransparentResolver(true);
add(border);

// blah
  }

  @Override
  public void setExpanded(boolean value)
  {
// blah...
  }
 }

 Here is the output (click collapse, and folding the content) :

 [MarkupContainer [Component id = content]] is NOT ExpandCollapseListener
 [MarkupContainer [Component id = _body]] is NOT ExpandCollapseListener
 [MarkupContainer [Component id = collapseExpandLink]] is NOT
 ExpandCollapseListener
 [Component id = collapseExpandText] is NOT ExpandCollapseListener
 [Component id = title] is NOT ExpandCollapseListener

 Why it cannot find any component implementing ExpandCollapseListener ? Where
 goes wrong ?

 Thanks a lot

 --
 smallufo

 2009/2/4 Igor Vaynberg igor.vaynb...@gmail.com

 add(new link(collapseOrExpand) {
  onclick() {
   expanded=!expanded;
   updateState(expanded);
   Border.this.visitChildren(new IVisitor() {
public int onComponent(Component c) {
 if (c instanceof ExpandCollapseListener) {
   ((ExpandCollapseListener)c).onEvent(expanded);
   return CONTINUE_BUT_DO_NOT_GO_ANY_DEEPER;
 } else {
return CONTINUE;
 }
  }
});
  }

 -igor


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [jira] Resolved: (WICKET-1712) Inheritance inside a Container throws WicketRuntimeException

2009-02-03 Thread smallufo
Thank you for such a practical IVisitor tutorial.

But I have another problem :
When traversalling the nodes , it cannot find any Component that implements
ExpandCollapseListener.
But the Panel that wrapped by the Border indeed implements
ExpandCollapseListener

Can you check where goes wrong ?

Here is the code :


public class PulldownBorder extends Border
{
  private final WebMarkupContainer content;

  private boolean expanded;

  public PulldownBorder(String id , String title , boolean defaultShown)
  {
super(id);

Label titleLabel = new Label(title , title );
expanded = defaultShown;

content = new WebMarkupContainer(content);

content.setOutputMarkupPlaceholderTag(true);
content.setVisible(defaultShown);
add(content);
content.add(getBodyContainer());

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)
  {
expanded=!expanded;
target.addComponent(content.setVisible(expanded));

PulldownBorder.this.visitChildren(new IVisitor()
{
  @Override
  public Object component(Component c)
  {
if (c instanceof ExpandCollapseListener)
{
  System.out.println(c +  is ExpandCollapseListener );
  ((ExpandCollapseListener)c).setExpanded(expanded);
  return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
}
else
{
  System.out.println(c +  is NOT ExpandCollapseListener );
  return CONTINUE_TRAVERSAL;
}
  }
});

if (!expanded)
  target.addComponent(collapseExpandText.setModel(new
StringResourceModel(expand , this , null)));
else
  target.addComponent(collapseExpandText.setModel(new
StringResourceModel(collapse , this , null)));
  }
};
add(collapseExpandLink);
collapseExpandLink.add(collapseExpandText);
collapseExpandLink.add(titleLabel);
  }
}

Here is the Panel that wrapped by PulldownBorder :

public class MyPanel extends Panel implements ExpandCollapseListener
{
  public MyPanel(String id)
  {
super(id);

PulldownBorder border = new PulldownBorder(border , Test Title ,
true);
border.setTransparentResolver(true);
add(border);

// blah
  }

  @Override
  public void setExpanded(boolean value)
  {
// blah...
  }
}

Here is the output (click collapse, and folding the content) :

[MarkupContainer [Component id = content]] is NOT ExpandCollapseListener
[MarkupContainer [Component id = _body]] is NOT ExpandCollapseListener
[MarkupContainer [Component id = collapseExpandLink]] is NOT
ExpandCollapseListener
[Component id = collapseExpandText] is NOT ExpandCollapseListener
[Component id = title] is NOT ExpandCollapseListener

Why it cannot find any component implementing ExpandCollapseListener ? Where
goes wrong ?

Thanks a lot

--
smallufo

2009/2/4 Igor Vaynberg igor.vaynb...@gmail.com

 add(new link(collapseOrExpand) {
  onclick() {
   expanded=!expanded;
   updateState(expanded);
   Border.this.visitChildren(new IVisitor() {
public int onComponent(Component c) {
 if (c instanceof ExpandCollapseListener) {
   ((ExpandCollapseListener)c).onEvent(expanded);
   return CONTINUE_BUT_DO_NOT_GO_ANY_DEEPER;
 } else {
return CONTINUE;
 }
  }
});
  }

 -igor


Re: Inheritance inside a Container

2008-06-22 Thread smallufo
Hello ,
I created a new issue containing the codes : WICKET-1712
https://issues.apache.org/jira/browse/WICKET-1712

Thanks.


2008/6/22 Maurice Marrink [EMAIL PROTECTED]:

 Sounds Like a bug.
 Could you open up a jira request please and attach a quickstart
 showing this behavior.

 Thanks.

 Maurice

 On Fri, Jun 20, 2008 at 10:52 PM, smallufo [EMAIL PROTECTED] wrote:
  Hi , after a few try and errors , I can conclude how the problem occurs
 
  In the ChildPanel , if my code is as follows :
 
  wicket:extend
   span wicket:id=selectDeselectGroup
 
   /span
   blah...
  /wicket:extend
 
  and code :
  RadioGroup selectDeselectGroup = new RadioGroup(selectDeselectGroup);
  add(selectDeselectGroup);
 
  Everything goes fine  , no matter the Child Panel is collapsed / expanded
 ,
  page-reloading is OK
 
  But , if I add something inside the CheckGroup :
 
  wicket:extend
   span wicket:id=selectDeselectGroup
 input type=radio wicket:id=selectAll/select all
 input type=radio wicket:id=deselectAll/clean
   /span
  /wicket:extend
 
  and code :
 
  RadioGroup selectDeselectGroup = new RadioGroup(selectDeselectGroup);
  add(selectDeselectGroup);
  Radio selectAll   = new Radio(selectAll   , new Model(Boolean.FALSE));
  Radio deselectAll = new Radio(deselectAll , new Model(Boolean.FALSE));
  selectDeselectGroup.add(selectAll);
  selectDeselectGroup.add(deselectAll);
 
  (Note , I haven't implement any AjaxEventBehavior(onclick) to the 2
  radios)
 
  Here comes the problem :
  If the Child Panel is expanded , page reloading is OK.
  But...
  If the Child Panel is collapsed (folded /hidden) and do page reloading ,
 it
  will throw exception :
 
 
  Root cause:
 
  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).
 
  1. [MarkupContainer [Component id = checkGroup, page =
  destiny.wicket.astrology.HoroscopePage, path =
  3:selectPlanetsPanel:checkGroup.CheckGroup, isVisible = true, isVersioned
 =
  false]]
  2. [MarkupContainer [Component id = selectDeselectGroup, page =
  destiny.wicket.astrology.HoroscopePage, path =
  3:selectPlanetsPanel:selectDeselectGroup.RadioGroup, isVisible = true,
  isVersioned = false]]
  3. [MarkupContainer [Component id = selectAll, page =
  destiny.wicket.astrology.HoroscopePage, path =
  3:selectPlanetsPanel:selectDeselectGroup:selectAll.Radio, isVisible =
 true,
  isVersioned = false]]
  4. [MarkupContainer [Component id = deselectAll, page =
  destiny.wicket.astrology.HoroscopePage, path =
  3:selectPlanetsPanel:selectDeselectGroup:deselectAll.Radio, isVisible =
  true, isVersioned = false]]
 
  at org.apache.wicket.Page.checkRendering(Page.java:1116)
  at org.apache.wicket.Page.renderPage(Page.java:914)
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Inheritance inside a Container

2008-06-21 Thread Maurice Marrink
Sounds Like a bug.
Could you open up a jira request please and attach a quickstart
showing this behavior.

Thanks.

Maurice

On Fri, Jun 20, 2008 at 10:52 PM, smallufo [EMAIL PROTECTED] wrote:
 Hi , after a few try and errors , I can conclude how the problem occurs

 In the ChildPanel , if my code is as follows :

 wicket:extend
  span wicket:id=selectDeselectGroup

  /span
  blah...
 /wicket:extend

 and code :
 RadioGroup selectDeselectGroup = new RadioGroup(selectDeselectGroup);
 add(selectDeselectGroup);

 Everything goes fine  , no matter the Child Panel is collapsed / expanded ,
 page-reloading is OK

 But , if I add something inside the CheckGroup :

 wicket:extend
  span wicket:id=selectDeselectGroup
input type=radio wicket:id=selectAll/select all
input type=radio wicket:id=deselectAll/clean
  /span
 /wicket:extend

 and code :

 RadioGroup selectDeselectGroup = new RadioGroup(selectDeselectGroup);
 add(selectDeselectGroup);
 Radio selectAll   = new Radio(selectAll   , new Model(Boolean.FALSE));
 Radio deselectAll = new Radio(deselectAll , new Model(Boolean.FALSE));
 selectDeselectGroup.add(selectAll);
 selectDeselectGroup.add(deselectAll);

 (Note , I haven't implement any AjaxEventBehavior(onclick) to the 2
 radios)

 Here comes the problem :
 If the Child Panel is expanded , page reloading is OK.
 But...
 If the Child Panel is collapsed (folded /hidden) and do page reloading , it
 will throw exception :


 Root cause:

 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).

 1. [MarkupContainer [Component id = checkGroup, page =
 destiny.wicket.astrology.HoroscopePage, path =
 3:selectPlanetsPanel:checkGroup.CheckGroup, isVisible = true, isVersioned =
 false]]
 2. [MarkupContainer [Component id = selectDeselectGroup, page =
 destiny.wicket.astrology.HoroscopePage, path =
 3:selectPlanetsPanel:selectDeselectGroup.RadioGroup, isVisible = true,
 isVersioned = false]]
 3. [MarkupContainer [Component id = selectAll, page =
 destiny.wicket.astrology.HoroscopePage, path =
 3:selectPlanetsPanel:selectDeselectGroup:selectAll.Radio, isVisible = true,
 isVersioned = false]]
 4. [MarkupContainer [Component id = deselectAll, page =
 destiny.wicket.astrology.HoroscopePage, path =
 3:selectPlanetsPanel:selectDeselectGroup:deselectAll.Radio, isVisible =
 true, isVersioned = false]]

 at org.apache.wicket.Page.checkRendering(Page.java:1116)
 at org.apache.wicket.Page.renderPage(Page.java:914)


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Inheritance inside a Container

2008-06-20 Thread smallufo
ok...here is the error message (very long)

summary :
abstrac class AbstractPullDownPanel (the Parent Panel , abstract ,
containing a title bar and a content WebMarkupContainer) , the full code
is shown in the previous post.

class SelectPlanetsPanel extends AbstractPullDownPanel : containing a
CheckGroup , can be expanded / collapsed by AbstractPullDownPanel



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).

1. [MarkupContainer [Component id = checkGroup, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup.CheckGroup, isVisible = true, isVersioned =
false]]
2. [MarkupContainer [Component id = list, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup:list.SelectStarsPanel2$1, isVisible = true,
isVersioned = false]]
3. [MarkupContainer [Component id = 0, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup:list:0.ListItem, isVisible = true,
isVersioned = false]]
4. [MarkupContainer [Component id = check, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup:list:0:check.PointShownCheckBox, isVisible =
true, isVersioned = false]]
5. [Component id = name, page = destiny.wicket.astrology.HoroscopePage, path
= 3:selectPlanetsPanel:checkGroup:list:0:name.Label, isVisible = true,
isVersioned = false]
6. [Component id = starIcon, page = destiny.wicket.astrology.HoroscopePage,
path = 3:selectPlanetsPanel:checkGroup:list:0:starIcon.Image, isVisible =
true, isVersioned = false]
7. [MarkupContainer [Component id = 1, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup:list:1.ListItem, isVisible = true,
isVersioned = false]]
8. [MarkupContainer [Component id = check, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup:list:1:check.PointShownCheckBox, isVisible =
true, isVersioned = false]]
9. [Component id = name, page = destiny.wicket.astrology.HoroscopePage, path
= 3:selectPlanetsPanel:checkGroup:list:1:name.Label, isVisible = true,
isVersioned = false]
10. [Component id = starIcon, page = destiny.wicket.astrology.HoroscopePage,
path = 3:selectPlanetsPanel:checkGroup:list:1:starIcon.Image, isVisible =
true, isVersioned = false]
11. [MarkupContainer [Component id = 2, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup:list:2.ListItem, isVisible = true,
isVersioned = false]]
12. [MarkupContainer [Component id = check, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup:list:2:check.PointShownCheckBox, isVisible =
true, isVersioned = false]]
13. [Component id = name, page = destiny.wicket.astrology.HoroscopePage,
path = 3:selectPlanetsPanel:checkGroup:list:2:name.Label, isVisible = true,
isVersioned = false]
14. [Component id = starIcon, page = destiny.wicket.astrology.HoroscopePage,
path = 3:selectPlanetsPanel:checkGroup:list:2:starIcon.Image, isVisible =
true, isVersioned = false]
15. [MarkupContainer [Component id = 3, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup:list:3.ListItem, isVisible = true,
isVersioned = false]]
16. [MarkupContainer [Component id = check, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup:list:3:check.PointShownCheckBox, isVisible =
true, isVersioned = false]]
17. [Component id = name, page = destiny.wicket.astrology.HoroscopePage,
path = 3:selectPlanetsPanel:checkGroup:list:3:name.Label, isVisible = true,
isVersioned = false]
18. [Component id = starIcon, page = destiny.wicket.astrology.HoroscopePage,
path = 3:selectPlanetsPanel:checkGroup:list:3:starIcon.Image, isVisible =
true, isVersioned = false]
19. [MarkupContainer [Component id = 4, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup:list:4.ListItem, isVisible = true,
isVersioned = false]]
20. [MarkupContainer [Component id = check, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup:list:4:check.PointShownCheckBox, isVisible =
true, isVersioned = false]]
21. [Component id = name, page = destiny.wicket.astrology.HoroscopePage,
path = 3:selectPlanetsPanel:checkGroup:list:4:name.Label, isVisible = true,
isVersioned = false]
22. [Component id = starIcon, page = destiny.wicket.astrology.HoroscopePage,
path = 3:selectPlanetsPanel:checkGroup:list:4:starIcon.Image, isVisible =
true, isVersioned = false]
23. [MarkupContainer [Component id = 5, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup:list:5.ListItem, isVisible = true,
isVersioned = false]]
24. [MarkupContainer [Component id = check, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup:list:5:check.PointShownCheckBox, isVisible =

Re: Inheritance inside a Container

2008-06-20 Thread smallufo
Hi , after a few try and errors , I can conclude how the problem occurs

In the ChildPanel , if my code is as follows :

wicket:extend
  span wicket:id=selectDeselectGroup

  /span
  blah...
/wicket:extend

and code :
RadioGroup selectDeselectGroup = new RadioGroup(selectDeselectGroup);
add(selectDeselectGroup);

Everything goes fine  , no matter the Child Panel is collapsed / expanded ,
page-reloading is OK

But , if I add something inside the CheckGroup :

wicket:extend
  span wicket:id=selectDeselectGroup
input type=radio wicket:id=selectAll/select all
input type=radio wicket:id=deselectAll/clean
  /span
/wicket:extend

and code :

RadioGroup selectDeselectGroup = new RadioGroup(selectDeselectGroup);
add(selectDeselectGroup);
Radio selectAll   = new Radio(selectAll   , new Model(Boolean.FALSE));
Radio deselectAll = new Radio(deselectAll , new Model(Boolean.FALSE));
selectDeselectGroup.add(selectAll);
selectDeselectGroup.add(deselectAll);

(Note , I haven't implement any AjaxEventBehavior(onclick) to the 2
radios)

Here comes the problem :
If the Child Panel is expanded , page reloading is OK.
But...
If the Child Panel is collapsed (folded /hidden) and do page reloading , it
will throw exception :


Root cause:

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).

1. [MarkupContainer [Component id = checkGroup, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:checkGroup.CheckGroup, isVisible = true, isVersioned =
false]]
2. [MarkupContainer [Component id = selectDeselectGroup, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:selectDeselectGroup.RadioGroup, isVisible = true,
isVersioned = false]]
3. [MarkupContainer [Component id = selectAll, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:selectDeselectGroup:selectAll.Radio, isVisible = true,
isVersioned = false]]
4. [MarkupContainer [Component id = deselectAll, page =
destiny.wicket.astrology.HoroscopePage, path =
3:selectPlanetsPanel:selectDeselectGroup:deselectAll.Radio, isVisible =
true, isVersioned = false]]

at org.apache.wicket.Page.checkRendering(Page.java:1116)
at org.apache.wicket.Page.renderPage(Page.java:914)


Re: Inheritance inside a Container

2008-06-19 Thread smallufo
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
  hidingshowing 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]




Re: Inheritance inside a Container

2008-06-19 Thread Maurice Marrink
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
  hidingshowing 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]



Re: Inheritance inside a Container

2008-06-19 Thread smallufo
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
   hidingshowing 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]




Re: Inheritance inside a Container

2008-06-19 Thread smallufo
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
   hidingshowing 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 

Re: Inheritance inside a Container

2008-06-19 Thread smallufo
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
   hidingshowing 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 

Inheritance inside a Container

2008-04-05 Thread Oliver Sawade

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 
hidingshowing 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]



Re: Inheritance inside a Container

2008-04-05 Thread Martijn Dashorst
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
 hidingshowing 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]



Re: Inheritance inside a Container

2008-04-05 Thread Maurice Marrink
In other words, what you should have done in the first place was
public class testChildPanel extends testSuperPanel {
  public testChildPanel(String id) {
  super(id);
  get(childContainer).add(new Label(childLabel,Test!));
  }
}

So that the label would have actually been attached to the
webmarkupcontainer instead of the panel.

However the solution Martijn provided is much more elegant since it
eliminates the need for subclasses to be aware of implementation
details in the parent class.

Maurice

On Sat, Apr 5, 2008 at 6:53 PM, Martijn Dashorst
[EMAIL PROTECTED] wrote:
 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
   hidingshowing 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]