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


Java RequestContext类代码示例

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


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

示例1: select

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public String select()
{
  FacesContext context = FacesContext.getCurrentInstance();
  // The tableSelectOne is marked as required; so there'd better
  // be a selected row - an exception will result here if there
  // isn't.  Is there some better code?
  Iterator<Object> iterator = _table.getSelectedRowKeys().iterator();
  Object rowKey = iterator.next();
  Object oldRowKey = _table.getRowKey();
  _table.setRowKey(rowKey);
  ValueBinding binding = context.getApplication().
    createValueBinding("#{row.symbol}");
  Object value = binding.getValue(context);
  RequestContext.getCurrentInstance().returnFromDialog(value, null);
  _table.setRowKey(oldRowKey);

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

示例2: decode

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void decode(
  FacesContext context, 
  UIComponent component)
{
  Map<String, String> parameters = 
    context.getExternalContext().getRequestParameterMap();
  
  String source = parameters.get(UIConstants.SOURCE_PARAM);
  
  UIXPage page = (UIXPage)component;
  
  // the path needs to be set correctly before calling 
  // page.getClientId
  String treeId = page.getClientId(context) + TREE_SUFFIX;
  
  if ( treeId.equals(source))
  {          
    TreeUtils.decodeExpandEvents(parameters, page, Collections.emptyList());
    RequestContext afContext = RequestContext.getCurrentInstance();
    if (afContext != null)
      afContext.addPartialTarget(component);
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:26,代码来源:PageRenderer.java

示例3: __getParam

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
static String __getParam(
  FacesContext context,
  String name
  )
{
  Map<String, String> requestParams = 
    context.getExternalContext().getRequestParameterMap();
  
  String value = requestParams.get(name);
  if (value == null || value.equals(""))
  {
    RequestContext afContext = RequestContext.getCurrentInstance();
    Object o = afContext.getPageFlowScope().get(name);
    if (o != null)
      value = o.toString();
  }

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

示例4: tearDownVisitingContext

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
/**
 * Re-applies the suspended context changes.
 * @param facesContext the faces context
 * @see #setupVisitingContext(FacesContext)
 * @see ComponentContextManager#resume(FacesContext, SuspendedContextChanges)
 */
@Override
protected void tearDownVisitingContext(FacesContext facesContext)
{
  super.tearDownVisitingContext(facesContext);

  ComponentContextManager ctxMgr = RequestContext.getCurrentInstance()
    .getComponentContextManager();
  Map<String, Object> reqMap = facesContext.getExternalContext().getRequestMap();
  @SuppressWarnings("unchecked")
  Queue<SuspendedContextChanges> suspendedChangesQueue = (Queue<SuspendedContextChanges>)
    reqMap.get(_SUSPENDED_CHANGES_KEY);
  SuspendedContextChanges changes = suspendedChangesQueue.poll();
  ctxMgr.resume(facesContext, changes);
  _LOG.fine("UIXDocument resumed context changes in setupVisitingContext");
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:22,代码来源:UIXDocumentTemplate.java

示例5: decode

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
@Override
public void decode(FacesContext context)
{
  if (context == null)
    throw new NullPointerException();

  // Find all the partialTriggers and save on the context
  Map<String, Object> attrs = getAttributes();
  Object triggers = attrs.get("partialTriggers");
  if (triggers instanceof String[])
  {
    RequestContext adfContext = RequestContext.getCurrentInstance();
    if (adfContext != null)
      adfContext.addPartialTriggerListeners(this, (String[]) triggers);
  }

  __rendererDecode(context);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:19,代码来源:UIXComponentBase.java

示例6: isPartialRequest

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
/**
 * This method delegates to the RequestContext.isPartialRequest() with the 
 * exception that JSF Ajax render="@all" requests are reported as non-partial
 * @param context
 * @return
 */
public static boolean isPartialRequest(FacesContext context)
{
  RequestContext rc = RequestContext.getCurrentInstance();
  if (rc == null)
    return false;
  boolean isPartial = rc.isPartialRequest(context);
  
  if (isPartial && context.getPartialViewContext().isRenderAll())
  {
    // We do not want to create PartialPageContext and use the tree visit (if enabled)
    // for the 'render all' <f:ajax> case
    isPartial = false;
  }
  
  return isPartial;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:23,代码来源:PartialPageUtils.java

示例7: getInlineStyle

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
@Override
protected String getInlineStyle(
  UIComponent component,
  FacesBean   bean)
{
  String inlineStyle = super.getInlineStyle(component, bean);

  boolean inlineValidation =
    RequestContext.ClientValidation.INLINE.equals(
        RequestContext.getCurrentInstance().getClientValidation());

  if (!inlineValidation)
    return inlineStyle;

  boolean hasMessages = FacesContext.getCurrentInstance().getMessages().hasNext();

  if (hasMessages)
    return inlineStyle;

  // Ensure the MessageBox is hidden for inline mode when there are no messages
  if (inlineStyle != null)
    return inlineStyle + ";display:none;";

  return "display:none;";
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:26,代码来源:MessageBoxRenderer.java

示例8: expandFocusRowKey

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
/**
 * Utility method to expand the focusRowKey during initial
 * rendering.
 * @param tree
 */
public static void expandFocusRowKey(UIXTree tree)
{
  if (!RequestContext.getCurrentInstance().isPostback())
  {
    Object focusRowKey = tree.getFocusRowKey();
    if ( focusRowKey != null)
    {
      List<Object> focusPath = 
        new ArrayList<Object>(tree.getAllAncestorContainerRowKeys(focusRowKey));
      focusPath.add(focusRowKey);
      int size = focusPath.size();
      RowKeySet disclosedRowKeys = tree.getDisclosedRowKeys();
      for ( int i = 0 ; i < size; i++)
      {
        Object subkey = focusPath.get(i);
        disclosedRowKeys.add(subkey);
      }     
    }
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:26,代码来源:TreeUtils.java

示例9: chooseRenderKit

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
/**
 * Choose a RenderKit for the current request.
 */
static public String chooseRenderKit(FacesContext context)
{
  RequestContext afc = RequestContext.getCurrentInstance();
  // According to the spec FacesContext can be null.
  // In that case RequestContext could also be null.
  // bug 4695929:
  if (afc != null)
  {
    // TODO: Obviously, this cheesy algorithm is not quite enough!
    Agent agent = afc.getAgent();
    if (Agent.TYPE_PDA.equals(agent.getType()))
      return "org.apache.myfaces.trinidad.core.pda";
  }
  return "org.apache.myfaces.trinidad.core.desktop";
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:19,代码来源:CoreRenderKit.java

示例10: setupVisitingContext

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
/**
 * Suspends any context changes before allowing invokeOnComponent or visitTree calls to continue,
 * allowing components to undo any context changes during a re-entrant call.
 * @param facesContext the faces context
 * @see ComponentContextManager#suspend(FacesContext)
 */
@Override
protected void setupVisitingContext(FacesContext facesContext)
{
  ComponentContextManager ctxMgr = RequestContext.getCurrentInstance()
    .getComponentContextManager();

  // Suspend any current component context during a visit tree for re-entrant
  // component tree processing
  SuspendedContextChanges suspendedChanges = ctxMgr.suspend(facesContext);

  Map<String, Object> reqMap = facesContext.getExternalContext().getRequestMap();
  @SuppressWarnings("unchecked")
  Queue<SuspendedContextChanges> suspendedChangesQueue = (Queue<SuspendedContextChanges>)
    reqMap.get(_SUSPENDED_CHANGES_KEY);
  if (suspendedChangesQueue == null)
  {
    suspendedChangesQueue = Collections.asLifoQueue(new ArrayDeque<SuspendedContextChanges>());
    reqMap.put(_SUSPENDED_CHANGES_KEY, suspendedChangesQueue);
  }

  suspendedChangesQueue.offer(suspendedChanges);
  _LOG.fine("UIXDocument suspended context changes in setupVisitingContext");

  super.setupVisitingContext(facesContext);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:32,代码来源:UIXDocumentTemplate.java

示例11: appendChildToDocument

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
/**
 * Appends an image child to the panelGroup in the underlying JSP document
 */
public void appendChildToDocument(ActionEvent event)
{
  UIComponent eventSource = event.getComponent();
  UIComponent uic = eventSource.findComponent("pg1");
  
  // only allow the image to be added once
  if (_findChildById(uic,"oi3") != null)
    return;
    
  FacesContext fc = FacesContext.getCurrentInstance();

  DocumentFragment imageFragment = _createDocumentFragment(_IMAGE_MARK_UP);
  
  if (imageFragment != null)
  {
    DocumentChange change = new AddChildDocumentChange(imageFragment);
    
    ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
    
    apm.addDocumentChange(fc, uic, change);
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:26,代码来源:ChangeBean.java

示例12: addFacet

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
/**
 * Adds a 'brandingAppContextual' facet  to the panelGroup.
 */
@SuppressWarnings("unchecked")
public void addFacet(ActionEvent event)
{
  UIComponent eventSource = event.getComponent();
  UIComponent uic = eventSource.findComponent("pp1");
  FacesContext fc = FacesContext.getCurrentInstance();
  CoreOutputFormatted newFacetComponent = 
    (CoreOutputFormatted) fc.getApplication().createComponent(
      "org.apache.myfaces.trinidad.CoreOutputFormatted");
  newFacetComponent.setStyleUsage("inContextBranding" );
  newFacetComponent.setValue(
    "Customer Company - Menlo Park");
  uic.getFacets().put("brandingAppContextual", newFacetComponent);

  ComponentChange afa = new SetFacetChildComponentChange("brandingAppContextual", newFacetComponent);

  ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
  apm.addComponentChange(fc, uic, afa);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:23,代码来源:ChangeBean.java

示例13: _setCurrencyInformation

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
private void _setCurrencyInformation(
  RequestContext context,
  DecimalFormatSymbols symbols)
{
  String currencyCode = _getCurrencyCode(context);

  // currencyCode is set we honour currency code.
  if (currencyCode != null)
  {
    symbols.setCurrency(Currency.getInstance(currencyCode));
    return;
  }

  if (getCurrencySymbol() != null)
  {
    symbols.setCurrencySymbol(getCurrencySymbol());

     // Loggin at level INFO - shows up by default - so use fine.
    _LOG.fine("Using currency symbol as currecny code evaluates to null");
  }
  // currency symbol will now default based on the locale.
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:23,代码来源:NumberConverter.java

示例14: setupVisitingContext

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
/**
 * Suspends any context changes before allowing invokeOnComponent or visitTree calls to continue,
 * allowing components to undo any context changes during a re-entrant call.
 * @param facesContext the faces context
 * @see ComponentContextManager#suspend(FacesContext)
 */
@Override
protected void setupVisitingContext(FacesContext facesContext)
{
  ComponentContextManager ctxMgr = RequestContext.getCurrentInstance()
    .getComponentContextManager();

  // Suspend any current component context during a visit tree for re-entrant
  // component tree processing
  SuspendedContextChanges suspendedChanges = ctxMgr.suspend(facesContext);

  Map<String, Object> reqMap = facesContext.getExternalContext().getRequestMap();
  @SuppressWarnings("unchecked")
  Queue<SuspendedContextChanges> suspendedChangesQueue = (Queue<SuspendedContextChanges>)
    reqMap.get(_SUSPENDED_CHANGES_KEY);
  if (suspendedChangesQueue == null)
  {
    suspendedChangesQueue = Collections.asLifoQueue(new ArrayDeque<SuspendedContextChanges>());
    reqMap.put(_SUSPENDED_CHANGES_KEY, suspendedChangesQueue);
  }

  suspendedChangesQueue.offer(suspendedChanges);

  super.setupVisitingContext(facesContext);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:31,代码来源:HtmlHeadTemplate.java

示例15: _setUpDecimalSymbolFormatProperties

import org.apache.myfaces.trinidad.context.RequestContext; //导入依赖的package包/类
private void _setUpDecimalSymbolFormatProperties(
  DecimalFormatSymbols symbols,
  RequestContext reqCtx,
  Locale locale
  )
{
  if (reqCtx != null)
  {
    char ch = (char) 0;

    if ((ch = reqCtx.getDecimalSeparator()) != (char)0)
      symbols.setDecimalSeparator(ch);

    if ((ch = reqCtx.getNumberGroupingSeparator()) != (char)0)
      symbols.setGroupingSeparator(ch);

  }
  else
  {
    if (_LOG.isWarning())
    {
      _LOG.warning("NULL_REQUESTCONTEXT", locale.toString());
      }
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:26,代码来源:NumberConverter.java


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