use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveClientIds_RelativeAndPFSAndWidgetVarAndFormParent.
@Test
public void resolveClientIds_RelativeAndPFSAndWidgetVarAndFormParent() {
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:outerContainer:innerContainer:other @(.myClass, .myClass2) @widgetVar(test) root @(.myClass :not:(select))", resolveClientIds(source, " other,@(.myClass, .myClass2) @widgetVar(test),@form:@parent @(.myClass :not:(select))"));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponents_SimpleMultiSearchExpressionResolver_ParentParent.
@Test
public void resolveComponents_SimpleMultiSearchExpressionResolver_ParentParent() {
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:@parent ");
assertTrue(result.size() == 2);
assertTrue(result.contains(root));
assertTrue(result.contains(form));
SearchExpressionResolverFactory.removeResolver("@test");
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveClientId_None.
@Test
public void resolveClientId_None() {
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);
assertEquals("@none", resolveClientId(source, " @none", EnumSet.of(SearchExpressionHint.RESOLVE_CLIENT_SIDE)));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveClientIds_RelativeAndThisParent.
@Test
public void resolveClientIds_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);
assertEquals("form:outerContainer:innerContainer:other form:outerContainer:innerContainer", resolveClientIds(source, " other @this:@parent"));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponents_SimpleMultiSearchExpressionResolver.
@Test
public void resolveComponents_SimpleMultiSearchExpressionResolver() {
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 ");
assertTrue(result.size() == 2);
assertTrue(result.contains(outerContainer));
assertTrue(result.contains(innerContainer));
SearchExpressionResolverFactory.removeResolver("@test");
}
Aggregations