/** Test InlineEnclosure */ @Test public void autos6() { TestPage p = new TestPage(); p.setPageMarkup( "<div wicket:enclosure='a'><div wicket:id='a'></div><div wicket:id='b'></div></div>"); A a = new A(); B b = new B(); p.queue(a, b); tester.startPage(p); assertTrue(a.getParent() instanceof Enclosure); assertTrue(b.getParent() instanceof Enclosure); // A is visible, enclosure renders assertEquals( "<div wicket:enclosure=\"a\" id=\"wicket__InlineEnclosure_01\"><div wicket:id=\"a\"></div><div wicket:id=\"b\"></div></div>", tester.getLastResponseAsString()); // A is not visible, inline enclosure render only itself (the placeholder tag) a.setVisible(false); tester.startPage(p); assertEquals( "<div id=\"wicket__InlineEnclosure_01\" style=\"display:none\"></div>", tester.getLastResponseAsString()); }
@Test public void autos5() { TestPage p = new TestPage(); p.setPageMarkup( "<wicket:enclosure child='a'><div wicket:id='a'></div><div wicket:id='b'></div></wicket:enclosure>"); A a = new A(); B b = new B(); p.queue(a); p.add(b); tester.startPage(p); assertTrue(a.getParent() instanceof Enclosure); assertTrue(b.getParent() instanceof TestPage); // A is visible, enclosure renders assertEquals( "<wicket:enclosure child=\"a\"><div wicket:id=\"a\"></div><div wicket:id=\"b\"></div></wicket:enclosure>", tester.getLastResponseAsString()); // A is not visible, enclosure does not render a.setVisible(false); tester.startPage(p); assertEquals("", tester.getLastResponseAsString()); }
public static void main(String[] args) { ParentChildModel<YModel> model1 = new ParentChildModelImpl<>(); ParentChildModel<YModel> model2 = new ParentChildModelImpl<>(); ParentChildModel<YModel> model3 = new ParentChildModelImpl<>(); A a = new A(); B b = new B(); C c = new C(); model1.add(a); model1.add(b); model1.add(c); model2.add(a); model2.add(b); model2.add(c); model3.add(a); model3.add(b); model3.add(c); a.setModel(model1); b.setModel(model2); c.setModel(model3); System.out.println("a parent: " + a.getParent()); System.out.println("a child: " + a.getChild()); System.out.println("b parent: " + b.getParent()); System.out.println("b child: " + b.getChild()); System.out.println("c parent: " + c.getParent()); System.out.println("c child: " + c.getChild()); System.out.println("c parent parent: " + c.getParent().getParent()); }