use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveClientId_This.
@Test
public void resolveClientId_This() {
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();
source.setId("source");
innerContainer.getChildren().add(source);
assertEquals("form:outerContainer:innerContainer:source", resolveClientId(source, " @this "));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponent_WidgetVar.
@Test
public void resolveComponent_WidgetVar() {
UIComponent root = new UIPanel();
FacesContext.getCurrentInstance().getViewRoot().getChildren().add(root);
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);
InputText input = new InputText();
input.setWidgetVar("myInput_Widget");
outerContainer.getChildren().add(input);
assertEquals(input, resolveComponent(source, " @widgetVar(myInput_Widget)"));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponents_Id.
@Test
public void resolveComponents_Id() {
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);
UINamingContainer innerContainer3 = new UINamingContainer();
innerContainer3.setId("myContainer3-test");
form.getChildren().add(innerContainer3);
List<UIComponent> result = resolveComponents(form, " @id(myContainer) ");
assertTrue(result.size() == 1);
assertTrue(result.contains(innerContainer));
result = resolveComponents(form, " @id(myContainer3-test) ");
assertTrue(result.size() == 1);
assertTrue(result.contains(innerContainer3));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponents_SimpleMultiSearchExpressionResolver_Parent.
@Test
public void resolveComponents_SimpleMultiSearchExpressionResolver_Parent() {
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);
ArrayList<UIComponent> components = new ArrayList<>();
components.add(outerContainer);
components.add(innerContainer);
SearchExpressionResolverFactory.registerResolver("@test", new TestMultiSearchExpressionResolver(components));
List<UIComponent> result = resolveComponents(root, " @test:@parent ");
assertTrue(result.size() == 2);
assertTrue(result.contains(outerContainer));
assertTrue(result.contains(form));
SearchExpressionResolverFactory.removeResolver("@test");
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveClientId_Namingcontainer.
@Test
public void resolveClientId_Namingcontainer() {
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();
source.setId("source");
innerContainer.getChildren().add(source);
assertEquals("form:outerContainer:innerContainer", resolveClientId(source, " @namingcontainer "));
}
Aggregations