Package javax.faces.component.html

Examples of javax.faces.component.html.HtmlOutputText


       
        facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
       
        viewRoot.getAttributes().put("somekey", "somevalue");
       
        HtmlOutputText a = new HtmlOutputText();
        a.setId("output1");
        a.setValue("testOutput1");
        viewRoot.getChildren().add(a);
       
        viewRoot = saveAndRestore(stateManagement, viewRoot);

        HtmlOutputText b = new HtmlOutputText();
        b.setId("output2");
        b.setValue("testOutput2");
        viewRoot.getChildren().add(b);

        viewRoot = saveAndRestore(stateManagement, viewRoot);
       
        HtmlOutputText c = new HtmlOutputText();
        c.setId("output3");
        c.setValue("testOutput3");
        viewRoot.getChildren().add(c);

        viewRoot = saveAndRestore(stateManagement, viewRoot);
       
        HtmlOutputText d = new HtmlOutputText();
        d.setId("output4");
        d.setValue("testOutput4");
        viewRoot.getChildren().add(d);
       
        viewRoot = saveAndRestore(stateManagement, viewRoot);
       
        Assert.assertEquals("somevalue", viewRoot.getAttributes().get("somekey"));
        Assert.assertNotNull(viewRoot.findComponent("form1"));
        Assert.assertNotNull(viewRoot.findComponent("form1:foo1"));
        Assert.assertNotNull(viewRoot.findComponent("form1:var1"));
        Assert.assertNotNull(viewRoot.findComponent("form1:button1"));
       
        a = (HtmlOutputText) viewRoot.findComponent("output1");
        Assert.assertNotNull(a);
        Assert.assertEquals("testOutput1",a.getValue());
        b = (HtmlOutputText) viewRoot.findComponent("output2");
        Assert.assertNotNull(b);
        Assert.assertEquals("testOutput2",b.getValue());
        c = (HtmlOutputText) viewRoot.findComponent("output3");
        Assert.assertNotNull(c);
        Assert.assertEquals("testOutput3",c.getValue());
        d = (HtmlOutputText) viewRoot.findComponent("output4");
        Assert.assertNotNull(d);
        Assert.assertEquals("testOutput4",d.getValue());
    }
View Full Code Here


        vdl.buildView(facesContext, viewRoot);
        stateManagement.suscribeListeners(viewRoot);

        viewRoot.getAttributes().put("somekey", "somevalue");
       
        HtmlOutputText a = new HtmlOutputText();
        a.setId("output1");
        a.setValue("testOutput1");
       
        viewRoot.getChildren().add(a);
       
        viewRoot = saveAndRestore(stateManagement, viewRoot);
       
        Assert.assertEquals("form1",viewRoot.getChildren().get(0).getId());
        Assert.assertEquals("output1",viewRoot.getChildren().get(1).getId());
       
        UIComponent component = viewRoot.getChildren().remove( 0 );
        viewRoot.getChildren().add( component );

        viewRoot = saveAndRestore(stateManagement, viewRoot);

        Assert.assertEquals("output1",viewRoot.getChildren().get(0).getId());
        Assert.assertEquals("form1",viewRoot.getChildren().get(1).getId());
       
        component = viewRoot.getChildren().remove( 0 );
        viewRoot.getChildren().add( component );

        viewRoot = saveAndRestore(stateManagement, viewRoot);

        Assert.assertEquals("form1",viewRoot.getChildren().get(0).getId());
        Assert.assertEquals("output1",viewRoot.getChildren().get(1).getId());
       
        component = viewRoot.getChildren().remove( 0 );
        viewRoot.getChildren().add( component );

        viewRoot = saveAndRestore(stateManagement, viewRoot);

        Assert.assertEquals("output1",viewRoot.getChildren().get(0).getId());
        Assert.assertEquals("form1",viewRoot.getChildren().get(1).getId());
       
        component = viewRoot.getChildren().remove( 0 );
        viewRoot.getChildren().add( component );

        viewRoot = saveAndRestore(stateManagement, viewRoot);

        Assert.assertEquals("form1",viewRoot.getChildren().get(0).getId());
        Assert.assertEquals("output1",viewRoot.getChildren().get(1).getId());
       
        Assert.assertEquals("somevalue", viewRoot.getAttributes().get("somekey"));
        Assert.assertNotNull(viewRoot.findComponent("form1"));
        Assert.assertNotNull(viewRoot.findComponent("form1:foo1"));
        Assert.assertNotNull(viewRoot.findComponent("form1:var1"));
        Assert.assertNotNull(viewRoot.findComponent("form1:button1"));
       
        a = (HtmlOutputText) viewRoot.findComponent("output1");
        Assert.assertNotNull(a);
        Assert.assertEquals("testOutput1",a.getValue());
    }
View Full Code Here

        vdl.buildView(facesContext, viewRoot);
        stateManagement.suscribeListeners(viewRoot);

        viewRoot.getAttributes().put("somekey", "somevalue");
       
        HtmlOutputText a = new HtmlOutputText();
        a.setId("output1");
        a.setValue("testOutput1");       
        viewRoot.getChildren().add(a);

        HtmlOutputText b = new HtmlOutputText();
        b.setId("output2");
        b.setValue("testOutput2");       
        viewRoot.getChildren().add(b);
       
        viewRoot = saveAndRestore(stateManagement, viewRoot);
       
        Assert.assertEquals("form1",viewRoot.getChildren().get(0).getId());
View Full Code Here

        @Override
        public void buildView(FacesContext context, UIViewRoot viewRoot)
                throws IOException
        {           
            HtmlOutputText output = new HtmlOutputText();
            output.setValue("foo");
            output.setId("foo1");

            HtmlInputText input = new HtmlInputText();
            input.setValue("var");
            input.setId("var1");
           
View Full Code Here

            parameter.setValue(id);
            List children = link.getChildren();
            children.add(parameter);
            if (text != null)
            {
                HtmlOutputText uiText = (HtmlOutputText) application
                                .createComponent(HtmlOutputText.COMPONENT_TYPE);
                uiText.setId(scroller.getId() + id + "_text");
                uiText.setTransient(true);
                uiText.setValue(text);
                children.add(uiText);
            }
            scroller.getChildren().add(link);
        }
        else
        {
            UIOutput uiText = (UIOutput) link.findComponent(scroller.getId() + id + "_text");
            if (uiText != null)
            {
                //Update text value
                uiText.setValue(text);
            }
        }
        return link;
    }
View Full Code Here

        link.setTransient(true);
        link.setImmediate(true);

        List children = link.getChildren();
        // Create the indicator. You could later make this conditional and render optional images instead
        HtmlOutputText uiText = (HtmlOutputText) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
        uiText.setTransient(true);
        uiText.setValue(collapsiblePanel.isCollapsed() ? ">" : "ν");
        uiText.setEscape(false);
        uiText.setStyleClass(collapsiblePanel.getStyleClass());
        uiText.setStyle(collapsiblePanel.getStyle());
        children.add(uiText);

        // Create the optional label
        String label = collapsiblePanel.getTitle();
        if (label != null) {
            uiText = (HtmlOutputText) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
            uiText.setTransient(true);
            uiText.setValue(" " + label);
            uiText.setStyleClass(collapsiblePanel.getStyleClass());
            uiText.setStyle(collapsiblePanel.getStyle());
            children.add(uiText);
        }
        return link;
    }
View Full Code Here

{
  if (!(component instanceof HtmlOutputText))
  {
    throw new IllegalArgumentException("Component " + component.getClass().getName() + " is no HtmlOutputText");
  }
  HtmlOutputText comp = (HtmlOutputText)component;

  super.setProperties(component);

  if (_title != null)
  {
    comp.setValueExpression("title", _title);
  }
  if (_dir != null)
  {
    comp.setValueExpression("dir", _dir);
  }
  if (_escape != null)
  {
    comp.setValueExpression("escape", _escape);
  }
  if (_converter != null)
  {
    if (!_converter.isLiteralText())
    {
      comp.setValueExpression("converter", _converter);
    }
    else
    {
      String s = _converter.getExpressionString();
      if (s != null)
      {
        Converter converter = getFacesContext().getApplication().
          createConverter(s);
        comp.setConverter(converter);
      }
    }
  }
  if (_lang != null)
  {
    comp.setValueExpression("lang", _lang);
  }
  if (_styleClass != null)
  {
    comp.setValueExpression("styleClass", _styleClass);
  }
  if (_value != null)
  {
    comp.setValueExpression("value", _value);
  }
  if (_style != null)
  {
    comp.setValueExpression("style", _style);
  }
}
View Full Code Here

            throws IOException
    {
        Converter converter = getConverter(component);
        Application application = facesContext.getApplication();

        HtmlOutputText text
                = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
        text.setValue(content);
        text.setId(component.getId() + "_" + valueForLink.getTime() + "_text");
        text.setTransient(true);

        HtmlInputCalendar calendar = (HtmlInputCalendar)component;
        if (isDisabled(facesContext, component) || calendar.isReadonly())
        {
            component.getChildren().add(text);
View Full Code Here

    public void setUp() throws Exception
    {
        super.setUp();

        outputText = new HtmlOutputText();
        inputText = new HtmlInputText();

        writer = new MockResponseWriter(new StringWriter(), null, null);
        facesContext.setResponseWriter(writer);
        // TODO remove these two lines once myfaces-test goes alpha, see MYFACES-1155
View Full Code Here

        Assert.assertNotNull(panelGroup1);
        UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
        Assert.assertNotNull(compositeComponent1);
        UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
        Assert.assertNotNull(facet1);
        HtmlOutputText text1 = (HtmlOutputText) facet1.findComponent("text");
        Assert.assertNotNull(text1);
       
        compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
        facet1.pushComponentToEL(facesContext, facet1);
        text1.pushComponentToEL(facesContext, text1);
        //set on tag
        Assert.assertEquals("class1", text1.getStyleClass());
        //set as default
        Assert.assertEquals("background:red", text1.getStyle());
        //Check coercion of attribute using type value
        Assert.assertEquals(5, compositeComponent1.getAttributes().get("index"));
        //Check default coercion
        ValueExpression ve = facesContext.getApplication().getExpressionFactory().createValueExpression(
                facesContext.getELContext(), "#{cc.attrs.cols}", Object.class);
        Assert.assertEquals(1, ve.getValue(facesContext.getELContext()));
        text1.popComponentFromEL(facesContext);
        facet1.popComponentFromEL(facesContext);
        compositeComponent1.popComponentFromEL(facesContext);
       
        UIComponent panelGroup2 = root.findComponent("testGroup2");
        Assert.assertNotNull(panelGroup2);
        UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
        Assert.assertNotNull(compositeComponent2);
        UIComponent facet2 = compositeComponent2.getFacet(UIComponent.COMPOSITE_FACET_NAME);
        Assert.assertNotNull(facet2);       
        HtmlOutputText text2 = (HtmlOutputText) facet2.findComponent("text");
        Assert.assertNotNull(text2);
       
        compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
        facet2.pushComponentToEL(facesContext, facet2);
        text2.pushComponentToEL(facesContext, text2);
        //set on tag
        Assert.assertEquals("background:green", text2.getStyle());
        // not set, should return null, but since there is a ValueExpression indirection,
        // coercing rules apply here, so null is converted as ""
        Assert.assertEquals("", text2.getStyleClass());
        text2.popComponentFromEL(facesContext);
        facet2.popComponentFromEL(facesContext);
        compositeComponent2.popComponentFromEL(facesContext);

        StringWriter sw = new StringWriter();
        MockResponseWriter mrw = new MockResponseWriter(sw);
View Full Code Here

TOP

Related Classes of javax.faces.component.html.HtmlOutputText

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.