You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2009/12/17 03:33:11 UTC
svn commit: r891522 [8/28] - in /myfaces/trinidad/branches/trinidad-2.0.x:
./ trinidad-api/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/
trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/util/
trinidad-api/src/main/java/org/ap...
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java?rev=891522&r1=891521&r2=891522&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java Thu Dec 17 02:33:05 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -35,26 +35,26 @@
import javax.faces.convert.Converter;
import javax.faces.validator.Validator;
-import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.UIXComponent;
import org.apache.myfaces.trinidad.component.UIXForm;
import org.apache.myfaces.trinidad.component.core.CoreForm;
-import org.apache.myfaces.trinidad.context.RequestContext;
-
import org.apache.myfaces.trinidad.context.Agent;
-import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
import org.apache.myfaces.trinidad.context.FormData;
import org.apache.myfaces.trinidad.context.PartialPageContext;
import org.apache.myfaces.trinidad.context.RenderingContext;
+import org.apache.myfaces.trinidad.context.RequestContext;
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.util.ExternalContextUtils;
import org.apache.myfaces.trinidad.util.RequestType;
+import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
import org.apache.myfaces.trinidadinternal.renderkit.core.CoreResponseStateManager;
import org.apache.myfaces.trinidadinternal.renderkit.uix.SubformRenderer;
+import org.apache.myfaces.trinidadinternal.share.data.ServletRequestParameters;
+
// TODO: Remove this class
-import org.apache.myfaces.trinidadinternal.share.data.ServletRequestParameters;
/**
* @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/ui/laf/base/xhtml/FormRenderer.java#0 $) $Date: 10-nov-2005.18:53:51 $
@@ -68,8 +68,9 @@
@SuppressWarnings("unchecked")
@Override
- public void decode(FacesContext context,
- UIComponent component)
+ public void decode(
+ FacesContext context,
+ UIComponent component)
{
Map<String, String> paramMap =
context.getExternalContext().getRequestParameterMap();
@@ -94,7 +95,8 @@
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
@@ -107,19 +109,19 @@
@Override
public void setupEncodingContext(
- FacesContext context,
+ FacesContext context,
RenderingContext rc,
- UIXComponent component)
+ UIXComponent component)
{
// temp hack
setupEncodingContext(context, rc, (UIComponent)component);
}
-
+
@Override
public void setupEncodingContext(
- FacesContext context,
+ FacesContext context,
RenderingContext rc,
- UIComponent component)
+ UIComponent component)
{
String formName = getClientId(context, component);
@@ -136,7 +138,7 @@
// Check to see if this is a partial page render. If so, we need
// to push the ID of the postscript onto the partial target stack
final String postscriptId = _getPostscriptId(rc, formName);
-
+
PartialPageContext pprContext = rc.getPartialPageContext();
if (pprContext != null)
@@ -165,36 +167,37 @@
@Override
protected void encodeBegin(
- FacesContext context,
- RenderingContext arc,
- UIComponent comp,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent comp,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
ExternalContext ec = context.getExternalContext();
- String formName = arc.getFormData().getName();
-
- if (supportsScripting(arc))
+ String formName = rc.getFormData().getName();
+
+ if (supportsScripting(rc))
{
// we depend on the form submission library
- XhtmlUtils.addLib(context, arc, "submitForm()");
- XhtmlUtils.addLib(context, arc, "_submitOnEnter()");
+ XhtmlUtils.addLib(context, rc, "submitForm()");
+ XhtmlUtils.addLib(context, rc, "_submitOnEnter()");
// if the onSubmit attribute is set, generate the JavaScript variable
// with the source code to execute when submitting. We do this,
// because the normal onSubmit handler on forms is NOT called if
// the form is submitted programatically
- String onsubmit = getOnsubmit(bean);
+ String onsubmit = getOnsubmit(comp, bean);
if (onsubmit != null)
{
rw.startElement("script", null);
- renderScriptDeferAttribute(context, arc);
+ renderScriptDeferAttribute(context, rc);
// Bug #3426092:
// render the type="text/javascript" attribute in accessibility mode
- renderScriptTypeAttribute(context, arc);
+ renderScriptTypeAttribute(context, rc);
rw.write("var _");
rw.write(XhtmlUtils.getJSIdentifier(formName));
@@ -209,11 +212,11 @@
rw.startElement("form", comp);
renderId(context, comp);
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, comp, bean);
// Render the method. It's POST if they want file upload, and they
// can actually upload files otherwise we'll just use whatever they request
- if (getUsesUpload(bean))
+ if (getUsesUpload(comp, bean))
{
rw.writeAttribute("enctype", "multipart/form-data", "usesUpload");
}
@@ -221,7 +224,7 @@
rw.writeAttribute("method", "POST", null);
//only render onkeypress if supports scripting (not in printable mode)
- if (supportsScripting(arc))
+ if (supportsScripting(rc))
{
rw.writeAttribute("onkeypress",
getFullOnkeypress(context,
@@ -232,9 +235,9 @@
}
// render the autocomplete attribute
- if (supportsAutoCompleteFormElements(arc))
+ if (supportsAutoCompleteFormElements(rc))
{
- String autocomplete = getAutoComplete(bean);
+ String autocomplete = getAutoComplete(comp, bean);
if (autocomplete.equalsIgnoreCase(CoreForm.AUTO_COMPLETE_OFF))
{
rw.writeAttribute("autocomplete", "off", "autoComplete");
@@ -245,33 +248,34 @@
String action =
context.getApplication().getViewHandler().getActionURL(context, viewId);
renderEncodedActionURI(context, "action", action);
-
+
RequestType type = ExternalContextUtils.getRequestType(ec);
-
+
//Always add expando to portlet form
if(type.isPortlet())
{
renderEncodedResourceURI(context, "_trinPPRAction", action);
}
-
- if (supportsTarget(arc))
+
+ if (supportsTarget(rc))
{
- rw.writeAttribute("target", getTargetFrame(bean), "targetFrame");
+ rw.writeAttribute("target", getTargetFrame(comp, bean), "targetFrame");
}
}
@Override
protected void encodeEnd(
- FacesContext context,
- RenderingContext arc,
- UIComponent comp,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent comp,
+ FacesBean bean
+ ) throws IOException
{
String noJavaScriptSupport = "false";
ResponseWriter writer = context.getResponseWriter();
- String formName = arc.getFormData().getName();
- PartialPageContext pprContext = arc.getPartialPageContext();
+ String formName = rc.getFormData().getName();
+ PartialPageContext pprContext = rc.getPartialPageContext();
// Write out the hidden form field that identifies which
// form is the one being submitted
@@ -284,7 +288,7 @@
* set the hidden parameter noJavaScriptSupport as true for Non-JavaScript
* browsers
*/
- if( !supportsScripting(arc))
+ if( !supportsScripting(rc))
{
noJavaScriptSupport = XhtmlConstants.NON_JS_BROWSER_TRUE;
}
@@ -294,20 +298,20 @@
writer.writeAttribute("value", noJavaScriptSupport, null);
writer.endElement("input");
- final String postscriptId = _getPostscriptId(arc, formName);
+ final String postscriptId = _getPostscriptId(rc, formName);
// render postscript element containing the state and the
- _renderPostscriptElement(context, arc, writer, postscriptId);
+ _renderPostscriptElement(context, rc, writer, postscriptId);
//this condition is needed for bug 4526850- It ensures that only
//state token and form name parameters are overwritten when there is
//a partial page submission.
// (also include blackberry browser in this condition)
- if (isPDA(arc) && pprContext == null)
+ if (isPDA(rc) && pprContext == null)
{
//Add hidden elements in the form for enabling PPR on IE Mobile.
- Object domLevel = arc.getAgent().getCapabilities().get(
+ Object domLevel = rc.getAgent().getCapabilities().get(
TrinidadAgent.CAP_DOM);
if(
@@ -315,11 +319,11 @@
domLevel == TrinidadAgent.DOM_CAP_NONE ||
domLevel == TrinidadAgent.DOM_CAP_FORM)
{
- FormData formData = arc.getFormData();
+ FormData formData = rc.getFormData();
if(formData != null)
{
boolean isPIE = Agent.PLATFORM_PPC.equalsIgnoreCase(
- arc.getAgent().getPlatformName());
+ rc.getAgent().getPlatformName());
// =-=AdamWiner: this isn't correct - these
// parameters should be added by the components that need
@@ -332,19 +336,19 @@
formData.addNeededValue(XhtmlConstants.PARTIAL_PARAM);
// In the case of Windows-mobile(WM) browsers, store the value of
- // the request-header field, UA-pixels, into a hidden-parameter's
- // value attribute. WM browsers' PPRs don't contain UA-pixels in
- // their request-headers. So during a WM browser's PPR, we need to
- // manually (using JavaScript) set the field, UA-pixels, into
+ // the request-header field, UA-pixels, into a hidden-parameter's
+ // value attribute. WM browsers' PPRs don't contain UA-pixels in
+ // their request-headers. So during a WM browser's PPR, we need to
+ // manually (using JavaScript) set the field, UA-pixels, into
// the request-header with the hidden parameter's value.
-
- Map<String, String> headerMap =
+
+ Map<String, String> headerMap =
context.getExternalContext().getRequestHeaderMap();
-
+
_renderHiddenField(writer,
XhtmlConstants.WINDOWS_MOBILE_UAPIXELS,
headerMap.get("UA-pixels"));
-
+
}
else
{
@@ -354,17 +358,17 @@
}
}
- _renderNeededValues(context, arc);
+ _renderNeededValues(context, rc);
}
// Render submitFormCheck js function --
// checks if submitForm was rejected because form was incomplete
// when it was called, and thus calls submitForm again.
if (pprContext == null)
- _renderSubmitFormCheck(context, arc);
+ _renderSubmitFormCheck(context, rc);
// trigger the rendering of targeted resource
- // for the FORM, on UIViewRoot - if there are
+ // for the FORM, on UIViewRoot - if there are
// any...
encodeComponentResources(context, "form");
@@ -380,10 +384,11 @@
* @throws IOException
*/
private void _renderPostscriptElement(
- FacesContext context,
+ FacesContext context,
RenderingContext rc,
- ResponseWriter rw,
- final String postscriptId) throws IOException
+ ResponseWriter rw,
+ final String postscriptId
+ ) throws IOException
{
if (postscriptId != null)
{
@@ -432,19 +437,19 @@
@Override
public void tearDownEncodingContext(
- FacesContext context,
+ FacesContext context,
RenderingContext rc,
UIXComponent component)
{
// temp hack
tearDownEncodingContext(context, rc, (UIComponent)component);
}
-
+
@Override
public void tearDownEncodingContext(
- FacesContext context,
+ FacesContext context,
RenderingContext rc,
- UIComponent component)
+ UIComponent component)
{
// Clear out the form name property
rc.getProperties().remove(XhtmlConstants.FORM_NAME_PROPERTY);
@@ -453,28 +458,29 @@
rc.clearFormData();
}
-
/**
* Returns the inline Style used to render this node.
*/
@Override
- protected String getInlineStyle(FacesBean bean)
+ protected String getInlineStyle(
+ UIComponent component,
+ FacesBean bean)
{
- String inlineStyle = super.getInlineStyle(bean);
+ String inlineStyle = super.getInlineStyle(component, bean);
if (inlineStyle == null)
return "margin:0px";
return inlineStyle + ";margin:0px";
}
-
/**
* Render the client ID as both an "id" and a "name"
*/
@Override
protected void renderId(
FacesContext context,
- UIComponent component) throws IOException
+ UIComponent component
+ ) throws IOException
{
String clientId = getClientId(context, component);
@@ -496,18 +502,19 @@
// Renders reset call code
private static void _renderResetCalls(
- FacesContext context,
- RenderingContext arc) throws IOException
+ FacesContext context,
+ RenderingContext rc
+ ) throws IOException
{
// if scripting isn't supported, no need to do the rest
- if (!supportsScripting(arc))
+ if (!supportsScripting(rc))
return;
//
// Write the array of reset calls
//
- CoreFormData fData = (CoreFormData) arc.getFormData();
+ CoreFormData fData = (CoreFormData) rc.getFormData();
Map<String, String> resetCallMap = fData.getResetCalls(false);
int resetCallCount = (resetCallMap != null)
@@ -518,10 +525,10 @@
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement("script", null);
- renderScriptDeferAttribute(context, arc);
+ renderScriptDeferAttribute(context, rc);
// Bug #3426092:
// render the type="text/javascript" attribute in accessibility mode
- renderScriptTypeAttribute(context, arc);
+ renderScriptTypeAttribute(context, rc);
writer.writeText("TrPage.getInstance()._addResetCalls('", null);
writer.writeText(fData.getName(), null);
writer.writeText("',{", null);
@@ -558,7 +565,6 @@
}
-
// Renders validation code
// Code is of the form:
// - Dependencies, written sequentially
@@ -579,26 +585,26 @@
// - _Formats array: now used only for required messages
//
private static void _renderValidationScripts(
- FacesContext context,
- RenderingContext arc
+ FacesContext context,
+ RenderingContext rc
) throws IOException
{
// if scripting isn't supported, no need to do the rest
- if (!supportsScripting(arc))
+ if (!supportsScripting(rc))
return;
//
// Output validation-related JavaScript
//
ResponseWriter writer = context.getResponseWriter();
- CoreFormData fData = (CoreFormData) arc.getFormData();
+ CoreFormData fData = (CoreFormData) rc.getFormData();
// Fix up the form name for use as a Javascript identifier
String jsID = XhtmlUtils.getJSIdentifier(fData.getName());
writer.startElement("script", null);
- renderScriptDeferAttribute(context, arc);
- renderScriptTypeAttribute(context, arc);
+ renderScriptDeferAttribute(context, rc);
+ renderScriptTypeAttribute(context, rc);
//
// Write the array of client dependencies
@@ -614,24 +620,24 @@
writer.writeText(clientDependencies.get(d),null);
}
}
-
- RequestContext rc = RequestContext.getCurrentInstance();
- boolean isClientValidationDisabled =
- rc.getClientValidation() == RequestContext.ClientValidation.DISABLED;
+
+ RequestContext requestContext = RequestContext.getCurrentInstance();
+ boolean isClientValidationDisabled =
+ requestContext.getClientValidation() == RequestContext.ClientValidation.DISABLED;
// Only bother writing out the function when there's no PPR,
// as the content doesn't change request to request
- if (arc.getPartialPageContext() == null)
+ if (rc.getPartialPageContext() == null)
{
boolean isInline =
- (rc.getClientValidation() == RequestContext.ClientValidation.INLINE);
+ (requestContext.getClientValidation() == RequestContext.ClientValidation.INLINE);
//
// write the validation function for this form
//
writer.writeText("function _", null);
writer.writeText(jsID, null);
-
+
writer.writeText("Validator(f,s){return ", null);
if (isClientValidationDisabled)
@@ -647,18 +653,18 @@
{
writer.writeText("_validateAlert(f,s,null,\"", null);
writer.writeText(XhtmlUtils.escapeJS(
- arc.getTranslatedString(_GLOBAL_FORMAT_KEY)), null);
+ rc.getTranslatedString(_GLOBAL_FORMAT_KEY)), null);
writer.writeText("\",\"", null);
-
+
writer.writeText(XhtmlUtils.escapeJS(
- arc.getTranslatedString("af_form.SUBMIT_ERRORS")), null);
+ rc.getTranslatedString("af_form.SUBMIT_ERRORS")), null);
writer.writeText("\")", null);
}
-
+
writer.writeText(";}", null);
}
-
-
+
+
// If no client-side validation, return now
if (isClientValidationDisabled)
{
@@ -674,7 +680,7 @@
//
Map<String, List<CoreFormData.ConvertValidate>> validatorInfoMap =
fData.getFormValidatorsInfo(false);
-
+
if (validatorInfoMap != null)
{
writer.writeText("_addValidators(\"", null);
@@ -691,10 +697,10 @@
String clientId = validatorEntry.getKey();
List<CoreFormData.ConvertValidate> validatorInfoList =
validatorEntry.getValue();
-
+
for (CoreFormData.ConvertValidate convertValidate : validatorInfoList)
{
-
+
if (firstFormInfo)
{
firstFormInfo = false;
@@ -704,9 +710,9 @@
// write the separator every time except the first time
writer.writeText("],", null);
}
-
+
writer.writeText("\"", null);
-
+
// write the element name of the element to be validated
writer.writeText(clientId, null);
writer.writeText("\",", null);
@@ -714,17 +720,17 @@
// write out whether or not this element is required
writer.writeText(convertValidate.required? "1" : "0", null);
writer.writeText(",", null);
-
+
if (convertValidate.requiredFormatIndex != null)
{
// write out the index of the required error message
writer.writeText(convertValidate.requiredFormatIndex, null);
}
-
+
writer.writeText(",", null);
-
+
Object converterInfo = convertValidate.converter;
-
+
if (converterInfo != null)
{
writer.writeText(converterInfo, null);
@@ -733,15 +739,15 @@
{
writer.writeText("(void 0)", null);
}
-
+
writer.writeText(",[", null);
-
+
ArrayList<Integer> validatorInfo = convertValidate.validators;
if (validatorInfo != null)
{
boolean firstValidator = true;
-
+
int i = 0;
while (i < validatorInfo.size())
{
@@ -754,10 +760,10 @@
// write the separator every time except the first time
writer.writeText(",", null);
}
-
+
// write the validation string for the validater
writer.writeText(validatorInfo.get(i).toString(), null);
-
+
i = i + 1;
}
}
@@ -774,7 +780,7 @@
while(validationIterator.hasNext())
{
String currValidation = validationIterator.next();
-
+
if (firstValidation)
{
firstValidation = false;
@@ -784,7 +790,7 @@
// write the separator every time except the first time
writer.writeText(",", null);
}
-
+
// write the error format
// use single quotes since embedded single quotes
// are automatically escaped
@@ -794,37 +800,37 @@
}
}
-
+
writer.writeText("],{", null);
-
+
//
// Render the labels used by validated fields in this form
//
-
+
// list of labels used for validation on this form
List<String> inputList = fData.getValidatedInputList(false);
-
+
int inputCount = (inputList != null)
? inputList.size()
: 0;
-
+
if (inputCount > 0)
{
Map<String, String> labelMap = fData.getLabelMap(false);
-
+
if (labelMap != null)
{
boolean firstLabel = true;
-
+
for (int i = 0; i < inputCount; i++)
{
String currID = inputList.get(i);
-
+
// remove the ID entry to prevent multiple labels from
// being written
String currLabel = labelMap.remove(currID);
-
+
if (currLabel != null)
{
if (firstLabel)
@@ -836,7 +842,7 @@
// write the separator every time except the first time
writer.writeText(",", null);
}
-
+
// write the ID of the validated field as the key
writer.writeText("\'", null);
writer.writeText(currID, null);
@@ -854,18 +860,18 @@
//
// Render the error format list for this form
//
-
+
// list of error formats used for validation on this form
Iterator<String> errorFormatIterator = fData.getErrorFormatIterator();
if (errorFormatIterator != null)
{
boolean firstFormat = true;
-
+
while(errorFormatIterator.hasNext())
{
String currErrorFormat = errorFormatIterator.next();
-
+
if (firstFormat)
{
firstFormat = false;
@@ -875,7 +881,7 @@
// write the separator every time except the first time
writer.writeText(",", null);
}
-
+
// write the error format
writer.writeText("'", null);
writer.writeText(XhtmlUtils.escapeJS(currErrorFormat), null);
@@ -891,10 +897,9 @@
writer.endElement("script");
}
-
private static void _renderSubformLists(
- FacesContext context,
- String jsID
+ FacesContext context,
+ String jsID
) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
@@ -929,40 +934,37 @@
writer.writeText("};", null);
}
-
// render script which will check if submitForm script has been called before
// the form has rendered in its entirety, and if so, it will re-call
// submitForm.
// this script should be rendered at the very end of the form.
private static void _renderSubmitFormCheck(
- FacesContext context,
- RenderingContext arc
+ FacesContext context,
+ RenderingContext rc
) throws IOException
{
// if scripting isn't supported, no need to do the rest
- if (!supportsScripting(arc))
+ if (!supportsScripting(rc))
return;
ResponseWriter writer = context.getResponseWriter();
writer.startElement("script", null);
- renderScriptDeferAttribute(context, arc);
+ renderScriptDeferAttribute(context, rc);
// Bug #3426092:
// render the type="text/javascript" attribute in accessibility mode
- renderScriptTypeAttribute(context, arc);
+ renderScriptTypeAttribute(context, rc);
writer.writeText("_submitFormCheck();", null);
writer.endElement("script");
}
-
-
/**
* @param call a function call.
* "eval(call)" will be called on the client when resetting.
*/
public static void addResetCall(
- String clientId,
- String call
+ String clientId,
+ String call
)
{
CoreFormData fData = (CoreFormData)
@@ -1003,24 +1005,21 @@
* <code>targetID</code>
*/
public static void addLabelMapping(
- String targetID,
- String label
+ String targetID,
+ String label
)
{
FormData fData = RenderingContext.getCurrentInstance().getFormData();
fData.addLabel(targetID, label);
}
-
- public static int getInputTextCount(
- )
+ public static int getInputTextCount()
{
CoreFormData fData = (CoreFormData) RenderingContext.getCurrentInstance().getFormData();
return fData.getInputTextCount();
}
- public static void incrementInputTextCount(
- )
+ public static void incrementInputTextCount()
{
CoreFormData fData = (CoreFormData) RenderingContext.getCurrentInstance().getFormData();
fData.incrementInputTextCount();
@@ -1028,36 +1027,44 @@
// Returns the ID to use for our postscript if PPR is supported
private static String _getPostscriptId(
- RenderingContext arc,
- String formName
+ RenderingContext rc,
+ String formName
)
{
- if (PartialPageUtils.supportsPartialRendering(arc))
+ if (PartialPageUtils.supportsPartialRendering(rc))
return "tr_" + formName + "_Postscript";
return null;
}
- protected String getDefaultCommand(FacesBean bean)
+ protected String getDefaultCommand(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_defaultCommandKey));
}
- protected String getOnsubmit(FacesBean bean)
+ protected String getOnsubmit(
+ UIComponent component,
+ FacesBean bean)
{
if (_onsubmitKey == null)
return null;
- return toString(bean.getProperty(_onsubmitKey));
+ return XhtmlUtils.getClientEventHandler(FacesContext.getCurrentInstance(), component,
+ "submit", null, toString(bean.getProperty(_onsubmitKey)), null);
}
- protected String getTargetFrame(FacesBean bean)
+ protected String getTargetFrame(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_targetFrameKey));
}
-
- protected boolean getUsesUpload(FacesBean bean)
+ protected boolean getUsesUpload(
+ UIComponent component,
+ FacesBean bean)
{
Object o = bean.getProperty(_usesUploadKey);
if (o == null)
@@ -1066,16 +1073,15 @@
return Boolean.TRUE.equals(o);
}
-
protected String getFullOnkeypress(
- FacesContext context,
- UIComponent component,
- FacesBean bean,
- String clientId)
+ FacesContext context,
+ UIComponent component,
+ FacesBean bean,
+ String clientId)
{
- String onKeypress = super.getOnkeypress(bean);
+ String onKeypress = super.getOnkeypress(component, bean);
- String defaultCommand = getDefaultCommand(bean);
+ String defaultCommand = getDefaultCommand(component, bean);
String submitFunc = null;
@@ -1097,15 +1103,15 @@
{
immediate = 0;
}
-
+
//PPR
- Boolean ppr = (Boolean) defaultCommandComponent.getAttributes().get("partialSubmit");
+ Boolean ppr = (Boolean) defaultCommandComponent.getAttributes().get("partialSubmit");
if(ppr != null && ppr)
{
submitFunc = "return _submitOnEnter"
+ "(event,'" + clientId
+ "'," + "'" + defaultCommandId
- + "'," + immediate
+ + "'," + immediate
+ "," + true +");";
}
//no PPR
@@ -1114,7 +1120,7 @@
submitFunc = "return _submitOnEnter"
+ "(event,'" + clientId
+ "'," + "'" + defaultCommandId
- + "'," + immediate
+ + "'," + immediate
+ "," + false +");";
}
}
@@ -1131,13 +1137,17 @@
}
@Override
- protected String getOnkeypress(FacesBean bean)
+ protected String getOnkeypress(
+ UIComponent component,
+ FacesBean bean)
{
// Back out the default keypress, since we need more info
return null;
}
- protected String getAutoComplete(FacesBean bean)
+ protected String getAutoComplete(
+ UIComponent component,
+ FacesBean bean)
{
Object o = bean.getProperty(_autoCompleteKey);
if (o == null)
@@ -1147,8 +1157,8 @@
private static void _renderHiddenField(
ResponseWriter writer,
- Object name,
- Object value
+ Object name,
+ Object value
) throws IOException
{
writer.startElement("input", null);
@@ -1164,12 +1174,12 @@
* @see FormRenderer#encodeEnd(FacesContext,RenderingContext, UIComponent, FacesBean)
*/
static private void _renderNeededValues(
- FacesContext context,
- RenderingContext arc
+ FacesContext context,
+ RenderingContext rc
) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
- CoreFormData fData = (CoreFormData) arc.getFormData();
+ CoreFormData fData = (CoreFormData) rc.getFormData();
if (fData.useCompoundNames())
{
@@ -1198,7 +1208,7 @@
// the needed values, as we will be filling them
// in. For non-js platforms, use a value that will
// result in the value being passed to the server
- String neededValue = (supportsScripting(arc))
+ String neededValue = (supportsScripting(rc))
? null
: "a";
@@ -1227,13 +1237,13 @@
//
if (realNeededIndex > 0)
{
- if (supportsScripting(arc))
+ if (supportsScripting(rc))
{
writer.startElement("script", null);
- renderScriptDeferAttribute(context, arc);
+ renderScriptDeferAttribute(context, rc);
// Bug #3426092:
// render the type="text/javascript" attribute in accessibility mode
- renderScriptTypeAttribute(context, arc);
+ renderScriptTypeAttribute(context, rc);
writer.writeText("TrPage.getInstance()._addResetFields('", null);
writer.writeText(fData.getName(), null);
@@ -1254,7 +1264,6 @@
}
}
-
// key used to indicate whether or not usesUpload is used:
public static final Object USES_UPLOAD_KEY = new Object();
@@ -1271,4 +1280,4 @@
// FIXME: Nothing in this class is logged as of 2006-08-03
@SuppressWarnings("unused")
static private final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(FormRenderer.class);
-}
+}
\ No newline at end of file
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FrameBorderLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FrameBorderLayoutRenderer.java?rev=891522&r1=891521&r2=891522&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FrameBorderLayoutRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FrameBorderLayoutRenderer.java Thu Dec 17 02:33:05 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,6 +19,7 @@
package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
import java.io.IOException;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -26,9 +27,9 @@
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.html.HtmlFrameBorderLayout;
+import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-import org.apache.myfaces.trinidad.context.RenderingContext;
/**
* @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/ui/laf/base/xhtml/FrameBorderLayoutRenderer.java#0 $) $Date: 10-nov-2005.18:53:53 $
@@ -40,23 +41,25 @@
this(HtmlFrameBorderLayout.TYPE);
}
- protected FrameBorderLayoutRenderer(FacesBean.Type type)
+ protected FrameBorderLayoutRenderer(
+ FacesBean.Type type)
{
super(type);
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
-
+
_onloadKey = type.findKey("onload");
_onunloadKey = type.findKey("onunload");
_frameSpacingKey = type.findKey("frameSpacing");
_borderWidthKey = type.findKey("borderWidth");
_frameBorderWidthKey = type.findKey("frameBorderWidth");
}
-
+
@Override
public boolean getRendersChildren()
{
@@ -66,19 +69,21 @@
@Override
protected void renderAllAttributes(
- FacesContext context,
- RenderingContext arc,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
-
- renderShortDescAttribute(context, arc, bean);
- renderStyleAttributes(context, arc, bean);
+
+ renderShortDescAttribute(context, rc, component, bean);
+ renderStyleAttributes(context, rc, component, bean);
// Explicitly render rows to ensure onunload handler will fire
writer.writeAttribute(XhtmlConstants.ROWS_ATTRIBUTE, "100%,*", null);
- if (supportsScripting(arc))
+ if (supportsScripting(rc))
{
writer.writeAttribute("onload",
bean.getProperty(_onloadKey),
@@ -112,18 +117,19 @@
@Override
protected final void encodeAll(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement("frameset", component);
renderId(context, component);
- renderAllAttributes(context, arc, bean);
-
+ renderAllAttributes(context, rc, component, bean);
+
String leftName = HtmlFrameBorderLayout.LEFT_FACET;
String innerLeftName = HtmlFrameBorderLayout.INNER_LEFT_FACET;
String rightName = HtmlFrameBorderLayout.RIGHT_FACET;
@@ -137,7 +143,7 @@
UIComponent innerLeft = getFacet(component, innerLeftName);
UIComponent innerRight = getFacet(component, innerRightName);
- boolean r2l = arc.getLocaleContext().isRightToLeft();
+ boolean r2l = rc.getLocaleContext().isRightToLeft();
if (left == null)
{
leftName = r2l ? HtmlFrameBorderLayout.END_FACET : HtmlFrameBorderLayout.START_FACET;
@@ -177,17 +183,17 @@
{
// this frameset contains the top and bottom children
writer.startElement("frameset", null);
- if (!isInaccessibleMode(arc))
+ if (!isInaccessibleMode(rc))
{
writer.writeAttribute(
"title",
- arc.getTranslatedString(
+ rc.getTranslatedString(
"af_frameBorderLayout.HORIZONTAL_FRAMESET_LAYOUT_CONTAINER_TITLE"),
null);
}
writer.writeAttribute(XhtmlConstants.ROWS_ATTRIBUTE, sizes, null);
-
- _renderFrameBorderAndSpacing(writer, bean);
+
+ _renderFrameBorderAndSpacing(writer, component, bean);
}
_encodeFacet(context, top);
@@ -208,19 +214,19 @@
{
// this frameset renders the left, center and right children
writer.startElement("frameset", null);
- if (!isInaccessibleMode(arc))
+ if (!isInaccessibleMode(rc))
{
writer.writeAttribute(
"title",
- arc.getTranslatedString(
+ rc.getTranslatedString(
"af_frameBorderLayout.VERTICAL_FRAMESET_LAYOUT_CONTAINER_TITLE"),
null);
}
writer.writeAttribute(XhtmlConstants.COLS_ATTRIBUTE, sizes, null);
-
- _renderFrameBorderAndSpacing(writer, bean);
+
+ _renderFrameBorderAndSpacing(writer, component, bean);
}
-
+
_encodeFacet(context, left);
_encodeFacet(context, innerLeft);
_encodeFacet(context, center);
@@ -241,12 +247,11 @@
writer.endElement("frameset");
}
-
UIComponent alternateContent = getFacet(component,
HtmlFrameBorderLayout.ALTERNATE_CONTENT_FACET);
if (alternateContent != null)
{
- writer.startElement("noframes", null);
+ writer.startElement("noframes", null);
encodeChild(context, alternateContent);
writer.endElement("noframes");
}
@@ -259,7 +264,7 @@
UIComponent inner1,
UIComponent inner2,
UIComponent outer2,
- String attr)
+ String attr)
{
StringBuffer buf = new StringBuffer(17);
@@ -280,9 +285,10 @@
return buf.toString();
}
- private StringBuffer _getPropertyValue(UIComponent frame,
- String attr,
- StringBuffer result)
+ private StringBuffer _getPropertyValue(
+ UIComponent frame,
+ String attr,
+ StringBuffer result)
{
Object val = frame.getAttributes().get(attr);
@@ -297,8 +303,10 @@
return result;
}
- private void _encodeFacet(FacesContext context,
- UIComponent component) throws IOException
+ private void _encodeFacet(
+ FacesContext context,
+ UIComponent component
+ ) throws IOException
{
if (component != null)
{
@@ -306,15 +314,20 @@
}
}
- private void _renderFrameBorderAndSpacing(ResponseWriter writer,
- FacesBean bean) throws IOException
- {
- writer.writeAttribute("framespacing", _getFrameSpacing(bean), "frameSpacing");
- writer.writeAttribute("border", _getBorderWidth(bean), "borderWidth");
- writer.writeAttribute("frameborder", _getFrameBorderWidth(bean), "frameBorderWidth");
+ private void _renderFrameBorderAndSpacing(
+ ResponseWriter writer,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
+ {
+ writer.writeAttribute("framespacing", _getFrameSpacing(component, bean), "frameSpacing");
+ writer.writeAttribute("border", _getBorderWidth(component, bean), "borderWidth");
+ writer.writeAttribute("frameborder", _getFrameBorderWidth(component, bean), "frameBorderWidth");
}
-
- private Object _getFrameSpacing(FacesBean bean)
+
+ private Object _getFrameSpacing(
+ UIComponent component,
+ FacesBean bean)
{
Object value = bean.getProperty(_frameSpacingKey);
if (value == null)
@@ -323,7 +336,9 @@
return value;
}
- private Object _getBorderWidth(FacesBean bean)
+ private Object _getBorderWidth(
+ UIComponent component,
+ FacesBean bean)
{
Object value = bean.getProperty(_borderWidthKey);
if (value == null)
@@ -332,8 +347,9 @@
return value;
}
-
- private Object _getFrameBorderWidth(FacesBean bean)
+ private Object _getFrameBorderWidth(
+ UIComponent component,
+ FacesBean bean)
{
Object value = bean.getProperty(_frameBorderWidthKey);
if (value == null)
@@ -342,7 +358,6 @@
return value;
}
-
private PropertyKey _onloadKey;
private PropertyKey _onunloadKey;
private PropertyKey _frameSpacingKey;
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FrameRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FrameRenderer.java?rev=891522&r1=891521&r2=891522&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FrameRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FrameRenderer.java Thu Dec 17 02:33:05 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -26,11 +26,11 @@
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
-import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.component.html.HtmlFrame;
import org.apache.myfaces.trinidad.component.html.HtmlFrameBorderLayout;
-
import org.apache.myfaces.trinidad.context.RenderingContext;
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+
/**
* Renders a frame.
@@ -44,13 +44,15 @@
this(HtmlFrame.TYPE);
}
- protected FrameRenderer(FacesBean.Type type)
+ protected FrameRenderer(
+ FacesBean.Type type)
{
super(type);
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
@@ -60,7 +62,7 @@
_longDescUrlKey = type.findKey("longDescURL");
_scrollingKey = type.findKey("scrolling");
}
-
+
@Override
public boolean getRendersChildren()
{
@@ -69,21 +71,23 @@
@Override
protected void renderAllAttributes(
- FacesContext context,
- RenderingContext rc,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
- renderShortDescAttribute(context, rc, bean);
- renderStyleAttributes(context, rc, bean);
-
+ renderShortDescAttribute(context, rc, component, bean);
+ renderStyleAttributes(context, rc, component, bean);
+
writer.writeAttribute("frameborder", "0", null);
- writer.writeAttribute("marginwidth",
- getMarginWidth(bean),
+ writer.writeAttribute("marginwidth",
+ getMarginWidth(component, bean),
"marginWidth");
writer.writeAttribute("marginheight",
- getMarginHeight(bean),
+ getMarginHeight(component, bean),
"marginHeight");
writer.writeAttribute("noresize", Boolean.TRUE, null);
@@ -99,7 +103,9 @@
"scrolling");
}
- protected Object getMarginWidth(FacesBean bean)
+ protected Object getMarginWidth(
+ UIComponent component,
+ FacesBean bean)
{
Object value = bean.getProperty(_marginWidthKey);
if (value == null)
@@ -107,7 +113,9 @@
return value;
}
- protected Object getMarginHeight(FacesBean bean)
+ protected Object getMarginHeight(
+ UIComponent component,
+ FacesBean bean)
{
Object value = bean.getProperty(_marginHeightKey);
if (value == null)
@@ -121,7 +129,8 @@
@Override
protected void renderId(
FacesContext context,
- UIComponent component) throws IOException
+ UIComponent component
+ ) throws IOException
{
if (shouldRenderId(context, component))
{
@@ -133,10 +142,11 @@
@Override
protected final void encodeAll(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
UIComponent parent = component.getParent();
@@ -151,10 +161,10 @@
else
{
ResponseWriter writer = context.getResponseWriter();
-
+
writer.startElement("frame", component);
renderId(context, component);
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, component, bean);
writer.endElement("frame");
}
}
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/GoButtonRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/GoButtonRenderer.java?rev=891522&r1=891521&r2=891522&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/GoButtonRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/GoButtonRenderer.java Thu Dec 17 02:33:05 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -27,13 +27,14 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.apache.myfaces.trinidad.util.StringUtils;
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.core.nav.CoreGoButton;
import org.apache.myfaces.trinidad.context.RenderingContext;
+import org.apache.myfaces.trinidad.util.StringUtils;
import org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.XhtmlLafConstants;
+
/**
* FIXME: the inheritance hierarchy is a bit annoying: should
* we extend CommandButtonRenderer or GoLinkRenderer? Either
@@ -46,19 +47,20 @@
this(CoreGoButton.TYPE);
}
- protected GoButtonRenderer(FacesBean.Type type)
+ protected GoButtonRenderer(
+ FacesBean.Type type)
{
super(type);
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_iconKey = type.findKey("icon");
}
-
@Override
public boolean getRendersChildren()
{
@@ -67,39 +69,40 @@
@Override
protected void encodeAll(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
String clientId = component.getClientId(context);
- if (canSkipRendering(arc, clientId))
+ if (canSkipRendering(rc, clientId))
return;
// Make sure we don't have anything to save
- assert(arc.getCurrentClientId() == null);
- arc.setCurrentClientId(clientId);
+ assert(rc.getCurrentClientId() == null);
+ rc.setCurrentClientId(clientId);
String element;
- boolean useButton = false;
+ boolean useButton = false;
boolean useInput = false;
boolean supportScriptEvents = false;
boolean imageLink = false;
boolean iconAvailable = false;
- String icon = getIcon(bean);
+ String icon = getIcon(component, bean);
if (icon != null)
{
iconAvailable = true;
}
- if ((supportsScripting(arc) && supportsIntrinsicEvents(arc)))
+ if ((supportsScripting(rc) && supportsIntrinsicEvents(rc)))
{
supportScriptEvents = true;
}
-
+
if (supportScriptEvents)
{
- if (supportsAdvancedForms(arc))
+ if (supportsAdvancedForms(rc))
{
element = XhtmlLafConstants.BUTTON_ELEMENT;
useButton = true;
@@ -107,7 +110,7 @@
//if icon is set, render as an image element within a link element
//since "buttons" html element is not supported and "input" element of
//type=image does not support "onClick" JS handler.
- else if (iconAvailable && !supportsOnClickOnImgInput(arc))
+ else if (iconAvailable && !supportsOnClickOnImgInput(rc))
{
element = XhtmlLafConstants.LINK_ELEMENT;
imageLink = true;
@@ -122,41 +125,41 @@
{
element = XhtmlLafConstants.LINK_ELEMENT;
}
-
+
ResponseWriter rw = context.getResponseWriter();
- boolean disabled = getDisabled(bean);
+ boolean disabled = getDisabled(component, bean);
rw.startElement(element, component);
renderId(context, component);
-
+
if (supportScriptEvents)
- {
+ {
if (useInput && iconAvailable)
{
rw.writeAttribute("type", "image", null);
- }
- //For any element like <button> or <input> except <a> set type to "button"
+ }
+ //For any element like <button> or <input> except <a> set type to "button"
else if (!imageLink)
{
- rw.writeAttribute("type", "button", null);
+ rw.writeAttribute("type", "button", null);
}
- // If disabled, render "disable" only for <input> and <button> elements
+ // If disabled, render "disable" only for <input> and <button> elements
if (!imageLink && disabled)
{
rw.writeAttribute("disabled", Boolean.TRUE, "disabled");
}
}
-
- if (disabled || !supportsNavigation(arc))
+
+ if (disabled || !supportsNavigation(rc))
{
// Skip over event attributes when disabled
- renderStyleAttributes(context, arc, bean);
+ renderStyleAttributes(context, rc, component, bean);
}
else
{
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, component, bean);
if (supportScriptEvents)
{
- rw.writeAttribute("onclick", getButtonOnclick(bean), null);
+ rw.writeAttribute("onclick", getButtonOnclick(component, bean), null);
if (imageLink)
{
renderEncodedActionURI(context, XhtmlConstants.HREF_ATTRIBUTE, "#");
@@ -164,11 +167,12 @@
}
else
{
- renderEncodedActionURI(context, XhtmlConstants.HREF_ATTRIBUTE, getDestination(bean));
-
- if (supportsTarget(arc))
+ renderEncodedActionURI(context, XhtmlConstants.HREF_ATTRIBUTE,
+ getDestination(component, bean));
+
+ if (supportsTarget(rc))
{
- rw.writeAttribute("target", getTargetFrame(bean), null);
+ rw.writeAttribute("target", getTargetFrame(component, bean), null);
}
}
}
@@ -176,9 +180,9 @@
// Write the text and access key
char accessKey;
- if (supportsAccessKeys(arc))
+ if (supportsAccessKeys(rc))
{
- accessKey = getAccessKey(bean);
+ accessKey = getAccessKey(component, bean);
if (accessKey != CHAR_UNDEFINED)
{
rw.writeAttribute("accesskey",
@@ -191,46 +195,46 @@
accessKey = CHAR_UNDEFINED;
}
- String text = getText(bean);
-
+ String text = getText(component, bean);
+
if (useButton)
{
-
+
AccessKeyUtils.renderAccessKeyText(context,
text,
accessKey,
SkinSelectors.AF_ACCESSKEY_STYLE_CLASS);
if (icon != null)
- OutputUtils.renderImage(context, arc, icon, null, null, null,
- getShortDesc(bean));
+ OutputUtils.renderImage(context, rc, icon, null, null, null,
+ getShortDesc(component, bean));
}
// For PDAs, render only the image if icon is available
- else if (!supportScriptEvents)
+ else if (!supportScriptEvents)
{
if(iconAvailable)
{
-
- OutputUtils.renderImage(context, arc, icon, null, null, null,
- getShortDesc(bean));
+
+ OutputUtils.renderImage(context, rc, icon, null, null, null,
+ getShortDesc(component, bean));
}
else
{
-
+
AccessKeyUtils.renderAccessKeyText(context,
text,
accessKey,
- SkinSelectors.AF_ACCESSKEY_STYLE_CLASS);
+ SkinSelectors.AF_ACCESSKEY_STYLE_CLASS);
}
}
- else
+ else
{
// Render an image tag inside the anchor tag
if (imageLink)
{
- OutputUtils.renderImage(context, arc, icon, null, null, null,
- getShortDesc(bean));
+ OutputUtils.renderImage(context, rc, icon, null, null, null,
+ getShortDesc(component, bean));
}
- // For input element render src attribute to the url of the icon
+ // For input element render src attribute to the url of the icon
else if (iconAvailable)
{
renderEncodedResourceURI(context, "src", icon);
@@ -242,20 +246,21 @@
}
rw.endElement(element);
- arc.setCurrentClientId(null);
+ rc.setCurrentClientId(null);
}
/**
* Override to return any state-based (selected, disabled, etc.)
- * CSS style markers. HINT: use an immutable, cached List<String>
+ * CSS style markers. HINT: use an immutable, cached List<String>
* for better performance.
*/
protected List<String> getStateStyleClasses(
- FacesContext context,
- RenderingContext arc,
- FacesBean bean)
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean)
{
- if (getDisabled(bean))
+ if (getDisabled(component, bean))
return _DISABLED_STATE_LIST;
return null;
}
@@ -263,22 +268,24 @@
// FIXME: move this implementation to XhtmlRenderer
@Override
protected void renderStyleAttributes(
- FacesContext context,
- RenderingContext arc,
- FacesBean bean,
- String defaultStyleClass) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean,
+ String defaultStyleClass
+ ) throws IOException
{
- String styleClass = getStyleClass(bean);
+ String styleClass = getStyleClass(component, bean);
// -= Simon =-
// FIXME: How come inlineStyle is never read
//String inlineStyle = getInlineStyle(bean);
- List<String> stateStyleClasses = getStateStyleClasses(context, arc, bean);
+ List<String> stateStyleClasses = getStateStyleClasses(context, rc, component, bean);
if ((styleClass==null) &&
(defaultStyleClass != null) &&
(stateStyleClasses == null))
{
- renderStyleClass(context, arc, defaultStyleClass);
+ renderStyleClass(context, rc, defaultStyleClass);
}
else
{
@@ -304,11 +311,11 @@
styleClasses[i] = stateStyleClasses.get(j);
}
- renderStyleClasses(context, arc, styleClasses);
+ renderStyleClasses(context, rc, styleClasses);
}
}
- String style = getInlineStyle(bean);
+ String style = getInlineStyle(component, bean);
if (style != null)
{
context.getResponseWriter().writeAttribute("style",
@@ -318,15 +325,19 @@
}
@Override
- protected String getOnclick(FacesBean bean)
+ protected String getOnclick(
+ UIComponent component,
+ FacesBean bean)
{
return null;
}
- protected String getButtonOnclick(FacesBean bean)
+ protected String getButtonOnclick(
+ UIComponent component,
+ FacesBean bean)
{
- String base = super.getOnclick(bean);
- String destination = getDestination(bean);
+ String base = super.getOnclick(component, bean);
+ String destination = getDestination(component, bean);
if (destination == null)
return base;
@@ -344,7 +355,7 @@
// Escape the destination in case there's any quotes
destination = StringUtils.replace(destination, "'", "\\'");
- String targetFrame = getTargetFrame(bean);
+ String targetFrame = getTargetFrame(component, bean);
// Look for target frames with well-known names, like
// _self, _top, _parent, _blank, and _new. (_new
// is actually non-standard, but often used for _blank)
@@ -381,12 +392,16 @@
}
@Override
- protected String getDefaultStyleClass(FacesBean bean)
+ protected String getDefaultStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
return SkinSelectors.AF_GO_BUTTON_STYLE_CLASS;
}
- protected String getIcon(FacesBean bean)
+ protected String getIcon(
+ UIComponent component,
+ FacesBean bean)
{
return toResourceUri(FacesContext.getCurrentInstance(), bean.getProperty(_iconKey));
}
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/GoLinkRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/GoLinkRenderer.java?rev=891522&r1=891521&r2=891522&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/GoLinkRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/GoLinkRenderer.java Thu Dec 17 02:33:05 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -27,10 +27,11 @@
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.core.nav.CoreGoLink;
-import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
import org.apache.myfaces.trinidad.context.RenderingContext;
+import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext;
+
public class GoLinkRenderer extends XhtmlRenderer
{
public GoLinkRenderer()
@@ -38,13 +39,15 @@
this(CoreGoLink.TYPE);
}
- protected GoLinkRenderer(FacesBean.Type type)
+ protected GoLinkRenderer(
+ FacesBean.Type type)
{
super(type);
}
-
+
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_accessKeyKey = type.findKey("accessKey");
@@ -58,27 +61,28 @@
@Override
protected void encodeBegin(
- FacesContext context,
- RenderingContext arc,
- UIComponent comp,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent comp,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
rw.startElement("a", comp);
- if (getDisabled(bean) || !supportsNavigation(arc))
+ if (getDisabled(comp, bean) || !supportsNavigation(rc))
{
renderId(context, comp);
- renderStyleAttributes(context, arc, bean);
+ renderStyleAttributes(context, rc, comp, bean);
}
else
{
renderId(context, comp);
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, comp, bean);
// If we have an onclick handler, always provide a destination
- String destination = getDestination(bean);
- if ((destination == null) && hasOnclick(bean))
+ String destination = getDestination(comp, bean);
+ if ((destination == null) && hasOnclick(comp, bean))
{
destination = "#";
}
@@ -86,40 +90,41 @@
renderEncodedActionURI(context, "href", destination);
if (!Boolean.FALSE.equals(
- arc.getAgent().getCapabilities().get(TrinidadAgent.CAP_TARGET)))
+ rc.getAgent().getCapabilities().get(TrinidadAgent.CAP_TARGET)))
{
- rw.writeAttribute("target", getTargetFrame(bean), null);
+ rw.writeAttribute("target", getTargetFrame(comp, bean), null);
}
}
char accessKey;
- if (supportsAccessKeys(arc))
+ if (supportsAccessKeys(rc))
{
- accessKey = getAccessKey(bean);
+ accessKey = getAccessKey(comp, bean);
if (accessKey != CHAR_UNDEFINED)
{
rw.writeAttribute("accesskey",
Character.valueOf(accessKey),
"accessKey");
- }
+ }
}
else
{
accessKey = CHAR_UNDEFINED;
}
-
+
AccessKeyUtils.renderAccessKeyText(context,
- getText(bean),
+ getText(comp, bean),
accessKey,
SkinSelectors.AF_LINKACCESSKEY_STYLE_CLASS);
}
@Override
public void encodeEnd(
- FacesContext context,
- RenderingContext arc,
- UIComponent comp,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent comp,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
rw.endElement("a");
@@ -131,7 +136,8 @@
@Override
protected void renderId(
FacesContext context,
- UIComponent component) throws IOException
+ UIComponent component
+ ) throws IOException
{
if (shouldRenderId(context, component))
{
@@ -145,26 +151,33 @@
@Override
protected void renderEventHandlers(
FacesContext context,
- FacesBean bean) throws IOException
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
- super.renderEventHandlers(context, bean);
+ super.renderEventHandlers(context, component, bean);
ResponseWriter rw = context.getResponseWriter();
- rw.writeAttribute("onblur", getOnblur(bean), "onblur");
- rw.writeAttribute("onfocus", getOnfocus(bean), "onfocus");
+ rw.writeAttribute("onblur", getOnblur(component, bean), "onblur");
+ rw.writeAttribute("onfocus", getOnfocus(component, bean), "onfocus");
}
-
- protected char getAccessKey(FacesBean bean)
+ protected char getAccessKey(
+ UIComponent component,
+ FacesBean bean)
{
return toChar(bean.getProperty(_accessKeyKey));
}
- protected String getDestination(FacesBean bean)
+ protected String getDestination(
+ UIComponent component,
+ FacesBean bean)
{
return toResourceUri(FacesContext.getCurrentInstance(), bean.getProperty(_destinationKey));
}
- protected boolean getDisabled(FacesBean bean)
+ protected boolean getDisabled(
+ UIComponent component,
+ FacesBean bean)
{
Object o = bean.getProperty(_disabledKey);
if (o == null)
@@ -176,46 +189,60 @@
/**
* Returns true if the bean has onclick; provided so
* subclasses that always have onclick can override.
- */
- protected boolean hasOnclick(FacesBean bean)
+ */
+ protected boolean hasOnclick(
+ UIComponent component,
+ FacesBean bean)
{
- return getOnclick(bean) != null;
+ return getOnclick(component, bean) != null;
}
- protected String getOnblur(FacesBean bean)
+ protected String getOnblur(
+ UIComponent component,
+ FacesBean bean)
{
if (_onblurKey == null)
return null;
- return toString(bean.getProperty(_onblurKey));
+ return XhtmlUtils.getClientEventHandler(FacesContext.getCurrentInstance(), component,
+ "blur", null, toString(bean.getProperty(_onblurKey)), null);
}
- protected String getOnfocus(FacesBean bean)
+ protected String getOnfocus(
+ UIComponent component,
+ FacesBean bean)
{
if (_onfocusKey == null)
return null;
- return toString(bean.getProperty(_onfocusKey));
+ return XhtmlUtils.getClientEventHandler(FacesContext.getCurrentInstance(), component,
+ "focus", null, toString(bean.getProperty(_onfocusKey)), null);
}
- protected String getTargetFrame(FacesBean bean)
+ protected String getTargetFrame(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_targetFrameKey));
}
- protected String getText(FacesBean bean)
+ protected String getText(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_textKey));
}
@Override
- protected String getDefaultStyleClass(FacesBean bean)
+ protected String getDefaultStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
RenderingContext arc = RenderingContext.getCurrentInstance();
if (((CoreRenderingContext) arc).isDefaultLinkStyleDisabled())
return null;
- if (getDisabled(bean))
+ if (getDisabled(component, bean))
return SkinSelectors.LINK_DISABLED_STYLE_CLASS;
else
return SkinSelectors.LINK_STYLE_CLASS;
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java?rev=891522&r1=891521&r2=891522&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java Thu Dec 17 02:33:05 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -37,19 +37,21 @@
* @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/renderkit/core/xhtml/HeadRenderer.java#0 $) $Date: 10-nov-2005.19:01:29 $
*/
public class HeadRenderer extends XhtmlRenderer
-{
+{
public HeadRenderer()
{
this(HtmlHead.TYPE);
}
- protected HeadRenderer(FacesBean.Type type)
+ protected HeadRenderer(
+ FacesBean.Type type)
{
super(type);
}
-
+
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_titleKey = type.findKey("title");
@@ -57,16 +59,17 @@
@Override
protected void encodeBegin(
- FacesContext context,
- RenderingContext arc,
- UIComponent comp,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent comp,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
rw.startElement("head", comp);
renderId(context, comp);
- String title = getTitle(bean);
+ String title = getTitle(comp, bean);
if (title != null)
{
rw.startElement("title", null);
@@ -74,30 +77,33 @@
rw.endElement("title");
}
- // Write the META generator tag
+ // Write the META generator tag
_writeGeneratorTag(context);
- delegateRenderer(context, arc, comp, bean, _styleSheetRenderer);
+ delegateRenderer(context, rc, comp, bean, _styleSheetRenderer);
}
@Override
protected void encodeEnd(
- FacesContext context,
- RenderingContext arc,
- UIComponent comp,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent comp,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
-
+
// trigger the rendering of targeted resource
- // for the HEAD, on UIViewRoot - if there are
+ // for the HEAD, on UIViewRoot - if there are
// any...
encodeComponentResources(context, "head");
rw.endElement("head");
}
- protected String getTitle(FacesBean bean)
+ protected String getTitle(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_titleKey));
}
@@ -106,20 +112,18 @@
* Writes the META generator tag that identifies the technology
* generating the page.
*/
- static private void _writeGeneratorTag(FacesContext context)
- throws IOException
+ static private void _writeGeneratorTag(
+ FacesContext context
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
-
+
writer.startElement("meta", null);
writer.writeAttribute("name", "generator", null);
writer.writeAttribute("content", "Apache MyFaces Trinidad", null);
writer.endElement("meta");
}
-
-
-
private CoreRenderer _styleSheetRenderer = new StyleSheetRenderer()
{
// Don't render the ID
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HtmlRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HtmlRenderer.java?rev=891522&r1=891521&r2=891522&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HtmlRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HtmlRenderer.java Thu Dec 17 02:33:05 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -30,9 +30,9 @@
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.html.HtmlFrameBorderLayout;
import org.apache.myfaces.trinidad.component.html.HtmlHtml;
-
import org.apache.myfaces.trinidad.context.RenderingContext;
+
/**
* Renderer for rendering the root document element
* <p>
@@ -44,11 +44,12 @@
* Identify if standards mode has been disabled.
* =-=AEW Is this the correct place?
*/
- static public boolean isStandardsModeDisabled(FacesContext context)
+ static public boolean isStandardsModeDisabled(
+ FacesContext context)
{
- String disableStandardsMode =
+ String disableStandardsMode =
context.getExternalContext().getInitParameter(_DISABLE_STANDARDS_MODE);
-
+
return ((disableStandardsMode != null) &&
disableStandardsMode.equalsIgnoreCase("true"));
}
@@ -58,13 +59,15 @@
this(HtmlHtml.TYPE);
}
- protected HtmlRenderer(FacesBean.Type type)
+ protected HtmlRenderer(
+ FacesBean.Type type)
{
super(type);
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_modeKey = type.findKey("mode");
@@ -72,10 +75,11 @@
@Override
protected void encodeBegin(
- FacesContext context,
- RenderingContext arc,
- UIComponent comp,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent comp,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
@@ -100,11 +104,11 @@
}
}
- String direction = arc.isRightToLeft() ? "rtl" : "ltr";
+ String direction = rc.isRightToLeft() ? "rtl" : "ltr";
writer.writeAttribute("dir", direction, null);
// render the correct language
- String lang = arc.getLocaleContext().getTranslationIANALocaleString();
+ String lang = rc.getLocaleContext().getTranslationIANALocaleString();
if (lang != null)
{
if (isXML)
@@ -116,16 +120,19 @@
@Override
public void encodeEnd(
- FacesContext context,
- RenderingContext arc,
- UIComponent comp,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent comp,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
rw.endElement("html");
}
- protected String getMode(FacesBean bean)
+ protected String getMode(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_modeKey));
}
@@ -152,11 +159,10 @@
}
else
{
- return getDocumentDocType(context, bean);
+ return getDocumentDocType(context, component, bean);
}
}
-
/**
* Returns the document type to use when rendering a frame set, as
* opposed to a document.
@@ -175,17 +181,17 @@
}
}
-
/**
* Returns the document type to use when rendering a document, as opposed
* to a frameset.
*/
protected String getDocumentDocType(
FacesContext context,
+ UIComponent component,
FacesBean bean
)
{
- String mode = getMode(bean);
+ String mode = getMode(component, bean);
// default to transitional, rather than strict
if (isXMLDocument(context))
{
@@ -205,7 +211,6 @@
}
}
-
/**
* Determines whether we have a frameset component as a child
* for determining which doctype to return
@@ -218,13 +223,12 @@
if (HtmlFrameBorderLayout.COMPONENT_FAMILY.equals(child.getFamily()))
{
return true;
- }
+ }
}
return false;
}
-
/**
* Returns the XML namespace to use for this document
*/
@@ -233,7 +237,6 @@
return "http://www.w3.org/1999/xhtml";
}
-
/**
* Returns true if we are rendering an XML document
*/
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/IconRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/IconRenderer.java?rev=891522&r1=891521&r2=891522&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/IconRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/IconRenderer.java Thu Dec 17 02:33:05 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -29,10 +29,10 @@
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.core.output.CoreIcon;
-import org.apache.myfaces.trinidad.util.ArrayMap;
-
import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidad.skin.Icon;
+import org.apache.myfaces.trinidad.util.ArrayMap;
+
public class IconRenderer extends XhtmlRenderer
{
@@ -42,7 +42,8 @@
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_nameKey = type.findKey("name");
@@ -50,19 +51,20 @@
@Override
protected void encodeBegin(
- FacesContext context,
- RenderingContext arc,
- UIComponent comp,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent comp,
+ FacesBean bean
+ ) throws IOException
{
- if (canSkipRendering(context, arc, comp))
+ if (canSkipRendering(context, rc, comp))
return;
- String name = getName(bean);
+ String name = getName(comp, bean);
ResponseWriter rw = context.getResponseWriter();
-
+
// special case for extra skinning of margins in the PanelPage branding
// The span is written out here because the writer
// needs to see the UIComponent.
@@ -70,8 +72,8 @@
{
rw.startElement("img", comp);
renderId(context, comp);
- renderAllAttributes(context, arc, bean, false);
- renderStyleAttributes(context, arc, bean, "AFLogo");
+ renderAllAttributes(context, rc, comp, bean, false);
+ renderStyleAttributes(context, rc, comp, bean, "AFLogo");
renderEncodedResourceURI(
context,
"src",
@@ -81,8 +83,8 @@
}
else
{
- Icon icon = arc.getIcon(name);
-
+ Icon icon = rc.getIcon(name);
+
if (icon == null)
{
StringBuffer fullName = new StringBuffer(_ICON_NAME_PREFIX.length() +
@@ -93,37 +95,37 @@
fullName.append(firstChar);
fullName.append(name.substring(1));
fullName.append(_ICON_NAME_SUFFIX);
- icon = arc.getIcon(fullName.toString());
+ icon = rc.getIcon(fullName.toString());
}
-
+
// If we've got an Icon, and it has content, render it
if ((icon != null) && !icon.isNull())
{
rw.startElement("span", comp);
// If this icon renders as an image, don't embed it in a span
- boolean embed = icon.getImageURI(context, arc) == null;
+ boolean embed = icon.getImageURI(context, rc) == null;
if (embed)
{
renderId(context, comp);
// Don't render style class, as it's handled by the icon code
- renderAllAttributes(context, arc, bean, false);
+ renderAllAttributes(context, rc, comp, bean, false);
}
// ... unless we have inlineStyle or Javascript, which won't
// get rendered on the icon itself. If none are present,
// our ResponseWriter will trim the unneeded span
else
{ // render the events only if the browser supports JavaScript
- if (supportsScripting(arc))
+ if (supportsScripting(rc))
{
- renderEventHandlers(context, bean);
+ renderEventHandlers(context, comp, bean);
}
}
// inlineStyle, if set, always goes on the span (today)
- renderInlineStyle(context, arc, bean);
-
- icon.renderIcon(context, arc,
+ renderInlineStyle(context, rc, comp, bean);
+
+ icon.renderIcon(context, rc,
_getNodeAttributeMap(context, comp, bean, embed));
rw.endElement("span");
}
@@ -132,29 +134,33 @@
@Override
protected void renderShortDescAttribute(
- FacesContext context,
- RenderingContext arc,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
// do nothing, handled by the icon renderer
}
- protected String getName(FacesBean bean)
+ protected String getName(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_nameKey));
}
private Map<String, Object> _getNodeAttributeMap(
- FacesContext context,
- UIComponent comp,
- FacesBean bean,
- boolean embed)
+ FacesContext context,
+ UIComponent comp,
+ FacesBean bean,
+ boolean embed)
{
Map<String, Object> attrs = null;
attrs = new ArrayMap<String, Object>(1);
- attrs.put(Icon.SHORT_DESC_KEY, getShortDesc(bean));
- attrs.put(Icon.STYLE_CLASS_KEY, getStyleClass(bean));
+ attrs.put(Icon.SHORT_DESC_KEY, getShortDesc(comp, bean));
+ attrs.put(Icon.STYLE_CLASS_KEY, getStyleClass(comp, bean));
if (embed)
{