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 [11/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/a...
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputLabelRenderer.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/OutputLabelRenderer.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/OutputLabelRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputLabelRenderer.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
@@ -21,7 +21,6 @@
import java.io.IOException;
import javax.faces.application.FacesMessage;
-import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -29,17 +28,17 @@
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.core.output.CoreOutputLabel;
-
import org.apache.myfaces.trinidad.context.Agent;
import org.apache.myfaces.trinidad.context.FormData;
import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidad.context.RequestContext;
-import org.apache.myfaces.trinidadinternal.util.MessageUtils;
import org.apache.myfaces.trinidad.skin.Icon;
+import org.apache.myfaces.trinidadinternal.util.MessageUtils;
+
/**
* Renderer for org.apache.myfaces.trinidad.Label, family org.apache.myfaces.trinidad.Output.
- *
+ *
* @todo Support "anchor"
* @todo Support messageDescUrl and targetFrame
*/
@@ -50,7 +49,8 @@
this(CoreOutputLabel.TYPE);
}
- protected OutputLabelRenderer(FacesBean.Type type)
+ protected OutputLabelRenderer(
+ FacesBean.Type type)
{
super(type);
}
@@ -62,7 +62,8 @@
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_accessKeyKey = type.findKey("accessKey");
@@ -79,20 +80,21 @@
*/
@Override
protected void encodeAll(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
- {
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
+ {
ResponseWriter rw = context.getResponseWriter();
String value = getConvertedString(context, component, bean);
String forId = getForId(context, component, bean);
- FormData fd = arc.getFormData();
+ FormData fd = rc.getFormData();
if (fd != null)
- fd.addLabel(forId, value);
-
- String messageType = _getMessageType(context, bean, forId);
+ fd.addLabel(forId, value);
+
+ String messageType = _getMessageType(context, component, bean, forId);
boolean noSpanNeeded =
((value == null) &&
@@ -102,10 +104,10 @@
{
rw.startElement("span", needComponentInStartElement() ? component : null);
renderId(context, component);
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, component, bean);
}
- boolean encodedIcons = encodeIcons(context, arc, component,
+ boolean encodedIcons = encodeIcons(context, rc, component,
bean, messageType, forId);
if (value != null)
@@ -114,21 +116,21 @@
{
rw.writeText(XhtmlConstants.NBSP_STRING, null);
}
-
+
char accessKey;
- if (supportsAccessKeys(arc))
+ if (supportsAccessKeys(rc))
{
- accessKey = getAccessKey(bean);
+ accessKey = getAccessKey(component, bean);
}
else
{
accessKey = CHAR_UNDEFINED;
}
-
+
int accessKeyIndex = AccessKeyUtils.getAccessKeyIndex(value, accessKey);
-
- boolean needsLabel = isLabelTagNeeded(arc, bean, forId, accessKeyIndex);
-
+
+ boolean needsLabel = isLabelTagNeeded(rc, component, bean, forId, accessKeyIndex);
+
if (needsLabel)
{
rw.startElement("label", needComponentInStartElement() ? component : null);
@@ -136,40 +138,40 @@
{
rw.writeAttribute("for", forId, "for");
// Remember this label so we don't output it twice
- HiddenLabelUtils.rememberLabel(arc, forId);
+ HiddenLabelUtils.rememberLabel(rc, forId);
}
-
+
if (accessKey != CHAR_UNDEFINED)
{
rw.writeAttribute("accesskey",
Character.valueOf(accessKey),
"accessKey");
-
- // BlackBerry browsers underline the entire text instead of just
- // the accessKey character in cases where the accessKey character
- // happens to be the first character in the text. Rendering an
+
+ // BlackBerry browsers underline the entire text instead of just
+ // the accessKey character in cases where the accessKey character
+ // happens to be the first character in the text. Rendering an
// empty span element before rendering the text fixes this problem.
-
- Agent agent = arc.getAgent();
-
- if ((accessKeyIndex == 0) &&
+
+ Agent agent = rc.getAgent();
+
+ if ((accessKeyIndex == 0) &&
Agent.AGENT_BLACKBERRY.equals(agent.getAgentName()))
{
rw.startElement("span", null);
- // Since an empty span element is not rendered, lets
- // include some attribute to the span element
+ // Since an empty span element is not rendered, lets
+ // include some attribute to the span element
rw.writeAttribute("style", "display:inline", null);
rw.endElement("span");
}
- }
+ }
}
-
-
+
+
AccessKeyUtils.renderAccessKeyText(context,
value,
accessKey,
SkinSelectors.AF_ACCESSKEY_STYLE_CLASS);
-
+
if (needsLabel)
{
rw.endElement("label");
@@ -188,73 +190,75 @@
}
protected boolean encodeIcons(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean,
- String messageType,
- String forId) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean,
+ String messageType,
+ String forId
+ ) throws IOException
{
boolean encodedIcons = false;
boolean isInline = (RequestContext.getCurrentInstance().getClientValidation() ==
RequestContext.ClientValidation.INLINE);
- if (_shouldRenderMessageSymbol(arc, messageType, isInline, forId))
+ if (_shouldRenderMessageSymbol(rc, messageType, isInline, forId))
{
- String vAlign = getDefaultValign(bean);
- String destination = getMessageDescUrl(bean);
- String targetFrame = getMessageTargetFrame(bean);
- String anchor = MessageUtils.getAnchor(forId);
+ String vAlign = getDefaultValign(component, bean);
+ String destination = getMessageDescUrl(component, bean);
+ String targetFrame = getMessageTargetFrame(component, bean);
+ String anchor = MessageUtils.getAnchor(forId);
ResponseWriter rw = context.getResponseWriter();
if(isInline)
{
rw.startElement(XhtmlConstants.SPAN_ELEMENT, component);
- rw.writeAttribute(XhtmlConstants.ID_ATTRIBUTE,
+ rw.writeAttribute(XhtmlConstants.ID_ATTRIBUTE,
forId + "::icon", null);
-
+
if(null == messageType || "none".equals(messageType))
{
messageType = XhtmlConstants.MESSAGE_TYPE_ERROR;
- rw.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE,
+ rw.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE,
"display:none;", null);
}
}
- encodedIcons = renderMessageSymbol(context, arc, messageType,
- destination, anchor,
+ encodedIcons = renderMessageSymbol(context, rc, messageType,
+ destination, anchor,
targetFrame, vAlign);
-
+
if(isInline)
rw.endElement(XhtmlConstants.SPAN_ELEMENT);
}
- if (getShowRequired(bean))
+ if (getShowRequired(component, bean))
{
// Get the required Icon from the context
- Icon icon = arc.getIcon(SkinSelectors.REQUIRED_ICON_ALIAS_NAME);
+ Icon icon = rc.getIcon(SkinSelectors.REQUIRED_ICON_ALIAS_NAME);
if (icon != null)
{
- String vAlign = getDefaultValign(bean);
- _renderIcon(context, arc, icon, null, null, null, "REQUIRED_TIP", vAlign);
+ String vAlign = getDefaultValign(component, bean);
+ _renderIcon(context, rc, icon, null, null, null, "REQUIRED_TIP", vAlign);
}
// Render the required icon
encodedIcons = true;
}
-
+
return encodedIcons;
}
protected boolean isLabelTagNeeded(
- RenderingContext arc,
- FacesBean bean,
- String forId,
- int accessKeyIndex
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean,
+ String forId,
+ int accessKeyIndex
)
{
return (((forId != null) &&
- !isInaccessibleMode(arc)) ||
+ !isInaccessibleMode(rc)) ||
(accessKeyIndex >= 0));
}
@@ -262,13 +266,13 @@
* @todo Support targetFrame???
*/
protected boolean renderMessageSymbol(
- FacesContext context,
- RenderingContext arc,
- Object type,
- Object destination,
- Object anchor,
- Object targetFrame,
- Object vAlign
+ FacesContext context,
+ RenderingContext rc,
+ Object type,
+ Object destination,
+ Object anchor,
+ Object targetFrame,
+ Object vAlign
) throws IOException
{
// Get the name of the Icon
@@ -297,12 +301,12 @@
if (iconName != null)
{
// Get the Icon to render from the skin
- Icon icon = arc.getIcon(iconName);
-
+ Icon icon = rc.getIcon(iconName);
+
if (icon != null)
{
_renderIcon(context,
- arc,
+ rc,
icon,
destination,
anchor,
@@ -317,19 +321,20 @@
return false;
}
-
//
// OVERRIDES
//
@Override
- protected String getDefaultStyleClass(FacesBean bean)
+ protected String getDefaultStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
return "af|outputLabel";
}
private void _renderIcon(
- FacesContext context,
- RenderingContext arc,
+ FacesContext context,
+ RenderingContext rc,
Icon icon,
Object destination,
Object anchor,
@@ -343,13 +348,13 @@
if ((destination != null) || (anchor != null))
{
- if (supportsNavigation(arc))
+ if (supportsNavigation(rc))
{
writer.startElement("a", null);
renderEncodedActionURI(context, "href", destination);
writer.writeAttribute("target", targetFrame, null);
writer.writeAttribute("name", anchor, null);
-
+
// Set renderedAnchor to true so that we know that
// we need to close the anchor element.
renderedAnchor = true;
@@ -359,17 +364,17 @@
// Get ready to render the Icon. We need to get the
// alt text, and also check to see whether the Icon
// should render the style class
- Object altText = arc.getTranslatedString(altTextKey);
+ Object altText = rc.getTranslatedString(altTextKey);
// Apply the default alignment
if (vAlign == null)
- vAlign = OutputUtils.getMiddleIconAlignment(arc);
+ vAlign = OutputUtils.getMiddleIconAlignment(rc);
// Render the icon, specifying embedded=renderedAnchor.
// This allows text-based Icons to render their style class
// and altText directly on the anchor itself
OutputUtils.renderIcon(context,
- arc,
+ rc,
icon,
altText,
vAlign,
@@ -381,12 +386,14 @@
}
private String _getMessageType(
- FacesContext context,
- FacesBean bean,
- String forId) throws IOException
+ FacesContext context,
+ UIComponent component,
+ FacesBean bean,
+ String forId
+ ) throws IOException
{
// Derive the message type
- String messageType = getMessageType(bean);
+ String messageType = getMessageType(component, bean);
if (null == messageType)
{
FacesMessage message = MessageUtils.getFacesMessage(context, forId);
@@ -400,35 +407,41 @@
return messageType;
}
-
//
// NEW HOOKS
- //
+ //
- protected boolean getShowRequired(FacesBean bean)
+ protected boolean getShowRequired(
+ UIComponent component,
+ FacesBean bean)
{
Object o = bean.getProperty(_showRequiredKey);
if (o == null)
o = _showRequiredKey.getDefault();
return Boolean.TRUE.equals(o);
- }
+ }
/**
* we default the valign. the user can use skinning to override.
- */
- protected String getDefaultValign(FacesBean bean)
+ */
+ protected String getDefaultValign(
+ UIComponent component,
+ FacesBean bean)
{
return null;
}
- protected char getAccessKey(FacesBean bean)
+ protected char getAccessKey(
+ UIComponent component,
+ FacesBean bean)
{
return toChar(bean.getProperty(_accessKeyKey));
}
-
- protected String getFor(FacesBean bean)
+ protected String getFor(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_forKey));
}
@@ -438,7 +451,7 @@
UIComponent component,
FacesBean bean)
{
- String forValue = getFor(bean);
+ String forValue = getFor(component, bean);
if (forValue == null)
return null;
@@ -447,7 +460,9 @@
forValue);
}
- protected String getMessageType(FacesBean bean)
+ protected String getMessageType(
+ UIComponent component,
+ FacesBean bean)
{
// We're used in some composite circumstances where
// the message type is always derived from the presence
@@ -456,25 +471,26 @@
return null;
return toString(bean.getProperty(_messageTypeKey));
}
-
- protected String getMessageDescUrl(FacesBean bean)
+ protected String getMessageDescUrl(
+ UIComponent component,
+ FacesBean bean)
{
return null;
- }
-
+ }
- protected String getMessageTargetFrame(FacesBean bean)
+ protected String getMessageTargetFrame(
+ UIComponent component,
+ FacesBean bean)
{
-
return null;
- }
+ }
private boolean _shouldRenderMessageSymbol(
- RenderingContext arc,
- String messageType,
- boolean isInline,
- String forId)
+ RenderingContext rc,
+ String messageType,
+ boolean isInline,
+ String forId)
{
// BlackBerry does not support inline style "display:none".
// BlackBerry supports some inline styles and thus test by
@@ -493,7 +509,7 @@
((forId != null) &&
isInline))
{
- Agent agent = arc.getAgent();
+ Agent agent = rc.getAgent();
if ((agent != null) &&
(Agent.AGENT_BLACKBERRY.equals(agent.getAgentName()) ||
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputTextRenderer.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/OutputTextRenderer.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/OutputTextRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputTextRenderer.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,10 @@
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.core.output.CoreOutputText;
-
import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidadinternal.util.nls.StringUtils;
+
public class OutputTextRenderer extends ValueRenderer
{
public OutputTextRenderer()
@@ -39,7 +39,8 @@
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
@@ -56,35 +57,36 @@
@Override
protected void encodeAll(
- 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;
ResponseWriter rw = context.getResponseWriter();
String value = getConvertedString(context, comp, bean);
- boolean escape = getEscape(bean);
+ boolean escape = getEscape(comp, bean);
if (escape)
{
rw.startElement("span", comp);
-
+
renderId(context, comp);
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, comp, bean);
- _renderDescription(context, arc, bean);
+ _renderDescription(context, rc, comp, bean);
if (value != null)
{
- int truncateAt = getTruncateAt(bean);
+ int truncateAt = getTruncateAt(comp, bean);
if (truncateAt > 0)
{
value = StringUtils.truncateString(value, truncateAt);
}
-
+
rw.writeText(value, "value");
}
@@ -97,8 +99,9 @@
}
}
-
- protected boolean getEscape(FacesBean bean)
+ protected boolean getEscape(
+ UIComponent component,
+ FacesBean bean)
{
Object o = bean.getProperty(_escapeKey);
if (o == null)
@@ -107,41 +110,46 @@
return !Boolean.FALSE.equals(o);
}
- protected int getTruncateAt(FacesBean bean)
+ protected int getTruncateAt(
+ UIComponent component,
+ FacesBean bean)
{
Object o = bean.getProperty(_truncateAtKey);
if (o == null)
o = _truncateAtKey.getDefault();
-
+
return ((Number) o).intValue();
}
- protected Object getDescription(FacesBean bean)
+ protected Object getDescription(
+ UIComponent component,
+ FacesBean bean)
{
return bean.getProperty(_descriptionKey);
}
private void _renderDescription(
- FacesContext context,
- RenderingContext arc,
- FacesBean bean
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
) throws IOException
{
- if (isInaccessibleMode(arc))
+ if (isInaccessibleMode(rc))
return;
- Object label = getDescription(bean);
+ Object label = getDescription(component, bean);
if (label == null)
return;
// Do not attempt to render this label if the underlying
// platform does not support hidden labels
- if (!HiddenLabelUtils.supportsHiddenLabels(arc))
+ if (!HiddenLabelUtils.supportsHiddenLabels(rc))
return;
ResponseWriter writer = context.getResponseWriter();
writer.startElement("span", null);
- renderStyleClass(context, arc, SkinSelectors.HIDDEN_LABEL_STYLE_CLASS);
+ renderStyleClass(context, rc, SkinSelectors.HIDDEN_LABEL_STYLE_CLASS);
writer.writeText(label, null);
writer.endElement("span");
}
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelAccordionRenderer.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/PanelAccordionRenderer.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/PanelAccordionRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelAccordionRenderer.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 java.util.List;
import java.util.Map;
@@ -31,15 +32,14 @@
import org.apache.myfaces.trinidad.component.UIXShowDetail;
import org.apache.myfaces.trinidad.component.core.layout.CorePanelAccordion;
import org.apache.myfaces.trinidad.component.core.layout.CoreShowDetailItem;
-import org.apache.myfaces.trinidad.context.Agent;
import org.apache.myfaces.trinidad.context.FormData;
import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidad.context.RequestContext;
import org.apache.myfaces.trinidad.event.DisclosureEvent;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-
import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
+
/**
* Renderer for PanelAccordion
*
@@ -53,7 +53,8 @@
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_discloseNoneKey = type.findKey("discloseNone");
@@ -62,18 +63,20 @@
@SuppressWarnings("unchecked")
@Override
- public void decode(FacesContext context, UIComponent component)
+ public void decode(
+ FacesContext context,
+ UIComponent component)
{
- Map<String, String> parameters =
+ Map<String, String> parameters =
context.getExternalContext().getRequestParameterMap();
-
+
Object event = parameters.get(XhtmlConstants.EVENT_PARAM);
if (XhtmlConstants.HIDE_EVENT.equals(event) ||
XhtmlConstants.SHOW_EVENT.equals(event))
{
Object source = parameters.get(XhtmlConstants.SOURCE_PARAM);
String id = component.getClientId(context);
-
+
if (id.equals(source))
{
boolean isDisclosed = XhtmlConstants.SHOW_EVENT.equals(event);
@@ -126,7 +129,7 @@
{
return true;
}
-
+
/**
* First: If nothing is disclosed, makes the first child disclosed.
*
@@ -151,12 +154,13 @@
@SuppressWarnings("unchecked")
@Override
protected void encodeAll(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
- FormData fData = arc.getFormData();
+ FormData fData = rc.getFormData();
String formName = "";
if (fData != null)
@@ -170,7 +174,7 @@
// Hidden field to store parameter targetItem is needed for non
// Ajax browsers to pass the target item Id back to the server.
boolean pprEnabled =
- PartialPageUtils.supportsPartialRendering(arc);
+ PartialPageUtils.supportsPartialRendering(rc);
if (!pprEnabled)
{
fData.addNeededValue(XhtmlConstants.TARGETITEM_PARAM);
@@ -214,7 +218,7 @@
// If we have a minimum of 1 disclosed child and none have been disclosed
// yet, disclose the first rendered one:
- if ( (disclosedChild == null) && !getDiscloseNone(bean) &&
+ if ( (disclosedChild == null) && !getDiscloseNone(component, bean) &&
(renderableChild != null) && !renderableChild.isDisclosedTransient())
{
renderableChild.setDisclosed(true);
@@ -226,10 +230,10 @@
out.startElement("div", component);
renderId(context, component);
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, component, bean);
- boolean discloseMany = getDiscloseMany(bean);
- boolean discloseNone = getDiscloseNone(bean);
+ boolean discloseMany = getDiscloseMany(component, bean);
+ boolean discloseNone = getDiscloseNone(component, bean);
boolean disclosedFixed = false;
if (discloseMany && !discloseNone) // must keep at least one item disclosed
{
@@ -264,7 +268,7 @@
if (!(child instanceof UIXShowDetail) ||
!child.isRendered())
continue;
-
+
UIXShowDetail detailItem = (UIXShowDetail) child;
boolean disabled = _isItemDisabled(detailItem);
String titleText = (String)
@@ -292,8 +296,8 @@
itemStyleClass = getHeaderExpandedStyleClass();
else
itemStyleClass = getHeaderCollapsedStyleClass();
-
- renderStyleClass(context, arc, itemStyleClass);
+
+ renderStyleClass(context, rc, itemStyleClass);
// Render the toolbar component, if any (we use float to keep
// the toolbar on the right - or left, in RTL languages - so
@@ -303,13 +307,13 @@
if (toolbar != null)
{
out.startElement("div", detailItem);
- renderStyleClass(context, arc, SkinSelectors.AF_PANELACCORDION_TOOLBAR_STYLE_CLASS);
+ renderStyleClass(context, rc, SkinSelectors.AF_PANELACCORDION_TOOLBAR_STYLE_CLASS);
encodeChild(context, toolbar);
out.endElement("div");
}
-
- boolean javaScriptSupport = supportsScripting(arc);
-
+
+ boolean javaScriptSupport = supportsScripting(rc);
+
if (javaScriptSupport)
{
out.startElement("a", null);
@@ -317,15 +321,15 @@
}
else
{
- // For Non-JavaScript browsers, render an input element(type=submit) to
- // submit the page. Encode the name attribute with the parameter name
- // and value thus it would enable the browsers to include the name of
+ // For Non-JavaScript browsers, render an input element(type=submit) to
+ // submit the page. Encode the name attribute with the parameter name
+ // and value thus it would enable the browsers to include the name of
// this element in its payLoad if it submits the page.
out.startElement("input", null);
out.writeAttribute("type", "submit", null);
}
- renderStyleClass(context, arc,
+ renderStyleClass(context, rc,
disabled
? getLinkDisabledStyleClass()
: getLinkEnabledStyleClass());
@@ -337,11 +341,11 @@
{
boolean isImmediate = detailItem.isImmediate();
String event = disclosed ? "hide" : "show";
-
+
if (javaScriptSupport)
{
String onClickHandler = _getFormSubmitScript(component,
- arc,
+ rc,
event,
detailItemId,
formName,
@@ -361,19 +365,19 @@
+ XhtmlUtils.getEncodedParameter
(XhtmlConstants.TARGETITEM_PARAM)
+ detailItemId;
-
+
out.writeAttribute("name", nameAttri, null);
}
}
-
+
if (javaScriptSupport)
- {
+ {
// =-=rbaranwa Per the UI Review, no icon to be rendered when
// panel is disabled.
if (! disabled)
{
ShowDetailRenderer.renderDisclosureIcon(context,
- arc,
+ rc,
disclosed,
getDisclosedTipKey(),
getUndisclosedTipKey());
@@ -386,7 +390,7 @@
}
else
{
- // Since we cannot render any image element as a child of input element,
+ // Since we cannot render any image element as a child of input element,
// just render the icon symbol along with the text.
String icon = disclosed ? XhtmlConstants.NON_JS_DETAIL_DISCLOSED_ICON :
XhtmlConstants.NON_JS_DETAIL_UNDISCLOSED_ICON;
@@ -394,17 +398,17 @@
{
icon = icon + titleText;
}
-
+
out.writeAttribute("value", icon, null);
-
+
if (disabled || !disclosable)
{
out.writeAttribute("disabled", Boolean.TRUE, "disabled");
}
-
+
out.endElement("input");
}
-
+
out.endElement("div"); // Ending div for an individual panel
@@ -415,7 +419,7 @@
// one showDetail child has it's disclosed property set to true.
if (disclosed && (! disabled) && (! childAlreadyRendered) )
{
- _encodeDetailItem(context, arc, component, detailItem, out);
+ _encodeDetailItem(context, rc, component, detailItem, out);
if (!discloseMany)
{
childAlreadyRendered = true;
@@ -426,7 +430,9 @@
}
@Override
- protected String getDefaultStyleClass(FacesBean bean)
+ protected String getDefaultStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
return SkinSelectors.AF_PANELACCORDION_STYLE_CLASS;
}
@@ -482,19 +488,20 @@
* @param out the response writer object
* @throws IOException when some issues while writing output
*/
- private void _encodeDetailItem(FacesContext context,
- RenderingContext arc,
- UIComponent component,
- UIXShowDetail detailItem,
- ResponseWriter out)
- throws IOException
+ private void _encodeDetailItem(
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ UIXShowDetail detailItem,
+ ResponseWriter out
+ ) throws IOException
{
out.startElement("table", component);
out.writeAttribute("cellSpacing", "0", null);
out.writeAttribute("cellPadding", "0", null);
out.writeAttribute("summary", "", null);
- renderStyleClass(context, arc, getContentStyleClass());
+ renderStyleClass(context, rc, getContentStyleClass());
out.startElement("tr", component);
out.startElement("td", component);
@@ -507,22 +514,22 @@
out.endElement("table"); // Ending table for the contained child
}
-
/**
* Creates javascript used to submit the page.
*/
- private String _getFormSubmitScript(UIComponent component,
- RenderingContext arc,
- String event,
- String detailItemId,
- String formName,
- String compId,
- boolean isImmediate)
+ private String _getFormSubmitScript(
+ UIComponent component,
+ RenderingContext rc,
+ String event,
+ String detailItemId,
+ String formName,
+ String compId,
+ boolean isImmediate)
{
// Check if PPR enabled, do a _submitPartialChange, else do a formSubmit.
String onClickHandler = "";
boolean pprEnabled =
- PartialPageUtils.supportsPartialRendering(arc);
+ PartialPageUtils.supportsPartialRendering(rc);
String validate = "1";
if (isImmediate)
@@ -545,7 +552,7 @@
.append(detailItemId)
.append("'});return false;");
- onClickHandler = onClickHandlerBuff.toString();
+ onClickHandler = onClickHandlerBuff.toString();
}
else
{
@@ -566,8 +573,9 @@
return onClickHandler;
}
-
- protected boolean getDiscloseMany(FacesBean bean)
+ protected boolean getDiscloseMany(
+ UIComponent component,
+ FacesBean bean)
{
Object o = bean.getProperty(_discloseManyKey);
if (o == null)
@@ -576,7 +584,9 @@
return Boolean.TRUE.equals(o);
}
- protected boolean getDiscloseNone(FacesBean bean)
+ protected boolean getDiscloseNone(
+ UIComponent component,
+ FacesBean bean)
{
Object o = bean.getProperty(_discloseNoneKey);
if (o == null)
@@ -585,7 +595,8 @@
return Boolean.TRUE.equals(o);
}
- private boolean _isItemDisabled(UIComponent component)
+ private boolean _isItemDisabled(
+ UIComponent component)
{
Object isDisabled = component.getAttributes().get(
CoreShowDetailItem.DISABLED_KEY.getName());
@@ -602,5 +613,4 @@
"af_panelAccordion.DISCLOSED_TIP";
private static final String _UNDISCLOSED_TIP_KEY =
"af_panelAccordion.UNDISCLOSED_TIP";
-
-}
+}
\ 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/PanelBorderLayoutRenderer.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/PanelBorderLayoutRenderer.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/PanelBorderLayoutRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelBorderLayoutRenderer.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
@@ -25,8 +25,8 @@
import javax.faces.context.ResponseWriter;
import org.apache.myfaces.trinidad.bean.FacesBean;
-import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.bean.FacesBean.Type;
+import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.core.layout.CorePanelBorderLayout;
import org.apache.myfaces.trinidad.context.Agent;
import org.apache.myfaces.trinidad.context.RenderingContext;
@@ -34,25 +34,12 @@
import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.jsLibs.Scriptlet;
+
/**
* @version $Name: $ $
*/
public class PanelBorderLayoutRenderer extends XhtmlRenderer
{
- private PropertyKey _layoutKey;
- private PropertyKey _topHeightKey;
- private PropertyKey _innerTopHeightKey;
- private PropertyKey _bottomHeightKey;
- private PropertyKey _innerBottomHeightKey;
- private PropertyKey _leftWidthKey;
- private PropertyKey _innerLeftWidthKey;
- private PropertyKey _rightWidthKey;
- private PropertyKey _innerRightWidthKey;
- private PropertyKey _startWidthKey;
- private PropertyKey _innerStartWidthKey;
- private PropertyKey _endWidthKey;
- private PropertyKey _innerEndWidthKey;
-
public PanelBorderLayoutRenderer()
{
super(CorePanelBorderLayout.TYPE);
@@ -63,33 +50,38 @@
{
return true;
}
-
+
/**
- * @see org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer#getDefaultStyleClass(
- * org.apache.myfaces.trinidad.bean.FacesBean)
+ * @see org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer#getDefaultStyleClass
*/
@Override
- protected String getDefaultStyleClass(FacesBean bean)
+ protected String getDefaultStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
- return "positioned".equals(getLayout(bean)) ? SkinSelectors.AF_PANEL_BORDER_POSITIONED_ROOT_STYLE_CLASS : null;
+ return "positioned".equals(getLayout(component, bean)) ?
+ SkinSelectors.AF_PANEL_BORDER_POSITIONED_ROOT_STYLE_CLASS : null;
}
-
+
/**
* @see org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer#shouldRenderId(
* javax.faces.context.FacesContext, javax.faces.component.UIComponent)
*/
@Override
- protected boolean shouldRenderId(FacesContext context, UIComponent component)
+ protected boolean shouldRenderId(
+ FacesContext context,
+ UIComponent component)
{
return true;
}
-
+
/**
* @see org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer#findTypeConstants(
* org.apache.myfaces.trinidad.bean.FacesBean.Type)
*/
@Override
- protected void findTypeConstants(Type type)
+ protected void findTypeConstants(
+ Type type)
{
super.findTypeConstants(type);
_layoutKey = type.findKey("layout");
@@ -106,70 +98,109 @@
_endWidthKey = type.findKey("endWidth");
_innerEndWidthKey = type.findKey("innerEndWidth");
}
-
- protected String getLayout(FacesBean bean)
+
+ protected String getLayout(
+ UIComponent component,
+ FacesBean bean)
{
- return ComponentUtils.resolveString(bean.getProperty(_layoutKey), (String)_layoutKey.getDefault());
+ return ComponentUtils.resolveString(bean.getProperty(_layoutKey),
+ (String)_layoutKey.getDefault());
}
-
- protected String getTopHeight(FacesBean bean)
+
+ protected String getTopHeight(
+ UIComponent component,
+ FacesBean bean)
{
- return ComponentUtils.resolveString(bean.getProperty(_topHeightKey), (String)_topHeightKey.getDefault());
+ return ComponentUtils.resolveString(bean.getProperty(_topHeightKey),
+ (String)_topHeightKey.getDefault());
}
-
- protected String getinnerTopHeight(FacesBean bean)
+
+ protected String getinnerTopHeight(
+ UIComponent component,
+ FacesBean bean)
{
- return ComponentUtils.resolveString(bean.getProperty(_innerTopHeightKey), (String)_innerTopHeightKey.getDefault());
+ return ComponentUtils.resolveString(bean.getProperty(_innerTopHeightKey),
+ (String)_innerTopHeightKey.getDefault());
}
-
- protected String getBottomHeight(FacesBean bean)
+
+ protected String getBottomHeight(
+ UIComponent component,
+ FacesBean bean)
{
- return ComponentUtils.resolveString(bean.getProperty(_bottomHeightKey), (String)_bottomHeightKey.getDefault());
+ return ComponentUtils.resolveString(bean.getProperty(_bottomHeightKey),
+ (String)_bottomHeightKey.getDefault());
}
-
- protected String getinnerBottomHeight(FacesBean bean)
+
+ protected String getinnerBottomHeight(
+ UIComponent component,
+ FacesBean bean)
{
- return ComponentUtils.resolveString(bean.getProperty(_innerBottomHeightKey), (String)_innerBottomHeightKey.getDefault());
+ return ComponentUtils.resolveString(bean.getProperty(_innerBottomHeightKey),
+ (String)_innerBottomHeightKey.getDefault());
}
-
- protected String getLeftWidth(FacesBean bean)
+
+ protected String getLeftWidth(
+ UIComponent component,
+ FacesBean bean)
{
- return ComponentUtils.resolveString(bean.getProperty(_leftWidthKey), (String)_leftWidthKey.getDefault());
+ return ComponentUtils.resolveString(bean.getProperty(_leftWidthKey),
+ (String)_leftWidthKey.getDefault());
}
-
- protected String getinnerLeftWidth(FacesBean bean)
+
+ protected String getinnerLeftWidth(
+ UIComponent component,
+ FacesBean bean)
{
- return ComponentUtils.resolveString(bean.getProperty(_innerLeftWidthKey), (String)_innerLeftWidthKey.getDefault());
+ return ComponentUtils.resolveString(bean.getProperty(_innerLeftWidthKey),
+ (String)_innerLeftWidthKey.getDefault());
}
-
- protected String getRightWidth(FacesBean bean)
+
+ protected String getRightWidth(
+ UIComponent component,
+ FacesBean bean)
{
- return ComponentUtils.resolveString(bean.getProperty(_rightWidthKey), (String)_rightWidthKey.getDefault());
+ return ComponentUtils.resolveString(bean.getProperty(_rightWidthKey),
+ (String)_rightWidthKey.getDefault());
}
-
- protected String getinnerRightWidth(FacesBean bean)
+
+ protected String getinnerRightWidth(
+ UIComponent component,
+ FacesBean bean)
{
- return ComponentUtils.resolveString(bean.getProperty(_innerRightWidthKey), (String)_innerRightWidthKey.getDefault());
+ return ComponentUtils.resolveString(bean.getProperty(_innerRightWidthKey),
+ (String)_innerRightWidthKey.getDefault());
}
-
- protected String getEndWidth(FacesBean bean)
+
+ protected String getEndWidth(
+ UIComponent component,
+ FacesBean bean)
{
- return ComponentUtils.resolveString(bean.getProperty(_endWidthKey), (String)_endWidthKey.getDefault());
+ return ComponentUtils.resolveString(bean.getProperty(_endWidthKey),
+ (String)_endWidthKey.getDefault());
}
-
- protected String getEndInnerWidth(FacesBean bean)
+
+ protected String getEndInnerWidth(
+ UIComponent component,
+ FacesBean bean)
{
- return ComponentUtils.resolveString(bean.getProperty(_innerEndWidthKey), (String)_innerEndWidthKey.getDefault());
+ return ComponentUtils.resolveString(bean.getProperty(_innerEndWidthKey),
+ (String)_innerEndWidthKey.getDefault());
}
-
- protected String getStartWidth(FacesBean bean)
+
+ protected String getStartWidth(
+ UIComponent component,
+ FacesBean bean)
{
- return ComponentUtils.resolveString(bean.getProperty(_startWidthKey), (String)_startWidthKey.getDefault());
+ return ComponentUtils.resolveString(bean.getProperty(_startWidthKey),
+ (String)_startWidthKey.getDefault());
}
-
- protected String getStartInnerWidth(FacesBean bean)
+
+ protected String getStartInnerWidth(
+ UIComponent component,
+ FacesBean bean)
{
- return ComponentUtils.resolveString(bean.getProperty(_innerStartWidthKey), (String)_innerStartWidthKey.getDefault());
+ return ComponentUtils.resolveString(bean.getProperty(_innerStartWidthKey),
+ (String)_innerStartWidthKey.getDefault());
}
@Override
@@ -180,8 +211,8 @@
FacesBean bean
) throws IOException
{
- String layout = getLayout(bean);
-
+ String layout = getLayout(component, bean);
+
if ("positioned".equals(layout))
{
_encodeAllPositioned(context, rc, component, bean);
@@ -200,11 +231,13 @@
}
}
- private boolean _hasSideFacets(RenderingContext arc, UIComponent component)
+ private boolean _hasSideFacets(
+ RenderingContext rc,
+ UIComponent component)
{
// For PDAs, disavow allow knowledge of side facets (there's no space
// to render them). Ideally, this would be height/width driven...
- if (isPDA(arc))
+ if (isPDA(rc))
return false;
return ((getFacet(component, CorePanelBorderLayout.LEFT_FACET) != null) ||
@@ -218,21 +251,22 @@
}
protected void _encodeAllWithSideFacets(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
rw.startElement("table", component);
- OutputUtils.renderLayoutTableAttributes(context, arc, "0", "100%");
-
+ OutputUtils.renderLayoutTableAttributes(context, rc, "0", "100%");
+
renderId(context, component);
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, component, bean);
Integer rowSpan = _getRowSpan(component);
- Integer colSpan = _getColSpan(component, arc, rowSpan);
+ Integer colSpan = _getColSpan(component, rc, rowSpan);
//
// If we have a header node, render it
@@ -242,14 +276,14 @@
if (topFacet != null)
{
rw.startElement("tr", null);
- _renderMarginSpacer(context, arc, null);
+ _renderMarginSpacer(context, rc, null);
rw.startElement("td", null);
rw.writeAttribute("colspan", colSpan, null);
encodeChild(context, topFacet);
rw.endElement("td");
- _renderMarginSpacer(context, arc, null);
+ _renderMarginSpacer(context, rc, null);
rw.endElement("tr");
}
@@ -258,37 +292,37 @@
//
rw.startElement("tr", null);
- _renderMarginSpacer(context, arc, rowSpan);
+ _renderMarginSpacer(context, rc, rowSpan);
//
// Render the left hand side
//
- String leftName = _getSideFacet(component, arc, true);
+ String leftName = _getSideFacet(component, rc, true);
UIComponent leftFacet = getFacet(component, leftName);
if (leftFacet != null)
renderSideFacet(context, leftFacet, rowSpan, null);
-
+
//
// Render the inner left side node, if any
//
- String innerleftName = _getInnerSideFacet(component, arc, true);
+ String innerleftName = _getInnerSideFacet(component, rc, true);
UIComponent innerLeftFacet = getFacet(component, innerleftName);
if (innerLeftFacet != null)
{
renderSideFacet(context, innerLeftFacet, rowSpan, null);
}
-
+
//
// Render the child on the inside top of the layout
//
boolean isRightSideRendered =
- _renderMiddleFacet(context, arc, component,
+ _renderMiddleFacet(context, rc, component,
CorePanelBorderLayout.INNER_TOP_FACET, rowSpan,
false, true);
-
+
// render the content
if (component.getChildCount() > 0)
{
@@ -298,11 +332,11 @@
{
rw.startElement("tr", null);
}
-
+
rw.startElement("td", null);
rw.writeAttribute("width", "100%", null);
rw.writeAttribute("valign", "top", null);
-
+
encodeAllChildren(context, component);
rw.endElement("td");
@@ -311,7 +345,7 @@
here */
if (!isRightSideRendered)
{
- _renderRightFacets(context, arc, component, rowSpan);
+ _renderRightFacets(context, rc, component, rowSpan);
isRightSideRendered = true;
}
@@ -322,7 +356,7 @@
right side nodes have been rendered, and render the
right side nodes if they have not been rendered. */
isRightSideRendered |=
- _renderMiddleFacet(context, arc, component,
+ _renderMiddleFacet(context, rc, component,
CorePanelBorderLayout.INNER_BOTTOM_FACET, rowSpan,
isRightSideRendered,
!isRightSideRendered);
@@ -331,7 +365,7 @@
to render it here */
if (!isRightSideRendered)
{
- _renderRightFacets(context, arc, component, rowSpan);
+ _renderRightFacets(context, rc, component, rowSpan);
rw.endElement("tr");
}
@@ -343,14 +377,14 @@
if (bottomFacet != null)
{
rw.startElement("tr", null);
- _renderMarginSpacer(context, arc, null);
-
+ _renderMarginSpacer(context, rc, null);
+
rw.startElement("td", null);
rw.writeAttribute("colspan", colSpan, null);
encodeChild(context, bottomFacet);
rw.endElement("td");
-
- _renderMarginSpacer(context, arc, null);
+
+ _renderMarginSpacer(context, rc, null);
rw.endElement("tr");
}
@@ -358,15 +392,16 @@
}
protected void _encodeAllInDiv(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
rw.startElement("div", component);
renderId(context, component);
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, component, bean);
UIComponent top = getFacet(component, CorePanelBorderLayout.TOP_FACET);
if (top != null)
@@ -374,14 +409,14 @@
rw.startElement("div", null);
rw.endElement("div");
-
+
UIComponent innerTop = getFacet(component, CorePanelBorderLayout.INNER_TOP_FACET);
if (innerTop != null)
encodeChild(context, innerTop);
rw.startElement("div", null);
rw.endElement("div");
-
+
encodeAllChildren(context, component);
rw.startElement("div", null);
@@ -390,7 +425,7 @@
UIComponent innerBottom = getFacet(component, CorePanelBorderLayout.INNER_BOTTOM_FACET);
if (innerBottom != null)
encodeChild(context, innerBottom);
-
+
rw.startElement("div", null);
rw.endElement("div");
@@ -421,14 +456,15 @@
writer.endElement("td");
}
- private boolean _renderMiddleFacet(FacesContext context,
- RenderingContext arc,
- UIComponent component,
- String middleFacetName,
- Integer rowSpan,
- boolean startTableRow,
- boolean renderRightFacets)
- throws IOException
+ private boolean _renderMiddleFacet(
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ String middleFacetName,
+ Integer rowSpan,
+ boolean startTableRow,
+ boolean renderRightFacets
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
UIComponent middleFacet = getFacet(component, middleFacetName);
@@ -436,11 +472,11 @@
{
if (startTableRow)
writer.startElement("tr", null);
-
+
_renderInnerFacet(context, middleFacet);
if (renderRightFacets)
- _renderRightFacets(context, arc, component, rowSpan);
+ _renderRightFacets(context, rc, component, rowSpan);
writer.endElement("tr");
return true;
@@ -454,17 +490,17 @@
*/
private boolean _renderRightFacets(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
UIComponent component,
Integer rowSpan
) throws IOException
{
boolean facetRendered = false;
-
+
//
// Render the inner right node.
//
- String innerSideName = _getInnerSideFacet(component, arc, false);
+ String innerSideName = _getInnerSideFacet(component, rc, false);
UIComponent innerSideFacet = getFacet(component, innerSideName);
if (innerSideFacet != null)
{
@@ -475,24 +511,24 @@
facetRendered = true;
}
-
+
//
// Render the side node
//
- String sideName = _getSideFacet(component, arc, false);
+ String sideName = _getSideFacet(component, rc, false);
UIComponent sideFacet = getFacet(component, sideName);
if (sideFacet != null)
{
renderSideFacet(context, sideFacet, rowSpan, null);
- _renderMarginSpacer(context, arc, rowSpan);
-
+ _renderMarginSpacer(context, rc, rowSpan);
+
facetRendered = true;
}
-
+
return facetRendered;
}
-
+
/**
* Renders one of the inner nodes.
*/
@@ -511,7 +547,7 @@
private void _renderMarginSpacer(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
Integer rowSpan
) throws IOException
{
@@ -519,10 +555,10 @@
writer.startElement("td", null);
writer.writeAttribute("rowspan", rowSpan, null);
- Object spacerWidth = arc.getSkin().getProperty(
+ Object spacerWidth = rc.getSkin().getProperty(
SkinProperties.AF_PANEL_BORDER_LAYOUT_SPACER_WIDTH);
if (spacerWidth != null)
- renderSpacer(context, arc, spacerWidth.toString(), "0");
+ renderSpacer(context, rc, spacerWidth.toString(), "0");
writer.endElement("td");
}
@@ -552,21 +588,21 @@
* Returns the column span to use for the top and bottom children.
*/
private Integer _getColSpan(
- UIComponent component,
- RenderingContext arc,
- Integer rowSpan
+ UIComponent component,
+ RenderingContext rc,
+ Integer rowSpan
)
{
int colSpan = 0;
-
+
// increment the colspan if we have a left side node
- if (getFacet(component, _getSideFacet(component, arc, true)) != null)
+ if (getFacet(component, _getSideFacet(component, rc, true)) != null)
{
colSpan++;
}
// increment the colspan if we have an inner left side node
- if (getFacet(component, _getInnerSideFacet(component, arc, true)) != null)
+ if (getFacet(component, _getInnerSideFacet(component, rc, true)) != null)
{
colSpan++;
}
@@ -578,13 +614,13 @@
}
// increment the colspan if we have an inner right side node
- if (getFacet(component, _getInnerSideFacet(component, arc, false)) != null)
+ if (getFacet(component, _getInnerSideFacet(component, rc, false)) != null)
{
colSpan++;
}
-
+
// increment the colspan if we have a right side node
- if (getFacet(component, _getSideFacet(component, arc, false)) != null)
+ if (getFacet(component, _getSideFacet(component, rc, false)) != null)
{
colSpan++;
}
@@ -598,12 +634,12 @@
* layout, following bi-di rules.
*/
private String _getSideFacet(
- UIComponent component,
- RenderingContext arc,
- boolean getLeftName
+ UIComponent component,
+ RenderingContext rc,
+ boolean getLeftName
)
{
- boolean isRTL = arc.isRightToLeft();
+ boolean isRTL = rc.isRightToLeft();
//
// A precisely specified name wins over a dynamic name
@@ -639,12 +675,12 @@
* layout, following bi-di rules.
*/
private String _getInnerSideFacet(
- UIComponent component,
- RenderingContext arc,
- boolean getLeftName
+ UIComponent component,
+ RenderingContext rc,
+ boolean getLeftName
)
{
- boolean isRTL = arc.isRightToLeft();
+ boolean isRTL = rc.isRightToLeft();
//
// A precisely specified name wins over a dynamic name
@@ -674,7 +710,7 @@
return exactName;
}
-
+
/**
* Encode the panel for a positioned layout
*/
@@ -686,7 +722,7 @@
) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
-
+
// IE6 does not support stretching by setting both top & bottom or left & right,
// so we have to use some ugly code.
TrinidadAgent agent = (TrinidadAgent)rc.getAgent();
@@ -697,15 +733,15 @@
// send down the JS that we need to stretch the components
XhtmlUtils.addLib(context, rc, IE6_SCRIPT.getScriptletKey());
}
-
+
writer.startElement("div", component);
renderId(context, component);
if (isIE6)
{
writer.writeAttribute("onresize", "TrPanelBorderLayoutResizeIE6(this)", null);
}
- renderAllAttributes(context, rc, bean);
-
+ renderAllAttributes(context, rc, component, bean);
+
UIComponent topFacet = getFacet(component, CorePanelBorderLayout.TOP_FACET);
UIComponent bottomFacet = getFacet(component, CorePanelBorderLayout.BOTTOM_FACET);
UIComponent leftFacet = getFacet(component, CorePanelBorderLayout.LEFT_FACET);
@@ -714,17 +750,17 @@
UIComponent innerBottomFacet = getFacet(component, CorePanelBorderLayout.INNER_BOTTOM_FACET);
UIComponent innerLeftFacet = getFacet(component, CorePanelBorderLayout.INNER_LEFT_FACET);
UIComponent innerRightFacet = getFacet(component, CorePanelBorderLayout.INNER_RIGHT_FACET);
-
+
// Don't make room for non-rendered facets
if (topFacet != null && !topFacet.isRendered()) topFacet = null;
if (bottomFacet != null && !bottomFacet.isRendered()) bottomFacet = null;
if (innerTopFacet != null && !innerTopFacet.isRendered()) innerTopFacet = null;
if (innerBottomFacet != null && !innerBottomFacet.isRendered()) innerBottomFacet = null;
-
+
boolean useLR = leftFacet != null || rightFacet != null
|| innerLeftFacet != null || innerRightFacet != null;
boolean ltr = !rc.isRightToLeft();
-
+
if (!useLR)
{
leftFacet = getFacet(component, ltr ?
@@ -741,37 +777,40 @@
if (innerRightFacet != null && !innerRightFacet.isRendered()) innerRightFacet = null;
if (innerLeftFacet != null && !innerLeftFacet.isRendered()) innerLeftFacet = null;
if (innerRightFacet != null && !innerRightFacet.isRendered()) innerRightFacet = null;
-
- String topHeight = (topFacet == null) ? "0px" : getTopHeight(bean);
- String innerTopHeight = (innerTopFacet == null) ? "0px" : getinnerTopHeight(bean);
- String bottomHeight = (bottomFacet == null) ? "0px" : getBottomHeight(bean);
- String innerBottomHeight = (innerBottomFacet == null) ? "0px" : getinnerBottomHeight(bean);
+
+ String topHeight = (topFacet == null) ? "0px" : getTopHeight(component, bean);
+ String innerTopHeight = (innerTopFacet == null) ? "0px" : getinnerTopHeight(component, bean);
+ String bottomHeight = (bottomFacet == null) ? "0px" : getBottomHeight(component, bean);
+ String innerBottomHeight = (innerBottomFacet == null) ? "0px" :
+ getinnerBottomHeight(component, bean);
String leftWidth = (leftFacet == null) ? "0px" :
- (useLR ? getLeftWidth(bean) : (ltr ? getStartWidth(bean) : getEndWidth(bean)));
+ (useLR ? getLeftWidth(component, bean) :
+ (ltr ? getStartWidth(component, bean) : getEndWidth(component, bean)));
String rightWidth = (rightFacet == null) ? "0px" :
- (useLR ? getRightWidth(bean) : (ltr ? getEndWidth(bean) : getStartWidth(bean)));
+ (useLR ? getRightWidth(component, bean) :
+ (ltr ? getEndWidth(component, bean) : getStartWidth(component, bean)));
String innerLeftWidth = (innerLeftFacet == null) ? "0px" :
- (useLR ? getinnerLeftWidth(bean) :
- (ltr ? getStartInnerWidth(bean) : getEndInnerWidth(bean)));
+ (useLR ? getinnerLeftWidth(component, bean) :
+ (ltr ? getStartInnerWidth(component, bean) : getEndInnerWidth(component, bean)));
String innerRightWidth = (innerRightFacet == null) ? "0px" :
- (useLR ? getinnerRightWidth(bean) :
- (ltr ? getEndInnerWidth(bean) : getStartInnerWidth(bean)));
-
+ (useLR ? getinnerRightWidth(component, bean) :
+ (ltr ? getEndInnerWidth(component, bean) : getStartInnerWidth(component, bean)));
+
String clientId = component.getClientId(context);
-
+
_encodePositionedFacetGroup(context, rc, bean, writer, clientId, component,
topFacet, topHeight,
rightFacet, rightWidth,
bottomFacet, bottomHeight,
leftFacet, leftWidth,
false, useLR, isIE6, ltr);
-
+
writer.startElement("div", null);
writer.writeAttribute("id", _createSubId(clientId, "center"), null);
writer.writeAttribute("style", _buildPositionedCenterCss(
topHeight, bottomHeight, leftWidth, rightWidth, isIE6), null);
renderStyleClass(context, rc, SkinSelectors.AF_PANEL_BORDER_POSITIONED_CENTER_STYLE_CLASS);
-
+
_encodePositionedFacetGroup(context, rc, bean, writer, clientId, component,
innerTopFacet, innerTopHeight,
innerRightFacet, innerRightWidth,
@@ -786,11 +825,11 @@
renderStyleClass(context, rc, SkinSelectors.AF_PANEL_BORDER_POSITIONED_INNER_CENTER_STYLE_CLASS);
encodeAllChildren(context, component);
-
+
writer.endElement("div");
writer.endElement("div");
writer.endElement("div");
-
+
if (isIE6)
{
// force the resize code to run at earliest moment
@@ -805,12 +844,12 @@
writer.endElement(XhtmlConstants.SCRIPT_ELEMENT);
}
}
-
+
private String _buildPositionedCenterCss(
- String topHeight,
- String bottomHeight,
- String leftWidth,
- String rightWidth,
+ String topHeight,
+ String bottomHeight,
+ String leftWidth,
+ String rightWidth,
boolean isIE6)
{
return isIE6 ?
@@ -833,7 +872,7 @@
.append(rightWidth)
.toString();
}
-
+
private void _encodePositionedFacetGroup(
FacesContext context,
RenderingContext rc,
@@ -892,7 +931,7 @@
isInner, false, isIE6);
}
}
-
+
private String _createSubId(
String clientId,
String name)
@@ -903,7 +942,7 @@
.append(name)
.toString();
}
-
+
private void _encodePositionedHeightFacet(
FacesContext context,
RenderingContext rc,
@@ -926,11 +965,11 @@
.append("height:") // 7 chars
.append(cssHeight)
.toString();
- renderInlineStyleAttribute(context, rc, style);
+ renderInlineStyleAttribute(context, rc, component, style);
encodeChild(context, component);
writer.endElement("div");
}
-
+
private void _encodePositionedWidthFacet(
FacesContext context,
RenderingContext rc,
@@ -952,7 +991,7 @@
isInner ? (isLeft ? "innerLeft" : "innerRight") : (isLeft ? "left" : "right")), null);
renderStyleClass(context, rc, cssClass);
String style;
-
+
if (isIE6)
{
style = new StringBuilder(11 + cssTopHeight.length() + cssWidth.length())
@@ -974,11 +1013,25 @@
.append(cssBottomHeight)
.toString();
}
- renderInlineStyleAttribute(context, rc, style);
+ renderInlineStyleAttribute(context, rc, component, style);
encodeChild(context, component);
writer.endElement("div");
}
-
+
+ private PropertyKey _layoutKey;
+ private PropertyKey _topHeightKey;
+ private PropertyKey _innerTopHeightKey;
+ private PropertyKey _bottomHeightKey;
+ private PropertyKey _innerBottomHeightKey;
+ private PropertyKey _leftWidthKey;
+ private PropertyKey _innerLeftWidthKey;
+ private PropertyKey _rightWidthKey;
+ private PropertyKey _innerRightWidthKey;
+ private PropertyKey _startWidthKey;
+ private PropertyKey _innerStartWidthKey;
+ private PropertyKey _endWidthKey;
+ private PropertyKey _innerEndWidthKey;
+
// Since IE6 cannot stretch components using docking, we are forced to use
// JavaScript to do the dirty work
private static final Scriptlet IE6_SCRIPT = new Scriptlet()
@@ -1027,13 +1080,13 @@
" if (innerElems[7]) innerElems[7].style.height = innerCenterHeight + 'px';\n" +
" if (innerElems[8]) innerElems[8].style.height = innerCenterHeight + 'px';\n" +
"}";
-
+
@Override
public Object getScriptletKey()
{
return "TrPanelBorderLayoutResizeIE6()";
};
-
+
@Override
protected void outputScriptletContent(
FacesContext context,
@@ -1043,7 +1096,7 @@
context.getResponseWriter().writeText(IE_JS_CODE, null);
};
};
-
+
static
{
XhtmlUtils.registerScriptlet(IE6_SCRIPT.getScriptletKey(), IE6_SCRIPT);
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelBoxRenderer.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/PanelBoxRenderer.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/PanelBoxRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelBoxRenderer.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,6 +29,7 @@
import org.apache.myfaces.trinidad.component.core.layout.CorePanelBox;
import org.apache.myfaces.trinidad.context.RenderingContext;
+
public class PanelBoxRenderer
extends XhtmlRenderer
{
@@ -37,13 +38,15 @@
this(CorePanelBox.TYPE);
}
- protected PanelBoxRenderer(FacesBean.Type type)
+ protected PanelBoxRenderer(
+ FacesBean.Type type)
{
super(type);
}
-
+
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_textKey = type.findKey("text");
@@ -51,11 +54,13 @@
_backgroundKey = type.findKey("background");
_contentStyleKey = type.findKey("contentStyle");
}
-
+
@Override
- public String getDefaultStyleClass(FacesBean bean)
+ public String getDefaultStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
- String background = getBackground(bean);
+ String background = getBackground(component, bean);
if(_BACKGROUND_TRANSPARENT.equals(background))
{
return SkinSelectors.AF_PANEL_BOX_TRANSPARENT_STYLE_CLASS;
@@ -77,252 +82,259 @@
return _BACKGROUND_DEFAULT_STYLE_CLASS;
}
}
-
+
@Override
public boolean getRendersChildren()
{
return true;
}
- protected boolean hasChildren(UIComponent component)
+ protected boolean hasChildren(
+ UIComponent component)
{
return component.getChildCount() > 0;
}
@Override
protected void encodeAll(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
- {
- super.encodeAll(context, arc, component, bean);
-
- String icon = getIcon(bean);
- String text = getText(bean);
-
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
+ {
+ super.encodeAll(context, rc, component, bean);
+
+ String icon = getIcon(component, bean);
+ String text = getText(component, bean);
+
ResponseWriter writer = context.getResponseWriter();
writer.startElement(XhtmlConstants.TABLE_ELEMENT, component); // The frame table
renderId(context, component);
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, component, bean);
writer.startElement(XhtmlConstants.TABLE_BODY_ELEMENT, null);
-
+
if (hasChildren(component) || text != null || icon != null)
{
// There's something to render to let build the frame
- _renderContainerTopRow(context, arc);
-
- _renderMiddleRow(context, arc, component, bean, icon, text);
-
- _renderContainerBottomRow(context, arc);
+ _renderContainerTopRow(context, rc);
+
+ _renderMiddleRow(context, rc, component, bean, icon, text);
+
+ _renderContainerBottomRow(context, rc);
}
writer.endElement(XhtmlConstants.TABLE_BODY_ELEMENT);
writer.endElement(XhtmlConstants.TABLE_ELEMENT);
}
-
+
@Override
protected void renderAllAttributes(
- FacesContext context,
- RenderingContext arc,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
- super.renderAllAttributes(context, arc, bean);
- OutputUtils.renderLayoutTableAttributes(context, arc, "0", null);
+ super.renderAllAttributes(context, rc, component, bean);
+ OutputUtils.renderLayoutTableAttributes(context, rc, "0", null);
}
-
-
+
private void _renderContainerTopRow(
- FacesContext context,
- RenderingContext arc) throws IOException
+ FacesContext context,
+ RenderingContext rc
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
- if(arc.isRightToLeft())
+ if(rc.isRightToLeft())
{
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_TOP_END_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
-
+
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_TOP_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
-
+
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_TOP_START_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
else
{
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_TOP_START_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
-
+
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_TOP_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
-
+
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_TOP_END_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
-
+
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
}
-
+
private void _renderContainerBottomRow(
- FacesContext context,
- RenderingContext arc) throws IOException
+ FacesContext context,
+ RenderingContext rc
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
- if(arc.isRightToLeft())
+ if(rc.isRightToLeft())
{
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_BOTTOM_END_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
-
+
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_BOTTOM_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
-
+
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_BOTTOM_START_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
else
{
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_BOTTOM_START_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
-
+
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_BOTTOM_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
-
+
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_BOTTOM_END_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
-
+
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
}
-
+
private void _renderMiddleRow(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean,
- Object icon,
- Object text) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean,
+ Object icon,
+ Object text
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
-
+
// Render left edge
- if(arc.isRightToLeft())
+ if(rc.isRightToLeft())
{
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_END_STYLE_CLASS);
-
+
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
else
{
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_START_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
-
+
// Render body
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderBody(context, arc, component, bean, icon, text);
+ renderBody(context, rc, component, bean, icon, text);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
// Render right edge
- if(arc.isRightToLeft())
+ if(rc.isRightToLeft())
{
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_START_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
else
{
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClass(context,
- arc,
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_END_STYLE_CLASS);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
-
+
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
}
-
+
protected void renderBody(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean,
- Object icon,
- Object text) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean,
+ Object icon,
+ Object text
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
-
- renderStyleClass(context,
- arc,
+
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_BODY_STYLE_CLASS);
-
+
if (hasChildren(component) && (text != null || icon != null))
{
// There's both a header and a content, use a table.
writer.startElement(XhtmlConstants.TABLE_ELEMENT, null);
- OutputUtils.renderLayoutTableAttributes(context, arc, "0", "100%");
+ OutputUtils.renderLayoutTableAttributes(context, rc, "0", "100%");
writer.startElement(XhtmlConstants.TABLE_BODY_ELEMENT, null);
-
+
// Render header
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- _renderHeader(context, arc, icon, text);
+ _renderHeader(context, rc, icon, text);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
-
+
// Render content
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderContent(context, arc, bean, component);
+ renderContent(context, rc, bean, component);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
-
+
writer.endElement(XhtmlConstants.TABLE_BODY_ELEMENT);
writer.endElement(XhtmlConstants.TABLE_ELEMENT);
}
@@ -330,44 +342,45 @@
{
// We only have a header, use a div as style class placeholder
writer.startElement(XhtmlConstants.DIV_ELEMENT, null);
- _renderHeader(context, arc, icon, text);
+ _renderHeader(context, rc, icon, text);
writer.endElement(XhtmlConstants.DIV_ELEMENT);
}
else
{
// We only have a content, use a div as style class placeholder
writer.startElement(XhtmlConstants.DIV_ELEMENT, null);
- renderContent(context, arc, bean, component);
+ renderContent(context, rc, bean, component);
writer.endElement(XhtmlConstants.DIV_ELEMENT);
}
}
-
+
private void _renderHeader(
- FacesContext context,
- RenderingContext arc,
- Object icon,
- Object text) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ Object icon,
+ Object text
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
-
- renderStyleClass(context,
- arc,
+
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_HEADER_STYLE_CLASS);
-
- if(arc.isRightToLeft())
+
+ if(rc.isRightToLeft())
{
if(text != null)
{
writer.writeText(text, _textKey.getName());
}
-
+
if(icon != null)
{
writer.startElement("img", null);
- OutputUtils.renderAltAndTooltipForImage(context,
- arc,
+ OutputUtils.renderAltAndTooltipForImage(context,
+ rc,
XhtmlConstants.EMPTY_STRING_ATTRIBUTE_VALUE);
-
+
renderEncodedResourceURI(context, "src", icon);
writer.endElement("img");
}
@@ -377,34 +390,35 @@
if(icon != null)
{
writer.startElement("img", null);
- OutputUtils.renderAltAndTooltipForImage(context,
- arc,
+ OutputUtils.renderAltAndTooltipForImage(context,
+ rc,
XhtmlConstants.EMPTY_STRING_ATTRIBUTE_VALUE);
-
+
renderEncodedResourceURI(context, "src", icon);
writer.endElement("img");
}
-
+
if(text != null)
{
writer.writeText(text, _textKey.getName());
}
}
}
-
+
protected void renderContent(
- FacesContext context,
- RenderingContext arc,
- FacesBean bean,
- UIComponent component) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ FacesBean bean,
+ UIComponent component
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
-
- renderStyleClass(context,
- arc,
+
+ renderStyleClass(context,
+ rc,
SkinSelectors.AF_PANEL_BOX_CONTENT_STYLE_CLASS);
-
- String style = getContentStyle(bean);
+
+ String style = getContentStyle(component, bean);
if(style != null)
{
writer.writeAttribute("style", style, null);
@@ -413,44 +427,52 @@
encodeAllChildren(context, component);
}
- protected String getText(FacesBean bean)
+ protected String getText(
+ UIComponent component,
+ FacesBean bean)
{
if (_textKey == null)
return null;
return toString(bean.getProperty(_textKey));
}
- protected String getIcon(FacesBean bean)
+ protected String getIcon(
+ UIComponent component,
+ FacesBean bean)
{
if (_iconKey == null)
return null;
return toResourceUri(FacesContext.getCurrentInstance(), bean.getProperty(_iconKey));
}
- protected String getContentStyle(FacesBean bean)
+ protected String getContentStyle(
+ UIComponent component,
+ FacesBean bean)
{
if (_contentStyleKey == null)
return null;
return toString(bean.getProperty(_contentStyleKey));
}
- protected String getBackground(FacesBean bean)
+ protected String getBackground(
+ UIComponent component,
+ FacesBean bean)
{
if (_backgroundKey == null)
return null;
return toString(bean.getProperty(_backgroundKey));
}
-
+
private PropertyKey _textKey;
private PropertyKey _iconKey;
private PropertyKey _contentStyleKey;
private PropertyKey _backgroundKey;
-
+
private static final String _BACKGROUND_LIGHT = "light";
private static final String _BACKGROUND_TRANSPARENT = "transparent";
private static final String _BACKGROUND_MEDIUM = "medium";
private static final String _BACKGROUND_DARK = "dark";
-
- private static final String _BACKGROUND_DEFAULT_STYLE_CLASS =
+
+ private static final String _BACKGROUND_DEFAULT_STYLE_CLASS =
SkinSelectors.AF_PANEL_BOX_LIGHT_STYLE_CLASS;
}
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelButtonBarRenderer.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/PanelButtonBarRenderer.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/PanelButtonBarRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelButtonBarRenderer.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.component.core.data.CoreSelectRangeChoiceBar;
-import org.apache.myfaces.trinidad.component.core.nav.CoreSingleStepButtonBar;
import org.apache.myfaces.trinidad.component.core.layout.CorePanelButtonBar;
-
+import org.apache.myfaces.trinidad.component.core.nav.CoreSingleStepButtonBar;
import org.apache.myfaces.trinidad.context.RenderingContext;
+
public class PanelButtonBarRenderer extends PanelHorizontalLayoutRenderer
{
public PanelButtonBarRenderer()
@@ -40,7 +40,9 @@
// Not currently supported, but would be easy to add...
@Override
- protected Object getValign(FacesBean bean)
+ protected Object getValign(
+ UIComponent component,
+ FacesBean bean)
{
return null;
}
@@ -51,11 +53,13 @@
*/
@Override
protected void renderStyleAttributes(
- FacesContext context,
- RenderingContext arc,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
- renderStyleAttributes(context, arc, bean,
+ renderStyleAttributes(context, rc, component, bean,
SkinSelectors.AF_PANEL_BUTTON_BAR_STYLE_CLASS);
}
@@ -66,7 +70,8 @@
protected void encodeChild(
FacesContext context,
UIComponent child,
- Object vAlign) throws IOException
+ Object vAlign
+ ) throws IOException
{
// These two components render themselves
if ((child instanceof CoreSingleStepButtonBar) ||
@@ -80,15 +85,15 @@
}
}
-
/**
- * Render a separator
+ * Render a separator
*/
@Override
protected void encodeSeparator(
FacesContext context,
UIComponent separator,
- Object vAlign) throws IOException
+ Object vAlign
+ ) throws IOException
{
// FIXME Use proper skinning techniques
RenderingContext rc = RenderingContext.getCurrentInstance();