Search in sources :

Example 21 with UINamingContainer

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

the class SearchExpressionFacadeTest method resolveComponent_WidgetVarNext.

@Test
public void resolveComponent_WidgetVarNext() {
    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);
    InputText input2 = new InputText();
    input2.setWidgetVar("myInput_Widget2");
    outerContainer.getChildren().add(input2);
    assertEquals(input2, resolveComponent(source, " @widgetVar(myInput_Widget):@next"));
}
Also used : UIOutput(javax.faces.component.UIOutput) InputText(org.primefaces.component.inputtext.InputText) 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 22 with UINamingContainer

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

the class SearchExpressionFacadeTest method resolveClientId_AbsoluteId.

@Test
public void resolveClientId_AbsoluteId() {
    UIComponent root = new UIPanel();
    FacesContext.getCurrentInstance().getViewRoot().getChildren().add(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();
    innerContainer.getChildren().add(component);
    UIComponent source = new UICommand();
    innerContainer.getChildren().add(source);
    assertEquals("form", resolveClientId(source, " :form "));
}
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 23 with UINamingContainer

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

the class SearchExpressionFacadeTest method resolveClientIds_RelativeAndParentParent.

@Test
public void resolveClientIds_RelativeAndParentParent() {
    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", resolveClientIds(source, " other @parent:@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)

Example 24 with UINamingContainer

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

the class SearchExpressionFacadeTest method resolveComponent_AbsoluteWithFormPrependIdFalse_InvokeOnComponentUnrendered.

@Test
public void resolveComponent_AbsoluteWithFormPrependIdFalse_InvokeOnComponentUnrendered() {
    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");
    innerContainer.setRendered(false);
    outerContainer.getChildren().add(innerContainer);
    UIComponent component = new UIOutput();
    innerContainer.getChildren().add(component);
    UIComponent source = new UICommand();
    source.setId("source");
    innerContainer.getChildren().add(source);
    assertEquals(source, resolveComponent(source, " outerContainer:innerContainer:source "));
}
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 25 with UINamingContainer

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

the class SearchExpressionFacadeTest method resolveComponent_ParentParent.

@Test
public void resolveComponent_ParentParent() {
    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, "@parent:@parent"), "Failed");
}
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