Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-391

Tooltip loses "position=after_end" positioning if onOpen eventlistener added to popup

XMLWordPrintable

      Here is the code used for testing:
      <zk>
      <window apply="com.MyComposer">
      <popup id="zulPu1"><label>content here</label></popup>
      <popup id="zulPu2"/>
      <popup id="zulPu3"/>
      <vlayout id="container">
      <label tooltip="zulPu1, position=after_end">Popup created in zul - good positioning</label>
      <label tooltip="zulPu2, position=after_end">Popup created in zul, check for children and add child in Java - bad positioning, good on second hover</label>
      <label tooltip="zulPu3, position=after_end">Popup created in zul 2, add child with no check for children in Java - bad positioning, good on second hover</label>
      <label id="javaLbl">Popup created in java, check for children and add child in Java - bad positioning, good on second hover</label>
      </vlayout>
      </window>
      </zk>

      package com;

      import org.zkoss.zk.ui.Component;
      import org.zkoss.zk.ui.event.Event;
      import org.zkoss.zk.ui.event.EventListener;
      import org.zkoss.zk.ui.util.GenericForwardComposer;
      import org.zkoss.zul.Label;
      import org.zkoss.zul.Popup;
      import org.zkoss.zul.Vlayout;

      public class MyComposer extends GenericForwardComposer {

      protected Popup zulPu2;
      protected Popup zulPu3;
      protected Vlayout container;
      protected Label javaLbl;

      @Override
      public void doAfterCompose(Component comp) throws Exception {
      super.doAfterCompose(comp);
      final Popup javaPu = new Popup();
      container.appendChild(javaPu);
      javaPu.setId("javaPu");
      javaPu.addEventListener("onOpen", new EventListener() {

      public void onEvent(Event e) throws Exception {
      if (javaPu.getChildren().size() == 0)

      { javaPu.appendChild(new Label("content here")); }

      }
      });
      javaLbl.setTooltip("javaPu, position=after_end");
      }

      public void onOpen$zulPu2(Event e) {
      if (zulPu2.getChildren().size() == 0)

      { zulPu2.appendChild(new Label("content here")); }

      }
      public void onOpen$zulPu3(Event e)

      { zulPu3.appendChild(new Label("content here")); }

      }

            benbai benbai
            RichardL RichardL
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours
                5h