Example usage for org.apache.wicket.markup.repeater AbstractRepeater size

List of usage examples for org.apache.wicket.markup.repeater AbstractRepeater size

Introduction

In this page you can find the example usage for org.apache.wicket.markup.repeater AbstractRepeater size.

Prototype

public int size() 

Source Link

Document

Get the number of children in this container.

Usage

From source file:org.openengsb.ui.admin.editorPage.EditorPageTest.java

License:Apache License

@Test
public void testAddPropertyWithoutName_shouldLeaveListUnchanged() throws Exception {
    tester.startPage(new ConnectorEditorPage("testdomain", "testconnector"));
    AjaxButton button = (AjaxButton) tester.getComponentFromLastRenderedPage("editor:form:addProperty");
    AbstractRepeater properties = (AbstractRepeater) tester
            .getComponentFromLastRenderedPage("editor:form:attributesPanel:properties");
    tester.executeAjaxEvent(button, "onclick");
    assertThat(properties.size(), is(0));
}

From source file:org.openengsb.ui.admin.editorPage.EditorPageTest.java

License:Apache License

@Test
public void testAddPropertyWithSameName_shouldLeaveListUnchanged() throws Exception {
    tester.startPage(new ConnectorEditorPage("testdomain", "testconnector"));
    FormTester formTester = tester.newFormTester("editor:form");
    formTester.setValue("attributesPanel:fields:a:row:field", "someValue");

    AjaxButton newPropertyButton = (AjaxButton) tester
            .getComponentFromLastRenderedPage("editor:form:addProperty");

    formTester.setValue("newPropertyKey", "testNew");
    tester.executeAjaxEvent(newPropertyButton, "onclick");

    tester.executeAjaxEvent("editor:form:attributesPanel:properties:0:values:1:value:label", "onclick");
    formTester.setValue("attributesPanel:properties:0:values:1:value:editor", "foo");

    tester.executeAjaxEvent("editor:form:attributesPanel:properties:0:newArrayEntry", "onclick");
    tester.executeAjaxEvent("editor:form:attributesPanel:properties:0:values:2:value:label", "onclick");
    formTester.setValue("attributesPanel:properties:0:values:2:value:editor", "bar");

    formTester.setValue("newPropertyKey", "testNew");
    tester.executeAjaxEvent(newPropertyButton, "onclick");

    AbstractRepeater list = (AbstractRepeater) tester
            .getComponentFromLastRenderedPage("editor:form:attributesPanel:properties:0:values");
    assertThat(list.size(), is(2));
}