本文整理匯總了Java中javax.faces.context.ResponseWriter.write方法的典型用法代碼示例。如果您正苦於以下問題:Java ResponseWriter.write方法的具體用法?Java ResponseWriter.write怎麽用?Java ResponseWriter.write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.faces.context.ResponseWriter
的用法示例。
在下文中一共展示了ResponseWriter.write方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: _renderDisableJsfAjaxScript
import javax.faces.context.ResponseWriter; //導入方法依賴的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");
}
}
示例2: encodeTooltip
import javax.faces.context.ResponseWriter; //導入方法依賴的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);
}
}
示例3: 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);
}
示例4: _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());
}
}
}
示例5: _renderMessageAnchor
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
protected void _renderMessageAnchor(
FacesContext context,
RenderingContext rc,
FacesMessage msg,
String componentId
) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
if (componentId == null)
return;
// Anchor rendering currently only possible for messages that
// contain a label, but we could use summary text in future
if (msg instanceof LabeledFacesMessage)
{
LabeledFacesMessage labeledMsg = (LabeledFacesMessage)msg;
String labelString = labeledMsg.getLabelAsString(context);
if (labelString != null && labelString.length() > 0) // check for empty string
{
String anchor = MessageUtils.getAnchor(componentId);
writer.startElement(XhtmlConstants.LINK_ELEMENT, null);
renderStyleClass(context, rc, SkinSelectors.LINK_STYLE_CLASS);
writer.writeAttribute(XhtmlConstants.HREF_ATTRIBUTE, "#" + anchor, null);
writer.write(labelString);
writer.endElement(XhtmlConstants.LINK_ELEMENT);
writer.write(' ');
}
}
}
示例6: 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();
writer.write(mapVar + ".addControl(new ol.control.OverviewMap());\n");
}
示例7: _renderChoiceLabel
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private void _renderChoiceLabel(
FacesContext context,
RenderingContext rc,
ResponseWriter rw,
boolean isRtl,
UIComponent component,
FacesBean bean
) throws IOException
{
String chooseText = getTitle(component, bean);
if ( (chooseText == null) || (chooseText.length() == 0) )
{
chooseText = getShortDesc(component, bean);
}
if ( (chooseText != null) && (chooseText.length() != 0) )
{
if (isRtl)
{
_renderSpace(rw);
}
rw.startElement("span", null);
renderStyleClass(context, rc,
SkinSelectors.AF_NAVIGATION_LEVEL_CHOICE_LABEL_STYLE_CLASS);
rw.write(chooseText);
rw.endElement("span");
if (!isRtl)
{
_renderSpace(rw);
}
}
}
示例8: _renderSpace
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
private void _renderSpace(
ResponseWriter rw
) throws IOException
{
rw.startElement("span", null);
rw.writeAttribute("style", "width: 5px;", null);
rw.write(" ");
rw.endElement("span");
}
示例9: 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 url = getUrl();
String layer = getLayer();
String name = getName();
String newLayer = "var newLayer = new ol.layer.Image({"
+ " title: '" + name + "', "
+ " source: new ol.source.ImageWMS({url: '" + url + "', "
+ " params: {'LAYERS': '" + layer
+ " ', 'VERSION': '1.1.1'},"
+ " serverType: 'geoserver' "
+ " }) "
+ " });\n";
writer.write(newLayer + mapVar + ".addLayer(newLayer);\n");
}
示例10: encodeAll
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
* render all pieces of the chart
*/
@Override
protected void encodeAll(
FacesContext context,
RenderingContext rc,
UIComponent component,
FacesBean bean
) throws IOException
{
if (canSkipRendering(context, rc, component))
return;
ResponseWriter rw = context.getResponseWriter();
rw.startElement(XhtmlConstants.DIV_ELEMENT, component);
renderId(context, component);
renderStyleAttributes(context, rc, component, bean, SkinSelectors.AF_CHART_STYLE_CLASS);
// We need the number convertor so that we can format numbers on the client
XhtmlUtils.addLib(context, rc, _NUMBER_CONVERTER_SCRIPTLET);
// output the chart javascript library
chartLib.outputScriptlet(context, rc);
// We will render the chart using JavaScript
StringWriter sw = new StringWriter(5000);
_outputSVGDocumentCreate(context, sw, component, bean);
_outputJSChartModel(sw, component);
_outputJSChartObject(context, rc, sw, component, bean);
// Output the script to the response
rw.startElement(XhtmlConstants.SCRIPT_ELEMENT, null);
renderScriptDeferAttribute(context, rc);
renderScriptTypeAttribute(context, rc);
rw.write(sw.toString());
rw.endElement(XhtmlConstants.SCRIPT_ELEMENT);
rw.endElement(XhtmlConstants.DIV_ELEMENT);
}
示例11: outputScriptletContent
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
@Override
protected void outputScriptletContent(
FacesContext context,
RenderingContext arc) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
// write generic navbar submission code
writer.write(_CHOICE_SUBMIT_SCRIPT);
}
示例12: 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();
writer.write(mapVar + ".addControl(new ol.control.ZoomSlider());\n");
}
示例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 id = (String) this.getAttributes().get("id");
String styleClass = (String) this.getAttributes().get("styleClass");
// popup
writer.write("var popupContainer = document.createElement('div');\n");
writer.write("popupContainer.id = '" + id + "';\n");
writer.write("popupContainer.className = '" + styleClass + "';\n");
// popup-closer
writer.write("var popupCloser = document.createElement('a');\n");
writer.write("popupCloser.href = '#';\n");
writer.write("popupCloser.id = 'popup-closer';\n");
writer.write("popupCloser.className = 'ol-popup-closer';\n");
// popup-content
writer.write("var popupContent = document.createElement('div');\n");
writer.write("popupContent.id = 'popup-content';\n");
writer.write("var overlay = new ol.Overlay(({"
+ " element: popupContainer, "
+ " autoPan: true, "
+ " autoPanAnimation: {duration: 250}"
+ " }));\n");
writer.write("popupCloser.onclick = function() {"
+ " overlay.setPosition(undefined); "
+ " popupCloser.blur(); "
+ " return false; "
+ " };\n");
writer.write(mapVar + ".addOverlay(overlay);\n");
writer.write(mapVar + ".on('singleclick', function(evt) { "
+ " var coordinate = evt.coordinate; "
+ " overlay.setPosition(coordinate); "
+ " });\n");
writer.write("popupContainer.appendChild(popupCloser);\n");
writer.write("popupContainer.appendChild(popupContent);\n");
}
示例14: renderSourceHighlighted
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
/**
* @param context
* @param comp
* @param bean
* @param hlight
* @throws IOException
*/
protected void renderSourceHighlighted(FacesContext context, UIComponent comp, FacesBean bean, Renderer hlight) throws IOException {
String sourceContent = readSource(context, comp, bean);
ResponseWriter rw = context.getResponseWriter();
rw.write("<span class=\"line_counter\">");
for(int i=0;i<sourceContent.split("\n").length;i++)
rw.write("<span>"+(i+1)+"</span><br/>");
rw.write("</span><span class=\"code_body_wrap\"><span class=\"code_body\">");
rw.write(hlight.highlight(null, sourceContent, "UTF-8", true));
rw.write("</span></span>");
}
示例15: encodeScript
import javax.faces.context.ResponseWriter; //導入方法依賴的package包/類
protected void encodeScript(FacesContext context, AbstractMenu abstractMenu) throws IOException
/* */ {
/* 238 */ ResponseWriter writer = context.getResponseWriter();
/* 239 */ writer.startElement("script", null);
/* 240 */ writer.writeAttribute("type", "text/javascript", null);
/* 241 */ writer.write("Sentinel.restoreMenuState();");
/* 242 */ writer.endElement("script");
/* */ }