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


Java ResponseWriter.writeAttribute方法代碼示例

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


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

示例1: _renderEmptyCell

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private void _renderEmptyCell(FacesContext context, RenderingContext rc, TableRenderingContext tContext,
                              int physicalColumn, String text, int colspan)
  throws IOException
{
  ColumnData colData = tContext.getColumnData();
  ResponseWriter writer = context.getResponseWriter();
  // root columns only, so headerID is singleton
  // rather than space-separated list
  String colID = colData.getHeaderID(physicalColumn);
  colData.setCurrentHeaderID(colID);
  colData.setColumnIndex(physicalColumn, ColumnData.SPECIAL_COLUMN_INDEX);
  writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
  renderCellFormatAttributes(context, rc, tContext);
  if (colspan > 1)
    writer.writeAttribute(XhtmlConstants.COLSPAN_ATTRIBUTE, colspan, null);
  if (text != null)
    writer.writeText(text, null);
  writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:20,代碼來源:DesktopTableRenderer.java

示例2: _writeSelectItems

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private void _writeSelectItems(
  FacesContext     context,
  List<SelectItem> items,
  int              selectedIndex
  ) throws IOException
{
  ResponseWriter writer = context.getResponseWriter();
  int count = items.size();
  for (int i = 0; i < count; i++)
  {
    SelectItem item = items.get(i);
    writer.startElement("option", null);
    writer.writeAttribute("value", item.getValue(), null);
    if (i == selectedIndex)
      writer.writeAttribute("selected", Boolean.TRUE, null);
    writer.writeText(item.getLabel(), null);
    writer.endElement("option");
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:20,代碼來源:SelectRangeChoiceBarRenderer.java

示例3: _renderGlobalHeader

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
 * render a table row with the global header
 * @return void
 */
private void _renderGlobalHeader(
  UIXRenderingContext context,
  UINode           node,
  ResponseWriter   writer,
  UINode           globalHeader,
  boolean          hasQuickSearch,
  int              colSpan
  ) throws IOException
{
    writer.startElement(TABLE_ROW_ELEMENT, null);
    writer.startElement(TABLE_DATA_ELEMENT, null);

    if (colSpan > 1)
      writer.writeAttribute(COLSPAN_ATTRIBUTE, getInteger(colSpan), null);

    writer.writeAttribute(WIDTH_ATTRIBUTE,
                          ONE_HUNDRED_PERCENT_ATTRIBUTE_VALUE, null);

    renderPageHeaderChild( context, node, globalHeader, hasQuickSearch );


    writer.endElement(TABLE_DATA_ELEMENT);
    writer.endElement(TABLE_ROW_ELEMENT);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:29,代碼來源:PageHeaderLayoutRenderer.java

示例4: renderId

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
@Override
protected void renderId(
  FacesContext context,
  UIComponent  component
  ) throws IOException
{
  TableRenderingContext tContext =
    TableRenderingContext.getCurrentInstance();
  String param = (tContext.getTableId() +
                  NamingContainer.SEPARATOR_CHAR +
                  XhtmlConstants.SELECTED_KEY);
  ResponseWriter writer = context.getResponseWriter();
  writer.writeAttribute("name", param, null);
  // =-=AEW Inefficient.  We only need the "id" when there's
  // a shortDescription (which is when we'll get a label)
  if (getShortDesc(component, getFacesBean(component)) != null)
    writer.writeAttribute("id", getClientId(context, component), null);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:19,代碼來源:TableSelectOneRenderer.java

示例5: renderInlineStyleAttribute

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
 * Renders the inline style attribute for the specified node
 */
public static void renderInlineStyleAttribute(FacesContext context,
  RenderingContext rc, UIComponent component, String style)
  throws IOException
{
  if (style != null)
  {
    if (supportsStyleAttributes(rc))
    {
      ResponseWriter writer = context.getResponseWriter();
      writer.writeAttribute("style", style, null);
    }

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

示例6: encodeAll

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

  ResponseWriter rw = context.getResponseWriter();
  rw.startElement("input", component);
  rw.writeAttribute("type", "hidden", null);
  rw.writeAttribute("id", id, "id");
  rw.writeAttribute("name", id, "id");
  rw.writeAttribute("value",
                    getConvertedString(context, component, bean),
                    "value");
  rw.endElement("input");

  FormData fd = rc.getFormData();
  if (fd != null)
    fd.addRenderedValue(id);

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

示例7: _writeCommandChildProperty

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private void _writeCommandChildProperty(
  ResponseWriter rw,
  UIXCommand     commandChild,
  String         propertyName
  ) throws IOException
{
  rw.writeAttribute(
    propertyName,
    _getCommandChildProperty(commandChild, propertyName),
    propertyName);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:12,代碼來源:NavigationPaneRenderer.java

示例8: _renderSpacerTR

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
 *  Generates markup for rendering a blank TR and TD within it.
 *
 */
private void _renderSpacerTR(ResponseWriter out, UIComponent component)
  throws IOException
{
  out.startElement("tr", component);
  out.startElement("td", component);
  out.writeAttribute("height", _SEPARATOR_SIZE, null);
  out.endElement("td");
  out.endElement("tr");
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:14,代碼來源:ShowOneListRendererBase.java

示例9: renderSpanEventHandlers

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
@Override
protected void renderSpanEventHandlers(
  FacesContext context,
  UIComponent  component,
  FacesBean    bean
  ) throws IOException
{
  ResponseWriter rw = context.getResponseWriter();

  // PH: This condition is needed to set onclick on radio rather than on
  // enclosing span in an IE Mobile and PIE since these browsers don't have
  // onclick support on a span.

  if(!isPDA(RenderingContext.getCurrentInstance()))
  {
    if ( isAutoSubmit(component, bean))
      rw.writeAttribute("onclick", getAutoSubmitScript(component, bean) , null);
  }
  rw.writeAttribute("ondblclick", getOndblclick(component, bean),  "ondblclick");
  rw.writeAttribute("onkeydown", getOnkeydown(component, bean),  "onkeydown");
  rw.writeAttribute("onkeyup", getOnkeyup(component, bean),  "onkeyup");
  rw.writeAttribute("onkeypress", getOnkeypress(component, bean),  "onkeypress");
  rw.writeAttribute("onmousedown", getOnmousedown(component, bean),  "onmousedown");
  rw.writeAttribute("onmousemove", getOnmousemove(component, bean),  "onmousemove");
  rw.writeAttribute("onmouseout", getOnmouseout(component, bean),  "onmouseout");
  rw.writeAttribute("onmouseover", getOnmouseover(component, bean),  "onmouseover");
  rw.writeAttribute("onmouseup", getOnmouseup(component, bean),  "onmouseup");
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:29,代碼來源:SimpleSelectBooleanRadioRenderer.java

示例10: prerender

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
@Override
protected void prerender(
  UIXRenderingContext context,
  UINode           node
  ) throws IOException
{
  ResponseWriter writer = context.getResponseWriter();
  
  // write out the horizontal rule
  writer.startElement("hr", null);
  writer.writeAttribute("size", "2", null);
  writer.endElement("hr");
  
  super.prerender(context, node);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:16,代碼來源:ContentFooterRenderer.java

示例11: renderCellFormatAttributes

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
 * @todo Implement cellClass correctly!
 * @todo Implement "headers" attribute correctly!
 */
protected void renderCellFormatAttributes(FacesContext context, RenderingContext rc, TableRenderingContext tContext)
  throws IOException
{
  // renders "style", "class", "nowrap", "headers".
  // renders "width" when there are no column headers.

  //TODO: must get individual column's style:
  String cellClass = SkinSelectors.AF_COLUMN_CELL_TEXT_STYLE; /*ColumnRenderer.getDataStyleClass(...)*/

  String borderStyleClass = CellUtils.getDataBorderStyle(rc, tContext);

  renderStyleClasses(context, rc, new String[]
  {
    cellClass, borderStyleClass
  });

  final ResponseWriter writer = context.getResponseWriter();
  int row = tContext.getRowData().getRangeIndex();
  int physicalColumn = tContext.getColumnData().getPhysicalColumnIndex();
  boolean noSelect = (!tContext.hasSelection());
  // Bug 1807935: if there's no column headers (and no
  // selection) then we haven't yet rendered the width
  // attribute.  Render it on the first row of cells.
  if ((row == 0) && noSelect && !tContext.hasColumnHeaders())
  {
    Object width = tContext.getColumnWidth(physicalColumn);
    writer.writeAttribute(XhtmlConstants.WIDTH_ATTRIBUTE, width, null);
  }

  // render "headers" attribute if necessary
  /*ColumnRenderer.renderHeadersAttr(context);*/

  // support "nowrap"
  if (tContext.getColumnData().getNoWrap(physicalColumn))
    writer.writeAttribute(XhtmlConstants.NOWRAP_ATTRIBUTE, Boolean.TRUE, null);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:41,代碼來源:DesktopTableRenderer.java

示例12: renderHeaderAttrs

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
 * renders abbr, scope, width and nowrap
 */
public static void renderHeaderAttrs(FacesContext context,
                                     TableRenderingContext tContext,
                                     // Need SHORT_TEXT from node???
                                     Object abbreviation,
                                     Object width,
                                     boolean isNoWrap,
                                     boolean isColumnHeader)
  throws IOException
{
  ResponseWriter writer = context.getResponseWriter();

  // This is for accessibility support. Gives this header an abbreviation
  // for use with screen readers.
  writer.writeAttribute("abbr", abbreviation, null);

  if (!tContext.isExplicitHeaderIDMode())
  {
    // This is for accessibility support. Identifies whether this header
    // is a header for columns or for rows:
    writer.writeAttribute("scope", (isColumnHeader) ? "col" : "row", null);
  }

  // put a column width on
  writer.writeAttribute(XhtmlConstants.WIDTH_ATTRIBUTE, width, null);

  // only no-wrap header cells if specified
  if (isNoWrap)
    writer.writeAttribute(XhtmlConstants.NOWRAP_ATTRIBUTE, Boolean.TRUE, null);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:33,代碼來源:CellUtils.java

示例13: _renderStationContent

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private void _renderStationContent(
  FacesContext     context,
  RenderingContext rc,
  UIXProcess       process,
  UIComponent      stamp,
  Station          station
  ) throws IOException
{
  ResponseWriter writer = context.getResponseWriter();

  writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);

  writer.writeAttribute(XhtmlConstants.COLSPAN_ATTRIBUTE, "3", null);

  String baseStyleClass = station.getBaseStyleClass();

  List<String> stateStyleClasses = station.getStates();
  stateStyleClasses.add(baseStyleClass);
  stateStyleClasses.add(baseStyleClass + _SUFFIX_CONTENT);

  renderStyleClasses(context,
                     rc,
                     stateStyleClasses.toArray(_EMPTY_STRING_ARRAY));

  /* -= Simon =-
   * FIXME HACK for MSIE CSS bug involving composite style classes.
   *       Since the bug is most obvious with join background images
   *       I hard code background-image to none to fix it.
   *       See Jira for issue ADFFACES-206.
   */
  if(rc.getAgent().getAgentName().equalsIgnoreCase(Agent.AGENT_IE))
  {
    writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE,
                          "background-image:none;",
                          null);
  }

  Map<String, String> originalMap = rc.getSkinResourceKeyMap();

  // Init the model
  process.setRowIndex(station.getRowIndex());
  try
  {
    rc.setSkinResourceKeyMap(_RESOURCE_KEY_MAP);
    encodeChild(context, stamp);
  }
  finally
  {
    rc.setSkinResourceKeyMap(originalMap);
  }

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

示例14: _renderMonthChoice

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private void _renderMonthChoice(
  FacesContext     context,
  RenderingContext rc,
  String[]         months,
  Calendar         currentTime,
  int              visibleMonth,
  int              minimumMonth,
  int              maximumMonth,
  long             offset,
  String           onChange,
  String           baseId
  ) throws IOException
{
  ResponseWriter writer = context.getResponseWriter();
  String label = rc.getTranslatedString("af_chooseDate.MONTH_CHOICE_LABEL");
  String id = MONTH_PARAM;

  // If we've got a baseID, tack it on.  This is necessary
  // for inline mode, where we might have more than one
  // calendar (and thus more than one "month" choice) on
  // the same page.
  if (baseId != null)
    id = baseId + id;

  //
  // create the choice
  //
  writer.startElement("select", null);
  writer.writeAttribute("id", id, null);
  writer.writeAttribute("name", id, null);
  writer.writeAttribute("title", label, null);
  writer.writeAttribute("onchange", onChange, null);
  renderStyleClass(context,
                   rc,
                   SkinSelectors.AF_FIELD_TEXT_STYLE_CLASS);

  for (int currMonth = minimumMonth; currMonth <= maximumMonth; currMonth++)
  {
    writer.startElement("option", null);

    if (currMonth == visibleMonth)
    {
      writer.writeAttribute("selected", Boolean.TRUE, null);
    }

    //
    // generate the new date as the value for each entry]
    //
    currentTime.set(Calendar.MONTH, currMonth);


    String value = String.valueOf(currentTime.getTimeInMillis() - offset);
    writer.writeAttribute("value", value, null );

    writer.writeText(months[currMonth], null);

    writer.endElement("option");
  }

  writer.endElement("select");

  HiddenLabelUtils.outputHiddenLabelIfNeeded(context,
                                             rc,
                                             id,
                                             label,
                                             null);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:68,代碼來源:ChooseDateRenderer.java

示例15: renderIndexedChild

import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
@Override
protected void renderIndexedChild(
  UIXRenderingContext context,
  UINode           node,
  int              currVisChildIndex,
  int              prevVisChildIndex,
  int              nextVisChildIndex,
  int              ithRenderedChild
  ) throws IOException
{
  UINode currVisChild = node.getIndexedChild(context, currVisChildIndex);
  ResponseWriter writer = context.getResponseWriter();
  // get the selected index
  int selectedIndex = ((Integer)context.getLocalProperty( 0,
                                                          _SELECTED_NODE_KEY,
                                                          ZERO)).intValue();
  boolean isSelected = (currVisChildIndex == selectedIndex);
  //
  // output the link
  //
  try
  {
    context.pushChild(currVisChild, null, currVisChildIndex);
    context.pushRenderedChild(context, currVisChild);
    writer.startElement( SPAN_ELEMENT, null);
    writer.writeAttribute( NOWRAP_ATTRIBUTE,
                           Boolean.TRUE,
                           null);
    renderStyleClassAttribute(context,
                              isSelected ?
                              AF_SHOW_ONE_TAB_SELECTED_STYLE_CLASS : 
                              AF_SHOW_ONE_TAB_STYLE_CLASS);
    renderSpacer( context, 5, 1 );
    // Store the status of Link selection - used in LinkRenderer
    LinkUtils.setSelected(context,isSelected);
    Renderer renderer = context.getRendererManager().getRenderer(
          MARLIN_NAMESPACE, SHOW_ITEM_NAME);
        renderer.render(context, currVisChild);
    //currVisChild.render(context);
    renderSpacer( context, 5, 1 );
    writer.endElement( SPAN_ELEMENT);
  }
  finally
  {
    context.popRenderedChild(context);
    context.popChild();
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:49,代碼來源:SubTabBarRenderer.java


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