Hi,

I have a use case like below -


- There will be two frames, more like the left frame will have menus. On
click on left menu items, on right side the page will be displayed. Now
on left side, how many items will be in menus is not static. They come
from a service, so its dynamic.


I have tried below given way -

- I have used repeater (the data view with a table and "td") to put
dynamic links. The links are added fine on left menu. But when I click
on those links, each click creates a new frame on right side (on first
click its 2 frames, on second click its 3 frames, on third click its 4
frames.....). The sample code is like -

><table cellspacing="0">
>            <tr>
>                <th>Available Services...</th>
>            </tr>
>            <tr wicket:id="listServices">
>                <td>
>                    <span wicket:id="service">
>                        <span
wicket:id="serviceName">[ServiceName]</span>
>                    </span>
>                </td>
>            </tr>
></table>






private List<Class<? extends AbstractServiceWebPage>> classes = new
ArrayList<Class<? extends AbstractServiceWebPage>>();

classes.add(RoleService.class);
        final IDataProvider dataProvider = new DataProvider<Class<?
extends AbstractServiceWebPage>>(classes);

        add(new DataView("listServices", dataProvider) {

            @Override
            protected void populateItem(Item item) {
                final Class<? extends AbstractServiceWebPage> clazz =
(Class<? extends AbstractServiceWebPage>) item.getModelObject();
                String serviceName = null;
                try {
                    serviceName = ((AbstractServiceWebPage)
clazz.newInstance()).getServiceName();
                } catch (InstantiationException ex) {
                    throw new RuntimeException(ex);
                } catch (IllegalAccessException ex) {
                    throw new RuntimeException(ex);
                }

                if (serviceName == null) {
                    throw new IllegalStateException("Service name can
not be null");
                }
                item.add(new ChangeFramePageLink("service", bodyFrame,
clazz).add(new Label("serviceName", serviceName)));
            }
        });



- But If I create a link normal way then it works fine, but on that
situation the links and their labels will not be dynamic, but hard
coded. Which is -

> <div>
>            <ul>
>                <li><a href="#" wicket:id="linkToPage1"
target="_parent">Role Service</a></li>
>            </ul>
> </div>


And in code its like --

add(new ChangeFramePageLink("linkToPage1", bodyFrame,
RoleService.class));









Any suggestion will be highly appreciated.


Regards,


//Jahid

Reply via email to