use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponent_ThisParent.
@Test
public void resolveComponent_ThisParent() {
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(innerContainer, resolveComponent(source, "@this:@parent"));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponent_Relative.
@Test
public void resolveComponent_Relative() {
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);
assertSame(component, resolveComponent(source, " other "));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponents_Root.
@Test
public void resolveComponents_Root() {
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 ");
assertTrue(result.size() == 1);
assertTrue(result.contains(FacesContext.getCurrentInstance().getViewRoot()));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponent_Parent.
@Test
public void resolveComponent_Parent() {
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(innerContainer, resolveComponent(source, "@parent"));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveClientId_AbsoluteNamingcontainer.
@Test
public void resolveClientId_AbsoluteNamingcontainer() {
UIComponent root = new UIPanel();
root.setId("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();
component.setId("other");
innerContainer.getChildren().add(component);
UIComponent source = new UICommand();
source.setId("source");
innerContainer.getChildren().add(source);
assertEquals("form", resolveClientId(source, " :form:outerContainer:@namingcontainer "));
}
Aggregations