本文整理匯總了Java中javax.faces.context.ResponseWriter類的典型用法代碼示例。如果您正苦於以下問題:Java ResponseWriter類的具體用法?Java ResponseWriter怎麽用?Java ResponseWriter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ResponseWriter類屬於javax.faces.context包,在下文中一共展示了ResponseWriter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: _renderSubmitButtonNonJSBrowser
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
/**
* @param context a <code>UIXRenderingContext</code>
* @param valueAttri a <code>String</code> it is the value attribute
* of the submit button
* @param nameAttri a <code>String</code> it is the name attribute
* of the submit button
*
* This method renders an input element(type= submit) to submit the page.
* The name attribute of this element is encoded with parameter name and
* value pairs thus it would enable browsers to include the name of this
* element in its payLoad if it submits the page.
*
*/
private void _renderSubmitButtonNonJSBrowser(
UIXRenderingContext context,
String valueAttri,
String nameAttri
) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement("input", null);
renderAttribute(context, "type", "submit");
renderAttribute(context, "value", valueAttri);
renderAttribute(context, "name", nameAttri);
renderStyleClassAttribute(context,
SkinSelectors.AF_COMMAND_BUTTON_STYLE_CLASS);
writer.endElement("input");
}
示例2: renderRegularHeaders
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
/**
* renders the regular table column headers.
*/
protected final void renderRegularHeaders(FacesContext context, RenderingContext rc, TableRenderingContext tContext,
UIComponent component, int physicalCol)
throws IOException
{
// this renders a whole bunch of <TH>...</TH> elements.
// if there are columnGroups present, it will render some
// </TR><TR><TH>...</TH> sequences.
final ColumnData colData = tContext.getColumnData();
_renderRegularColumns(context, tContext, component, physicalCol);
int rowSpan = colData.getHeaderRowSpan();
if (rowSpan > 1)
{
ResponseWriter writer = context.getResponseWriter();
for (int i = 1; i < rowSpan; i++)
{
colData.setRowIndex(i);
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
_renderRegularColumns(context, tContext, component, physicalCol);
}
}
}
示例3: renderLayoutTableAttributes
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
/**
* all data tables should call this one, so that a summary tag is written
* out
*/
protected static void renderLayoutTableAttributes(
UIXRenderingContext context,
Object cellpadding,
Object cellspacing,
Object border,
Object tableWidth,
Object summary
) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
writer.writeAttribute("cellpadding", cellpadding, null);
writer.writeAttribute("cellspacing", cellspacing, null);
writer.writeAttribute("border", border, null);
writer.writeAttribute("width", tableWidth, null);
if (!isInaccessibleMode(context))
{
writer.writeAttribute("summary", summary, null);
}
}
示例4: _writeOnclickProperty
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
private void _writeOnclickProperty(
RenderingContext rc,
ResponseWriter rw,
UIXCommand commandChild,
boolean actionSpecialCase,
boolean immediate,
boolean partialSubmit
) throws IOException
{
if (actionSpecialCase)
{
String onclick = (String)_getCommandChildProperty(commandChild, "onclick");
String script = _getAutoSubmitScript(rc, immediate, partialSubmit);
rw.writeAttribute(
"onclick", XhtmlUtils.getChainedJS(onclick, script, true), "onclick");
}
else // simple case, e.g. (destination != null)
{
_writeCommandChildProperty(rw, commandChild, "onclick");
}
}
示例5: cloneWithWriter
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
@Override
public ResponseWriter cloneWithWriter(Writer writer)
{
try
{
TestResponseWriter trw = new TestResponseWriter(writer, getContentType(),
getCharacterEncoding(),
_test,
_result);
trw._depth = _depth;
return trw;
}
catch (UnsupportedEncodingException e)
{
// this can't happen; the character encoding should already
// be legal.
assert(false);
throw new IllegalStateException();
}
}
示例6: render
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
/**
*
* render using the RepeatIdResponseWriter.
* @param context
* @param node
* @throws IOException
*/
@Override
public void render(
UIXRenderingContext context,
UINode node
) throws IOException
{
ResponseWriter oldRW = RepeatIdResponseWriter.install(context.getFacesContext());
try
{
super.render(context, node);
}
finally
{
RepeatIdResponseWriter.remove(context.getFacesContext(), oldRW);
}
}
示例7: encodeMarkup
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
protected void encodeMarkup(FacesContext context, AbstractMenu abstractMenu)
/* */ throws IOException
/* */ {
/* 41 */ SentinelMenu menu = (SentinelMenu)abstractMenu;
/* 42 */ ResponseWriter writer = context.getResponseWriter();
/* 43 */ String clientId = menu.getClientId(context);
/* 44 */ String style = menu.getStyle();
/* 45 */ String styleClass = menu.getStyleClass();
/* 46 */ styleClass = "layout-menubar-container " + styleClass;
/* */
/* 48 */ writer.startElement("ul", menu);
/* 49 */ if (shouldRenderId(null)) {
/* 50 */ writer.writeAttribute("id", clientId, "id");
/* */ }
/* 52 */ writer.writeAttribute("class", styleClass, "styleClass");
/* 53 */ if (style != null) {
/* 54 */ writer.writeAttribute("style", style, "style");
/* */ }
/* */
/* 57 */ if (menu.getElementsCount() > 0) {
/* 58 */ encodeElements(context, menu, menu.getElements(), 0);
/* */ }
/* */
/* 61 */ writer.endElement("ul");
/* */ }
示例8: _renderText
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
private void _renderText(
UIXRenderingContext context,
UINode node,
AttributeKey attrKey
) throws IOException
{
Object value = node.getAttributeValue(context, attrKey);
if (value != null)
{
ResponseWriter writer = context.getResponseWriter();
if (value instanceof char[])
{
char[] text = (char[]) value;
writer.write(text, 0, text.length);
}
else
{
writer.write(value.toString());
}
}
}
示例9: _service
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
static private void _service(
FacesContext context,
String jspName) throws IOException
{
// Prepare the view tree
if (NEW_FRAME_REDIRECT_ENTRY.equals(jspName))
FredJSP.service(context);
else if (CALENDAR_DIALOG_ENTRY.equals(jspName))
CalendarDialogJSP.service(context);
else if (INLINE_DATE_PICKER_ENTRY.equals(jspName))
InlineDatePickerJSP.service(context);
else if (COLOR_PICKER_ENTRY.equals(jspName))
ColorPickerJSP.service(context);
else
{
assert(false);
}
// And render
ResponseWriter rw = context.getResponseWriter();
rw.startDocument();
RenderUtils.encodeRecursive(context, context.getViewRoot());
rw.endDocument();
}
示例10: renderContent
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
/**
* Overrride to render in three passes.
*/
@Override
protected void renderContent(
UIXRenderingContext context,
UINode node
) throws IOException
{
// save the inital stauts
boolean actualLinkStatus = LinkUtils.isSelected(context);
ResponseWriter writer = context.getResponseWriter();
LinkRenderer.setSaveModelDisabled(context, true);
Integer selectedIndex = (Integer)SubTabBarUtils.getSelectedIndex(context);
// save away the selected index
context.setLocalProperty( _SELECTED_NODE_KEY, selectedIndex);
// render pass 1 - row with rendered children
writer.startElement(DIV_ELEMENT, null);
super.renderContent(context, node);
writer.endElement(DIV_ELEMENT);
LinkRenderer.setSaveModelDisabled(context, false);
// restore it back to original status
LinkUtils.setSelected(context,actualLinkStatus);
}
示例11: _encodeDetailItem
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
/**
* Encodes the disclosed child.
*
* Generates the required markup for the disclosed child.
*
* @param context the faces context object
* @param component the UIComponent object
* @param detailItem the UIXShowDetailItem thats disclosed
* @param out the response writer object
* @throws IOException when some issues while writing output
*/
private void _encodeDetailItem(
FacesContext context,
RenderingContext rc,
UIComponent component,
UIXShowDetail detailItem,
ResponseWriter out
) throws IOException
{
out.startElement("table", component);
out.writeAttribute("cellSpacing", "0", null);
out.writeAttribute("cellPadding", "0", null);
out.writeAttribute("summary", "", null);
renderStyleClass(context, rc, getContentStyleClass());
out.startElement("tr", component);
out.startElement("td", component);
encodeChild(context, detailItem);
out.endElement("td");
out.endElement("tr");
out.endElement("table"); // Ending table for the contained child
}
示例12: encodeEnd
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
/**
* <p>Encode the ending of this component.</p>
*
* @param context <code>FacesContext</code> for the current request
* @param component <code>UIComponent</code> to be encoded
* @throws java.io.IOException
*/
@Override
public void encodeEnd(FacesContext context, UIComponent component)
throws IOException {
if ((context == null) || (component == null)) {
throw new NullPointerException();
}
MapComponent map = (MapComponent) component;
ResponseWriter writer = context.getResponseWriter();
writer.startElement("input", map);
writer.writeAttribute("type", "hidden", null);
writer.writeAttribute("name", getName(context, map), "clientId");
writer.endElement("input");
writer.endElement("map");
}
示例13: encodeAll
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
@Override
public void encodeAll(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
UIComponent parent = this;
while (!(parent instanceof Map)) {
parent = parent.getParent();
}
Map mapComponent = (Map) parent;
String mapVar = mapComponent.getJsVariable();
String isBaseLayer = getIsBaseLayer();
String newLayer = "var newOsmLayer = new ol.layer.Tile({ source: new ol.source.OSM()});\n";
String addLayer;
if (isBaseLayer != null && isBaseLayer.equals("true")) {
addLayer = "var layersCollection = " + mapVar + ".getLayers(); layersCollection.insertAt(0, newOsmLayer);\n";
} else {
addLayer = mapVar + ".addLayer(newOsmLayer);\n";
}
writer.write(newLayer + addLayer);
}
示例14: appendIconAndText
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
protected void appendIconAndText(
FacesContext context,
RenderingContext rc,
ResponseWriter rw,
String iconUri,
Map<String, Object> itemData,
boolean isDisabled,
boolean isRtl
) throws IOException
{
if ( (iconUri != null) && !isRtl )
{
_appendIcon(context, rw, iconUri, isRtl, rc);
}
_writeItemLink(context, rc, rw, itemData, isDisabled);
if ( (iconUri != null) && isRtl )
{
_appendIcon(context, rw, iconUri, isRtl, rc);
}
}
示例15: _renderMarginSpacer
import javax.faces.context.ResponseWriter; //導入依賴的package包/類
private void _renderMarginSpacer(
FacesContext context,
RenderingContext rc,
Integer rowSpan
) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement("td", null);
writer.writeAttribute("rowspan", rowSpan, null);
Object spacerWidth = rc.getSkin().getProperty(
SkinProperties.AF_PANEL_BORDER_LAYOUT_SPACER_WIDTH);
if (spacerWidth != null)
renderSpacer(context, rc, spacerWidth.toString(), "0");
writer.endElement("td");
}