當前位置: 首頁>>代碼示例>>Java>>正文


Java ResponseWriter.writeText方法代碼示例

本文整理匯總了Java中javax.faces.context.ResponseWriter.writeText方法的典型用法代碼示例。如果您正苦於以下問題:Java ResponseWriter.writeText方法的具體用法?Java ResponseWriter.writeText怎麽用?Java ResponseWriter.writeText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.faces.context.ResponseWriter的用法示例。


在下文中一共展示了ResponseWriter.writeText方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: _renderSubmitFormCheck

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private static void _renderSubmitFormCheck(
  FacesContext     context,
  RenderingContext rc
  ) throws IOException
{
  // if scripting isn't supported, no need to do the rest
  if (!supportsScripting(rc))
    return;

  ResponseWriter writer = context.getResponseWriter();
  writer.startElement("script", null);
  renderScriptDeferAttribute(context, rc);
  // Bug #3426092:
  // render the type="text/javascript" attribute in accessibility mode
  renderScriptTypeAttribute(context, rc);

  writer.writeText("_submitFormCheck();", null);
  writer.endElement("script");
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:20,代碼來源:FormRenderer.java

示例2: renderScriptOnce

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
public static void renderScriptOnce(
  UIXRenderingContext context,
  String script,
  Object key
  ) throws IOException
{
  if (supportsScripting(context))
  {
    // check to see if we've written this already
    if (!isPreviouslyRendered(context, key))
    {
      // nope, write it out now
      ResponseWriter writer = context.getResponseWriter();
      writer.startElement(UIConstants.SCRIPT_NAME, null);
      renderScriptDeferAttribute(context);

      // Bug #3426092:
      // render the type="text/javascript" attribute in accessibility mode
      XhtmlLafRenderer.renderScriptTypeAttribute(context);

      writer.writeText(script, null);
      writer.endElement(UIConstants.SCRIPT_NAME);
    }
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:26,代碼來源:XhtmlLafRenderer.java

示例3: _renderNoScript

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private void _renderNoScript(
  FacesContext     context,
  RenderingContext rc
  ) throws IOException
{
  // Some accessibility standards rather oddly claim that NOSCRIPT
  // tags are essential for compliance.  So, render NOSCRIPT, at
  // least when we're not in "inacessible" mode.
  //
  // But don't bother in design time mode - this check is
  // largely there for JDev 10.1.3 preview, which was rendering
  // the contents of any NOSCRIPT tags in the VE, but it's
  // a check that does no harm.
  if (!isInaccessibleMode(rc) && !rc.isDesignTime())
  {
    ResponseWriter writer = context.getResponseWriter();
    writer.startElement("noscript",null);
    String message = rc.getTranslatedString("NO_SCRIPT_MESSAGE");
    writer.writeText(message, null);
    writer.endElement("noscript");
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:23,代碼來源:BodyRenderer.java

示例4: renderEmptyGlobalHeader

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
 * Renders the empty global header
 */
protected void renderEmptyGlobalHeader(
  UIXRenderingContext context,
  UINode           node
  ) throws IOException
{
  Object text = node.getAttributeValue(context, TEXT_ATTR);

  if (text != null)
  {
    ResponseWriter writer = context.getResponseWriter();
    writer.writeText(text, TEXT_ATTR.getAttributeName());
  }
  else if (isIE(context))
  {
    Style style =XhtmlLafUtils.getClassStyle(context, 
                                            AF_MENU_BAR_STYLE_CLASS);
    if (style != null)
    {
      String minHeight = style.getProperties().get("min-height");
      renderSpacer(context, null, minHeight);
    }
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:27,代碼來源:GlobalHeaderRenderer.java

示例5: outputScriptletContent

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
@Override
protected void outputScriptletContent(
  FacesContext context,
  RenderingContext arc)
  throws IOException
{
  // get the tzOffset for the current date. I will compare this with
  // the tzOffset for the current data in javascript, and use it to
  // manipulate the formatted datefield's value so that it shows the

  // localeContext's timeZone, and not the time zone on the browser.
  TimeZone tz = arc.getLocaleContext().getTimeZone();
  int tzOffsetMinutes = tz.getOffset(System.currentTimeMillis())/(1000*60);
  ResponseWriter writer = context.getResponseWriter();
  writer.writeText("var _uixLocaleTZ=", null);
  writer.writeText(String.valueOf(tzOffsetMinutes), null);
  writer.writeText(";", null);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:19,代碼來源:SimpleInputDateRenderer.java

示例6: _renderOtherComponentScripts

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
 * Render the JavaScript needed by other components.
 * @param: context - FacesContext
 * @param: arc - RenderingContext
 * @param: writer - ResponseWriter
 */
private void _renderOtherComponentScripts(
  FacesContext  context,
  RenderingContext arc,
  ResponseWriter writer) throws IOException
{
  // Script for show/hide funtionality in detailStamp facet
  writer.startElement(XhtmlConstants.SCRIPT_ELEMENT, null);
  renderScriptDeferAttribute(context, arc);
  renderScriptTypeAttribute(context, arc);
  writer.writeText(ShowDetailRenderer.PARTIAL_JS, null);
  writer.endElement(XhtmlConstants.SCRIPT_ELEMENT);
    
  // Script for a table's pagination
  ProcessUtils.renderNavSubmitScript(context, arc);
  ProcessUtils.renderNavChoiceSubmitScript(context, arc);  
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:23,代碼來源:FormRenderer.java

示例7: encodeAll

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
protected void encodeAll(
  FacesContext     context,
  RenderingContext rc,
  UIComponent      component,
  FacesBean        bean
  ) throws IOException
{
  ResponseWriter writer = context.getResponseWriter();

  writer.startElement(XhtmlConstants.FIELDSET_ELEMENT, component);
  renderAllAttributes(context, rc, component, bean, false);
  renderStyleAttributes(context, rc, component, bean, getRootStyle());

  UIComponent captionFacet = getFacet(component, CorePanelCaptionGroup.CAPTION_FACET);
  String captionText = getCaptionText(component, bean);

  // Render either the caption facet or the captionText
  if (captionFacet != null || captionText != null)
  {
    writer.startElement(XhtmlConstants.LEGEND_ELEMENT, null);
    renderStyleClass(context, rc, getCaptionStyle());

    if (captionFacet != null)
      encodeChild(context, captionFacet);
    else
      writer.writeText(captionText, "captionText");

    writer.endElement(XhtmlConstants.LEGEND_ELEMENT);
  }

  // Output all the body of the component
  encodeAllChildren(context, component);

  writer.endElement(XhtmlConstants.FIELDSET_ELEMENT);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:38,代碼來源:PanelCaptionGroupRenderer.java

示例8: renderHeaderContents

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
protected void renderHeaderContents(
  FacesContext          context,
  RenderingContext      rc,
  TableRenderingContext tContext,
  UIComponent           column,
  int                   sortability,
  Icon                  sortIcon,
  String                sortOnclick
  ) throws IOException
{
  ResponseWriter rw = context.getResponseWriter();
  UIComponent header = getFacet(column, CoreColumn.HEADER_FACET);
  if (header != null)
  {
    encodeChild(context, header);
  }
  else
  {
    String headerText = getHeaderText(column, getFacesBean(column));
    if (headerText != null)
      rw.writeText(headerText, "headerText");
  }

   renderSortOrderSymbol(context, rc, column, tContext,
                                  sortability, sortIcon, sortOnclick);

}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:28,代碼來源:ColumnGroupRenderer.java

示例9: _writeClientMsg

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private BaseMutableUINode _writeClientMsg(
  UIXRenderingContext context,
  ResponseWriter writer,
  String summary,
  MessageWrapper msg,
  BaseMutableUINode currentChild
  ) throws IOException
{
  String description;

  if (summary != null)
  {
    String pattern;
    String[] parameters;

    parameters = new String[] {summary};
    pattern = getTranslatedString(context, "af_messages.LIST_FORMAT_private");
    description = formatString(context, pattern, parameters);
  }
  else
  {
    description = "";
  }

  // get (or generate) the current child
  currentChild = _generateChild(msg, currentChild);
  currentChild.render(context);

  if (isTextFormatted(summary))
    renderFormattedText(context, description);
  else if (description != null)
    writer.writeText(description, null);

  return currentChild;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:36,代碼來源:MessageBoxRenderer.java

示例10: _writeClientMsg

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private BaseMutableUINode _writeClientMsg(
  UIXRenderingContext context,
  ResponseWriter writer,
  String summary,
  MessageWrapper msg,
  BaseMutableUINode currentChild
  ) throws IOException
{
  String description;

  if (summary != null)
  {
    String pattern;
    String[] parameters;

    parameters = new String[] {summary};
    pattern = getTranslatedString(context, _MESSAGE_BOX_LIST_FORMAT_KEY);
    description = formatString(context, pattern, parameters);
  }
  else
  {
    description = "";
  }

  // get (or generate) the current child
  currentChild = _generateChild(msg, currentChild);
  currentChild.render(context);

  if (isTextFormatted(summary))
    renderFormattedText(context, description);
  else if (description != null)
    writer.writeText(description, null);

  return currentChild;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:36,代碼來源:MessageBoxRenderer.java

示例11: encodeAll

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
@Override
protected final void encodeAll(
  FacesContext     context,
  RenderingContext rc,
  UIComponent      component,
  FacesBean        bean
  ) throws IOException
{
  UIComponent parent = component.getParent();

  //
  // complain if our parent isn't a FrameBorderLayout
  //
  if ((parent == null) ||
      !HtmlFrameBorderLayout.COMPONENT_FAMILY.equals(parent.getFamily()))
  {
    _LOG.warning("FRAMES_MUST_INSIDE_FRAMEBORDERLAYOUTS");
  }
  else
  {
    ResponseWriter writer = context.getResponseWriter();

    writer.startElement("a", component);
    renderId(context, component);

    String source = toResourceUri(context, bean.getProperty(_sourceKey));
    String shortDesc = getShortDesc(component, bean);

    // =-=Adam Winer: OraLink is obviously not a good style class
    // here - substitute something like trh|frame in a PDA css
    renderStyleClass(context, rc, "OraLink");
    renderEncodedActionURI(context, "href", source);
    if (shortDesc != null)
      writer.writeText(shortDesc, "shortDesc");
    else if (source != null)
      writer.writeText(source, null);

    writer.endElement("a");
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:41,代碼來源:FrameRenderer.java

示例12: _writeResetScript

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private void _writeResetScript(
  FacesContext     context,
  RenderingContext rc,
  String           clientId
  ) throws IOException
{
  // FIXME: Make sure we don't NPE when not in form

  // Get JS-valid identifiers for ourselves
  String formName = rc.getFormData().getName();
  String jsFormName = XhtmlUtils.getJSIdentifier(formName);
  String jsClientId = XhtmlUtils.getJSIdentifier(clientId);

  // Add the reset call to the form as a whole
  StringBuilder funcCallBuffer = new StringBuilder(
                                             19 +
                                             formName.length() +
                                             clientId.length());

  funcCallBuffer.append("TrShuttleProxy._resetItems('").append(clientId);
  funcCallBuffer.append("','").append(formName).append("');");
  FormRenderer.addResetCall(clientId, funcCallBuffer.toString());

  ResponseWriter rw = context.getResponseWriter();
  // And write out the "orig" script that retains knowledge of
  // the original state of the component
  rw.writeText( "window[\"_", null);
  rw.writeText(jsFormName, null);
  rw.writeText("_", null);
  rw.writeText(jsClientId, null);
  rw.writeText("_orig\"]=TrShuttleProxy._copyLists('", null);
  rw.writeText(clientId, null);
  rw.writeText("','", null);
  rw.writeText(formName, null);
  rw.writeText("');", null);

}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:38,代碼來源:SelectManyShuttleRenderer.java

示例13: writeLabel

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
 *  Renders the label text with character underlined for label.
 *
 *  Takes care of encoding for label text and the accessKey.
 *
 */
protected void writeLabel(ResponseWriter out,
                          UIComponent component,
                          String label)
  throws IOException
{
  // AdamWiner: TODO: replace this with a call to AccessKeyUtils
  Character accessChar =
    (Character) component.getAttributes().get("accessKey");

  if (label != null)
  {
    if (accessChar == null)
    {
      out.writeText(label, null);
    }
    else
    {
      int accessKeyIndex = label.indexOf(accessChar.charValue());
      if (accessKeyIndex < 0)
      {
        out.writeText(label, null);
      }
      else
      {
        // String stripping to remove &amp; will already be done in Tag impl
        String strBefAccessKey = label.substring(0, accessKeyIndex);
        String strAfterAccessKey = label.substring(accessKeyIndex + 1,
                                                   label.length());
        out.writeText(strBefAccessKey, null);

        //ADFFACES-153: use default style (underline) for access key
        out.startElement ("span", null);
        XhtmlRenderer.renderStyleClass (FacesContext.getCurrentInstance(),
                                        RenderingContext.getCurrentInstance(),
                                        SkinSelectors.AF_ACCESSKEY_STYLE_CLASS);
        out.writeText (accessChar.toString(), null);
        out.endElement ("span");

        out.writeText(strAfterAccessKey, null);
      }
    }
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:50,代碼來源:ShowOneListRendererBase.java

示例14: renderListDisplay

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
 *  {@inheritDoc}
 */
@Override
protected void renderListDisplay(FacesContext context,
                                 UIComponent component,
                                 String disclosedChildId)
  throws IOException
{
  _LOG.finest("CorePanelRadioRenderer.renderRadioFacet: disclosedChildId: {0}", disclosedChildId);

  // This renders the select controls alongwith javascript onchange handler.
  UIXRenderingContext rCtx = getRenderingContext(context, component);

  String compId = component.getClientId(context);

  ResponseWriter out = context.getResponseWriter();

  // draw table to contain the select UI control
  out.startElement("table", component);
  out.writeAttribute("id", compId + _RADIO_TABLE_SUFFIX_ID_CONST, null);
  out.writeAttribute("border", "0", null);
  out.writeAttribute("cellspacing", "0", null);
  out.writeAttribute("cellpadding", "0", null);

  if (!XhtmlLafRenderer.isInaccessibleMode(rCtx))
  {
    out.writeAttribute("summary", "", null);
  }

  out.startElement("tr", component);

  String label = (String)component.getAttributes().get("label");

  out.startElement("td", component);
  out.writeAttribute("align", "left", null);
  out.writeAttribute("nowrap", Boolean.TRUE, null);
  out.startElement("span", component);

  XhtmlLafRenderer.
    renderStyleClassAttribute(rCtx,
                              SkinSelectors.AF_LABEL_TEXT_STYLE_CLASS);

  if (label != null)
    out.writeText(label, null);

  out.endElement("span");
  out.endElement("td");
  
  // render label and radio control vertically for narrow-screen PDAs
  if (XhtmlRenderer.supportsNarrowScreen
                  (RenderingContext.getCurrentInstance()))
  { 
    out.endElement("tr");
    out.startElement("tr", null);
  }
  else
  {
    // Render filler / separator between label and select control
    renderSpacerTD(out, component, getLabelControlSeparatorSize());
  }

  _renderRadioItemsInTD(context,
                        component,
                        out,
                        rCtx,
                        compId,
                        disclosedChildId);

  out.endElement("tr");
  out.endElement("table");
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:73,代碼來源:CorePanelRadioRenderer.java

示例15: renderAccessKeyText

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
static public void renderAccessKeyText(
  FacesContext  context,
  Object        textValue,
  int           keyIndex,
  String        accessKeyClass
  ) throws IOException
{
  ResponseWriter writer = context.getResponseWriter();
  
  if ((textValue != null) && (keyIndex != -1))
  {
    String textString = textValue.toString();
    
    char[] textChars = textString.toCharArray();
    
    // write text before the mnemonic
    writer.writeText(textChars, 0, keyIndex);
    
    if (accessKeyClass != null && accessKeyClass.length() > 0)
    {
      writer.startElement ("span", null);
      XhtmlRenderer.renderStyleClass (context, 
                                      RenderingContext.getCurrentInstance(),  
                                      accessKeyClass);
      writer.writeText (textChars, keyIndex, 1);
      writer.endElement ("span");
      
      // write text after the mnemonic
      keyIndex++;
    }
    
    int charsLeft = textChars.length - keyIndex;
    
    if (charsLeft > 0)
    {
      writer.writeText(textChars, keyIndex, charsLeft);
    }
  }
  else
  {
    // output the text directly since we have no access key
    if (textValue != null)
      writer.writeText(textValue, null);
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:46,代碼來源:AccessKeyUtils.java


注:本文中的javax.faces.context.ResponseWriter.writeText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。