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


Java UIViewRoot类代码示例

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


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

示例1: testRIManyAttributes

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
public void testRIManyAttributes() throws IOException
{
  HtmlOutputText out = _createHtmlOutputText();
  out.setValue("Plain value");
  out.setEscape(true);
  out.setId("OutId");
  out.setTitle("Short Desc");
  out.setStyleClass("Style Class");
  out.setStyle("The Style");

  UIViewRoot root = createTestTree(out, "testRIManyAttributes()");
  renderRoot(root);

  root = createTestTree(out, "testRIManyAttributes() 2");
  renderRoot(root);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:17,代码来源:CoreRenderKitPerf.java

示例2: getTableSectionId

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
/**
 * Ids of fields inside tables look like <code>tableId:rowNr:fieldId</code>.
 * So we try to cut the fieldId and the rowNr parts to get the table id and
 * then check if it is inside a section and return the section id.
 * 
 * @param clientId
 *            the id of the field inside of a table
 * @param root
 *            the {@link UIViewRoot}
 * @return the section id or <code>null</code>
 */
private String getTableSectionId(String clientId, UIViewRoot root) {
    if (!clientId.contains(":")) {
        return null;
    }
    // cut the field id
    clientId = clientId.substring(0, clientId.lastIndexOf(':'));
    if (!clientId.contains(":")) {
        return null;
    }
    // cut the row number - we should have the table id
    clientId = clientId.substring(0, clientId.lastIndexOf(':'));
    UIComponent comp = root.findComponent(clientId);
    if (comp != null) {
        return getSectionId(comp);
    }
    return null;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:29,代码来源:MessageListener.java

示例3: _logStaleParentAtLevel

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
/**
 * Logs a message at a specified level when a stale component is detected during create component.
 * @param context FacesContext
 * @param child the UIComponent being created
 * @param oldParent the parent UIComponent
 * @param level the level at which to log the message
 */
private void _logStaleParentAtLevel(FacesContext context,
                                    UIComponent child,
                                    UIComponent oldParent,
                                    Level level)
{
  if (_LOG.isLoggable(level))
  {
    UIViewRoot viewRoot = context.getViewRoot();

    String scopedId = ComponentUtils.getScopedIdForComponent(child, viewRoot);
    String oldParentScopedId = ComponentUtils.getScopedIdForComponent(oldParent, viewRoot);
    String newParentScopedId = _getParentScopedId(viewRoot);

    String bindingEL = _getBindingExpression();

    _LOG.log(level, "ERROR_CREATE_COMPONENT_STALE",
                new Object[] {scopedId, oldParentScopedId, newParentScopedId, bindingEL});
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:27,代码来源:UIXComponentELTag.java

示例4: testSelectOneChoice

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testSelectOneChoice() throws IOException
{
  CoreSelectOneChoice choice = new CoreSelectOneChoice();
  choice.setSimple(true);
  choice.setValue(new Integer(2));
  for (int i = 0 ; i < 10; i++)
  {
    UISelectItem selectItem  = new UISelectItem();
    selectItem.setItemLabel("Item " + i);
    selectItem.setItemValue(new Integer(i));
    choice.getChildren().add(selectItem);
  }

  UIViewRoot root = createTestTree(choice, "testSelectOneChoice");
  renderRoot(root);

  root = createTestTree(choice, "testSelectOneChoice2");
  renderRoot(root);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:21,代码来源:CoreRenderKitPerf.java

示例5: 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

示例6: setUp

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
@Override
protected void setUp() throws IOException
{
  _facesContext = createMockFacesContext(MApplication.sharedInstance(), true);
  _requestContext = createRequestContext();
  _requestContext.setSkinFamily(_skinFamily);
  _requestContext.setAgent(_agent);
  _requestContext.setRightToLeft(_rightToLeft);
  _requestContext.setOutputMode(_outputMode);
  _requestContext.setAccessibilityMode(_accMode);
  _facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);

  UIViewRoot root = RenderKitBootstrap.createUIViewRoot(_facesContext);
  root.setRenderKitId(getRenderKitId());
  _facesContext.setViewRoot(root);

  ExtendedRenderKitService service =
    _getExtendedRenderKitService(_facesContext);

  if (service != null)
    service.encodeBegin(_facesContext);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:23,代码来源:RenderKitTestCase.java

示例7: beforeClass

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
@Before
public void beforeClass() {
    ctrl = spy(new ExternalCustomerPriceModelCtrl());
    model = spy(new ExternalPriceModelModel());
    ctrl.setModel(model);
    ctrl.ui = mock(UiDelegate.class);

    appbean = mock(ApplicationBean.class);
    sessionBean = mock(SessionBean.class);
    doReturn(sessionBean).when(ctrl).getSessionBean();

    externalPriceModelService = mock(ExternalPriceModelService.class);
    externalPriceModelCtrl = mock(ExternalPriceModelCtrl.class);

    doReturn(locale).when(appbean).getDefaultLocale();
    doReturn(externalPriceModelService).when(ctrl)
            .getExternalPriceModelService();

    UIViewRoot viewRoot = mock(UIViewRoot.class);
    given(viewRoot.getLocale()).willReturn(locale);
    new FacesContextStub(locale).setViewRoot(viewRoot);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:23,代码来源:ExternalCustomerPriceModelCtrlTest.java

示例8: testRISelectOneMenu

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testRISelectOneMenu() throws IOException
{
  //
  HtmlSelectOneMenu menu = new HtmlSelectOneMenu();
  menu.setValue(new Integer(2));
  for (int i = 0 ; i < 10; i++)
  {
    UISelectItem selectItem  = new UISelectItem();
    selectItem.setItemLabel("Item " + i);
    selectItem.setItemValue("" + i);
    menu.getChildren().add(selectItem);
  }

  UIViewRoot root = createTestTree(menu, "testRISelectOneMenu");
  renderRoot(root);

  root = createTestTree(menu, "testRISelectOneNavigation2");
  renderRoot(root);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:21,代码来源:CoreRenderKitPerf.java

示例9: renderView

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
@Override
public void renderView(
  FacesContext context,
  UIViewRoot   viewToRender) throws IOException, FacesException
{
  String entryKey = (String) context.getExternalContext().getRequestParameterMap().get(__ENTRY_KEY_PARAM);
  if (entryKey == null)
  {
    RequestContext requestContext = RequestContext.getCurrentInstance();
    if (requestContext != null)
    {
      Object o = requestContext.getPageFlowScope().get(__ENTRY_KEY_PARAM);
      if (o != null)
        entryKey = o.toString();
    }
  }

  service(context,entryKey);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:20,代码来源:GenericEntry.java

示例10: setUp

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
  super.setUp();
  FacesContext oldFacesContext = facesContext;
  UIViewRoot oldViewRoot = oldFacesContext.getViewRoot();
  oldFacesContext.release();
  facesContext = new MockFacesContext12(externalContext,
                                        lifecycle,
                                        application);
  facesContext.setViewRoot(oldViewRoot);
  facesContext.setApplication(application);

  facesContext.getViewRoot().setRenderKitId("org.apache.myfaces.trinidad.core"); 
  RenderKitFactory renderKitFactory = (RenderKitFactory)
  FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
  Mock mockRenderKitty = mock(RenderKit.class);
  RenderKit renderKit = (RenderKit) mockRenderKitty.proxy();
  _mockRenderKit = new MockRenderKitWrapper(mockRenderKitty, renderKit);
  renderKitFactory.addRenderKit("org.apache.myfaces.trinidad.core", renderKit);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:22,代码来源:FacesTestCase.java

示例11: shouldRenderId

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
/**
 * Returns true if the component should render an ID.  Components
 * that deliver events should always return "true".
 */
// TODO Is this a bottleneck?  If so, optimize!
protected boolean shouldRenderId(
  FacesContext context,
  UIComponent component)
{
  String id = component.getId();

  // Otherwise, if ID isn't set, don't bother
  if (id == null)
    return false;

  // ... or if the ID was generated, don't bother
  if (id.startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
    return false;

  return true;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:22,代码来源:CoreRenderer.java

示例12: testRISelectOneRadio

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testRISelectOneRadio() throws IOException
{
  //
  HtmlSelectOneRadio radio = new HtmlSelectOneRadio();
  radio.setValue(new Integer(2));
  for (int i = 0 ; i < 10; i++)
  {
    UISelectItem selectItem  = new UISelectItem();
    selectItem.setItemLabel("Item " + i);
    selectItem.setItemValue("" + i);
    radio.getChildren().add(selectItem);
  }

  UIViewRoot root = createTestTree(radio, "testRISelectOneRadio");
  renderRoot(root);

  root = createTestTree(radio, "testRISelectOneRadio2");
  renderRoot(root);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:21,代码来源:CoreRenderKitPerf.java

示例13: installListener

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
static void installListener(
  FacesContext facesContext)
{
  UIViewRoot viewRoot = facesContext.getViewRoot();

  // See if the phase listener has already been added (only add it once)
  Map<String, Object> viewAttrs = viewRoot.getAttributes();
  if (!viewAttrs.containsKey(_PL_KEY))
  {
    PhaseListener newPhaseListener = new CleanupPhaseListener();
    viewRoot.addPhaseListener(newPhaseListener);

    viewAttrs.put(_PL_KEY, Boolean.TRUE);

    _LOG.finer("Cleanup phase listener has been installed");
  }
  else
  {
    _LOG.finest("Cleanup phase listener has already been installed on the current view");
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:22,代码来源:ForEachTag.java

示例14: testPanelGroupPerf

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testPanelGroupPerf() throws IOException
{
  CorePanelGroupLayout group = new CorePanelGroupLayout();
  group.setLayout(CorePanelGroupLayout.LAYOUT_VERTICAL);
  for (int i = 0; i < 8; i++)
  {
    /*
    CoreOutputText out = _createCoreOutputText();
    out.setValue("Plain value");
    group.getChildren().add(out);*/
    group.getChildren().add(new NullComp());
  }

  UIViewRoot root = createTestTree(group, "testPanelGroup()");
  renderRoot(root);

  root = createTestTree(group, "testPanelGroup() 2");
  renderRoot(root);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:21,代码来源:CoreRenderKitPerf.java

示例15: pushView

import javax.faces.component.UIViewRoot; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void pushView(UIViewRoot viewRoot)
{
  FacesContext context = _getFacesContext();
  Object savedOld = StateManagerImpl.saveViewRoot(context, viewRoot);

  List<Object> list = (List<Object>) _getPageFlowScope().get(_PUSHED_VIEWS_KEY);
  if (list == null)
    list = new ArrayList<Object>(1);
  else
  {
    List<Object> tmp = new ArrayList<Object>(list.size() + 1);
    tmp.addAll(list);
    list = tmp;
  }

  list.add(savedOld);
  _getPageFlowScope().put(_PUSHED_VIEWS_KEY, list);

  _LOG.fine("Pushed view {0}", viewRoot.getViewId());
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:23,代码来源:DialogServiceImpl.java


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