Hey all,

In IE, I can't get lazyloadpanels to load. I have a webapp with some
lazyloadpanels, and none of them loads in IE - in other browsers, there is
no problem. (Also, the content of an iframe doesn't load, which seems to be
related, since it is also an ajax-request.) I've been trying both IE 8 and
IE 9 on three different pc's. Can someone give me a clue why it won't work
in IE? (IE security settings are set to low, scripts etc are
enabled/allowed, so I suppose ajax-requests can be performed... if not, I
have no clue how to allow ajax in IE.) You may check it out:
http://www.tinyleaps.be

I've been checking on similar problems with lazyloadpanel in ie, and the
problem was known in 2008 (if it's the same, but it looks really similar):
http://www.mail-archive.com/users@wicket.apache.org/msg18815.html
There seems to be a bug report and a 'fixed' status, although it doesn't
seem to work out fine for me - the last comment states that the fix is not
confirmed. Or I am  missing something, which wouldn't really surprise me :),
or there still something wrong with the precondition stuff and loading the
panel in IE:
https://issues.apache.org/jira/browse/WICKET-1653


Ajax debug window (only these three lines):
--
INFO: Ajax GET stopped because of precondition check,
url:?wicket:interface=:3:mainpanel:bloglist:1:commentaar::IBehaviorListener:0:
INFO: Ajax GET stopped because of precondition check,
url:?wicket:interface=:3:mainpanel:bloglist:2:commentaar::IBehaviorListener:0:
INFO: Ajax GET stopped because of precondition check,
url:?wicket:interface=:3:weer::IBehaviorListener:0:
--

HomePage.html:
--
[...]
<body>
<wicket:extend>
[...]
      <div wicket:id="route" />
[...]
            <div wicket:id="mainpanel" />
[...]
            <div wicket:id="weer" class="weer" >&nbsp;
            </div>
[...]
      </div>
</wicket:extend>
</body>
</html>
--

HomePage.java:
--
[...]

public class HomePage
      extends BasePage {

   Panel mainPanel;
   Label linktekst;


   public HomePage() {
      this(null);
   }


   public HomePage(PageParameters pars) {
[...]
      add(new RoutePanel("route"));


      if (pars != null) {
         mainPanel = new BlogPanel("mainpanel", pars.getAsInteger("id"));
      }
      else {
         mainPanel = new BlogPanel("mainpanel");
      }

      add(mainPanel);
[...]
      add(new AjaxLazyLoadPanel("weer") {

         @Override
         public Component getLazyLoadComponent(String markupId) {
            return new WeerPanel(markupId,
reis.getBlogitemList().get(0).getLocation().getName());
         }

      });
   }

}
--

BlogPanel.html
--
[...]
      <wicket:panel>
[...]
         <ul class="bloglist">
            <li wicket:id="bloglist" class="blogitem">
[...]
                   <div wicket:id="commentaar" />
                     </div>
[...]
            </li>
         </ul>
[...]
      </wicket:panel>
   </body>
</html>
--

BlogPanel.java:
--
[...]
public final class BlogPanel
      extends Panel {

   private static final int ITEMSPERPAGE = 3;

   public BlogPanel(String id) {
      this(id, 0);
   }


   public BlogPanel(final String id, final int blogid) {
      super(id);

      setOutputMarkupId(true);

[...]
      List<Blogitem> blogitemList =
            Q.EM.createNamedQuery("Blogitem.findAll", Blogitem.class).
            setHint(QueryHints.REFRESH, HintValues.TRUE).getResultList();

      BlogListView blogListView = new BlogListView(
            "bloglist",
            new ListDataProvider(blogitemList),
            ITEMSPERPAGE) {

         @Override
         protected void populateItem(final Item<Blogitem> item) {

[...]
            item.add(new AjaxLazyLoadPanel("commentaar") {

               @Override
               public Component getLazyLoadComponent(String markupId) {
                  return new CommentaarPanel(markupId,
item.getModelObject());
               }

            });
[...]
         }

      };

[...]
      add(blogListView);

[...]
}

abstract class BlogListView
      extends DataView<Blogitem> {

   BlogListView(String id, ListDataProvider ldp, int i) {
      super(id, ldp, i);
   }

[...]
   }
}
--

CommentaarPanel.html:
--
[...]
   <body>
      <wicket:panel>
         <div wicket:id="commentaarToevoegen" />
         <ul>
            <li wicket:id="commentaarList" class="commentaar">
               <p class="zegt"><span wicket:id="tijdstip" /> - <span
wicket:id="commentator" class="schrift commentator" /> laat weten:</p>
               <p wicket:id="tekst" class="schrift" />
            </li>
            <div wicket:id="commentaarNav" class="navigator navigatordown"
/>
         </ul>
      </wicket:panel>
   </body>
</html>
--

CommentaarPanel.java:
--
[...]
public final class CommentaarPanel
      extends Panel {

   private Blogitem blog;
   private List<Comment> commentList;
   private DataView<Comment> commentListView;


   public CommentaarPanel(String id, Blogitem blog) {
      super(id);

      this.blog = blog;

      setOutputMarkupId(true);

      commentList = blog.getCommentList();
      Collections.sort(commentList);
      commentListView =
            new DataView<Comment>("commentaarList",
                                  new ListDataProvider(commentList),
                                  5) {

               @Override
               protected void populateItem(Item<Comment> item) {
                  item.add(new Label("tekst",
item.getModelObject().getText()));
                  item.add(new Label("commentator",
item.getModelObject().getName()));
                  item.add(new Label("tijdstip",
Q.DF.format(item.getModelObject().getTimestamp())));
               }

            };
      add(commentListView);
      add(new AjaxPagingNavigator("commentaarNav", commentListView) {

         @Override
         public boolean isVisible() {
            return this.getPageable().getPageCount() > 1;
         }

      });
      add(new CommentaarToevoegenPanel("commentaarToevoegen", this));
   }


   public Blogitem getBlog() {
      return blog;
   }


   public List<Comment> getCommentList() {
      return commentList;
   }


   public DataView<Comment> getCommentListView() {
      return commentListView;
   }

}
--


WeerPanel.html:
--
[...]
   <body>
      <wicket:panel>
         <span wicket:id="locatie" /><br />
         <img wicket:id="icoonhuidig" class="weericoon" />
         <p>temperatuur: <span wicket:id="temperatuur" />&deg;C<br />
         vochtigheid: <span wicket:id="vochtigheid" /><br />
         wind: <span wicket:id="wind" /></p>
      </wicket:panel>
   </body>
</html>
--

WeerPanel.java:
--
[...]
public final class WeerPanel
      extends Panel {

   private String locatie;

   public WeerPanel(String id, String locatie) {
      super(id);
      this.locatie = locatie;
      init();
   }


   public WeerPanel(String id) {
      this(id, "Brugge");
   }


   private void init() {
      Document doc = null;
      {
         InputStream in = null;
         try {
            URL xmlUrl = new URL("http://www.google.com/ig/api?weather="; +
locatie);
            in = xmlUrl.openStream();
            doc = parse(in);
         }
         catch (MalformedURLException ex) {
            Logger.getLogger(WeerPanel.class.getName()).log(Level.SEVERE,
null, ex);
         }
         catch (IOException ex) {
            Logger.getLogger(WeerPanel.class.getName()).log(Level.SEVERE,
null, ex);
         }
         finally {
            if (in != null) {
               try {
                  in.close();
               }
               catch (IOException ex) {

Logger.getLogger(WeerPanel.class.getName()).log(Level.SEVERE, null, ex);
               }
            }
         }
      }

      String locatieString = "<ongekend>";
      String srcicon = "http://www.google.com";;
      String temperatuur = "<?>";
      String vochtigheid = "<?>";
      String wind = "<?>";

      if (doc != null) {
         locatieString =

 
doc.getElementsByTagName("city").item(0).getAttributes().getNamedItem("data").getNodeValue();
         NodeList nl =
doc.getElementsByTagName("current_conditions").item(0).getChildNodes();
         for (int i = 0; i < nl.getLength(); i++) {
            Node n = nl.item(i);
            if (n.getNodeName().equals("icon")) {
               srcicon +=
n.getAttributes().getNamedItem("data").getNodeValue();
            }
            else if (n.getNodeName().equals("temp_c")) {
               temperatuur =
n.getAttributes().getNamedItem("data").getNodeValue();
            }
            else if (n.getNodeName().equals("humidity")) {
               vochtigheid =
n.getAttributes().getNamedItem("data").getNodeValue().split(": ")[1];
            }
            else if (n.getNodeName().equals("wind_condition")) {
               wind =
n.getAttributes().getNamedItem("data").getNodeValue().split(": ")[1];
            }
         }
      }

      add(new Label("locatie", locatieString));
      add(new StaticImage("icoonhuidig", srcicon));
      Label temperatuurLabel = new Label("temperatuur", temperatuur);
      temperatuurLabel.setRenderBodyOnly(true);
      add(temperatuurLabel);
      Label vochtigheidLabel = new Label("vochtigheid", vochtigheid);
      vochtigheidLabel.setRenderBodyOnly(true);
      add(vochtigheidLabel);
      Label windLabel = new Label("wind", wind);
      windLabel.setRenderBodyOnly(true);
      add(windLabel);

   }


   public static Document parse(InputStream is) {
      Document ret = null;
      DocumentBuilderFactory domFactory;
      DocumentBuilder builder;

      try {
         domFactory = DocumentBuilderFactory.newInstance();
         domFactory.setValidating(false);
         domFactory.setNamespaceAware(false);
         builder = domFactory.newDocumentBuilder();

         ret = builder.parse(is);
      }
      catch (Exception ex) {
         System.err.println("unable to load XML: " + ex);
      }
      return ret;
   }

}
--

Reply via email to