Search in sources :

Example 31 with UINamingContainer

use of javax.faces.component.UINamingContainer in project primefaces by primefaces.

the class SearchExpressionFacadeTest method resolveComponent_NamingcontainerNamingcontainer.

@Test
public void resolveComponent_NamingcontainerNamingcontainer() {
    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(outerContainer, resolveComponent(source, "@namingcontainer:@namingcontainer"));
}
Also used : UIOutput(javax.faces.component.UIOutput) UIComponent(javax.faces.component.UIComponent) UIPanel(javax.faces.component.UIPanel) UIForm(javax.faces.component.UIForm) UICommand(javax.faces.component.UICommand) UINamingContainer(javax.faces.component.UINamingContainer) Test(org.junit.jupiter.api.Test)

Example 32 with UINamingContainer

use of javax.faces.component.UINamingContainer in project primefaces by primefaces.

the class SearchExpressionFacadeTest method resolveComponent_ParentChild.

@Test
public void resolveComponent_ParentChild() {
    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);
    assertSame(component, resolveComponent(source, " @parent:@child(0) "));
    assertSame(source, resolveComponent(source, " @parent:@child(1) "));
}
Also used : UIOutput(javax.faces.component.UIOutput) UIComponent(javax.faces.component.UIComponent) UIPanel(javax.faces.component.UIPanel) UIForm(javax.faces.component.UIForm) UICommand(javax.faces.component.UICommand) UINamingContainer(javax.faces.component.UINamingContainer) Test(org.junit.jupiter.api.Test)

Example 33 with UINamingContainer

use of javax.faces.component.UINamingContainer in project primefaces by primefaces.

the class SearchExpressionFacadeTest method resolveClientId_All.

@Test
public void resolveClientId_All() {
    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("@all", resolveClientId(source, "@all", EnumSet.of(SearchExpressionHint.RESOLVE_CLIENT_SIDE)));
}
Also used : UIOutput(javax.faces.component.UIOutput) UIComponent(javax.faces.component.UIComponent) UIPanel(javax.faces.component.UIPanel) UIForm(javax.faces.component.UIForm) UICommand(javax.faces.component.UICommand) UINamingContainer(javax.faces.component.UINamingContainer) Test(org.junit.jupiter.api.Test)

Example 34 with UINamingContainer

use of javax.faces.component.UINamingContainer in project primefaces by primefaces.

the class SearchExpressionFacadeTest method resolveClientId_Root.

@Test
public void resolveClientId_Root() {
    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("@all", resolveClientId(source, "@root", EnumSet.of(SearchExpressionHint.RESOLVE_CLIENT_SIDE)));
}
Also used : UIOutput(javax.faces.component.UIOutput) UIComponent(javax.faces.component.UIComponent) UIPanel(javax.faces.component.UIPanel) UIForm(javax.faces.component.UIForm) UICommand(javax.faces.component.UICommand) UINamingContainer(javax.faces.component.UINamingContainer) Test(org.junit.jupiter.api.Test)

Example 35 with UINamingContainer

use of javax.faces.component.UINamingContainer in project primefaces by primefaces.

the class SearchExpressionFacadeTest method resolveClientId_AbsoluteForm.

@Test
public void resolveClientId_AbsoluteForm() {
    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("root", resolveClientId(source, " :form:@parent "));
}
Also used : UIOutput(javax.faces.component.UIOutput) UIComponent(javax.faces.component.UIComponent) UIPanel(javax.faces.component.UIPanel) UIForm(javax.faces.component.UIForm) UICommand(javax.faces.component.UICommand) UINamingContainer(javax.faces.component.UINamingContainer) Test(org.junit.jupiter.api.Test)

Aggregations

UIComponent (javax.faces.component.UIComponent)57 UINamingContainer (javax.faces.component.UINamingContainer)57 UIForm (javax.faces.component.UIForm)56 Test (org.junit.jupiter.api.Test)56 UIPanel (javax.faces.component.UIPanel)55 UIOutput (javax.faces.component.UIOutput)49 UICommand (javax.faces.component.UICommand)47 ArrayList (java.util.ArrayList)3 InputText (org.primefaces.component.inputtext.InputText)3