当前位置: 首页>>代码示例>>Java>>正文


Java UIPanel类代码示例

本文整理汇总了Java中javax.faces.component.UIPanel的典型用法代码示例。如果您正苦于以下问题:Java UIPanel类的具体用法?Java UIPanel怎么用?Java UIPanel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UIPanel类属于javax.faces.component包,在下文中一共展示了UIPanel类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isFlattenableCoreComponent

import javax.faces.component.UIPanel; //导入依赖的package包/类
/**
 * Determine if we can flatten a core JSF component.
 * @param component The component
 * @return true if the component is a core JSF component and we can
 * flatten it successfully.
 */
private static boolean isFlattenableCoreComponent(UIComponent component)
{
  // Optimize the cases of UINamingContainer (<f:subview>) and UIPanel -
  // we will treat these components as FlattenedComponents because they do not render
  // any DOM.
  // Also note that as of JSF 2.0, UINamingContainer components are built
  // by f:subview, as well as composite components.
  Class<? extends UIComponent> componentClass = component.getClass();

  if (UINamingContainer.class == componentClass)
  {
    // Check to see if this component was created as a composite
    // component, which we cannot flatten
    return component.getFacet(UIComponent.COMPOSITE_FACET_NAME) == null;
  }

  // Note that JSF 2.0 creates UIPanel wrappers around multiple components
  // inside of <f:facet>
  return UIPanel.class == componentClass;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:27,代码来源:UIXComponent.java

示例2: testFindInPanelComponents

import javax.faces.component.UIPanel; //导入依赖的package包/类
public void testFindInPanelComponents()
{
  UIViewRoot root = facesContext.getViewRoot(); root.setId("root");
  UIPanel panel1 = new UIPanel(); panel1.setId("panel1");
  UIPanel panel2 = new UIPanel(); panel2.setId("panel2");
  UIPanel panel3 = new UIPanel(); panel3.setId("panel3");
  UIOutput txt = new UIOutput(); txt.setId("txt");

  // build the Tree...
  root.getChildren().add(panel1);
  panel1.getChildren().add(panel2);
  panel2.getChildren().add(panel3);
  panel3.getChildren().add(txt);

  // Get the ComponentReference util
  ComponentReference<UIOutput> uiRef = ComponentReference.newUIComponentReference(txt);

  // find the component...
  UIOutput referencedComp = uiRef.getComponent();

  assertEquals(txt, referencedComp);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:23,代码来源:ComponentReferenceTest.java

示例3: restoreRowState

import javax.faces.component.UIPanel; //导入依赖的package包/类
@Override
public void restoreRowState(UIComponent child)
{
  //There is a bug in the RI where, on a PPR request, an UIPanel will sometimes be
  //added to a facet that contains only one child in facelets.  This, of course,
  //changes the structure of the saved data.  If we get a UIPanel here, then this
  //but is the cause.  It means we have a Collection which contains a switcher
  //which in turn contains another Collection, and UIPanel was returned instead of
  //the origional collection.  Therefore, this UIPanel should ALWAYS only have one
  //Item.  If the facet contained more then one item, we would ALWAYS have a UIPanel
  //and therefore we would be using a different stamp state.
  UIXCollection myChild = (child instanceof UIPanel)?(UIXCollection)child.getChildren().get(0):(UIXCollection)child;
  
  myChild.__setMyStampState(_state);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:16,代码来源:StampState.java

示例4: testCustomFacet

import javax.faces.component.UIPanel; //导入依赖的package包/类
public void testCustomFacet()
{
  UIViewRoot root = facesContext.getViewRoot();
  root.setId("root");
  UIForm form = new UIForm(); form.setId("form");
  UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
  UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
  UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");
  UIPanel panel = new UIPanel(); panel.setId("panel");
  UIInput input = new UIInput(); input.setId("input1");

  // build the Tree...
  panel.getFacets().put("fancyFacet", input);
  nc3.getChildren().add(panel);
  nc2.getChildren().add(new UIOutput());
  nc2.getChildren().add(new UIOutput());
  nc2.getChildren().add(nc3);
  nc1.getChildren().add(nc2);
  form.getChildren().add(new UIOutput());
  form.getChildren().add(new UIOutput());
  form.getChildren().add(new UIOutput());
  form.getChildren().add(nc1);
  root.getChildren().add(new UIOutput());
  root.getChildren().add(form);

  // Get the ComponentReference util
  ComponentReference<UIInput> uiRef = ComponentReference.newUIComponentReference(input);

  // find the component...
  UIInput referencedComp = uiRef.getComponent();
  assertEquals(input, referencedComp);
  
  // find it again!
  assertEquals(input, uiRef.getComponent());
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:36,代码来源:ComponentReferenceTest.java

示例5: testCustomFacetWithFind

import javax.faces.component.UIPanel; //导入依赖的package包/类
public void testCustomFacetWithFind()
{
  UIViewRoot root = new UIViewRoot();
  root.setId("root");
  UIForm form = new UIForm(); form.setId("form");
  UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
  UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
  UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");
  UIPanel panel = new UIPanel(); panel.setId("panel");
  UIInput input = new UIInput(); input.setId("input1");

  // build the Tree...
  panel.getFacets().put("fancyFacet", input);
  panel.getChildren().add(input);
  nc3.getChildren().add(panel);
  nc2.getChildren().add(new UIOutput());
  nc2.getChildren().add(new UIOutput());
  nc2.getChildren().add(nc3);
  nc1.getChildren().add(nc2);
  form.getChildren().add(new UIOutput());
  form.getChildren().add(new UIOutput());
  form.getChildren().add(new UIOutput());
  form.getChildren().add(nc1);
  root.getChildren().add(new UIOutput());
  root.getChildren().add(form);
  
  facesContext.setViewRoot(root);

  // Get the ComponentReference util
  ComponentReference<UIInput> uiRef = ComponentReference.newUIComponentReference(input);

  // find the component...
  UIInput referencedComp = uiRef.getComponent();
  assertEquals(input, referencedComp);

  // find it again!
  assertEquals(input, uiRef.getComponent());

}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:40,代码来源:ComponentReferenceTest.java

示例6: loadCompositeComponent

import javax.faces.component.UIPanel; //导入依赖的package包/类
public static void loadCompositeComponent(UIComponent parent, String libraryName, String resourceName, String id) {
    // Prepare.
    FacesContext context = FacesContext.getCurrentInstance();
    Application application = context.getApplication();
    FaceletContext faceletContext = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);

    // This basically creates <ui:component> based on <composite:interface>.
    Resource resource = application.getResourceHandler().createResource(resourceName, libraryName);
    UIComponent composite = application.createComponent(context, resource);
    composite.setId(id); // Mandatory for the case composite is part of UIForm! Otherwise JSF can't find inputs.

    // This basically creates <composite:implementation>.
    UIComponent implementation = application.createComponent(UIPanel.COMPONENT_TYPE);
    implementation.setRendererType("javax.faces.Group");
    composite.getFacets().put(UIComponent.COMPOSITE_FACET_NAME, implementation);

    // Now include the composite component tmpFileUploadPart in the given parent.
    parent.getChildren().clear();
    parent.getChildren().add(composite);
    parent.pushComponentToEL(context, composite); // This makes #{cc} available.
    try {
        faceletContext.includeFacelet(implementation, resource.getURL());
    } catch (IOException e) {
        throw new FacesException(e);
    } finally {
        parent.popComponentFromEL(context);
    }
}
 
开发者ID:Blue4x4Rebel,项目名称:kirke,代码行数:29,代码来源:SourceWizardBean.java

示例7: testFailoverOnCustomFacet

import javax.faces.component.UIPanel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testFailoverOnCustomFacet() throws IOException, ClassNotFoundException
{
  UIViewRoot root = facesContext.getViewRoot();
  root.setId("root");
  UIForm form = new UIForm(); form.setId("form");
  UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
  UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
  UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");
  UIPanel panel = new UIPanel(); panel.setId("panel");
  UIInput input = new UIInput(); input.setId("input1");

  // build the Tree...
  panel.getFacets().put("fancyFacet", input);
  nc3.getChildren().add(panel);
  nc2.getChildren().add(new UIOutput());
  nc2.getChildren().add(new UIOutput());
  nc2.getChildren().add(nc3);
  nc1.getChildren().add(nc2);
  form.getChildren().add(new UIOutput());
  form.getChildren().add(new UIOutput());
  form.getChildren().add(new UIOutput());
  form.getChildren().add(nc1);
  root.getChildren().add(new UIOutput());
  root.getChildren().add(form);

  // Get the ComponentReference util
  ComponentReference<UIInput> uiRef = ComponentReference.newUIComponentReference(input);

  // find the component...
  UIInput referencedComp = uiRef.getComponent();
  assertEquals(input, referencedComp);
  
  // find it again!
  assertEquals(input, uiRef.getComponent());

  // fake the failover
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  ObjectOutputStream oos = new ObjectOutputStream(baos);

  oos.writeObject(uiRef);

  ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
  ObjectInputStream ois = new ObjectInputStream(bais);

  uiRef = (ComponentReference<UIInput>) ois.readObject();

  referencedComp = uiRef.getComponent();
  assertEquals(input, referencedComp);

}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:52,代码来源:ComponentReferenceTest.java

示例8: testMoreFacets

import javax.faces.component.UIPanel; //导入依赖的package包/类
public void testMoreFacets()
{
  UIViewRoot root = facesContext.getViewRoot();
  root.setId("root");
  UIForm form = new UIForm(); form.setId("form");
  UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
  UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
  UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");
  UIPanel panel = new UIPanel(); panel.setId("panel");
  UIInput input = new UIInput(); input.setId("input1");

  // build the Tree...
  panel.getFacets().put("f1", new UIOutput());
  panel.getFacets().put("f2", new UIOutput());
  panel.getFacets().put("f3", new UIOutput());
  panel.getFacets().put("f4", new UIOutput());
  panel.getFacets().put("f5", new UIOutput());

  // add the important facet
  panel.getFacets().put("f0", input);

  nc3.getChildren().add(panel);
  nc2.getChildren().add(new UIOutput());
  nc2.getChildren().add(new UIOutput());
  nc2.getChildren().add(nc3);
  nc1.getChildren().add(nc2);
  form.getChildren().add(new UIOutput());
  form.getChildren().add(new UIOutput());
  form.getChildren().add(new UIOutput());
  form.getChildren().add(nc1);
  root.getChildren().add(new UIOutput());
  root.getChildren().add(form);

  // Get the ComponentReference util
  ComponentReference<UIInput> uiRef = ComponentReference.newUIComponentReference(input);

  // find the component...
  UIInput referencedComp = uiRef.getComponent();
  assertEquals(input, referencedComp);
  
  // find it again!
  assertEquals(input, uiRef.getComponent());
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:44,代码来源:ComponentReferenceTest.java

示例9: includeCompositeComponent

import javax.faces.component.UIPanel; //导入依赖的package包/类
public static void includeCompositeComponent(final UIComponent parent,
        final String libraryName, final String resourceName,
        final String id,
        final Map<String, ValueExpression> mapValueExpression) {

    // Prepare.
    FacesContext context = FacesContext.getCurrentInstance();
    Application application = context.getApplication();
    FaceletContext faceletContext = (FaceletContext) context
            .getAttributes().get("javax.faces.FACELET_CONTEXT");

    // This basically creates <ui:component> based on <composite:interface>.
    Resource resource = application.getResourceHandler().createResource(
            resourceName, libraryName);
    UIComponent composite = application.createComponent(context, resource);
    // Mandatory for the case composite is part of
    // UIForm! Otherwise JSF can't find inputs.
    composite.setId(id);

    // This for set the attribute and the action
    for (Map.Entry<String, ValueExpression> entry : mapValueExpression
            .entrySet()) {
        composite.setValueExpression(entry.getKey(), entry.getValue());
    }

    // This basically creates <composite:implementation>.
    UIComponent implementation = application
            .createComponent(UIPanel.COMPONENT_TYPE);
    implementation.setRendererType("javax.faces.Group");
    composite.getFacets().put(UIComponent.COMPOSITE_FACET_NAME,
            implementation);

    // Now include the composite component file in the given parent.
    parent.getChildren().add(composite);
    // This makes #{cc} available.
    parent.pushComponentToEL(context, composite);

    try {
        faceletContext.includeFacelet(implementation, resource.getURL());
    } catch (IOException e) {
        throw new FacesException(e);
    } finally {
        parent.popComponentFromEL(context);
    }
}
 
开发者ID:disit,项目名称:iclos,代码行数:46,代码来源:CCUtility.java

示例10: getFamily

import javax.faces.component.UIPanel; //导入依赖的package包/类
/**
 * @see javax.faces.component.UIComponent#getFamily()
 */
public String getFamily()
{
   return UIPanel.COMPONENT_FAMILY;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:8,代码来源:UIPropertySheet.java

示例11: encodeBegin

import javax.faces.component.UIPanel; //导入依赖的package包/类
/**
 * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
 */
@SuppressWarnings("unchecked")
public void encodeBegin(FacesContext context) throws IOException
{
   if (isRendered() == false)
   {
      return;
   }
   
   ResponseWriter out = context.getResponseWriter();
   
   if (getChildCount() == 0)
   {
      createComponentsFromConfig(context);
   }
   
   // encode the components in a 3 column table
   out.write("<table cellspacing=2 cellpadding=2 border=0");
   outputAttribute(out, getAttributes().get("styleClass"), "class");
   outputAttribute(out, getAttributes().get("style"), "style");
   out.write('>');
   List<UIComponent> children = getChildren();
   int colCounter = 0;
   for (int i=0; i<children.size(); i++)
   {
      UIComponent component = children.get(i);
      if (component instanceof UIPanel)
      {
         out.write("<tr><td colspan=3>");
         Utils.encodeRecursive(context, component);
         out.write("</td></tr>");
         colCounter += 3;
      }
      else
      {
         if ((colCounter % 3) == 0)
         {
            out.write("<tr>");
         }
         out.write("<td>");
         Utils.encodeRecursive(context, component);
         out.write("</td>");
         if ((colCounter % 3 ) == 2)
         {
            out.write("</tr>");
         }
         colCounter++;
      }
   }
   out.write("</table>");
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:54,代码来源:UISearchCustomProperties.java

示例12: getResultPanel

import javax.faces.component.UIPanel; //导入依赖的package包/类
public UIPanel getResultPanel() {
  return resultPanel;
}
 
开发者ID:dayler,项目名称:SimpleJsfModelAndController,代码行数:4,代码来源:CardController.java

示例13: setResultPanel

import javax.faces.component.UIPanel; //导入依赖的package包/类
public void setResultPanel(UIPanel resultPanel) {
  this.resultPanel = resultPanel;
}
 
开发者ID:dayler,项目名称:SimpleJsfModelAndController,代码行数:4,代码来源:CardController.java

示例14: setInfoPanel

import javax.faces.component.UIPanel; //导入依赖的package包/类
/**
 * Sets the info panel.
 * 
 * @param infoPanel the new info panel
 */
public void setInfoPanel(UIPanel infoPanel) {
  this.infoPanel = infoPanel;
  infoPanel.setId("_metadataPanel" + this.getRowIndexAsString());
}
 
开发者ID:GeoinformationSystems,项目名称:GeoprocessingAppstore,代码行数:10,代码来源:DataTableBackingBean.java


注:本文中的javax.faces.component.UIPanel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。