Re: [Wicket-user] No Page found for component after selecting TreeNode

2007-04-09 Thread Isaac Weng
Thanks for the quick replay. After some digging, I found that I forgot 
to check that TreeItem is also a WebMarkupContainer which is rebuilt. A 
wrong way to re-implement my requirement in the Tree component let me 
think it worked on the Tree component in wicket-extension, which is 
obvious not after some serious thought.

Seems like I asked a dumb question, hah

Isaac

Matej Knopp wrote:
> When tree node is selected the appropriate part of tree is rebuilt,
> which also involves recreating the components. So the component on
> which you're calling getPage() is no longer in hierarchy, thus the
> page returned is null.
>
> -Matej
>
> On 4/8/07, Isaac Weng <[EMAIL PROTECTED]> wrote:
>   
>> Hi,
>>
>> Similar to ILinkCallback of Tree in wicket-extension, I created a
>> callback link which allows me to select a tree node in my custom Link
>> component. After the link is clicked, the callback is executed and the
>> node is selected. However, after selectNode() runs, getPage() in the
>> Link component results in "No Page found for component". Following is a
>> brief sample code:
>> 

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] No Page found for component after selecting TreeNode

2007-04-08 Thread Matej Knopp
When tree node is selected the appropriate part of tree is rebuilt,
which also involves recreating the components. So the component on
which you're calling getPage() is no longer in hierarchy, thus the
page returned is null.

-Matej

On 4/8/07, Isaac Weng <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Similar to ILinkCallback of Tree in wicket-extension, I created a
> callback link which allows me to select a tree node in my custom Link
> component. After the link is clicked, the callback is executed and the
> node is selected. However, after selectNode() runs, getPage() in the
> Link component results in "No Page found for component". Following is a
> brief sample code:
>
> MyTree.html:
>
> 
> 
> 
>  wicket:id="link">
> 
> 
>
> MyTree.java:
>
> public class MyTree extends DefaultAbstractTree
> {
>...
>
>protected void populateTreeItem(final WebMarkupContainer item,
> int level)
>{
>   ...
>
>   final DefaultMutableTreeNode node = (DefaultMutableTreeNode)
> item.getModelObject();
>   add(new MyPanel("myPanel", item.getModelObject(), new
> IMyLinkCallback()
>   {
>  public void onClick(AjaxRequestTarget target)
>  {
> getTreeState().selectNode(node,
> !getTreeState().isNodeSelected(node));
>  }
>   });
>}
>
> MyPanel.html:
>
> 
> 
> 
>
> MyPanel.java:
>
> public class MyPanel extends Panel
> {
> public MyPanel(String id, Object object, final IMyLinkCallback
> callback)
> {
> super(id);
>
> Link myLink = new Link("link")
> {
> public void onClick()
> {
> getPage();  // return the Page instance correctly.
> callback.onClick(null);
> getPage();  // No Page found for component
> }
> };
>
> DefaultMutableTreeNode node = (DefaultMutableTreeNode) object;
> myLink.add(new Label("outputName", (String)
> node.getUserObject()));
> add(myLink);
> }
> }
>
> IMyLinkCallback.java:
>
> public interface IMyLinkCallback extends IClusterable
> {
> public void onClick(AjaxRequestTarget target);
> }
>
>
>
> The problem appears in both 1.3.0 of April 4, and 1.2.5. Am I doing
> it in a wrong way ?
>
>
> Isaac
>
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ___
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] No Page found for component after selecting TreeNode

2007-04-08 Thread Isaac Weng
Hi,

Similar to ILinkCallback of Tree in wicket-extension, I created a 
callback link which allows me to select a tree node in my custom Link 
component. After the link is clicked, the callback is executed and the 
node is selected. However, after selectNode() runs, getPage() in the 
Link component results in "No Page found for component". Following is a 
brief sample code:

MyTree.html:








MyTree.java:

public class MyTree extends DefaultAbstractTree
{
   ...

   protected void populateTreeItem(final WebMarkupContainer item, 
int level)
   {
  ...

  final DefaultMutableTreeNode node = (DefaultMutableTreeNode) 
item.getModelObject();
  add(new MyPanel("myPanel", item.getModelObject(), new 
IMyLinkCallback()
  {
 public void onClick(AjaxRequestTarget target)
 {
getTreeState().selectNode(node, 
!getTreeState().isNodeSelected(node));
 }
  });
   }

MyPanel.html:





MyPanel.java:
   
public class MyPanel extends Panel
{
public MyPanel(String id, Object object, final IMyLinkCallback 
callback)
{
super(id);

Link myLink = new Link("link")
{
public void onClick()
{
getPage();  // return the Page instance correctly.
callback.onClick(null);
getPage();  // No Page found for component
}
};

DefaultMutableTreeNode node = (DefaultMutableTreeNode) object;
myLink.add(new Label("outputName", (String) 
node.getUserObject()));
add(myLink);
}
}

IMyLinkCallback.java:

public interface IMyLinkCallback extends IClusterable
{
public void onClick(AjaxRequestTarget target);
}


   
The problem appears in both 1.3.0 of April 4, and 1.2.5. Am I doing 
it in a wrong way ?


Isaac

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user