use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponent_Form.
@Test
public void resolveComponent_Form() {
UIComponent root = new UIPanel();
UIForm form = new UIForm();
root.getChildren().add(form);
UINamingContainer outerContainer = new UINamingContainer();
form.getChildren().add(outerContainer);
UINamingContainer innerContainer = new UINamingContainer();
outerContainer.getChildren().add(innerContainer);
UIComponent component = new UIOutput();
innerContainer.getChildren().add(component);
UIComponent source = new UICommand();
innerContainer.getChildren().add(source);
assertSame(form, resolveComponent(source, "@form"));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponents_RelativeAndThisParent.
@Test
public void resolveComponents_RelativeAndThisParent() {
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,@this:@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 resolveClientId_AbsoluteWithFormPrependIdFalse_InvokeOnComponentSkipUnrendered.
@Test
public void resolveClientId_AbsoluteWithFormPrependIdFalse_InvokeOnComponentSkipUnrendered() {
UIComponent root = new UIPanel();
FacesContext.getCurrentInstance().getViewRoot().getChildren().add(root);
UIForm form = new UIForm();
form.setId("form");
form.setPrependId(false);
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("outerContainer:innerContainer:source", resolveClientId(source, " outerContainer:innerContainer:source "));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveClientId_Parent.
@Test
public void resolveClientId_Parent() {
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();
innerContainer.getChildren().add(component);
UIComponent source = new UICommand();
innerContainer.getChildren().add(source);
assertEquals("form:outerContainer:innerContainer", resolveClientId(source, " @parent "));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponents_Id_FromRoot.
@Test
public void resolveComponents_Id_FromRoot() {
UIComponent root = new UIPanel();
FacesContext.getCurrentInstance().getViewRoot().getChildren().add(root);
UINamingContainer outerContainer = new UINamingContainer();
outerContainer.setId("myContainer");
root.getChildren().add(outerContainer);
UIForm form = new UIForm();
form.setId("form");
root.getChildren().add(form);
UINamingContainer innerContainer = new UINamingContainer();
innerContainer.setId("myContainer");
form.getChildren().add(innerContainer);
UINamingContainer innerContainer2 = new UINamingContainer();
innerContainer2.setId("myContainer2");
form.getChildren().add(innerContainer2);
List<UIComponent> result = resolveComponents(innerContainer2, " @root:@id(myContainer) ");
assertTrue(result.size() == 2);
assertTrue(result.contains(outerContainer));
assertTrue(result.contains(innerContainer));
}
Aggregations