Examples of UIOutput


Examples of javax.faces.component.UIOutput

        {
            Application application = context.getApplication();
           
            // Create a UIOutput instance by passing javax.faces.Output. to
            // Application.createComponent(java.lang.String).
            UIOutput output = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
           
            // Get the annotation instance from the class and obtain the values of the name, library, and
            // target attributes.
            String name = annotation.name();
            if (name != null && name.length() > 0)
            {
                name = ELText.parse(getExpressionFactory(), context.getELContext(), name).toString(context.getELContext());
            }
           
            // Obtain the renderer-type for the resource name by passing name to
            // ResourceHandler.getRendererTypeForResourceName(java.lang.String).
            String rendererType = application.getResourceHandler().getRendererTypeForResourceName(name);
           
            // Call setRendererType on the UIOutput instance, passing the renderer-type.
            output.setRendererType(rendererType);
           
            // Obtain the Map of attributes from the UIOutput component by calling UIComponent.getAttributes().
            Map<String, Object> attributes = output.getAttributes();
           
            // Store the name into the attributes Map under the key "name".
            attributes.put("name", name);
           
            // If library is the empty string, let library be null.
View Full Code Here

Examples of javax.faces.component.UIOutput

        // If this annotation is not present on the class in question, no action must be taken.
        if (annotation != null)
        {
            // Create a UIOutput instance by passing javax.faces.Output. to
            // Application.createComponent(java.lang.String).
            UIOutput output = (UIOutput) createComponent(UIOutput.COMPONENT_TYPE);

            // Get the annotation instance from the class and obtain the values of the name, library, and
            // target attributes.
            String name = annotation.name();
            if (name != null && name.length() > 0)
            {
                name = ELText.parse(getExpressionFactory(), context.getELContext(), name).toString(context.getELContext());
            }

            // Obtain the renderer-type for the resource name by passing name to
            // ResourceHandler.getRendererTypeForResourceName(java.lang.String).
            // (note that we can not use this.getResourceHandler(), because the Application might be wrapped)
            String rendererType = context.getApplication().getResourceHandler().getRendererTypeForResourceName(name);

            // Call setRendererType on the UIOutput instance, passing the renderer-type.
            output.setRendererType(rendererType);

            // Obtain the Map of attributes from the UIOutput component by calling UIComponent.getAttributes().
            Map<String, Object> attributes = output.getAttributes();

            // Store the name into the attributes Map under the key "name".
            attributes.put("name", name);

            // If library is the empty string, let library be null.
View Full Code Here

Examples of javax.faces.component.UIOutput

      }
    }
  }

  private UIOutput createDefaultNodeFaceOutput(FacesContext facesContext) {
    UIOutput component = new UIOutput() {

      public Object getValue() {
        return getRowData();
      }


      public String getId() {
        String id = super.getId();

        if (id == null) {
          //set fixed id to prevent duplicate id exception
          id = "_defaultNodeFaceOutput";//FacesContext.getCurrentInstance().getViewRoot()
          //.createUniqueId();

          setId(id);
        }

        return id;
      }


      public void setTransient(boolean transientFlag) {
        if (!transientFlag) {
          throw new IllegalArgumentException(
          "Default representation for node face cannot be set non-persistent!");
        }
      }


      public boolean isTransient() {
        return true;
      }
    };

    component.getAttributes().put("escape", Boolean.TRUE);
   
    return component;
  }
View Full Code Here

Examples of javax.faces.component.UIOutput

            command.setValueBinding("label", binding);
            MethodBinding action = application.createMethodBinding("#{test.select}", new Class[0]);
            command.setAction(action);
            column.getChildren().add(command);
          } else {
            UIOutput output = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
            output.setValueBinding("value", binding);
            column.getChildren().add(output);
          }
          table.getChildren().add(column);
        }
View Full Code Here

Examples of javax.faces.component.UIOutput

  }

  public void onComponentCreated(FaceletContext faceletContext, UIComponent separator, UIComponent parent) {
    Application application = faceletContext.getFacesContext().getApplication();
    UIViewRoot root = ComponentUtils.findViewRoot(faceletContext, parent);
    UIOutput label = (UIOutput) application.createComponent(UILabel.COMPONENT_TYPE);
    label.setId(root.createUniqueId());
    label.setRendererType("Label");
    setAttributes(faceletContext, label);
    separator.getFacets().put(Facets.LABEL, label);
    if (labelAttribute != null) {
      if (labelAttribute.isLiteral()) {
        label.setValue(labelAttribute.getValue(faceletContext));
      } else {
        ValueExpression expression = labelAttribute.getValueExpression(faceletContext, String.class);
        label.setValueExpression(Attributes.VALUE, expression);
      }
    }
  }
View Full Code Here

Examples of javax.faces.component.UIOutput

public class LabelWithAccessKeyUnitTest {

  @Test
  public void testSimple() {
    UIComponent component = new UIOutput();
    component.getAttributes().put("label", "Save");
    LabelWithAccessKey label = new LabelWithAccessKey(component);
    Assert.assertEquals("Save", label.getText());
    Assert.assertEquals(-1, label.getPos());
    Assert.assertEquals(null, label.getAccessKey());
  }
View Full Code Here

Examples of javax.faces.component.UIOutput

    Assert.assertEquals(null, label.getAccessKey());
  }

  @Test
  public void testWithKeyFirstLetter() {
    UIComponent component = new UIOutput();
    component.getAttributes().put("label", "Save_");
    LabelWithAccessKey label = new LabelWithAccessKey(component);
    Assert.assertEquals("Save", label.getText());
    Assert.assertNull(label.getAccessKey());
  }
View Full Code Here

Examples of javax.faces.component.UIOutput

  }

  @Test
  public void testWithKeyLastLetter() {
    String result = "A_n_aly_ze";
    UIComponent component = new UIOutput();
    component.getAttributes().put("label", "A__n__a_ly__ze");
    LabelWithAccessKey label = new LabelWithAccessKey(component);
    Assert.assertEquals(result, label.getText());
    Assert.assertEquals(5, label.getPos());
    Assert.assertEquals(new Character('l'), label.getAccessKey());
  }
View Full Code Here

Examples of javax.faces.component.UIOutput

    Assert.assertEquals(new Character('l'), label.getAccessKey());
  }

  @Test
  public void testAmpersand() {
    UIComponent component = new UIOutput();
    component.getAttributes().put("label", "_Save");
    LabelWithAccessKey label = new LabelWithAccessKey(component);
    Assert.assertEquals("Save", label.getText());
    Assert.assertEquals(0, label.getPos());
    Assert.assertEquals(new Character('S'), label.getAccessKey());
  }
View Full Code Here

Examples of javax.faces.component.UIOutput

    Assert.assertEquals(new Character('S'), label.getAccessKey());
  }

  @Test
  public void testAmpersandAtEnd() {
    UIComponent component = new UIOutput();
    component.getAttributes().put("label", "Save_");
    LabelWithAccessKey label = new LabelWithAccessKey(component);
    Assert.assertEquals("Save", label.getText());
    Assert.assertEquals(-1, label.getPos());
    Assert.assertEquals(null, label.getAccessKey());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.