0 Replies Latest reply on Oct 1, 2016 5:46 AM by 3321776

    java wickets menu on image button

    3321776

      Hello All,

      I'm trying to create a image button. When this button clicked, a drop down menu should appear with External Links to other websites.

      Till now, I've managed to create drop down menu with External links but on navigation bar as provided in example: http://tomaszdziurko.pl/2012/03/wicket-and-twitter-bootstrap-navbar/.

       

      HTML:

      <div wicket:id="navBar"/>

      Code:

       

      public Builder withMenuItemAsDropdown(MenuItemEnum menuItem, String pageToLink, String label) {
         //BookmarkablePageLink<Page> link = new BookmarkablePageLink<Page>("link", pageToLink);
         ExternalLink linkExternal = new ExternalLink("link", pageToLink, label); 
        linkExternal.setBody(new Model<String>(label));
        linksMap2.put(menuItem, linkExternal);
      
         return this;
         }
      
      And then in Base JAVA class:
      add(new TwitterBootstrapNavBarPanel.Builder("navBar", HomePage.class, "Example Web App", getActiveMenu())
         .withMenuItem(MenuItemEnum.CLIENTS, ClientsPage.class)
       .withMenuItemAsDropdown(MenuItemEnum.PRODUCTS2, "Sample_URL", "Product 1")
         .withMenuItemAsDropdown(MenuItemEnum.PRODUCTS2,  "Sample_URL", "Product 2")
         .withMenuItemAsDropdown(MenuItemEnum.PRODUCTS2,  "Sample_URL", "Product 3")
         .build());

      Now to add a Image, I've added the code:-

       

      final ContextImage image=new ContextImage("image","IMAGE.png");
      ExternalLink link = new ExternalLink("link", "SAMPLE_URL");
         //Image image = new Image("img", new SharedResourceReference(BasePage.class, "/wicket-bootstrap/img/QuestionMark_2.png"));
        link.add(image);
        add(link);

      But I'm unable to add the drop down menu to this Image button. Kindly suggest some inputs.

      Thanks in advance.