use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class ComponentTraversalUtilsTest method closestForm.
@Test
public void closestForm() {
UIForm outerForm = new UIForm();
UIForm innerForm = new UIForm();
UINamingContainer container = new UINamingContainer();
UIComponent cmp = new UIOutput();
innerForm.getChildren().add(cmp);
container.getChildren().add(innerForm);
outerForm.getChildren().add(container);
UIComponent result = ComponentTraversalUtils.closestForm(null, cmp);
assertSame(innerForm, result, "Expected closest surrounding UIForm");
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class ComponentTraversalUtilsTest method closestNamingContainer.
@Test
public void closestNamingContainer() {
UINamingContainer outerContainer = new UINamingContainer();
UINamingContainer innerContainer = new UINamingContainer();
UIForm form = new UIForm();
UIComponent cmp = new UIOutput();
innerContainer.getChildren().add(cmp);
form.getChildren().add(innerContainer);
outerContainer.getChildren().add(form);
UIComponent result = ComponentTraversalUtils.closestNamingContainer(cmp);
assertSame(innerContainer, result, "Expected closest surrounding UIForm");
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveClientId_Absolute.
@Test
public void resolveClientId_Absolute() {
UIComponent root = new UIPanel();
FacesContext.getCurrentInstance().getViewRoot().getChildren().add(root);
UIForm form = new UIForm();
form.setId("form");
root.getChildren().add(form);
UINamingContainer outerContainer = new UINamingContainer();
outerContainer.setId("outerContainer");
form.getChildren().add(outerContainer);
UINamingContainer innerContainer = new UINamingContainer();
innerContainer.setId("innerContainer");
outerContainer.getChildren().add(innerContainer);
UIComponent component = new UIOutput();
innerContainer.getChildren().add(component);
UIComponent source = new UICommand();
source.setId("source");
innerContainer.getChildren().add(source);
assertEquals("form:outerContainer:innerContainer:source", resolveClientId(source, " :form:outerContainer:innerContainer:source "));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponents_RelativeAndParent.
@Test
public void resolveComponents_RelativeAndParent() {
UIComponent root = new UIPanel();
UIForm form = new UIForm();
form.setId("form");
root.getChildren().add(form);
UINamingContainer outerContainer = new UINamingContainer();
outerContainer.setId("outerContainer");
form.getChildren().add(outerContainer);
UINamingContainer innerContainer = new UINamingContainer();
innerContainer.setId("innerContainer");
outerContainer.getChildren().add(innerContainer);
UIComponent component = new UIOutput();
component.setId("other");
innerContainer.getChildren().add(component);
UIComponent source = new UICommand();
source.setId("source");
innerContainer.getChildren().add(source);
List<UIComponent> resolvedComponents = resolveComponents(source, " other @parent");
assertTrue(resolvedComponents.contains(component));
assertTrue(resolvedComponents.contains(innerContainer));
assertEquals(2, resolvedComponents.size());
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponent_Id.
public void resolveComponent_Id() {
UIComponent root = new UIPanel();
FacesContext.getCurrentInstance().getViewRoot().getChildren().add(root);
UINamingContainer outerContainer = new UINamingContainer();
outerContainer.setId("myContainer");
root.getChildren().add(outerContainer);
resolveComponent(root, " @id(myContainer) ");
}
Aggregations