本文整理匯總了Java中javax.faces.context.ResponseWriter.startElement方法的典型用法代碼示例。如果您正苦於以下問題:Java ResponseWriter.startElement方法的具體用法?Java ResponseWriter.startElement怎麽用?Java ResponseWriter.startElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.faces.context.ResponseWriter
的用法示例。
在下文中一共展示了ResponseWriter.startElement方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: _preRenderIconBlock
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private void _preRenderIconBlock(
FacesContext context,
RenderingContext rc
) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
// Icon cell
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
// Icons need to be in a table to stretch well
writer.startElement(XhtmlConstants.TABLE_ELEMENT, null);
OutputUtils.renderLayoutTableAttributes(context, rc, "0", null);
writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE, "width: 100%", null);
writer.startElement(XhtmlConstants.TABLE_BODY_ELEMENT, null);
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
}
示例2: _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);
}
示例3: _renderMarginSpacer
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private void _renderMarginSpacer(
UIXRenderingContext context,
UINode node,
Integer rowSpan
) throws IOException
{
Integer marginIndent = _getMarginIndent(context, node);
ResponseWriter writer = context.getResponseWriter();
writer.startElement("td", null);
writer.writeAttribute("rowspan", rowSpan, null);
if (marginIndent != null)
{
renderSpacer(context, marginIndent, _ZERO);
}
writer.endElement("td");
}
示例4: renderVerticalSpacer
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
* Renders a vertical spacer for a specified non-null height.
*/
protected final void renderVerticalSpacer(FacesContext context,
Object height, Object id, UIComponent comp)
throws IOException
{
if (height != null)
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement("div", comp);
writer.writeAttribute("id", id, null);
String heightString = height.toString();
if (heightString.length() != 0)
{
//pu: CSS mandates specifying units, a crude sanity check if height
// does not already contain units, if yes treat it as pixels.
boolean isUnitsNotSpecified =
Character.isDigit(heightString.charAt(heightString.length() -
1));
if (isUnitsNotSpecified)
heightString += "px";
writer.writeAttribute("style", "margin-top:" + heightString, null);
}
writer.endElement("div");
}
}
示例5: renderKids
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
protected void renderKids(
FacesContext context,
RenderingContext rc,
TableRenderingContext trc,
UIComponent column
) throws IOException
{
boolean renderedOne = false;
for(UIComponent child : (List<UIComponent>)column.getChildren())
{
if (child.isRendered())
{
// Put each component on a separate line, separated by a div
if (renderedOne)
{
ResponseWriter rw = context.getResponseWriter();
rw.startElement("div", null);
rw.endElement("div");
}
else
{
renderedOne = true;
}
encodeChild(context, child);
}
}
}
示例6: 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
{
// don't render a div around the first or last item
// as traditionally in stackLayout these items can flow into
// previous and subsequent nodes.
if ( prevVisChildIndex == NO_CHILD_INDEX ||
nextVisChildIndex == NO_CHILD_INDEX )
{
super.renderIndexedChild(context, node, currVisChildIndex);
}
else
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement("div", null);
super.renderIndexedChild(context, node, currVisChildIndex);
writer.endElement("div");
}
}
示例7: _renderLinkStart
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private void _renderLinkStart(
FacesContext context,
RenderingContext rc,
UIComponent component,
FacesBean bean,
String parameterString
) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
if (!supportsNavigation(rc)) {
rw.startElement("span", null);
}
else if (supportsScripting(rc))
{
String onclick = getOnclick(component, bean);
rw.startElement("a", null);
onclick = XhtmlUtils.getChainedJS(onclick, parameterString, true);
rw.writeAttribute("onclick", onclick, null);
rw.writeURIAttribute("href", "#", null);
}
// For Non-JavaScript browsers, render an input element(type=submit) to
// submit the page. Encode the name attribute with the parameter name
// and value thus it would enable the browsers to include the name of
// this element in its payLoad if it submits the page.
else
{
rw.startElement("input", null);
rw.writeAttribute("type", "submit", null);
rw.writeURIAttribute("name", parameterString, null);
}
}
示例8: renderFieldCellContents
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
@Override
protected void renderFieldCellContents(
FacesContext context,
RenderingContext rc,
UIComponent component,
FacesBean bean
) throws IOException
{
// The structure of this part of the DOM looks like this:
// +------------------+-----------+
// | indexed children | end facet |
// +------------------+-----------+
ResponseWriter rw = context.getResponseWriter();
rw.startElement("table", component);
OutputUtils.renderLayoutTableAttributes(context, rc, "0", null/*width*/);
UIComponent end = getFacet(component, CorePanelLabelAndMessage.END_FACET);
// Build the main row:
rw.startElement("tr", null);
rw.startElement("td", null);
encodeAllChildren(context, component);
rw.endElement("td");
// For narrow-screen PDAs, End facet is rendered vertically
// below the Help facet. So skip the End facet rendering here.
if (end != null && !supportsNarrowScreen(rc))
{
rw.startElement("td", null);
// =-= mcc TODO apply className for "af|panelLabelAndMessage::end-facet"
// renderStyleClass(context, arc, ...);
//apply className for "af|panelLabelAndMessage::help-facet"
encodeChild(context, end);
rw.endElement("td");
}
rw.endElement("tr");
rw.endElement("table");
}
示例9: renderRepeatingImage
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
protected void renderRepeatingImage(
UIXRenderingContext context,
String backgroundImageURL,
Object height
) throws IOException
{
if (backgroundImageURL != null)
{
ResponseWriter writer = context.getResponseWriter();
renderLayoutTableHeader(context, ZERO, "100%");
// Get the absolute URL based on the base image uri
writeAbsoluteImageURI(context, "background", backgroundImageURL);
if (height != null)
{
writer.writeAttribute("height", height, null);
}
writer.startElement("tr", null);
writer.startElement("td", null);
writer.writeAttribute("height","1px",null);
writer.endElement("td");
writer.endElement("tr");
writer.endElement("table");
}
}
示例10: 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);
}
示例11: encodeAllAsElement
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
@Override
protected void encodeAllAsElement(
FacesContext context,
RenderingContext rc,
UIComponent component,
FacesBean bean
) throws IOException
{
Converter converter = getConverter(component, bean);
if ( converter == null)
converter = getDefaultConverter(context, component, bean);
boolean valuePassThru = getValuePassThru(component, bean);
if (isAutoSubmit(component, bean))
AutoSubmitUtils.writeDependencies(context, rc);
// Only add in validators and converters when we're in valuePassThru
// mode; otherwise, there's not enough on the client to even consider
FormData fData = rc.getFormData();
if (fData != null)
{
((CoreFormData) fData).addOnSubmitConverterValidators(component,
valuePassThru ? converter : null,
valuePassThru ? getValidators(component, bean) : null,
getClientId(context, component),
isImmediate(component, bean),
getRequired(component, bean),
getRequiredMessageKey());
}
List<SelectItem> selectItems = getSelectItems(component, converter, false);
int selectedIndex = _getSelectedIndex(context,
component,
bean,
selectItems,
converter,
valuePassThru);
ResponseWriter writer = context.getResponseWriter();
boolean simple = getSimple(component, bean);
if (simple)
{
writer.startElement("span", component);
// put the outer style class here, like af_selectOneRadio, styleClass,
// inlineStyle, 'state' styles like p_AFDisabled, etc.
renderRootDomElementStyles(context, rc, component, bean);
}
encodeElementContent(context,
rc,
component,
bean,
selectItems,
selectedIndex,
converter,
valuePassThru);
if (isHiddenLabelRequired(rc))
renderShortDescAsHiddenLabel(context, rc, component, bean);
if (simple)
{
writer.endElement("span");
}
}
示例12: encodeAll
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
@Override
protected void encodeAll(
FacesContext context,
RenderingContext rc,
UIComponent component,
FacesBean bean
) throws IOException
{
super.encodeAll(context, rc, component, bean);
String icon = getIcon(component, bean);
String text = getText(component, bean);
ResponseWriter writer = context.getResponseWriter();
boolean isPIE = Agent.PLATFORM_PPC.equalsIgnoreCase(
rc.getAgent().getPlatformName());
// While handling a PPR response, Windows Mobile cannot DOM replace
// a table element. Wrapping a table element with a div element fixes
// the problem.
if (isPIE)
{
writer.startElement("div", component);
renderId(context, component);
// The frame table
writer.startElement(XhtmlConstants.TABLE_ELEMENT, null);
}
else
{
writer.startElement(XhtmlConstants.TABLE_ELEMENT, component);
renderId(context, component);
}
renderAllAttributes(context, rc, component, bean);
writer.startElement(XhtmlConstants.TABLE_BODY_ELEMENT, null);
if (hasChildren(component) || text != null || icon != null)
{
// There's something to render to let build the frame
_renderContainerTopRow(context, rc);
_renderMiddleRow(context, rc, component, bean, icon, text);
_renderContainerBottomRow(context, rc);
}
writer.endElement(XhtmlConstants.TABLE_BODY_ELEMENT);
writer.endElement(XhtmlConstants.TABLE_ELEMENT);
if (isPIE)
writer.endElement("div");
}
示例13: renderIndexedChild
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
@Override
protected void renderIndexedChild(
UIXRenderingContext context,
UINode node,
int index
)throws IOException
{
ResponseWriter writer = context.getResponseWriter();
boolean selected = (index == getResolvedSelectedIndexFromCache(
context, node));
if ( selected)
{
if ( renderStyleElements(context))
{
writer.startElement("b", null);
// Render the tab link
super.renderIndexedChild( context, node, index);
writer.endElement("b");
}
else
{
writer.startElement("span", null);
renderStyleClassAttribute(
context,
BaseDesktopConstants.AF_MENU_BAR_SELECTED_STYLE_CLASS);
// Render the tab link
super.renderIndexedChild( context, node, index);
writer.endElement("span");
}
}
else
{
if ( renderStyleElements(context))
{
// Render the tab link
super.renderIndexedChild( context, node, index);
}
else
{
writer.startElement("span", null);
renderStyleClassAttribute(
context,
BaseDesktopConstants.AF_MENU_BAR_ENABLED_STYLE_CLASS);
// Render the tab link
super.renderIndexedChild( context, node, index);
writer.endElement("span");
}
}
}
示例14: _renderFieldCell
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
* @todo see if bug 2484841 still applies!
*/
private void _renderFieldCell(
FacesContext context,
RenderingContext rc,
UIComponent component,
FacesBean bean,
boolean labelExists,
boolean needsPanelFormLayout,
boolean isInline
) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
rw.startElement("td", null);
rw.writeAttribute("valign", "top", null);
if (isDesktop(rc))
{
// On PDA browsers where width is limited, the field data is
// allowed to wrap.
rw.writeAttribute("nowrap", Boolean.TRUE, null);
}
renderStyleClass(context, rc, SkinSelectors.AF_CONTENT_CELL_STYLE_CLASS );
if (labelExists)
rw.writeAttribute("width",
rc.getProperties().get(_FIELD_CELL_WIDTH_KEY),
null);
renderFieldCellContents(context, rc, component, bean);
// The panelForm places messages below the fields, not on a separate
// row:
if (needsPanelFormLayout)
{
// =-= mcc PPR PROBLEM!!! We should always be rendering the "div",
// and always rendering an ID, if we ever want it to be PPR
// replaceable:
if (isInline || hasMessage(context, rc, component, bean))
{
rw.startElement("div", null);
renderStyleClass(context, rc,
SkinSelectors.AF_COMPONENT_MESSAGE_CELL_STYLE_CLASS);
_renderMessageCellContents(context, rc, component, bean);
rw.endElement("div");
}
}
// bug 2484841: PDA: TOO MUCH WHITESPACE BETWEEN
// INPUT ELEMENTS IN LABELEDFIELD
// This is a browser bug workaround, hopefully we can remove it eventually
if (isPDA(rc) && isIE(rc))
{
rw.startElement("div", null);
renderSpacer(context, rc, "1", "0");
rw.endElement("div");
}
rw.endElement("td");
}
示例15: renderAccessKeyText
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
* Renders the text with the access key highlighted as appropriate.
*/
protected void renderAccessKeyText(
UIXRenderingContext context,
Object textValue,
int keyIndex,
String accessKeyClass
) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
if (textValue != null)
{
// create the String containing the access key, if any.
// we don't render access key indicators on Netscape because
// Netscape doesn't support accesskeys
if ((keyIndex != -1) && supportsAccessKeys(context))
{
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.getFacesContext(),
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
writer.writeText(textValue, null);
}
}
}