當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。