Last active
August 29, 2015 14:11
-
-
Save regis-leray/6a296f9511b54930725e to your computer and use it in GitHub Desktop.
wicket dynamic panel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestWicket { | |
WicketTester tester = new WicketTester(); | |
@BeforeMethod | |
public void setUp() throws Exception { | |
tester = new WicketTester(); | |
} | |
@AfterMethod | |
public void tearDown() throws Exception { | |
tester.destroy(); | |
} | |
@Test | |
public void visibleOnAllVisible() { | |
TestPanel parent = new TestPanel("testPanel2"); | |
//parent.setMarkup(createDefaultMarkup()); | |
Component childPanel = new Label("child1").setVisible(true); | |
Component childPanel2 = new Label("child2").setVisible(true); | |
parent.add(childPanel, childPanel2); | |
//parent.add(new AutoHidingBehavior()); | |
tester.startComponentInPage(parent); | |
tester.assertVisible("testPanel2"); | |
} | |
private class TestPanel extends Panel implements IMarkupResourceStreamProvider { | |
public TestPanel(String id) { | |
super(id); | |
} | |
@Override | |
public IResourceStream getMarkupResourceStream(MarkupContainer container, Class<?> containerClass) { | |
return new StringResourceStream("<!DOCTYPE HTML>\n" + | |
"<html xmlns:wicket=\"http://wicket.apache.org\">\n" + | |
"\t<wicket:panel>\n" + | |
"\t\t<label wicket:id=\"child1\"></label>\n" + | |
"\t\t<label wicket:id=\"child2\"> </label>\n" + | |
"\t</wicket:panel>\n" + | |
"</html>"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment