Hello again!

Thank you very much for your hints and tricks. I have managed everything I 
wanted to do. And in fact my lerning progress is impressive. I think, that 
Wicket is a great framework. After only five hours of conceptual and coding 
work I have a fully customizable portal application which is modeled and 
generated with one click. I struggled a little bit because of css problems, but 
now everything is solved.

When my portal is online, I will publish some aspects or even a large part of 
this as constribution.  I think that in the next time I will get some problems 
with instances and memory management. As I have seen, Wicket creates a lot of 
new Instances for each page visit, but this seems to be a solvable by design of 
my application.

Following peace of code generates at this moment my complete left menu 
structure:

                /* definition for menu structure  */
                LinkedHashMap<String, LabeledLink[]> linkMap = new 
LinkedHashMap<String, LabeledLink[]>(){
                        
                        /** UUID */
                        private static final long serialVersionUID = 1L;
                {
                        
                        put("Top Link 1", new LabeledLink[]{
                                        new LabeledLink("Sub 1", 
HelpPage.class),
                                        new LabeledLink("Sub 2", 
RegistrationPage.class),
                                        new LabeledLink("Sub 3", 
ImpressumPage.class),
                        });
                        
                        put("Top Link 1", new LabeledLink[]{
                                        new LabeledLink("Sub 1", 
HomePage.class),
                                        new LabeledLink("Sub 2", 
HomePage.class),
                                        new LabeledLink("Sub 3", 
HomePage.class),                                       
                        });
                        
                        put("Top Link 1", new LabeledLink[]{
                                        new LabeledLink("Sub 1", 
HomePage.class),
                                        new LabeledLink("Sub 2", 
HomePage.class),
                                        new LabeledLink("Sub 3", 
HomePage.class),                                       
                        });
                        
                }};
                
                List<SubMenu> subMenueList = new LinkedList<SubMenu>();
                for (String topMenuName : linkMap.keySet()){
                        List<LabeledLink> subMenues = 
                                new 
LinkedList<LabeledLink>(Arrays.asList(linkMap.get(topMenuName)));
                        subMenueList.add(new SubMenu(topMenuName, subMenues));
                }
                
                add(new SubMenuList("list", subMenueList));

        private static class SubMenuList extends ListView {

                public SubMenuList(String id, List<SubMenu> subMenueList) {
                        super(id, subMenueList);
                }

                /**
                 * @see 
wicket.markup.html.list.ListView#populateItem(wicket.markup.html.list.ListItem)
                 */
                @Override
                protected void populateItem(ListItem listItem) {
                        SubMenu subMenu = (SubMenu)listItem.getModelObject();
                        MenuPanel menuPanel = new MenuPanel("panel", 
subMenu.getName(), subMenu.getSubMenues());
                        
                        menuPanel.setRenderBodyOnly(true);
                        listItem.setRenderBodyOnly(true);
                        
                        listItem.add(menuPanel);
                }
                
        }
        
        private static class SubMenu {
                
                private final String name;
                private final List<LabeledLink> subMenues;
                
                public String getName() {
                        return this.name;
                }

                public List<LabeledLink> getSubMenues() {
                        return this.subMenues;
                }

                public SubMenu(final String name, final List<LabeledLink> 
subMenues){
                        this.name = name;
                        this.subMenues = subMenues;
                }
                
        }

public class MenuPanel extends Panel {

        /**
         * svUID
         */
        private static final long serialVersionUID = 6259194530707239720L;

        /**
         * @param id
         */
        public MenuPanel(String id, String label, List<LabeledLink> subMenues) {
                super(id);
                
                this.setRenderBodyOnly(true);
                
                Label topicLabel = new Label("panelLabel", label);
                topicLabel.setRenderBodyOnly(true);
                add(topicLabel);
                
                ListView listView = new ListView("list", subMenues){

                        @Override
                        protected void populateItem(ListItem listItem) {
                                final LabeledLink link = 
(LabeledLink)listItem.getModelObject();
                                Link wicketLink = link.getLink();
                                listItem.setRenderBodyOnly(true);
                                listItem.add(wicketLink);
                        }};
                        
                        listView.setRenderBodyOnly(true);               
                        
                add(listView);
        }
        
}

public class LabeledLink {

        /**
         * 
         */
        private final Link link;
        
        /**
         * @return BookmarkablePageLink
         */
        public Link getLink() {
                return this.link;
        }

        /**
         * @param label 
         * @param pageClass 
         */
        public LabeledLink(final String label, Class pageClass) {
                this.link = new BookmarkablePageLink("link", 
pageClass).setAutoEnable(true);
                
                // Diable <em> Tags
                this.link.setBeforeDisabledLink("");
                this.link.setAfterDisabledLink("");
                
                Label labelComponent = new Label("label", label);
                labelComponent.setRenderBodyOnly(true);
                
                this.link.add(labelComponent);
        }
        
}

--- top menu panel html ---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";;>
<html xmlns="http://www.w3.org/1999/xhtml";; 
xmlns:wicket="http://wicket.sourceforge.net/";; xml:lang="de_DE" lang="de_DE">
        <body>
                <wicket:panel>
                        <span wicket:id="listView">
                                <a class="tmenu" wicket:id="link" 
href="#"><span wicket:id="label"></span></a>
                        </span>
                </wicket:panel>
        </body>
</html>

--- menu panel html ---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";;>
<html xmlns="http://www.w3.org/1999/xhtml";; 
xmlns:wicket="http://wicket.sourceforge.net/";; xml:lang="de_DE" lang="de_DE">
        <body>
                <wicket:panel>
                        <div class="lmenutopic"><span 
wicket:id="panelLabel">some value</span></div>
                        <span wicket:id="list">
                                <a class="menu" wicket:id="link" href="#"><span 
wicket:id="label"></span></a>
                        </span>
                </wicket:panel>
        </body>
</html>


Thanks again,

M.A.Bednarz

> -----Ursprüngliche Nachricht-----
> Von: wicket-user@lists.sourceforge.net
> Gesendet: 24.10.06 09:12:50
> An: wicket-user@lists.sourceforge.net
> Betreff: Re: [Wicket-user] Autoenabled links and custom style for em element

there is also a global switch in settings
> 
> -Igor
> 
> 
> 
> On 10/23/06, Erik van Oosten <[EMAIL PROTECTED]
> > wrote:You can give the em tag custom style by doing something like:
>    span.menu
>  em { font-style: normal; }
> 
> But I would go for Frank's solution.
> 
> Regards,
>      Erik.
> 
> 
> [EMAIL PROTECTED] schreef:
> > Hallo there,
> >
> > I would like to change the output class of the <em> element for autoenabled 
> > links. Currently I use the following code to create a link:
> >
> > Link link = new BookmarkablePageLink("link", pageClass).setAutoEnable(true);
> 
> >
> > After rendering such a link I get
> >
> > <a href="/portal" class="menu">Sub 1</a>
> >
> > and for enabled state:
> >
> > <span class="menu"><em>Sub 2</em></span>
> 
> >
> >
> > Does someone experienced know how to disable the em tags or how to add a 
> > custom css style to them? One of the following possiblities would be fine 
> > as output:
> >
> > <span class="menu"><em>Sub 2</em></span>
> 
> >
> > or
> >
> > <span class="menu">Sub 2</span>
> >
> > Thank you for any assistance to solve my problem,
> >
> > Maciej A. Bednarz
> >
> 
> --
> Erik van Oosten
> 
> http://www.day-to-day-stuff.blogspot.com/
> 
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> 
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> 
> 
> -----------------------------------------------------------------
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> 
> -----------------------------------------------------------------
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> 

-- 
mfG

Bednarz, Hannover

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to