use of jakarta.faces.component.UIPanel in project myfaces by apache.
the class UIComponentFindComponentTest method testRelativeExpression.
public void testRelativeExpression() throws Exception {
String expression = "testimpl";
UIComponent namingContainer = new UINamingContainer();
UIComponent parent = new UIPanel();
namingContainer.setId("namingContainer");
namingContainer.getChildren().add(parent);
parent.setId("parent");
parent.getChildren().add(_testImpl);
_testImpl.setId("testimpl");
Assert.assertEquals(_testImpl, _testImpl.findComponent(expression));
}
use of jakarta.faces.component.UIPanel in project myfaces by apache.
the class UIComponentBaseGetChildrenTest method testSetFacetClearChild.
/**
* Whenever an existing child component is removed, the parent
* property of the child must be set to null.
*/
public void testSetFacetClearChild() {
UIInput input = new UIInput();
input.setId("input0");
UIInput input1 = new UIInput();
input.setId("input1");
UIPanel panel = new UIPanel();
panel.getChildren().add(input);
Assert.assertEquals(panel, input.getParent());
UIViewRoot root = new UIViewRoot();
root.getChildren().add(panel);
root.getFacets().put("customFacet", input1);
root.getFacets().put("customFacet", input);
Assert.assertEquals(root, input.getParent());
Assert.assertNull(input1.getParent());
Assert.assertFalse(root.getFacets().isEmpty());
Assert.assertTrue(panel.getChildCount() == 0);
}
use of jakarta.faces.component.UIPanel in project myfaces by apache.
the class UIComponentBaseGetChildrenTest method testSimpleAddRemove.
public void testSimpleAddRemove() {
UIInput input = new UIInput();
input.setId("input0");
UIPanel panel = new UIPanel();
panel.getChildren().add(input);
Assert.assertEquals(panel, input.getParent());
panel.getChildren().remove(input);
Assert.assertNull(input.getParent());
}
use of jakarta.faces.component.UIPanel in project myfaces by apache.
the class UIComponentBaseGetChildrenTest method testSetChild2.
public void testSetChild2() {
UIInput input = new UIInput();
input.setId("input0");
UIInput input1 = new UIInput();
input.setId("input1");
UIPanel panel = new UIPanel();
panel.getChildren().add(input);
Assert.assertEquals(panel, input.getParent());
UIViewRoot root = new UIViewRoot();
root.getChildren().add(panel);
root.getFacets().put("customFacet", input1);
panel.getChildren().set(0, input1);
Assert.assertEquals(panel, input1.getParent());
Assert.assertNull(input.getParent());
Assert.assertTrue(root.getFacets().isEmpty());
}
use of jakarta.faces.component.UIPanel in project myfaces by apache.
the class UIComponentBaseGetChildrenTest method testSetFacetClearFacet.
public void testSetFacetClearFacet() {
UIInput input = new UIInput();
input.setId("input0");
UIInput input1 = new UIInput();
input.setId("input1");
UIPanel panel = new UIPanel();
panel.getFacets().put("header", input);
Assert.assertEquals(panel, input.getParent());
UIViewRoot root = new UIViewRoot();
root.getChildren().add(panel);
root.getFacets().put("customFacet", input1);
root.getFacets().put("customFacet", input);
Assert.assertEquals(root, input.getParent());
Assert.assertNull(input1.getParent());
Assert.assertFalse(root.getFacets().isEmpty());
Assert.assertTrue(panel.getChildCount() == 0);
}
Aggregations