Uploaded image for project: 'ZK Spring'
  1. ZK Spring
  2. ZKSPRING-8

children of spring-autowired widgets cannot be removed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Normal Normal
    • None
    • 3.0
    • None
    • None

      copied from http://code.google.com/p/zkspring/issues/detail?id=15


      Reported by [email protected], Apr 5, 2011
      What steps will reproduce the problem?

      1. In the zk spring essentials example (from http://zkbooks.googlecode.com/svn/trunk/zkspringessentials/zkspringcoresec/zkspringessentials.war),
      let the greeting be shown as Label inside a Div.

      modified org.zkoss.zkspringessentials.controller.GreetingCtrl:

      @org.springframework.stereotype.Component("greetingCtrl")
      @Scope("prototype")
      public class GreetingCtrl extends GenericSpringComposer {
      
      	@Autowired private Textbox name;
      	@Autowired private Button greetBtn;
      	@Autowired private Div myDiv;
      
      	public void doAfterCompose(Component comp) throws Exception {
      		super.doAfterCompose(comp);
      	}
      
      	@EventHandler("greetBtn.onClick")
      	public void showGreeting(Event evt) throws WrongValueException, InterruptedException {
      		myDiv.getChildren().clear();
      		new Label("Hello " + name.getValue() + "!").setParent(myDiv);
      	}
      }
      

      modified autowirezkcomp.zul:

      <?xml version="1.0" encoding="UTF-8"?>
      <?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
      <window title="Autowire ZK Components Example" border="normal" height="100px"
      	width="400px" apply="${greetingCtrl}">
      	<label value="Name:"></label>
      	<textbox id="name" />
      	<button id="greetBtn" label="Greet!" />
      	<div id="myDiv"/>
      </window>
      

      2. Open "/autowirezkcomp.zul" and click several times on on the "Greet!" button.

      What is the expected output? What do you see instead?
      myDiv.getChildren().clear(); does not work so you will see "Hello X!Hello Y!" and get a java.util.ConcurrentModificationException at the third time.

      What version of the product are you using? On what operating system?
      zkspring-3.0, zk-5.0.6, apache-tomcat-7

            hawk hawk
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: