wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pedro Santos <pedros...@gmail.com>
Subject Re: LinkTree
Date Wed, 04 Nov 2009 13:25:23 GMT
Add you need to replace your old detailsPanel for the new one. Like:
HomePage.this.replace(targetPanel)

On Wed, Nov 4, 2009 at 11:20 AM, Vytautas Racelis <turisto@gmail.com> wrote:

> Hi,
>  you should have a container and add that container into target.
>
>  This is how i've done this:
>
> http://xaloon.googlecode.com/svn/trunk/xaloon-wicket-jpa-components/src/main/java/org/xaloon/wicket/component/tree/TreePanel.java
>
>
> jahid wrote:
>
>> Hi,
>>
>> I have a LinkTree on a page, that page also contains a panel. First time
>> the page will be loaded with an empty panel. But if user clicks on link,
>> then i wanted to replace the empty panel with a new panel. but it seems like
>> its not  working. Below is the part of my code-
>>
>>  1. public ListContractsPage() {
>>  2.         add(prepareTree());
>>  3.         add(new
>>     EmptyPanel("detailsPanel","").setOutputMarkupId(true));
>>  4.     }
>>  5.     private BaseTree prepareTree() {
>>  6.         DefaultMutableTreeNode rootNode = new
>>     DefaultMutableTreeNode("Contracts");
>>  7.         TreeModel treeModel = new DefaultTreeModel(rootNode);
>>  8.         assembleContracts(rootNode);
>>  9.         final LinkTree linkTree=new LinkTree("tree", treeModel){
>>  10.             @Override
>>  11.             protected void onNodeLinkClicked(Object node, BaseTree
>>     tree, AjaxRequestTarget target) {
>>  12.                 Object userObject = ((DefaultMutableTreeNode)
>>     node).getUserObject();
>>  13.                 Panel targetPanel;
>>  14.                 if (userObject instanceof ServiceHandle) {
>>  15.                     targetPanel = new
>>     ServiceDetailsPanel<ServiceHandle>("detailsPanel", (ServiceHandle)
>>     userObject);
>>  16.                 } else if (userObject instanceof ContractHandle) {
>>  17.                     targetPanel = new
>>     ContractDetailsPanel<ContractHandle>("detailsPanel",
>>     (ContractHandle) userObject);
>>  18.                 } else {
>>  19.                     throw new AssertionError("Expected: master,
>>     sub or service handle, but found: " +
>>     userObject.getClass().getSimpleName());
>>  20.                 }
>>  21.                 targetPanel.setOutputMarkupId(true);
>>  22.                 target.addComponent(targetPanel);
>>  23.             }
>>  24.         };
>>  25.         return linkTree;
>>  26.     }
>>
>>
>> The panel which is added on line3, will be replaced by line15 or line17.
>> But it seems like its not replacing. I actually debugged, and the control
>> reaches over there and executes upto line22. But the new panel was never
>> rendered on browser.
>>
>> I am using wicket 1.4.2.
>>
>> Anyone have any idea why new panels are not rendered?
>>
>> Thanks in advance.
>>
>> Jahid
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> --
> Regards,
> Vytautas Racelis
> -----------------------------------
> phone:+370-600-34389
> e-mail: turisto@gmail.com
> www.xaloon.org
> www.leenle.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Pedro Henrique Oliveira dos Santos

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message