本文整理汇总了Java中javax.faces.context.FacesContext.getResponseWriter方法的典型用法代码示例。如果您正苦于以下问题:Java FacesContext.getResponseWriter方法的具体用法?Java FacesContext.getResponseWriter怎么用?Java FacesContext.getResponseWriter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.context.FacesContext
的用法示例。
在下文中一共展示了FacesContext.getResponseWriter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encodeTooltip
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
private void encodeTooltip(FacesContext context, String targetId, String tooltipText) throws IOException {
if (Settings.getBoolean(SettingCodes.ENABLE_TOOLTIPS, Bundle.SETTINGS, DefaultSettings.ENABLE_TOOLTIPS)) {
String tooltipId = targetId + "_tooltip";
ResponseWriter writer = context.getResponseWriter();
writer.startElement("div", null);
writer.writeAttribute("id", tooltipId, null);
writer.writeAttribute("class", Tooltip.CONTAINER_CLASS, null);
writer.writeText(tooltipText, null);
writer.endElement("div");
startScript(writer, tooltipId + "_script");
writer.write("$(function() {");
writer.write("PrimeFaces.cw('Tooltip','" + "widget_" + tooltipId + "',{"); // tooltip.resolveWidgetVar()
writer.write("id:'" + tooltipId + "'");
writer.write(",target:'" + targetId + "'");
writer.write(",showEffect:'fade'");
writer.write(",hideEffect:'fade'");
writer.write("});});");
endScript(writer);
}
}
示例2: renderIcon
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
/**
* render the spinbox icons. <div>img</div><div>img</div>
*/
@Override
protected void renderIcon(
FacesContext context,
RenderingContext rc,
UIComponent component,
FacesBean bean
) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
// render increment spinbox image
rw.startElement("div", component);
_renderSpinboxIcon(context, rc, component, bean, rw, true);
rw.endElement("div");
// render decrement spinbox image
rw.startElement("div", component);
_renderSpinboxIcon(context, rc, component, bean, rw, false);
rw.endElement("div");
}
示例3: renderVerticalSpacer
import javax.faces.context.FacesContext; //导入方法依赖的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");
}
}
示例4: encodeAll
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
@Override
protected void encodeAll(
FacesContext context,
RenderingContext rc,
UIComponent comp,
FacesBean bean
) throws IOException
{
if (canSkipRendering(context, rc, comp))
return;
ResponseWriter rw = context.getResponseWriter();
rw.startElement("img", comp);
renderId(context, rc, comp, rw);
renderAllAttributes(context, rc, comp, bean);
rw.endElement("img");
}
示例5: _renderDisableJsfAjaxScript
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
private void _renderDisableJsfAjaxScript(
FacesContext context,
RenderingContext rc
) throws IOException
{
if (!supportsScripting(rc))
{
return;
}
ExternalContext extContext = context.getExternalContext();
if ("off".equalsIgnoreCase(extContext.getInitParameter(_PPR_OVER_JSF_AJAX)))
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement("script", null);
writer.write("TrPage.getInstance().__disablePprOverJsfAjax()");
writer.endElement("script");
}
}
示例6: encodeScript
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
private void encodeScript(FacesContext context, SketchPad sketchPad) throws IOException {
ResponseWriter writer = context.getResponseWriter();
startScript(writer, getScriptId(sketchPad, context));
Object value = getValue(context, sketchPad);
List<String> regions = sketchPad.getRegions();
String strokesId = sketchPad.getStrokesId();
String backgroundImage = sketchPad.getBackgroundImage();
String onChange = sketchPad.getOnChange();
String widgetVar = sketchPad.getWidgetVar();
writer.write(MessageFormat.format(
(widgetVar != null && widgetVar.length() > 0 ? "window[''" + widgetVar + "''] = " : "")
+ "Sketch.initSketch(''{0}'', ''{1}'', ''{2}'', {3}, {4},{5}, {6}, {7}, {8}{9});",
value == null ? "" : value.toString(),
getInputId(sketchPad, context),
getDivId(sketchPad, context),
Integer.toString(sketchPad.getWidth()),
Integer.toString(sketchPad.getHeight()),
backgroundImage != null && backgroundImage.length() > 0 ? WebUtil.quoteJSString(backgroundImage, true) : "''",
!sketchPad.isDisabled(),
onChange != null && onChange.length() > 0 ? WebUtil.quoteJSString(onChange, true) : "''",
strokesId != null && strokesId.length() > 0 ? WebUtil.quoteJSString(strokesId, true) : "''",
regions != null && regions.size() > 0 ? ", " + WebUtil.escapeJSStringArray(regions, false, true) : ""
));
endScript(writer);
}
示例7: _renderPartialBlocking
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
private static void _renderPartialBlocking(
FacesContext context,
RenderingContext rc,
UIComponent component
) throws IOException
{
if (PartialPageUtils.supportsBlocking(rc))
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement("div", component);
writer.writeAttribute("id", _PARTIAL_DIV_ID,
null);
writer.writeAttribute("onclick",
_PARTIAL_DIV_CLICK_HANDLER, null);
writer.writeAttribute("style",
_PARTIAL_DIV_STYLE, null);
writer.writeAttribute("onkeydown", _PARTIAL_DIV_EAT_KEY_HANDLER, null);
writer.writeAttribute("onkeyup", _PARTIAL_DIV_EAT_KEY_HANDLER, null);
writer.writeAttribute("onmousedown", _PARTIAL_DIV_EAT_KEY_HANDLER, null);
writer.writeAttribute("onmouseup", _PARTIAL_DIV_EAT_KEY_HANDLER, null);
writer.writeAttribute("onkeypress", _PARTIAL_DIV_EAT_KEY_HANDLER, null);
writer.endElement("div");
}
}
示例8: _renderParamAttribute
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
/**
* Renders a name value pair as a <param> element
*/
private void _renderParamAttribute(
FacesContext context,
String paramName,
Object paramValue,
boolean isURL
) throws IOException
{
if ( paramValue != null )
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement("param", null);
writer.writeAttribute("name", paramName, null);
if (isURL)
{
renderEncodedResourceURI(context, "value", paramValue);
}
else
{
writer.writeAttribute("value", paramValue, null);
}
writer.endElement("param");
}
}
示例9: encodeAll
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
@Override
protected void encodeAll(
FacesContext context,
RenderingContext rc,
UIComponent component,
FacesBean bean
) throws IOException
{
// Since NavigationPane is a naming container, we can be more
// efficient about skipping its children
if (!PartialPageUtils.containsPprTargets(rc,
component,
getClientId(context, component)))
{
return;
}
ResponseWriter writer = context.getResponseWriter();
writer.startElement("div", component);
renderAllAttributes(context, rc, component, bean, false);
_renderStyleAttributes(context, rc, component, bean);
renderId(context, component);
int renderedItemCount = _getItemCount((UIXHierarchy)component);
int renderedRowCount = ((UIXHierarchy)component).getRowCount();
// no kids, no NavigationLevel -- but you still get the span.
if (renderedItemCount > 0 || renderedRowCount > 0)
{
renderContent(context, rc,
(UIXHierarchy)component, bean);
}
writer.endElement("div");
}
示例10: encodeElements
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
protected void encodeElements(FacesContext context, AbstractMenu menu, List<MenuElement> elements, int marginLevel) throws IOException {
/* 65 */ ResponseWriter writer = context.getResponseWriter();
/* 66 */ String menuClientId = menu.getClientId(context);
/* */
/* 68 */ for (MenuElement element : elements)
/* 69 */ if (element.isRendered())
/* 70 */ if ((element instanceof MenuItem)) {
/* 71 */ MenuItem menuItem = (MenuItem)element;
/* 72 */ String menuItemClientId = menuClientId + "_" + menuItem.getClientId();
/* 73 */ String containerStyle = menuItem.getContainerStyle();
/* 74 */ String containerStyleClass = menuItem.getContainerStyleClass();
/* */
/* 76 */ writer.startElement("li", null);
/* 77 */ writer.writeAttribute("id", menuItemClientId, null);
/* 78 */ writer.writeAttribute("role", "menuitem", null);
/* */
/* 80 */ if (containerStyle != null) writer.writeAttribute("style", containerStyle, null);
/* 81 */ if (containerStyleClass != null) writer.writeAttribute("class", containerStyleClass, null);
/* */
/* 83 */ encodeMenuItem(context, menu, menuItem, marginLevel);
/* */
/* 85 */ writer.endElement("li");
/* */ }
/* 87 */ else if ((element instanceof Submenu)) {
/* 88 */ Submenu submenu = (Submenu)element;
/* 89 */ String submenuClientId = menuClientId + "_" + submenu.getClientId();
/* 90 */ String style = submenu.getStyle();
/* 91 */ String styleClass = submenu.getStyleClass();
/* */
/* 93 */ writer.startElement("li", null);
/* 94 */ writer.writeAttribute("id", submenuClientId, null);
/* 95 */ writer.writeAttribute("role", "menuitem", null);
/* */
/* 97 */ if (style != null) writer.writeAttribute("style", style, null);
/* 98 */ if (styleClass != null) writer.writeAttribute("class", styleClass, null);
/* */
/* 100 */ encodeSubmenu(context, menu, submenu, marginLevel);
/* */
/* 102 */ writer.endElement("li");
/* */ }
/* 104 */ else if ((element instanceof Separator)) {
/* 105 */ encodeSeparator(context, (Separator)element);
/* */ }
/* */ }
示例11: _renderBottomRow
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
private void _renderBottomRow(
FacesContext fContext,
RenderingContext arc,
IconData icons,
int columnCount
) throws IOException
{
ResponseWriter writer = fContext.getResponseWriter();
// Render the contents inside of its own table row
writer.startElement(TABLE_ROW_ELEMENT, null);
// If we've got a start icon, render it
if (icons.bottomStart != null)
{
writer.startElement(TABLE_DATA_ELEMENT, null);
OutputUtils.renderIcon(fContext, arc, icons.bottomStart, "", null);
writer.endElement(TABLE_DATA_ELEMENT);
}
// Render the cell with the bottom background icon. We first
// need to determine how many columns the background cell should
// fill.
Integer colspan = _getBottomBackgroundColumnCount(icons, columnCount);
writer.startElement(TABLE_DATA_ELEMENT, null);
writer.writeAttribute(COLSPAN_ATTRIBUTE, colspan, null);
writer.writeAttribute(WIDTH_ATTRIBUTE, "100%", null);
org.apache.myfaces.trinidadinternal.renderkit.core.skin.CoreSkinUtils.__renderBackgroundIcon(fContext, arc, icons.bottomBackground);
writer.endElement(TABLE_DATA_ELEMENT);
// If we've got an end icon, render it
if (icons.bottomEnd != null)
{
writer.startElement(TABLE_DATA_ELEMENT, null);
OutputUtils.renderIcon(fContext, arc, icons.bottomEnd, "", null);
writer.endElement(TABLE_DATA_ELEMENT);
}
writer.endElement(TABLE_ROW_ELEMENT);
}
示例12: _renderContent
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
private void _renderContent(
FacesContext context,
RenderingContext rc,
UIXHierarchy tree,
FacesBean bean
) throws IOException
{
FormData fd = rc.getFormData();
if (fd == null)
{
_LOG.warning("TREE_COMPONENT_MUST_INSIDE_FORM");
return;
}
ResponseWriter rw = context.getResponseWriter();
rw.startElement("div", tree);
renderId(context, tree);
renderAllAttributes(context, rc, tree, bean);
final String id = getClientId(context, tree);
UIComponent stamp = getFacet(tree, CoreTree.NODE_STAMP_FACET);
//@todo - will this tree.getFocusPath survive?
// List focusPath = getFocusPath(context, node);
Object focusPath = tree.getFocusRowKey();
String formName = fd.getName();
// Bug 3931544: don't use colons in Javascript variable names.
// We'll just replace colons with underscores; not perfect, but adequate
final String varName = "_adftree" + XhtmlUtils.getJSIdentifier(id);
boolean leftToRight = !rc.isRightToLeft();
int rootSize = tree.getRowCount();
RowKeySet state = getExpandedRowKeys(tree);
Map<Object, Boolean> selectedPaths = getSelectedPaths(focusPath);
// render each of the root nodes
for (int i = 0; i < rootSize; i++)
{
tree.setRowIndex(i);
_renderNode(context, rc, tree, bean, stamp, varName, state,
selectedPaths, new Boolean[_DEFAULT_TREE_DEPTH],
leftToRight, (i == 0), (i == rootSize - 1), 0);
}
//HKuhn - not needed in printable mode (scripting disabled)
if (supportsScripting(rc))
{
rw.startElement("script", null);
renderScriptDeferAttribute(context, rc);
renderScriptTypeAttribute(context, rc);
_renderTreeJS(context, rc, tree, bean);
//out.writeText("_setNodes('"+name+"','"+nodesRendered+"');");
String selectedParam =
id + NamingContainer.SEPARATOR_CHAR + SELECTED_PARAM;
String focusNodeId = TreeUtils.getFocusNodeClientId(context, tree);
rw.writeText("var " + varName + " = " +
_createNewJSSelectionState(formName, id, selectedParam,
focusNodeId), null);
rw.endElement("script");
fd.addNeededValue(selectedParam);
}
rw.endElement("div");
fd.addNeededValue(_PATH_PARAM);
}
示例13: renderSelectDayAttributes
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
protected void renderSelectDayAttributes(
RenderingContext rc,
FacesContext context,
String[] keysAndValues,
String id,
long currTime,
int baseTZOffsetMinutes,
boolean isInline,
boolean isDesktop,
String destString
) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
if (isDesktop)
{
TimeZone tz = rc.getLocaleContext().getTimeZone();
int tzOffsetMinutes = tz.getOffset(currTime)/(1000*60);
StringBuilder clickRef = new StringBuilder(30);
writer.writeURIAttribute("href", "#", null);
if (isInline)
{
clickRef.append("return _calsd(");
// First argument is the ID of the calendar
if (id == null)
clickRef.append("null");
else
{
clickRef.append("'");
clickRef.append(id);
clickRef.append("'");
}
clickRef.append(',');
}
else
{
clickRef.append("return _selectDate(");
}
clickRef.append(currTime);
if (tzOffsetMinutes != baseTZOffsetMinutes)
clickRef.append (", " + tzOffsetMinutes);
clickRef.append(')');
writer.writeAttribute("onclick", clickRef, null);
}
else
{
keysAndValues[1] = IntegerUtils.getString( currTime);
assert(destString != null);
String url = EncoderUtils.appendURLArguments(destString,
keysAndValues);
renderEncodedActionURI(context, "href", url);
}
}
示例14: _renderSelectItemInTD
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
/**
* Generates markup for rendering HTML select control.
*
* The select control markup is contained within a TD element.
*/
@SuppressWarnings("unchecked")
private void _renderSelectItemInTD(FacesContext context,
UIComponent component,
String disclosedChildId)
throws IOException
{
String compId = component.getClientId(context);
ResponseWriter out = context.getResponseWriter();
UIXRenderingContext rCtx = getRenderingContext(context, component);
out.startElement("td", component);
out.writeAttribute("valign", "top", null);
out.writeAttribute("nowrap", Boolean.TRUE, null);
out.startElement("select", component);
out.writeAttribute("id", compId + _CHOICE_SELECT_SUFFIX_ID_CONST, null);
out.writeAttribute("name", compId + _CHOICE_SELECT_SUFFIX_ID_CONST,null);
XhtmlLafRenderer.renderStyleClassAttribute(rCtx, getFieldTextClass());
// construct the javascript for submitting the form
String onChangeJS = _getChoiceOnchangeJS(context,rCtx, component, compId);
if (onChangeJS != null)
{
out.writeAttribute("onchange", onChangeJS, null);
}
// Render options now.
ListIterator<UIComponent> children = component.getChildren().listIterator();
while (children.hasNext())
{
UIComponent child = children.next();
if (child instanceof UIXShowDetail)
{
UIXShowDetail detailItem = (UIXShowDetail) child;
Boolean disabledObj =
(Boolean) detailItem.getAttributes().get("disabled");
boolean disabled = false; // by default is enabled.
if (disabledObj != null)
{
disabled = disabledObj.booleanValue();
}
if (disabled)
{
// MSDN DHTML Reference says disabled not supported for option element
// hence don't render disabled options at all to be consistent
// across browsers. See Bug 4561967.
continue;
}
String childTitle = (String) detailItem.getAttributes().get("text");
String childClientId = child.getClientId(context);
out.startElement("option", component);
out.writeAttribute("id", childClientId, null);
if (childClientId.equals(disclosedChildId))
{
out.writeAttribute("selected", Boolean.TRUE, null);
}
if (childTitle != null)
out.writeText(childTitle, null);
out.endElement("option");
}
}
out.endElement("select");
out.endElement("td");
}
示例15: _renderBreadCrumbs
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
private void _renderBreadCrumbs(
FacesContext fc,
RenderingContext rc,
TableRenderingContext context,
UIComponent tree,
FacesBean bean
) throws IOException
{
// this renders <TR><TD><[crumbs]></TD></TR>
TreeTableRenderingContext hContext = (TreeTableRenderingContext) context;
// we will render the breadcrumbs only if they exist.
if (hContext.isFocusColumnVisible())
{
ResponseWriter writer = fc.getResponseWriter();
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
writer.writeAttribute(XhtmlConstants.HEIGHT_ATTRIBUTE, "30", null);
final String borderStyleClass;
borderStyleClass = CellUtils.getBorderClass( true, //top
true, //left
false, //bottom
true); //right
renderStyleClasses(fc, rc, new String[] {
SkinSelectors.HGRID_LOCATOR_HEADER_STYLE,
borderStyleClass}
);
int colspan = context.getActualColumnCount();
writer.writeAttribute("colspan", IntegerUtils.getString(colspan), null);
// The locator icon hits the left border if not for this spacer
renderSpacer(fc, rc, "0", "2");
_renderLocatorIcon(fc, rc);
delegateRenderer(fc, rc, tree, bean, _CRUMBS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
// end the <tr> containing the bread crumbs
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
}
}