Search in sources :

Example 76 with Label

use of org.apache.wicket.markup.html.basic.Label in project wicket by apache.

the class MarkupContainerTest method iteratorShouldAllowReplacingComponentAfterIterationStarted0.

@Test
public void iteratorShouldAllowReplacingComponentAfterIterationStarted0() {
    WebMarkupContainer wmc = new WebMarkupContainer("id");
    Label label1;
    Label label2;
    Label label3;
    wmc.add(label1 = new Label("label1", "Label1"));
    wmc.add(label2 = new Label("label2", "Label2"));
    Iterator<Component> iterator = wmc.iterator();
    wmc.replace(label3 = new Label("label1", "Label3"));
    Assert.assertThat(iterator.next(), is(equalToObject(label3)));
    Assert.assertThat(iterator.next(), is(equalToObject(label2)));
    Assert.assertThat(iterator.hasNext(), is(false));
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) WebComponent(org.apache.wicket.markup.html.WebComponent) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) Test(org.junit.Test)

Example 77 with Label

use of org.apache.wicket.markup.html.basic.Label in project wicket by apache.

the class MarkupContainerTest method singleChildShouldAllowReplacingChildAfterIterationHasStarted.

@Test
public void singleChildShouldAllowReplacingChildAfterIterationHasStarted() {
    WebMarkupContainer wmc = new WebMarkupContainer("id");
    Component label1 = new Label("label1", "Label1");
    Component label2 = new Label("label1", "Label2");
    wmc.add(label1);
    Iterator<Component> iterator = wmc.iterator();
    wmc.replace(label2);
    Assert.assertThat(iterator.hasNext(), is(true));
    Assert.assertThat(iterator.next(), is(sameInstance(label2)));
    Assert.assertThat(iterator.hasNext(), is(false));
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) WebComponent(org.apache.wicket.markup.html.WebComponent) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) Test(org.junit.Test)

Example 78 with Label

use of org.apache.wicket.markup.html.basic.Label in project wicket by apache.

the class MarkupContainerTest method noChildAddingChildAfterIteratorAcquiredShouldIterateAndReturnNewChild.

@Test
public void noChildAddingChildAfterIteratorAcquiredShouldIterateAndReturnNewChild() {
    WebMarkupContainer wmc = new WebMarkupContainer("id");
    Iterator<Component> iterator = wmc.iterator();
    Label label1 = new Label("label1", "Label1");
    wmc.add(label1);
    assertThat(wmc.size(), is(1));
    Assert.assertThat(iterator.hasNext(), is(true));
    Assert.assertThat(iterator.next(), is(equalToObject(label1)));
    Assert.assertThat(iterator.hasNext(), is(false));
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) WebComponent(org.apache.wicket.markup.html.WebComponent) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) Test(org.junit.Test)

Example 79 with Label

use of org.apache.wicket.markup.html.basic.Label in project wicket by apache.

the class MarkupContainerTest method iteratorShouldAllowReplacingComponentAfterIterationStarted24.

@Test
public void iteratorShouldAllowReplacingComponentAfterIterationStarted24() {
    WebMarkupContainer wmc = new WebMarkupContainer("id");
    Label label1;
    Label label2;
    Label label3;
    wmc.add(label1 = new Label("label1", "Label1"));
    wmc.add(label2 = new Label("label2", "Label2"));
    addNChildren(wmc, NUMBER_OF_CHILDREN_FOR_A_MAP);
    Iterator<Component> iterator = wmc.iterator();
    Assert.assertThat(iterator.next(), is(equalToObject(label1)));
    wmc.replace(label3 = new Label("label2", "Label3"));
    Assert.assertThat(iterator.next(), is(equalToObject(label3)));
    takeNChildren(iterator, NUMBER_OF_CHILDREN_FOR_A_MAP);
    Assert.assertThat(iterator.hasNext(), is(false));
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) WebComponent(org.apache.wicket.markup.html.WebComponent) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) Test(org.junit.Test)

Example 80 with Label

use of org.apache.wicket.markup.html.basic.Label in project wicket by apache.

the class MarkupContainerTest method iteratorShouldAllowAddingComponentAfterIterationStarted.

@Test
public void iteratorShouldAllowAddingComponentAfterIterationStarted() {
    WebMarkupContainer wmc = new WebMarkupContainer("id");
    Label label1;
    Label label2;
    Label label3;
    wmc.add(label1 = new Label("label1", "Label1"));
    wmc.add(label2 = new Label("label2", "Label2"));
    Iterator<Component> iterator = wmc.iterator();
    Assert.assertThat(iterator.next(), is(equalToObject(label1)));
    Assert.assertThat(iterator.next(), is(equalToObject(label2)));
    wmc.add(label3 = new Label("label3", "Label3"));
    Assert.assertThat(iterator.next(), is(equalToObject(label3)));
    Assert.assertThat(iterator.hasNext(), is(false));
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) WebComponent(org.apache.wicket.markup.html.WebComponent) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) Test(org.junit.Test)

Aggregations

Label (org.apache.wicket.markup.html.basic.Label)519 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)189 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)181 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)121 IModel (org.apache.wicket.model.IModel)116 ListItem (org.apache.wicket.markup.html.list.ListItem)84 ListView (org.apache.wicket.markup.html.list.ListView)70 ArrayList (java.util.ArrayList)68 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)65 PropertyModel (org.apache.wicket.model.PropertyModel)61 Test (org.junit.Test)56 List (java.util.List)51 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)47 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)46 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)41 Model (org.apache.wicket.model.Model)36 Item (org.apache.wicket.markup.repeater.Item)35 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)34 AttributeModifier (org.apache.wicket.AttributeModifier)32 Component (org.apache.wicket.Component)30