You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by ma...@apache.org on 2006/07/25 04:42:46 UTC
svn commit: r425276 [7/12] - in
/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src:
main/java/org/apache/myfaces/adfinternal/agent/
main/java/org/apache/myfaces/adfinternal/agent/parse/
main/java/org/apache/myfaces/adfi...
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/ShowDetailRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/ShowDetailRenderer.java?rev=425276&r1=425275&r2=425276&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/ShowDetailRenderer.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/ShowDetailRenderer.java Mon Jul 24 21:42:41 2006
@@ -13,499 +13,499 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.myfaces.adfinternal.renderkit.core.xhtml;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.apache.myfaces.adf.bean.FacesBean;
-import org.apache.myfaces.adf.bean.PropertyKey;
-import org.apache.myfaces.adf.component.core.layout.CoreShowDetail;
-
-import org.apache.myfaces.adfinternal.renderkit.AdfRenderingContext;
-import org.apache.myfaces.adfinternal.skin.icon.Icon;
-import org.apache.myfaces.adf.logging.ADFLogger;
-
-/**
- * This needs to be massively cleaned up...
- * @todo TEST NON-PPR! I removed the non-PPR case from the
- * JS script
- */
-public class ShowDetailRenderer extends ShowDetailItemRenderer
-{
- public ShowDetailRenderer()
- {
- this(CoreShowDetail.TYPE);
- }
-
- protected ShowDetailRenderer(FacesBean.Type type)
- {
- super(type);
- }
-
- protected void findTypeConstants(FacesBean.Type type)
- {
- super.findTypeConstants(type);
- _immediateKey = type.findKey("immediate");
- _disclosedTextKey = type.findKey("disclosedText");
- _undisclosedTextKey = type.findKey("undisclosedText");
- }
-
- /**
- */
- protected void encodeAll(
- FacesContext context,
- AdfRenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
- {
- boolean disclosed = getDisclosed(bean);
-
- ResponseWriter rw = context.getResponseWriter();
- rw.startElement("span", component);
- if (!isTableAllDisclosure() && !isTableDetailDisclosure())
- renderId(context, component);
-
- renderPromptStart(context, arc, component, bean);
- _renderScripts(context, arc, component);
- String onClickString =
- _generateOnClickString(context, arc, component, bean, disclosed);
- _renderLinkStart(context, arc, onClickString);
- String sourceValue = getClientId(context, component);
- String linkId = getLinkId(sourceValue, disclosed);
- if (linkId != null)
- rw.writeAttribute("id", linkId, null);
-
- if (!isTableAllDisclosure())
- {
- renderDisclosureIcon(context, arc, disclosed);
- _renderLinkEnd(context, arc);
- }
-
- UIComponent prompt = getFacet(component,
- CoreShowDetail.PROMPT_FACET);
- if (prompt == null)
- {
- String text = getDisclosureText(arc, bean, disclosed);
- if (text != null)
- {
- if (!isTableAllDisclosure())
- _renderLinkStart(context, arc, onClickString);
- String styleClass = getLinkStyleClass();
- if (styleClass != null)
- renderStyleClass(context, arc, styleClass);
- rw.writeText(text,
- disclosed ? "disclosedText" : "undisclosedText");
-
- _renderLinkEnd(context, arc);
- }
- }
-
- if (isTableAllDisclosure() && prompt != null)
- _renderLinkEnd(context, arc);
-
- if (prompt != null)
- {
- encodeChild(context, prompt);
- }
-
- renderPromptEnd(context);
-
- if (disclosed &&
- !isTableAllDisclosure() &&
- !isTableDetailDisclosure() &&
- !renderAsInline())
- {
- rw.startElement("div", null);
- encodeAllChildren(context, component);
- rw.endElement("div");
- }
-
- rw.endElement("span");
-
- }
-
- protected void renderPromptStart(
- FacesContext context,
- AdfRenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
- {
- ResponseWriter writer = context.getResponseWriter();
-
- // Start a different span; this is where all attributes
- // except the ID will go.
- if ( renderAsInline())
- writer.startElement("span", component);
- else
- writer.startElement("div", component);
-
- renderAllAttributes(context, arc, bean);
- }
-
- protected void renderPromptEnd(
- FacesContext context) throws IOException
- {
- ResponseWriter writer = context.getResponseWriter();
-
- if ( renderAsInline())
- writer.endElement("span");
- else
- writer.endElement("div");
- }
-
-
- static public void renderDisclosureIcon(
- FacesContext context,
- AdfRenderingContext arc,
- boolean disclosed,
- String disclosedAltTextKey,
- String undisclosedAltTextKey) throws IOException
- {
- Icon icon = _getDisclosureIcon(arc, disclosed);
-
- if (icon != null)
- {
- // Get the alt text
- String key = disclosed ? disclosedAltTextKey : undisclosedAltTextKey;
- String altText = arc.getTranslatedString(key);
- // Get the align
- String align = OutputUtils.getMiddleIconAlignment(arc);
-
- // Render the icon with the specified attrs
- OutputUtils.renderIcon(context, arc, icon, altText, align);
- }
- }
-
-
- protected void renderDisclosureIcon(
- FacesContext context,
- AdfRenderingContext arc,
- boolean disclosed) throws IOException
- {
- renderDisclosureIcon(context, arc, disclosed,
- _DISCLOSED_TIP_KEY, _UNDISCLOSED_TIP_KEY);
- }
-
- /**
- * Always render an ID, needed for proper PPR.
- */
- protected boolean shouldRenderId(
- FacesContext context,
- UIComponent component)
- {
- return true;
- }
-
-
- // Returns the disclosure Icon
- private static Icon _getDisclosureIcon(
- AdfRenderingContext arc,
- boolean disclosed
- )
- {
- String iconName = (disclosed
- ? XhtmlConstants.AF_SHOW_DETAIL_DISCLOSED_ICON_NAME
- : XhtmlConstants.AF_SHOW_DETAIL_UNDISCLOSED_ICON_NAME);
-
- return arc.getIcon(iconName);
- }
-
- protected String getDisclosureText(
- AdfRenderingContext arc,
- FacesBean bean,
- boolean disclosed)
- {
- String text;
- if (disclosed)
- {
- text = getDisclosedText(bean);
- if (text == null)
- {
- //smo: This functionality was added durring API Merge. If getDisclosedText is not present
- //we'll render undislosedText text if it's present before rendering the defaults
- text = getUndisclosedText(bean);
- if(text == null)
- {
- text = arc.getTranslatedString(_DISCLOSED_KEY);
- }
- }
- }
- else
- {
- text = getUndisclosedText(bean);
- if (text == null)
- {
- text = getDisclosedText(bean);
- if(text == null)
- {
- text = arc.getTranslatedString(_UNDISCLOSED_KEY);
- }
- }
- }
-
- return text;
- }
-
- private void _renderScripts(
- FacesContext context,
- AdfRenderingContext arc,
- UIComponent component) throws IOException
- {
- if (!supportsNavigation(arc))
- return;
-
- FormData fData = arc.getFormData();
- if (fData == null)
- {
- _LOG.warning("showDetail is not in a form, and " +
- "will not function correctly");
- return;
- }
-
- String valueValue = getValueParameter(component);
-
-
- ResponseWriter rw = context.getResponseWriter();
- boolean partial = PartialPageUtils.isPPRActive(context);
-
- // the first time, render the necessary Javascript
- if (arc.getProperties().get(_SHOW_DETAIL_SUBMIT_JS_RENDERED) == null)
- {
- arc.getProperties().put(_SHOW_DETAIL_SUBMIT_JS_RENDERED,
- Boolean.TRUE);
- // write the submit function
-
- String js;
- // Javascript function, optimized to reduce size. Parameters are:
- // a: form name
- // v: validate?
- // b: event name
- // c: source parameter (id)
- // l: ID of link (for focusing)
- // d: value parameter (for use in table)
- // =-=AEW Why bother including "document" and "window" in
- // _setRequestedFocusNode() call? It could derive them itself.
- if (partial)
- {
- js =
- "function _submitHideShow(a,v,b,c,l,d) {" +
- "var o = {"+
- XhtmlConstants.EVENT_PARAM + ":b," +
- XhtmlConstants.SOURCE_PARAM + ":c};" +
- "if (d!=(void 0)) o." +
- XhtmlConstants.VALUE_PARAM + "=d;" +
- "_setRequestedFocusNode(document,l,false,window);" +
- "_submitPartialChange(a,v,o);" +
- "return false;}";
- }
- else
- {
- js =
- "function _submitHideShow(a,v,b,c,l,d) {" +
- "var o={"+
- XhtmlConstants.EVENT_PARAM + ":b," +
- XhtmlConstants.SOURCE_PARAM + ":c};" +
- "if (d!=(void 0)) o." +
- XhtmlConstants.VALUE_PARAM + "=d;" +
- "submitForm(a,v,o);" +
- "return false;}";
- }
-
- // write the submit function
- rw.startElement("script", null);
- renderScriptDeferAttribute(context, arc);
- renderScriptTypeAttribute(context, arc);
-
- rw.writeText(js, null);
- rw.endElement("script");
-
- // Add these needed values at most once per page
- fData.addNeededValue(XhtmlConstants.EVENT_PARAM);
- fData.addNeededValue(XhtmlConstants.SOURCE_PARAM);
- if (partial)
- fData.addNeededValue(XhtmlConstants.PARTIAL_PARAM);
- }
-
- // And add this needed value if it ever comes up
- if (valueValue != null)
- fData.addNeededValue(XhtmlConstants.VALUE_PARAM);
-
- }
-
- private void _renderLinkStart(
- FacesContext context,
- AdfRenderingContext arc,
- String onclickString ) throws IOException
- {
- if (!supportsNavigation(arc))
- return;
-
- ResponseWriter rw = context.getResponseWriter();
- rw.startElement("a", null);
- rw.writeAttribute("onclick", onclickString, null);
- rw.writeAttribute("href", "#", null);
- }
-
- private String _generateOnClickString(
- FacesContext context,
- AdfRenderingContext arc,
- UIComponent component,
- FacesBean bean,
- boolean disclosed)
- {
- FormData fData = arc.getFormData();
- if (fData == null)
- return null;
-
- String sourceValue = getClientId(context, component);
- String formName = fData.getName();
- String eventValue = (disclosed
- ? XhtmlConstants.HIDE_EVENT
- : XhtmlConstants.SHOW_EVENT);
- String valueValue = getValueParameter(component);
- String linkId = getLinkId(sourceValue, disclosed);
-
- int linkBufferLen = 41 +
- formName.length() +
- eventValue.length() +
- sourceValue.length();
-
- if (valueValue != null)
- linkBufferLen += valueValue .length();
- else
- linkBufferLen += 4;
-
-
- StringBuffer linkBuffer = new StringBuffer(linkBufferLen);
- linkBuffer.append("return _submitHideShow('");
- linkBuffer.append(formName);
- linkBuffer.append("',");
- linkBuffer.append(getImmediate(bean) ? '0' : '1');
- linkBuffer.append(",'");
- linkBuffer.append(eventValue);
- linkBuffer.append("','");
- linkBuffer.append(sourceValue);
- linkBuffer.append("',");
-
- if (linkId != null)
- linkBuffer.append("'").append(linkId).append("'");
- else
- linkBuffer.append("null");
-
- if (valueValue != null)
- linkBuffer.append(",'").append(valueValue).append("'");
-
- linkBuffer.append(")");
- return linkBuffer.toString();
- }
-
-
- private void _renderLinkEnd(
- FacesContext context,
- AdfRenderingContext arc) throws IOException
- {
- if (!supportsNavigation(arc))
- return;
-
- context.getResponseWriter().endElement("a");
- }
-
- /**
- * Hook for table; it'd be cleaner to simply expose
- * more protected hooks in general, and eliminate this
- * Table-ShowDetail dependency.
- */
- protected boolean isTableDetailDisclosure()
- {
- return false;
- }
-
- /**
- * Hook for table; it'd be cleaner to simply expose
- * more protected hooks in general, and eliminate this
- * Table-ShowDetail dependency.
- */
- protected boolean isTableAllDisclosure()
- {
- return false;
- }
-
- protected boolean renderAsInline()
- {
- return false;
- }
-
- protected String getValueParameter(UIComponent component)
- {
- return null;
- }
-
- /**
- * Returns the style class to use for links rendered by the
- * ShowDetailRenderer
- */
- protected String getLinkStyleClass()
- {
- return XhtmlConstants.LINK_STYLE_CLASS;
- }
-
- /**
- */
- protected String getLinkId(String rootId, boolean disclosed)
- {
- return XhtmlUtils.getCompositeId(rootId, null);
- }
-
- protected boolean getImmediate(FacesBean bean)
- {
- Object o = bean.getProperty(_immediateKey);
- if (o == null)
- o = _immediateKey.getDefault();
-
- return Boolean.TRUE.equals(o);
- }
-
-
- protected String getDisclosedText(FacesBean bean)
- {
- // It can be null in the table...
- if (_disclosedTextKey == null)
- return null;
-
- return toString(bean.getProperty(_disclosedTextKey));
- }
-
- protected String getUndisclosedText(FacesBean bean)
- {
- // It can be null in the table...
- if (_undisclosedTextKey == null)
- return null;
-
- return toString(bean.getProperty(_undisclosedTextKey));
- }
-
-
-
- private PropertyKey _immediateKey;
- private PropertyKey _disclosedTextKey;
- private PropertyKey _undisclosedTextKey;
-
- private static final Object _SHOW_DETAIL_SUBMIT_JS_RENDERED =
- new Object();
-
- private static final String _DISCLOSED_KEY =
- "af_showDetail.DISCLOSED";
- private static final String _UNDISCLOSED_KEY =
- "af_showDetail.UNDISCLOSED";
-
- private static final String _DISCLOSED_TIP_KEY =
- "af_showDetail.DISCLOSED_TIP";
- private static final String _UNDISCLOSED_TIP_KEY =
- "af_showDetail.UNDISCLOSED_TIP";
-
- private static final ADFLogger _LOG = ADFLogger.createADFLogger(ShowDetailRenderer.class);
-}
+package org.apache.myfaces.adfinternal.renderkit.core.xhtml;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.adf.bean.FacesBean;
+import org.apache.myfaces.adf.bean.PropertyKey;
+import org.apache.myfaces.adf.component.core.layout.CoreShowDetail;
+
+import org.apache.myfaces.adfinternal.renderkit.AdfRenderingContext;
+import org.apache.myfaces.adfinternal.skin.icon.Icon;
+import org.apache.myfaces.adf.logging.ADFLogger;
+
+/**
+ * This needs to be massively cleaned up...
+ * @todo TEST NON-PPR! I removed the non-PPR case from the
+ * JS script
+ */
+public class ShowDetailRenderer extends ShowDetailItemRenderer
+{
+ public ShowDetailRenderer()
+ {
+ this(CoreShowDetail.TYPE);
+ }
+
+ protected ShowDetailRenderer(FacesBean.Type type)
+ {
+ super(type);
+ }
+
+ protected void findTypeConstants(FacesBean.Type type)
+ {
+ super.findTypeConstants(type);
+ _immediateKey = type.findKey("immediate");
+ _disclosedTextKey = type.findKey("disclosedText");
+ _undisclosedTextKey = type.findKey("undisclosedText");
+ }
+
+ /**
+ */
+ protected void encodeAll(
+ FacesContext context,
+ AdfRenderingContext arc,
+ UIComponent component,
+ FacesBean bean) throws IOException
+ {
+ boolean disclosed = getDisclosed(bean);
+
+ ResponseWriter rw = context.getResponseWriter();
+ rw.startElement("span", component);
+ if (!isTableAllDisclosure() && !isTableDetailDisclosure())
+ renderId(context, component);
+
+ renderPromptStart(context, arc, component, bean);
+ _renderScripts(context, arc, component);
+ String onClickString =
+ _generateOnClickString(context, arc, component, bean, disclosed);
+ _renderLinkStart(context, arc, onClickString);
+ String sourceValue = getClientId(context, component);
+ String linkId = getLinkId(sourceValue, disclosed);
+ if (linkId != null)
+ rw.writeAttribute("id", linkId, null);
+
+ if (!isTableAllDisclosure())
+ {
+ renderDisclosureIcon(context, arc, disclosed);
+ _renderLinkEnd(context, arc);
+ }
+
+ UIComponent prompt = getFacet(component,
+ CoreShowDetail.PROMPT_FACET);
+ if (prompt == null)
+ {
+ String text = getDisclosureText(arc, bean, disclosed);
+ if (text != null)
+ {
+ if (!isTableAllDisclosure())
+ _renderLinkStart(context, arc, onClickString);
+ String styleClass = getLinkStyleClass();
+ if (styleClass != null)
+ renderStyleClass(context, arc, styleClass);
+ rw.writeText(text,
+ disclosed ? "disclosedText" : "undisclosedText");
+
+ _renderLinkEnd(context, arc);
+ }
+ }
+
+ if (isTableAllDisclosure() && prompt != null)
+ _renderLinkEnd(context, arc);
+
+ if (prompt != null)
+ {
+ encodeChild(context, prompt);
+ }
+
+ renderPromptEnd(context);
+
+ if (disclosed &&
+ !isTableAllDisclosure() &&
+ !isTableDetailDisclosure() &&
+ !renderAsInline())
+ {
+ rw.startElement("div", null);
+ encodeAllChildren(context, component);
+ rw.endElement("div");
+ }
+
+ rw.endElement("span");
+
+ }
+
+ protected void renderPromptStart(
+ FacesContext context,
+ AdfRenderingContext arc,
+ UIComponent component,
+ FacesBean bean) throws IOException
+ {
+ ResponseWriter writer = context.getResponseWriter();
+
+ // Start a different span; this is where all attributes
+ // except the ID will go.
+ if ( renderAsInline())
+ writer.startElement("span", component);
+ else
+ writer.startElement("div", component);
+
+ renderAllAttributes(context, arc, bean);
+ }
+
+ protected void renderPromptEnd(
+ FacesContext context) throws IOException
+ {
+ ResponseWriter writer = context.getResponseWriter();
+
+ if ( renderAsInline())
+ writer.endElement("span");
+ else
+ writer.endElement("div");
+ }
+
+
+ static public void renderDisclosureIcon(
+ FacesContext context,
+ AdfRenderingContext arc,
+ boolean disclosed,
+ String disclosedAltTextKey,
+ String undisclosedAltTextKey) throws IOException
+ {
+ Icon icon = _getDisclosureIcon(arc, disclosed);
+
+ if (icon != null)
+ {
+ // Get the alt text
+ String key = disclosed ? disclosedAltTextKey : undisclosedAltTextKey;
+ String altText = arc.getTranslatedString(key);
+ // Get the align
+ String align = OutputUtils.getMiddleIconAlignment(arc);
+
+ // Render the icon with the specified attrs
+ OutputUtils.renderIcon(context, arc, icon, altText, align);
+ }
+ }
+
+
+ protected void renderDisclosureIcon(
+ FacesContext context,
+ AdfRenderingContext arc,
+ boolean disclosed) throws IOException
+ {
+ renderDisclosureIcon(context, arc, disclosed,
+ _DISCLOSED_TIP_KEY, _UNDISCLOSED_TIP_KEY);
+ }
+
+ /**
+ * Always render an ID, needed for proper PPR.
+ */
+ protected boolean shouldRenderId(
+ FacesContext context,
+ UIComponent component)
+ {
+ return true;
+ }
+
+
+ // Returns the disclosure Icon
+ private static Icon _getDisclosureIcon(
+ AdfRenderingContext arc,
+ boolean disclosed
+ )
+ {
+ String iconName = (disclosed
+ ? XhtmlConstants.AF_SHOW_DETAIL_DISCLOSED_ICON_NAME
+ : XhtmlConstants.AF_SHOW_DETAIL_UNDISCLOSED_ICON_NAME);
+
+ return arc.getIcon(iconName);
+ }
+
+ protected String getDisclosureText(
+ AdfRenderingContext arc,
+ FacesBean bean,
+ boolean disclosed)
+ {
+ String text;
+ if (disclosed)
+ {
+ text = getDisclosedText(bean);
+ if (text == null)
+ {
+ //smo: This functionality was added durring API Merge. If getDisclosedText is not present
+ //we'll render undislosedText text if it's present before rendering the defaults
+ text = getUndisclosedText(bean);
+ if(text == null)
+ {
+ text = arc.getTranslatedString(_DISCLOSED_KEY);
+ }
+ }
+ }
+ else
+ {
+ text = getUndisclosedText(bean);
+ if (text == null)
+ {
+ text = getDisclosedText(bean);
+ if(text == null)
+ {
+ text = arc.getTranslatedString(_UNDISCLOSED_KEY);
+ }
+ }
+ }
+
+ return text;
+ }
+
+ private void _renderScripts(
+ FacesContext context,
+ AdfRenderingContext arc,
+ UIComponent component) throws IOException
+ {
+ if (!supportsNavigation(arc))
+ return;
+
+ FormData fData = arc.getFormData();
+ if (fData == null)
+ {
+ _LOG.warning("showDetail is not in a form, and " +
+ "will not function correctly");
+ return;
+ }
+
+ String valueValue = getValueParameter(component);
+
+
+ ResponseWriter rw = context.getResponseWriter();
+ boolean partial = PartialPageUtils.isPPRActive(context);
+
+ // the first time, render the necessary Javascript
+ if (arc.getProperties().get(_SHOW_DETAIL_SUBMIT_JS_RENDERED) == null)
+ {
+ arc.getProperties().put(_SHOW_DETAIL_SUBMIT_JS_RENDERED,
+ Boolean.TRUE);
+ // write the submit function
+
+ String js;
+ // Javascript function, optimized to reduce size. Parameters are:
+ // a: form name
+ // v: validate?
+ // b: event name
+ // c: source parameter (id)
+ // l: ID of link (for focusing)
+ // d: value parameter (for use in table)
+ // =-=AEW Why bother including "document" and "window" in
+ // _setRequestedFocusNode() call? It could derive them itself.
+ if (partial)
+ {
+ js =
+ "function _submitHideShow(a,v,b,c,l,d) {" +
+ "var o = {"+
+ XhtmlConstants.EVENT_PARAM + ":b," +
+ XhtmlConstants.SOURCE_PARAM + ":c};" +
+ "if (d!=(void 0)) o." +
+ XhtmlConstants.VALUE_PARAM + "=d;" +
+ "_setRequestedFocusNode(document,l,false,window);" +
+ "_submitPartialChange(a,v,o);" +
+ "return false;}";
+ }
+ else
+ {
+ js =
+ "function _submitHideShow(a,v,b,c,l,d) {" +
+ "var o={"+
+ XhtmlConstants.EVENT_PARAM + ":b," +
+ XhtmlConstants.SOURCE_PARAM + ":c};" +
+ "if (d!=(void 0)) o." +
+ XhtmlConstants.VALUE_PARAM + "=d;" +
+ "submitForm(a,v,o);" +
+ "return false;}";
+ }
+
+ // write the submit function
+ rw.startElement("script", null);
+ renderScriptDeferAttribute(context, arc);
+ renderScriptTypeAttribute(context, arc);
+
+ rw.writeText(js, null);
+ rw.endElement("script");
+
+ // Add these needed values at most once per page
+ fData.addNeededValue(XhtmlConstants.EVENT_PARAM);
+ fData.addNeededValue(XhtmlConstants.SOURCE_PARAM);
+ if (partial)
+ fData.addNeededValue(XhtmlConstants.PARTIAL_PARAM);
+ }
+
+ // And add this needed value if it ever comes up
+ if (valueValue != null)
+ fData.addNeededValue(XhtmlConstants.VALUE_PARAM);
+
+ }
+
+ private void _renderLinkStart(
+ FacesContext context,
+ AdfRenderingContext arc,
+ String onclickString ) throws IOException
+ {
+ if (!supportsNavigation(arc))
+ return;
+
+ ResponseWriter rw = context.getResponseWriter();
+ rw.startElement("a", null);
+ rw.writeAttribute("onclick", onclickString, null);
+ rw.writeAttribute("href", "#", null);
+ }
+
+ private String _generateOnClickString(
+ FacesContext context,
+ AdfRenderingContext arc,
+ UIComponent component,
+ FacesBean bean,
+ boolean disclosed)
+ {
+ FormData fData = arc.getFormData();
+ if (fData == null)
+ return null;
+
+ String sourceValue = getClientId(context, component);
+ String formName = fData.getName();
+ String eventValue = (disclosed
+ ? XhtmlConstants.HIDE_EVENT
+ : XhtmlConstants.SHOW_EVENT);
+ String valueValue = getValueParameter(component);
+ String linkId = getLinkId(sourceValue, disclosed);
+
+ int linkBufferLen = 41 +
+ formName.length() +
+ eventValue.length() +
+ sourceValue.length();
+
+ if (valueValue != null)
+ linkBufferLen += valueValue .length();
+ else
+ linkBufferLen += 4;
+
+
+ StringBuffer linkBuffer = new StringBuffer(linkBufferLen);
+ linkBuffer.append("return _submitHideShow('");
+ linkBuffer.append(formName);
+ linkBuffer.append("',");
+ linkBuffer.append(getImmediate(bean) ? '0' : '1');
+ linkBuffer.append(",'");
+ linkBuffer.append(eventValue);
+ linkBuffer.append("','");
+ linkBuffer.append(sourceValue);
+ linkBuffer.append("',");
+
+ if (linkId != null)
+ linkBuffer.append("'").append(linkId).append("'");
+ else
+ linkBuffer.append("null");
+
+ if (valueValue != null)
+ linkBuffer.append(",'").append(valueValue).append("'");
+
+ linkBuffer.append(")");
+ return linkBuffer.toString();
+ }
+
+
+ private void _renderLinkEnd(
+ FacesContext context,
+ AdfRenderingContext arc) throws IOException
+ {
+ if (!supportsNavigation(arc))
+ return;
+
+ context.getResponseWriter().endElement("a");
+ }
+
+ /**
+ * Hook for table; it'd be cleaner to simply expose
+ * more protected hooks in general, and eliminate this
+ * Table-ShowDetail dependency.
+ */
+ protected boolean isTableDetailDisclosure()
+ {
+ return false;
+ }
+
+ /**
+ * Hook for table; it'd be cleaner to simply expose
+ * more protected hooks in general, and eliminate this
+ * Table-ShowDetail dependency.
+ */
+ protected boolean isTableAllDisclosure()
+ {
+ return false;
+ }
+
+ protected boolean renderAsInline()
+ {
+ return false;
+ }
+
+ protected String getValueParameter(UIComponent component)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the style class to use for links rendered by the
+ * ShowDetailRenderer
+ */
+ protected String getLinkStyleClass()
+ {
+ return XhtmlConstants.LINK_STYLE_CLASS;
+ }
+
+ /**
+ */
+ protected String getLinkId(String rootId, boolean disclosed)
+ {
+ return XhtmlUtils.getCompositeId(rootId, null);
+ }
+
+ protected boolean getImmediate(FacesBean bean)
+ {
+ Object o = bean.getProperty(_immediateKey);
+ if (o == null)
+ o = _immediateKey.getDefault();
+
+ return Boolean.TRUE.equals(o);
+ }
+
+
+ protected String getDisclosedText(FacesBean bean)
+ {
+ // It can be null in the table...
+ if (_disclosedTextKey == null)
+ return null;
+
+ return toString(bean.getProperty(_disclosedTextKey));
+ }
+
+ protected String getUndisclosedText(FacesBean bean)
+ {
+ // It can be null in the table...
+ if (_undisclosedTextKey == null)
+ return null;
+
+ return toString(bean.getProperty(_undisclosedTextKey));
+ }
+
+
+
+ private PropertyKey _immediateKey;
+ private PropertyKey _disclosedTextKey;
+ private PropertyKey _undisclosedTextKey;
+
+ private static final Object _SHOW_DETAIL_SUBMIT_JS_RENDERED =
+ new Object();
+
+ private static final String _DISCLOSED_KEY =
+ "af_showDetail.DISCLOSED";
+ private static final String _UNDISCLOSED_KEY =
+ "af_showDetail.UNDISCLOSED";
+
+ private static final String _DISCLOSED_TIP_KEY =
+ "af_showDetail.DISCLOSED_TIP";
+ private static final String _UNDISCLOSED_TIP_KEY =
+ "af_showDetail.UNDISCLOSED_TIP";
+
+ private static final ADFLogger _LOG = ADFLogger.createADFLogger(ShowDetailRenderer.class);
+}
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/ShowDetailRenderer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/table/TableUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/table/TableUtils.java?rev=425276&r1=425275&r2=425276&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/table/TableUtils.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/table/TableUtils.java Mon Jul 24 21:42:41 2006
@@ -13,135 +13,135 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.myfaces.adfinternal.renderkit.core.xhtml.table;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.apache.myfaces.adf.component.CollectionComponent;
-import org.apache.myfaces.adf.component.UIXTable;
-
-/**
- * @author The Oracle ADF Faces Team
- */
-public final class TableUtils
-{
- /**
- * implements a loop that loops through all the rows in the visible range
- */
- public static abstract class RowLoop
- {
- public RowLoop()
- {
- }
-
- /**
- * saves the state of the table that might be changed by the loop
- * @param fc
- * @param table
- */
- private void _saveOldState(CollectionComponent table)
- {
- _oldIndex = table.getRowKey();
- }
-
- /**
- * restores the state of the table that was changed by this loop
- * @param fc
- * @param table
- */
- private void _restoreOldState(CollectionComponent table)
- {
- table.setRowKey(_oldIndex);
- }
-
- /**
- * calls {@link #saveOldState} to save any state. Then calls {@link #loop} to
- * run through the loop. Finally, calls {@link #restoreOldState} to
- * restore any state.
- * @param fc
- * @param table
- * @throws java.io.IOException
- */
- public final void run(FacesContext fc, CollectionComponent table) throws IOException
- {
- _saveOldState(table);
- try
- {
- loop(fc, table);
- }
- finally
- {
- _restoreOldState(table);
- }
- }
-
- /**
- * selects each index in the table that is in the current range
- * and calls {@link #processRow}
- * @param fc
- * @param table
- * @throws java.io.IOException
- */
- protected void loop(FacesContext fc, CollectionComponent table) throws IOException
- {
- UIComponent comp = (UIComponent) table;
- boolean showAll =
- Boolean.TRUE.equals(comp.getAttributes().get(UIXTable.SHOW_ALL_KEY.getName()));
-
- int rangeStart = table.getFirst();
- int rangeEnd = showAll
- ? table.getRowCount() - 1
- : org.apache.myfaces.adf.component.TableUtils.getLast(table);
- for(int i=rangeStart; i<=rangeEnd; i++)
- {
- table.setRowIndex(i);
- processRow(fc, table);
- }
- }
-
- /**
- * this method sets up the 'var' variable and calls
- * {@link #processRowImpl}
- * @param fc
- * @param table
- * @throws java.io.IOException
- */
- protected final void processRow(FacesContext fc, CollectionComponent table)
- throws IOException
- {
- processRowImpl(fc, table);
- }
-
- /**
- * this method will be called for each visible row.
- * the rowIndex of table will be set to the corresponding row.
- * the 'var' variable will be setup before this method is called.
- * @param table
- */
- protected abstract void processRowImpl(FacesContext fc, CollectionComponent table)
- throws IOException;
-
- private Object _oldIndex = null;
- }
-
-
- /**
- * gets the number of visible rows in the table, taking the range start and
- * range size into account.
- * @param table
- * @return
- */
- public static int getVisibleRowCount(CollectionComponent table)
- {
- int rangeStart = table.getFirst();
- int rangeEnd = org.apache.myfaces.adf.component.TableUtils.getLast(table) + 1;
- return rangeEnd - rangeStart;
- }
-
- private TableUtils()
- {
- }
-}
+package org.apache.myfaces.adfinternal.renderkit.core.xhtml.table;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.adf.component.CollectionComponent;
+import org.apache.myfaces.adf.component.UIXTable;
+
+/**
+ * @author The Oracle ADF Faces Team
+ */
+public final class TableUtils
+{
+ /**
+ * implements a loop that loops through all the rows in the visible range
+ */
+ public static abstract class RowLoop
+ {
+ public RowLoop()
+ {
+ }
+
+ /**
+ * saves the state of the table that might be changed by the loop
+ * @param fc
+ * @param table
+ */
+ private void _saveOldState(CollectionComponent table)
+ {
+ _oldIndex = table.getRowKey();
+ }
+
+ /**
+ * restores the state of the table that was changed by this loop
+ * @param fc
+ * @param table
+ */
+ private void _restoreOldState(CollectionComponent table)
+ {
+ table.setRowKey(_oldIndex);
+ }
+
+ /**
+ * calls {@link #saveOldState} to save any state. Then calls {@link #loop} to
+ * run through the loop. Finally, calls {@link #restoreOldState} to
+ * restore any state.
+ * @param fc
+ * @param table
+ * @throws java.io.IOException
+ */
+ public final void run(FacesContext fc, CollectionComponent table) throws IOException
+ {
+ _saveOldState(table);
+ try
+ {
+ loop(fc, table);
+ }
+ finally
+ {
+ _restoreOldState(table);
+ }
+ }
+
+ /**
+ * selects each index in the table that is in the current range
+ * and calls {@link #processRow}
+ * @param fc
+ * @param table
+ * @throws java.io.IOException
+ */
+ protected void loop(FacesContext fc, CollectionComponent table) throws IOException
+ {
+ UIComponent comp = (UIComponent) table;
+ boolean showAll =
+ Boolean.TRUE.equals(comp.getAttributes().get(UIXTable.SHOW_ALL_KEY.getName()));
+
+ int rangeStart = table.getFirst();
+ int rangeEnd = showAll
+ ? table.getRowCount() - 1
+ : org.apache.myfaces.adf.component.TableUtils.getLast(table);
+ for(int i=rangeStart; i<=rangeEnd; i++)
+ {
+ table.setRowIndex(i);
+ processRow(fc, table);
+ }
+ }
+
+ /**
+ * this method sets up the 'var' variable and calls
+ * {@link #processRowImpl}
+ * @param fc
+ * @param table
+ * @throws java.io.IOException
+ */
+ protected final void processRow(FacesContext fc, CollectionComponent table)
+ throws IOException
+ {
+ processRowImpl(fc, table);
+ }
+
+ /**
+ * this method will be called for each visible row.
+ * the rowIndex of table will be set to the corresponding row.
+ * the 'var' variable will be setup before this method is called.
+ * @param table
+ */
+ protected abstract void processRowImpl(FacesContext fc, CollectionComponent table)
+ throws IOException;
+
+ private Object _oldIndex = null;
+ }
+
+
+ /**
+ * gets the number of visible rows in the table, taking the range start and
+ * range size into account.
+ * @param table
+ * @return
+ */
+ public static int getVisibleRowCount(CollectionComponent table)
+ {
+ int rangeStart = table.getFirst();
+ int rangeEnd = org.apache.myfaces.adf.component.TableUtils.getLast(table) + 1;
+ return rangeEnd - rangeStart;
+ }
+
+ private TableUtils()
+ {
+ }
+}
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/table/TableUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/table/TreeUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/table/TreeUtils.java?rev=425276&r1=425275&r2=425276&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/table/TreeUtils.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/table/TreeUtils.java Mon Jul 24 21:42:41 2006
@@ -13,348 +13,348 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.myfaces.adfinternal.renderkit.core.xhtml.table;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.event.FacesEvent;
-
-import org.apache.myfaces.adf.logging.ADFLogger;
-import org.apache.myfaces.adf.component.UIXHierarchy;
-import org.apache.myfaces.adf.component.UIXNavigationTree;
-import org.apache.myfaces.adf.component.UIXPage;
-import org.apache.myfaces.adf.component.UIXTree;
-import org.apache.myfaces.adf.component.UIXTreeTable;
-import org.apache.myfaces.adf.event.RowDisclosureEvent;
-import org.apache.myfaces.adf.event.FocusEvent;
-
-import org.apache.myfaces.adf.model.RowKeySet;
-
-import org.apache.myfaces.adfinternal.renderkit.AdfRenderingContext;
-import org.apache.myfaces.adfinternal.renderkit.core.xhtml.HiddenLabelUtils;
-import org.apache.myfaces.adfinternal.renderkit.core.xhtml.TableRenderer;
-import org.apache.myfaces.adfinternal.renderkit.core.xhtml.XhtmlConstants;
-import org.apache.myfaces.adfinternal.renderkit.core.xhtml.XhtmlRenderer;
-import org.apache.myfaces.adfinternal.renderkit.core.xhtml.XhtmlUtils;
-import org.apache.myfaces.adfinternal.util.IntegerUtils;
-
-/**
- * Class that handles all tree related events
- * @author The Oracle ADF Faces Team
- */
-public final class TreeUtils
-{
- private TreeUtils()
- {
- }
-
- // Names of the parameters used by TreeUtils. The names
- // need to be public so form value can be prepared;
- // the meaning of the parameters are not public
- public static final String EVENT_PARAM = "event";
- public static final String SOURCE_PARAM = "source";
-
-
- /**
- * This method is used for writing the depth of node from it's root in
- * the case tree and HGrid, thus making it more accessible.
- */
- public static void writeNodeLevel(
- FacesContext context,
- AdfRenderingContext arc,
- int depth,
- String nodeLevelTextKey
- ) throws IOException
- {
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement("label", null);
- String pattern = arc.getTranslatedString(nodeLevelTextKey);
- String levelInfo =
- XhtmlUtils.getFormattedString(pattern,
- new String[]
- {
- IntegerUtils.getString(depth)
- });
-
- if (HiddenLabelUtils.supportsHiddenLabels(arc))
- XhtmlRenderer.renderStyleClass(context, arc,
- XhtmlConstants.HIDDEN_LABEL_STYLE_CLASS);
-
- writer.writeText(levelInfo, null);
- writer.endElement("label");
- }
-
- // TODO: this method should be removed.
- public static Object getFocusRowKey(UIXTreeTable treeTable)
- {
- Object path = treeTable.getFocusRowKey();
- if (path == null)
- {
- int oldIndex = treeTable.getRowIndex();
- treeTable.setRowIndex(0);
- Object rowKey = treeTable.getRowKey();
- treeTable.setRowIndex(oldIndex);
- return rowKey;
- }
- else
- return path;
- }
-
- /**
- * writes the JS function needed for generating tree events.
- * @param buff the function source is appended to this buffer
- * @return
- */
- public static StringBuffer setupTreeCollectionComponent(
- StringBuffer buff,
- boolean validate)
- {
- String validateString = validate?"1":"0";
- buff.append
- ("CollectionComponent.defineTree('"+
- EVENT_PARAM+"','"+
- SOURCE_PARAM+"','"+
- _PATH_PARAM+"','"+
- _START_PARAM+"','"+
- _GOTO+"','"+
- _FOCUS+"'," +
- validateString + ");"
- );
-
- return buff;
- }
-
- public static String setupJSTreeCollectionComponent(boolean validate)
- {
- String validateString = validate?"1":"0";
- return
- "CollectionComponent.defineTree('"+
- EVENT_PARAM+"','"+
- SOURCE_PARAM+"','"+
- _PATH_PARAM+"','"+
- _START_PARAM+"','"+
- _GOTO+"','"+
- _FOCUS+ "'," +
- validateString + ")";
- }
-
- public static String setupJSMultiSelectCollectionComponent(
- String selectedKey,
- String selectedModeKey,
- boolean autoSubmit)
- {
- return
- "CollectionComponent.defineMultiSelect('"+
- selectedKey+"','"+
- selectedModeKey+"',"+(autoSubmit ? "true" : "false")+")";
- }
-
- public static String createNewJSCollectionComponentState(String formName, String treeClientId)
- {
- // must not end with a ";". This is because this might be passed as an
- // argument to some other function:
- return "new CollectionComponent('"+formName+"','"+treeClientId+"')";
- }
-
- public static String callJSExpandNode(UIXHierarchy tree, String jsVarName,
- boolean isExpand)
- {
- String path = _getPathParam(tree);
- return jsVarName+".action('"+(isExpand ? _SHOW : _HIDE)+
- "','"+path+"',this);return false;";
- }
-
- public static String callJSGotoNode(UIXHierarchy tree, String jsVarName,
- int rangeStart)
- {
- String path = _getPathParam(tree);
- return jsVarName+".range('"+path+"',"+rangeStart+");return false;";
- }
-
- public static String callJSFocusNode(UIXHierarchy tree, String jsVarName)
- {
- String path = _getPathParam(tree);
- return jsVarName+".focus('"+path+"',this);return false;";
- }
-
- public static String callJSExpandAll(UIXHierarchy tree, String jsVarName,
- boolean isExpand)
- {
- return jsVarName+".action('"+(isExpand ? _SHOW : _HIDE)+
- "','"+_ALL_VALUE+"',this);return false;";
- }
-
- public static String callJSSelectAll(String jsVarName, boolean isSelectAll)
- {
- return jsVarName+".multiSelect("+(isSelectAll ? "true" : "false")+")";
- }
-
- public static void decodeGotoEvent(final Map parameters,
- UIComponent tree)
- {
- Object event = parameters.get(EVENT_PARAM);
- if (_GOTO.equals(event))
- {
- PreserveState preserve = new PreserveState()
- {
- protected void process(UIXHierarchy tree)
- {
- final int newStart;
- String startParam = (String) parameters.get(_START_PARAM);
- if ((startParam == null) || ("".equals(startParam)))
- {
- // this must be a root level range change:
- startParam = (String) parameters.get(XhtmlConstants.VALUE_PARAM);
- newStart = Integer.parseInt(startParam) - 1; // value is based at one.
- tree.setRowKey(tree.getFocusRowKey());
- tree.setRowIndex(newStart);
- // queue a focusChange event as well as range change event:
- new FocusEvent(tree).queue();
- }
- else // large record set navigation
- {
- // set the currency to be the container that was scrolled:
- _restorePathFromParam(parameters, tree);
- newStart = Integer.parseInt(startParam);
- }
- TableRenderer.createRangeChangeEvent(tree, newStart).queue();
- }
- };
- preserve.run((UIXHierarchy) tree);
- }
- }
-
- public static void decodeFocusEvent(final Map parameters,
- UIComponent tree)
- {
- Object event = parameters.get(EVENT_PARAM);
- if (_FOCUS.equals(event))
- {
- PreserveState preserve = new PreserveState()
- {
- protected void process(UIXHierarchy tree)
- {
- _restorePathFromParam(parameters, tree);
- new FocusEvent(tree).queue();
- }
- };
- preserve.run((UIXHierarchy) tree);
- }
- }
-
- public static void decodeExpandEvents(final Map parameters,
- final UIComponent tree,
- final Object focusRowKey)
- {
- Object event = parameters.get(EVENT_PARAM);
- final Boolean expand;
- if (_HIDE.equals(event))
- {
- expand = Boolean.FALSE;
- }
- else if (_SHOW.equals(event))
- {
- expand = Boolean.TRUE;
- }
- else
- {
- return;
- }
-
- PreserveState preserve = new PreserveState()
- {
- protected void process(UIXHierarchy tree)
- {
- final FacesEvent event;
-
- Object key = parameters.get(_PATH_PARAM);
- if (_ALL_VALUE.equals(key)) // expandAll event
- {
- if (focusRowKey == null)
- {
- _LOG.severe("Unexpected tree state: focus rowKey is empty on an " +
- "expand/collapse all request.");
- return;
- }
- else
- {
- tree.setRowKey(focusRowKey);
- RowKeySet old = _getExpandedRowKeys(tree);
- RowKeySet newset = old.clone();
- if (expand)
- newset.addAll();
- else
- newset.removeAll();
- event = new RowDisclosureEvent(old, newset, tree);
- }
- }
- else // expand/collapse event
- {
- _restorePathFromParam(parameters, tree);
- RowKeySet old = _getExpandedRowKeys(tree);
- RowKeySet newset = old.clone();
- newset.setContained(expand);
- event = new RowDisclosureEvent(old, newset, tree);
- }
- event.queue();
- }
- };
-
- preserve.run((UIXHierarchy) tree);
- }
-
- private static RowKeySet _getExpandedRowKeys(UIXHierarchy tree)
- {
- if (tree instanceof UIXTree)
- return ((UIXTree) tree).getDisclosedRowKeys();
- if (tree instanceof UIXNavigationTree)
- return ((UIXNavigationTree) tree).getDisclosedRowKeys();
- if (tree instanceof UIXPage)
- return ((UIXPage) tree).getDisclosedRowKeys();
- throw new IllegalArgumentException("Don't know how to get disclosedRowKeys from:"+tree);
- }
-
- private static void _restorePathFromParam(Map parameters, UIXHierarchy tree)
- {
- String currencyString = (String) parameters.get(_PATH_PARAM);
- tree.setCurrencyString(currencyString);
- }
-
- private static String _getPathParam(UIXHierarchy tree)
- {
- String currencyString = tree.getCurrencyString();
- return currencyString;
- }
-
- private abstract static class PreserveState
- {
- public void run(UIXHierarchy tree)
- {
- Object oldPath = tree.getRowKey();
- try
- {
- process(tree);
- }
- finally
- {
- tree.setRowKey(oldPath);
- }
- }
-
- protected abstract void process(UIXHierarchy tree);
- }
-
- private static final String _GOTO = "goto";
- private static final String _HIDE = "hide";
- private static final String _SHOW = "show";
- private static final String _FOCUS = "focus";
- private static final String _ALL_VALUE = "all";
- private static final String _PATH_PARAM = "path";
- private static final String _START_PARAM = "start";
-
- private static final ADFLogger _LOG = ADFLogger.createADFLogger(TreeUtils.class);
-}
+package org.apache.myfaces.adfinternal.renderkit.core.xhtml.table;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.event.FacesEvent;
+
+import org.apache.myfaces.adf.logging.ADFLogger;
+import org.apache.myfaces.adf.component.UIXHierarchy;
+import org.apache.myfaces.adf.component.UIXNavigationTree;
+import org.apache.myfaces.adf.component.UIXPage;
+import org.apache.myfaces.adf.component.UIXTree;
+import org.apache.myfaces.adf.component.UIXTreeTable;
+import org.apache.myfaces.adf.event.RowDisclosureEvent;
+import org.apache.myfaces.adf.event.FocusEvent;
+
+import org.apache.myfaces.adf.model.RowKeySet;
+
+import org.apache.myfaces.adfinternal.renderkit.AdfRenderingContext;
+import org.apache.myfaces.adfinternal.renderkit.core.xhtml.HiddenLabelUtils;
+import org.apache.myfaces.adfinternal.renderkit.core.xhtml.TableRenderer;
+import org.apache.myfaces.adfinternal.renderkit.core.xhtml.XhtmlConstants;
+import org.apache.myfaces.adfinternal.renderkit.core.xhtml.XhtmlRenderer;
+import org.apache.myfaces.adfinternal.renderkit.core.xhtml.XhtmlUtils;
+import org.apache.myfaces.adfinternal.util.IntegerUtils;
+
+/**
+ * Class that handles all tree related events
+ * @author The Oracle ADF Faces Team
+ */
+public final class TreeUtils
+{
+ private TreeUtils()
+ {
+ }
+
+ // Names of the parameters used by TreeUtils. The names
+ // need to be public so form value can be prepared;
+ // the meaning of the parameters are not public
+ public static final String EVENT_PARAM = "event";
+ public static final String SOURCE_PARAM = "source";
+
+
+ /**
+ * This method is used for writing the depth of node from it's root in
+ * the case tree and HGrid, thus making it more accessible.
+ */
+ public static void writeNodeLevel(
+ FacesContext context,
+ AdfRenderingContext arc,
+ int depth,
+ String nodeLevelTextKey
+ ) throws IOException
+ {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement("label", null);
+ String pattern = arc.getTranslatedString(nodeLevelTextKey);
+ String levelInfo =
+ XhtmlUtils.getFormattedString(pattern,
+ new String[]
+ {
+ IntegerUtils.getString(depth)
+ });
+
+ if (HiddenLabelUtils.supportsHiddenLabels(arc))
+ XhtmlRenderer.renderStyleClass(context, arc,
+ XhtmlConstants.HIDDEN_LABEL_STYLE_CLASS);
+
+ writer.writeText(levelInfo, null);
+ writer.endElement("label");
+ }
+
+ // TODO: this method should be removed.
+ public static Object getFocusRowKey(UIXTreeTable treeTable)
+ {
+ Object path = treeTable.getFocusRowKey();
+ if (path == null)
+ {
+ int oldIndex = treeTable.getRowIndex();
+ treeTable.setRowIndex(0);
+ Object rowKey = treeTable.getRowKey();
+ treeTable.setRowIndex(oldIndex);
+ return rowKey;
+ }
+ else
+ return path;
+ }
+
+ /**
+ * writes the JS function needed for generating tree events.
+ * @param buff the function source is appended to this buffer
+ * @return
+ */
+ public static StringBuffer setupTreeCollectionComponent(
+ StringBuffer buff,
+ boolean validate)
+ {
+ String validateString = validate?"1":"0";
+ buff.append
+ ("CollectionComponent.defineTree('"+
+ EVENT_PARAM+"','"+
+ SOURCE_PARAM+"','"+
+ _PATH_PARAM+"','"+
+ _START_PARAM+"','"+
+ _GOTO+"','"+
+ _FOCUS+"'," +
+ validateString + ");"
+ );
+
+ return buff;
+ }
+
+ public static String setupJSTreeCollectionComponent(boolean validate)
+ {
+ String validateString = validate?"1":"0";
+ return
+ "CollectionComponent.defineTree('"+
+ EVENT_PARAM+"','"+
+ SOURCE_PARAM+"','"+
+ _PATH_PARAM+"','"+
+ _START_PARAM+"','"+
+ _GOTO+"','"+
+ _FOCUS+ "'," +
+ validateString + ")";
+ }
+
+ public static String setupJSMultiSelectCollectionComponent(
+ String selectedKey,
+ String selectedModeKey,
+ boolean autoSubmit)
+ {
+ return
+ "CollectionComponent.defineMultiSelect('"+
+ selectedKey+"','"+
+ selectedModeKey+"',"+(autoSubmit ? "true" : "false")+")";
+ }
+
+ public static String createNewJSCollectionComponentState(String formName, String treeClientId)
+ {
+ // must not end with a ";". This is because this might be passed as an
+ // argument to some other function:
+ return "new CollectionComponent('"+formName+"','"+treeClientId+"')";
+ }
+
+ public static String callJSExpandNode(UIXHierarchy tree, String jsVarName,
+ boolean isExpand)
+ {
+ String path = _getPathParam(tree);
+ return jsVarName+".action('"+(isExpand ? _SHOW : _HIDE)+
+ "','"+path+"',this);return false;";
+ }
+
+ public static String callJSGotoNode(UIXHierarchy tree, String jsVarName,
+ int rangeStart)
+ {
+ String path = _getPathParam(tree);
+ return jsVarName+".range('"+path+"',"+rangeStart+");return false;";
+ }
+
+ public static String callJSFocusNode(UIXHierarchy tree, String jsVarName)
+ {
+ String path = _getPathParam(tree);
+ return jsVarName+".focus('"+path+"',this);return false;";
+ }
+
+ public static String callJSExpandAll(UIXHierarchy tree, String jsVarName,
+ boolean isExpand)
+ {
+ return jsVarName+".action('"+(isExpand ? _SHOW : _HIDE)+
+ "','"+_ALL_VALUE+"',this);return false;";
+ }
+
+ public static String callJSSelectAll(String jsVarName, boolean isSelectAll)
+ {
+ return jsVarName+".multiSelect("+(isSelectAll ? "true" : "false")+")";
+ }
+
+ public static void decodeGotoEvent(final Map parameters,
+ UIComponent tree)
+ {
+ Object event = parameters.get(EVENT_PARAM);
+ if (_GOTO.equals(event))
+ {
+ PreserveState preserve = new PreserveState()
+ {
+ protected void process(UIXHierarchy tree)
+ {
+ final int newStart;
+ String startParam = (String) parameters.get(_START_PARAM);
+ if ((startParam == null) || ("".equals(startParam)))
+ {
+ // this must be a root level range change:
+ startParam = (String) parameters.get(XhtmlConstants.VALUE_PARAM);
+ newStart = Integer.parseInt(startParam) - 1; // value is based at one.
+ tree.setRowKey(tree.getFocusRowKey());
+ tree.setRowIndex(newStart);
+ // queue a focusChange event as well as range change event:
+ new FocusEvent(tree).queue();
+ }
+ else // large record set navigation
+ {
+ // set the currency to be the container that was scrolled:
+ _restorePathFromParam(parameters, tree);
+ newStart = Integer.parseInt(startParam);
+ }
+ TableRenderer.createRangeChangeEvent(tree, newStart).queue();
+ }
+ };
+ preserve.run((UIXHierarchy) tree);
+ }
+ }
+
+ public static void decodeFocusEvent(final Map parameters,
+ UIComponent tree)
+ {
+ Object event = parameters.get(EVENT_PARAM);
+ if (_FOCUS.equals(event))
+ {
+ PreserveState preserve = new PreserveState()
+ {
+ protected void process(UIXHierarchy tree)
+ {
+ _restorePathFromParam(parameters, tree);
+ new FocusEvent(tree).queue();
+ }
+ };
+ preserve.run((UIXHierarchy) tree);
+ }
+ }
+
+ public static void decodeExpandEvents(final Map parameters,
+ final UIComponent tree,
+ final Object focusRowKey)
+ {
+ Object event = parameters.get(EVENT_PARAM);
+ final Boolean expand;
+ if (_HIDE.equals(event))
+ {
+ expand = Boolean.FALSE;
+ }
+ else if (_SHOW.equals(event))
+ {
+ expand = Boolean.TRUE;
+ }
+ else
+ {
+ return;
+ }
+
+ PreserveState preserve = new PreserveState()
+ {
+ protected void process(UIXHierarchy tree)
+ {
+ final FacesEvent event;
+
+ Object key = parameters.get(_PATH_PARAM);
+ if (_ALL_VALUE.equals(key)) // expandAll event
+ {
+ if (focusRowKey == null)
+ {
+ _LOG.severe("Unexpected tree state: focus rowKey is empty on an " +
+ "expand/collapse all request.");
+ return;
+ }
+ else
+ {
+ tree.setRowKey(focusRowKey);
+ RowKeySet old = _getExpandedRowKeys(tree);
+ RowKeySet newset = old.clone();
+ if (expand)
+ newset.addAll();
+ else
+ newset.removeAll();
+ event = new RowDisclosureEvent(old, newset, tree);
+ }
+ }
+ else // expand/collapse event
+ {
+ _restorePathFromParam(parameters, tree);
+ RowKeySet old = _getExpandedRowKeys(tree);
+ RowKeySet newset = old.clone();
+ newset.setContained(expand);
+ event = new RowDisclosureEvent(old, newset, tree);
+ }
+ event.queue();
+ }
+ };
+
+ preserve.run((UIXHierarchy) tree);
+ }
+
+ private static RowKeySet _getExpandedRowKeys(UIXHierarchy tree)
+ {
+ if (tree instanceof UIXTree)
+ return ((UIXTree) tree).getDisclosedRowKeys();
+ if (tree instanceof UIXNavigationTree)
+ return ((UIXNavigationTree) tree).getDisclosedRowKeys();
+ if (tree instanceof UIXPage)
+ return ((UIXPage) tree).getDisclosedRowKeys();
+ throw new IllegalArgumentException("Don't know how to get disclosedRowKeys from:"+tree);
+ }
+
+ private static void _restorePathFromParam(Map parameters, UIXHierarchy tree)
+ {
+ String currencyString = (String) parameters.get(_PATH_PARAM);
+ tree.setCurrencyString(currencyString);
+ }
+
+ private static String _getPathParam(UIXHierarchy tree)
+ {
+ String currencyString = tree.getCurrencyString();
+ return currencyString;
+ }
+
+ private abstract static class PreserveState
+ {
+ public void run(UIXHierarchy tree)
+ {
+ Object oldPath = tree.getRowKey();
+ try
+ {
+ process(tree);
+ }
+ finally
+ {
+ tree.setRowKey(oldPath);
+ }
+ }
+
+ protected abstract void process(UIXHierarchy tree);
+ }
+
+ private static final String _GOTO = "goto";
+ private static final String _HIDE = "hide";
+ private static final String _SHOW = "show";
+ private static final String _FOCUS = "focus";
+ private static final String _ALL_VALUE = "all";
+ private static final String _PATH_PARAM = "path";
+ private static final String _START_PARAM = "start";
+
+ private static final ADFLogger _LOG = ADFLogger.createADFLogger(TreeUtils.class);
+}
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/core/xhtml/table/TreeUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/html/layout/ShowOneUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/html/layout/ShowOneUtils.java?rev=425276&r1=425275&r2=425276&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/html/layout/ShowOneUtils.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/html/layout/ShowOneUtils.java Mon Jul 24 21:42:41 2006
@@ -1,156 +1,156 @@
-/*
- * Copyright 2005,2006 The Apache Software Foundation.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.myfaces.adfinternal.renderkit.html.layout;
-
-import java.io.IOException;
-
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.ResponseWriter;
-
-import org.apache.myfaces.adfinternal.ui.RenderingContext;
-import org.apache.myfaces.adfinternal.ui.laf.base.BaseLafRenderer;
-import org.apache.myfaces.adfinternal.ui.laf.base.xhtml.XhtmlLafRenderer;
-import org.apache.myfaces.adfinternal.ui.partial.PartialPageRendererUtils;
-
-/**
- * Utility class for showOne category of components.
- *
- * @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/renderkit/html/layout/ShowOneUtils.java#0 $) $Date: 10-nov-2005.19:01:15 $
- * @author The Oracle ADF Faces Team
- */
-public class ShowOneUtils
-{
- /**
- * Generates markup corresponding to Core attributes the component has.
- *
- * @param context the faces context object
- * @param component the UIComponent object
- * @throws IOException when can't write onto response writer
- */
- static void renderGenericAttributes(RenderingContext rCtx,
- UIComponent component,
- ResponseWriter out)
- throws IOException
- {
- Map attrMap = component.getAttributes();
-
- // there is a certain amount of controversy about writing this attribute.
- // see bug 1606882
- String shortDesc = (String) attrMap.get("shortDesc");
- if (shortDesc != null)
- {
- out.writeAttribute("title", shortDesc, null);
- }
-
- if (BaseLafRenderer.supportsStyleAttributes(rCtx))
- {
- Object inlineStyle = attrMap.get("inlineStyle");
- if (inlineStyle != null)
- {
- XhtmlLafRenderer.renderInlineStyleAttribute(rCtx, inlineStyle);
- }
- }
-
- if (BaseLafRenderer.supportsIntrinsicEvents(rCtx) )
- {
- // since the showOne components don't have disabled attribute,
- // it's safe enough to just write all the event handlers.
- String onclick = (String) attrMap.get("onclick");
- if (onclick != null)
- {
- out.writeAttribute("onclick", onclick, null);
- }
- String ondblclick = (String) attrMap.get("ondblclick");
- if (ondblclick != null)
- {
- out.writeAttribute("ondblclick", ondblclick, null);
- }
- String onmousedown = (String) attrMap.get("onmousedown");
- if (onmousedown != null)
- {
- out.writeAttribute("onmousedown", onmousedown, null);
- }
- String onmouseup = (String) attrMap.get("onmouseup");
- if (onmouseup != null)
- {
- out.writeAttribute("onmouseup", onmouseup, null);
- }
- String onmouseover = (String) attrMap.get("onmouseover");
- if (onmouseover != null)
- {
- out.writeAttribute("onmouseover", onmouseover, null);
- }
- String onmousemove = (String) attrMap.get("onmousemove");
- if (onmousemove != null)
- {
- out.writeAttribute("onmousemove", onmousemove, null);
- }
- String onmouseout = (String) attrMap.get("onmouseout");
- if (onmouseout != null)
- {
- out.writeAttribute("onmouseout", onmouseout, null);
- }
- String onkeypress = (String) attrMap.get("onkeypress");
- if (onkeypress != null)
- {
- out.writeAttribute("onkeypress", onkeypress, null);
- }
- String onkeydown = (String) attrMap.get("onkeydown");
- if (onkeydown != null)
- {
- out.writeAttribute("onkeydown", onkeydown, null);
- }
- String onkeyup = (String) attrMap.get("onkeyup");
- if (onkeyup != null)
- {
- out.writeAttribute("onkeyup", onkeyup, null);
- }
- }
- }
-
-
- /**
- * Creates encoded partial targets for UIComponent.
- * Adds the compId to the list of partial targets available in component
- * attribute map.
- *
- * @param component the UIComponent object
- * @param compId the id to be added to already available partial targets
- * @return String encoded partialTarget string
- */
- static String getEncodedPartialTargets(UIComponent component, String compId)
- {
- String[] pprTargets =
- (String []) component.getAttributes().get("partialTargets");
- String encodedPartialTargets = null;
- if ( (pprTargets != null) && (pprTargets.length > 0) )
- {
- String[] pprTargetsNew = new String[pprTargets.length + 1];
- pprTargetsNew = pprTargets;
- pprTargetsNew[pprTargets.length] = compId;
- encodedPartialTargets =
- PartialPageRendererUtils.encodePartialTargets(pprTargetsNew);
- }
- else
- {
- encodedPartialTargets =
- PartialPageRendererUtils.encodePartialTargets(new String[] {compId});
- }
- return encodedPartialTargets;
- }
+/*
+ * Copyright 2005,2006 The Apache Software Foundation.
+ *
+ * Licensed 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 KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.adfinternal.renderkit.html.layout;
+
+import java.io.IOException;
+
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.adfinternal.ui.RenderingContext;
+import org.apache.myfaces.adfinternal.ui.laf.base.BaseLafRenderer;
+import org.apache.myfaces.adfinternal.ui.laf.base.xhtml.XhtmlLafRenderer;
+import org.apache.myfaces.adfinternal.ui.partial.PartialPageRendererUtils;
+
+/**
+ * Utility class for showOne category of components.
+ *
+ * @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/renderkit/html/layout/ShowOneUtils.java#0 $) $Date: 10-nov-2005.19:01:15 $
+ * @author The Oracle ADF Faces Team
+ */
+public class ShowOneUtils
+{
+ /**
+ * Generates markup corresponding to Core attributes the component has.
+ *
+ * @param context the faces context object
+ * @param component the UIComponent object
+ * @throws IOException when can't write onto response writer
+ */
+ static void renderGenericAttributes(RenderingContext rCtx,
+ UIComponent component,
+ ResponseWriter out)
+ throws IOException
+ {
+ Map attrMap = component.getAttributes();
+
+ // there is a certain amount of controversy about writing this attribute.
+ // see bug 1606882
+ String shortDesc = (String) attrMap.get("shortDesc");
+ if (shortDesc != null)
+ {
+ out.writeAttribute("title", shortDesc, null);
+ }
+
+ if (BaseLafRenderer.supportsStyleAttributes(rCtx))
+ {
+ Object inlineStyle = attrMap.get("inlineStyle");
+ if (inlineStyle != null)
+ {
+ XhtmlLafRenderer.renderInlineStyleAttribute(rCtx, inlineStyle);
+ }
+ }
+
+ if (BaseLafRenderer.supportsIntrinsicEvents(rCtx) )
+ {
+ // since the showOne components don't have disabled attribute,
+ // it's safe enough to just write all the event handlers.
+ String onclick = (String) attrMap.get("onclick");
+ if (onclick != null)
+ {
+ out.writeAttribute("onclick", onclick, null);
+ }
+ String ondblclick = (String) attrMap.get("ondblclick");
+ if (ondblclick != null)
+ {
+ out.writeAttribute("ondblclick", ondblclick, null);
+ }
+ String onmousedown = (String) attrMap.get("onmousedown");
+ if (onmousedown != null)
+ {
+ out.writeAttribute("onmousedown", onmousedown, null);
+ }
+ String onmouseup = (String) attrMap.get("onmouseup");
+ if (onmouseup != null)
+ {
+ out.writeAttribute("onmouseup", onmouseup, null);
+ }
+ String onmouseover = (String) attrMap.get("onmouseover");
+ if (onmouseover != null)
+ {
+ out.writeAttribute("onmouseover", onmouseover, null);
+ }
+ String onmousemove = (String) attrMap.get("onmousemove");
+ if (onmousemove != null)
+ {
+ out.writeAttribute("onmousemove", onmousemove, null);
+ }
+ String onmouseout = (String) attrMap.get("onmouseout");
+ if (onmouseout != null)
+ {
+ out.writeAttribute("onmouseout", onmouseout, null);
+ }
+ String onkeypress = (String) attrMap.get("onkeypress");
+ if (onkeypress != null)
+ {
+ out.writeAttribute("onkeypress", onkeypress, null);
+ }
+ String onkeydown = (String) attrMap.get("onkeydown");
+ if (onkeydown != null)
+ {
+ out.writeAttribute("onkeydown", onkeydown, null);
+ }
+ String onkeyup = (String) attrMap.get("onkeyup");
+ if (onkeyup != null)
+ {
+ out.writeAttribute("onkeyup", onkeyup, null);
+ }
+ }
+ }
+
+
+ /**
+ * Creates encoded partial targets for UIComponent.
+ * Adds the compId to the list of partial targets available in component
+ * attribute map.
+ *
+ * @param component the UIComponent object
+ * @param compId the id to be added to already available partial targets
+ * @return String encoded partialTarget string
+ */
+ static String getEncodedPartialTargets(UIComponent component, String compId)
+ {
+ String[] pprTargets =
+ (String []) component.getAttributes().get("partialTargets");
+ String encodedPartialTargets = null;
+ if ( (pprTargets != null) && (pprTargets.length > 0) )
+ {
+ String[] pprTargetsNew = new String[pprTargets.length + 1];
+ pprTargetsNew = pprTargets;
+ pprTargetsNew[pprTargets.length] = compId;
+ encodedPartialTargets =
+ PartialPageRendererUtils.encodePartialTargets(pprTargetsNew);
+ }
+ else
+ {
+ encodedPartialTargets =
+ PartialPageRendererUtils.encodePartialTargets(new String[] {compId});
+ }
+ return encodedPartialTargets;
+ }
}
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/html/layout/ShowOneUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/resource/CoreClassLoaderResourceLoader.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/resource/CoreClassLoaderResourceLoader.java?rev=425276&r1=425275&r2=425276&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/resource/CoreClassLoaderResourceLoader.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/resource/CoreClassLoaderResourceLoader.java Mon Jul 24 21:42:41 2006
@@ -13,40 +13,40 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.myfaces.adfinternal.resource;
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.apache.myfaces.adf.resource.ClassLoaderResourceLoader;
-import org.apache.myfaces.adf.resource.ResourceLoader;
-
-
-/**
- *
- * @author The Oracle ADF Faces Team
- */
-public class CoreClassLoaderResourceLoader extends ClassLoaderResourceLoader
-{
- /**
- * Creates a new CoreClassLoaderResourceLoader
- */
- public CoreClassLoaderResourceLoader(ResourceLoader parent)
- {
- super("META-INF", parent);
- }
-
- protected URL findResource(
- String path) throws IOException
- {
- String version = CoreRenderKitResourceLoader.__getVersion();
- int index = path.indexOf(version);
- if (index >= 0)
- {
- path = (path.substring(0, index) +
- path.substring(index + version.length()));
- }
-
- return super.findResource(path);
- }
-}
+package org.apache.myfaces.adfinternal.resource;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.myfaces.adf.resource.ClassLoaderResourceLoader;
+import org.apache.myfaces.adf.resource.ResourceLoader;
+
+
+/**
+ *
+ * @author The Oracle ADF Faces Team
+ */
+public class CoreClassLoaderResourceLoader extends ClassLoaderResourceLoader
+{
+ /**
+ * Creates a new CoreClassLoaderResourceLoader
+ */
+ public CoreClassLoaderResourceLoader(ResourceLoader parent)
+ {
+ super("META-INF", parent);
+ }
+
+ protected URL findResource(
+ String path) throws IOException
+ {
+ String version = CoreRenderKitResourceLoader.__getVersion();
+ int index = path.indexOf(version);
+ if (index >= 0)
+ {
+ path = (path.substring(0, index) +
+ path.substring(index + version.length()));
+ }
+
+ return super.findResource(path);
+ }
+}
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/resource/CoreClassLoaderResourceLoader.java
------------------------------------------------------------------------------
svn:eol-style = native