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


Java UIViewRoot.setId方法代码示例

本文整理汇总了Java中javax.faces.component.UIViewRoot.setId方法的典型用法代码示例。如果您正苦于以下问题:Java UIViewRoot.setId方法的具体用法?Java UIViewRoot.setId怎么用?Java UIViewRoot.setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.faces.component.UIViewRoot的用法示例。


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

示例1: testVerySimpleFinder

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
public void testVerySimpleFinder()
{
  UIViewRoot root = facesContext.getViewRoot();
  root.setId("root");
  UIInput input1 = new UIInput(); input1.setId("input1");

  // build the Tree...
  root.getChildren().add(input1);

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

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

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

示例2: testNoComponentWithoutAnId

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
public void testNoComponentWithoutAnId()
{
  UIViewRoot root = facesContext.getViewRoot();
  root.setId("root");
  UIInput input1 = new UIInput();

  // build the Tree...
  root.getChildren().add(input1);

  ComponentReference ref = ComponentReference.newUIComponentReference(input1);

  // Get the ComponentReference util
  try
  {
    ref.getComponent();
    
    // find the component...
    fail("IllegalStateException expected");
  }
  catch (IllegalStateException e)
  {
    // suppress it - this is as expected
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:25,代码来源:ComponentReferenceTest.java

示例3: testNamingContainerViewRoot

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
public void testNamingContainerViewRoot()
{
  UIViewRoot root = facesContext.getViewRoot();
  root.setId("root");
  UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
  UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
  UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");

  // build the tree
  root.getChildren().add(nc1);
  nc1.getChildren().add(nc2);
  nc2.getChildren().add(nc3);

  // Get the ComponentReference util
  ComponentReference<UINamingContainer> uiRef = ComponentReference.newUIComponentReference(nc3);

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

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

示例4: testFindInPanelComponents

import javax.faces.component.UIViewRoot; //导入方法依赖的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

示例5: testFailover

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void testFailover() throws IOException, ClassNotFoundException
{
  UIViewRoot root = facesContext.getViewRoot();
  root.setId("root");
  UIInput input1 = new UIInput(); input1.setId("input1");

  // build the Tree...
  root.getChildren().add(input1);

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

  // find the component...
  UIInput referencedComp = uiRef.getComponent();
  assertEquals(input1, referencedComp);
  
  // fake the failover
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  ObjectOutputStream oos = new ObjectOutputStream(baos);

  oos.writeObject(uiRef);
  oos.flush();

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

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

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

示例6: testEmptyViewRootOnGetComponent

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
public void testEmptyViewRootOnGetComponent()
{
  UIViewRoot root = facesContext.getViewRoot();
  root.setId("root");
  UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
  UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
  UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");

  // build the tree
  root.getChildren().add(nc1);
  nc1.getChildren().add(nc2);
  nc2.getChildren().add(nc3);

  // Get the ComponentReference util
  ComponentReference<UINamingContainer> uiRef = ComponentReference.newUIComponentReference(nc3);

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

  assertEquals(nc3, referencedComp);

  // clear the ViewRoot
  root.getChildren().clear();

  // now, the getComponent should return NULL
  assertNull(uiRef.getComponent());
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:28,代码来源:ComponentReferenceTest.java

示例7: testViewRoot

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
public void testViewRoot()
{
  UIViewRoot root = facesContext.getViewRoot();
  root.setId("root");

  // Get the ComponentReference util
  ComponentReference<UIViewRoot> uiRef = ComponentReference.newUIComponentReference(root);

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

示例8: testMovingInsideNamingContainer

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
public void testMovingInsideNamingContainer()
{
  UIViewRoot root = facesContext.getViewRoot();
  root.setId("root");
  UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
  UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
  UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");

  // build the tree
  root.getChildren().add(nc1);
  nc1.getChildren().add(nc2);
  nc2.getChildren().add(nc3);

  // Get the ComponentReference util
  ComponentReference<UINamingContainer> uiRef = ComponentReference.newUIComponentReference(nc3);

  // find the component...
  UINamingContainer referencedComp = uiRef.getComponent();
  assertEquals(nc3, referencedComp);

  // let's move the NC3 component one level up;
  nc2.getChildren().remove(nc3);
  nc1.getChildren().add(nc3);

  // and we can not find the component...
  referencedComp = uiRef.getComponent();
  assertNull(referencedComp);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:29,代码来源:ComponentReferenceTest.java

示例9: testDeferredMovingInsideNamingContainer

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
public void testDeferredMovingInsideNamingContainer()
{
  UIViewRoot root = facesContext.getViewRoot();
  root.setId("root");
  UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
  UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
  UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");

  // almost build the tree
  nc1.getChildren().add(nc2);
  nc2.getChildren().add(nc3);

  // Get the ComponentReference util, this will be a deferred component reference since the
  // component wasn't attached
  ComponentReference<UINamingContainer> uiRef = ComponentReference.newUIComponentReference(nc3);

  // now finish building the component tree
  root.getChildren().add(nc1);

  // find the component...
  UINamingContainer referencedComp = uiRef.getComponent();
  assertEquals(nc3, referencedComp);

  // let's move the NC3 component one level up;
  nc2.getChildren().remove(nc3);
  nc1.getChildren().add(nc3);

  // and we can not find the component...
  referencedComp = uiRef.getComponent();
  assertNull(referencedComp);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:32,代码来源:ComponentReferenceTest.java

示例10: testCustomFacet

import javax.faces.component.UIViewRoot; //导入方法依赖的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

示例11: testCustomFacetWithFind

import javax.faces.component.UIViewRoot; //导入方法依赖的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

示例12: testUIDataFooterFacet

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
public void testUIDataFooterFacet()
{
  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");
  UIData table = new UIData(); table.setId("table1");
  UIInput input = new UIInput(); input.setId("input1");

  // build the Tree...
  table.setFooter(input);
  nc3.getChildren().add(table);
  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);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:34,代码来源:ComponentReferenceTest.java

示例13: testIndex

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
public void testIndex()
{
  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");
  UIInput input1 = new UIInput(); input1.setId("input1");

  // build the Tree...
  nc3.getChildren().add(input1);
  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(input1);

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

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

示例14: testFailoverOnCustomFacet

import javax.faces.component.UIViewRoot; //导入方法依赖的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

示例15: testMoreFacets

import javax.faces.component.UIViewRoot; //导入方法依赖的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


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