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 [12/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/PanelCaptionGroupRenderer.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/PanelCaptionGroupRenderer.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/PanelCaptionGroupRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelCaptionGroupRenderer.java Thu Dec 17 02:33:05 2009
@@ -24,6 +24,7 @@
import org.apache.myfaces.trinidad.component.core.layout.CorePanelCaptionGroup;
import org.apache.myfaces.trinidad.context.RenderingContext;
+
/**
* @author Danny Robinson
*/
@@ -34,7 +35,8 @@
this(CorePanelCaptionGroup.TYPE);
}
- protected PanelCaptionGroupRenderer(FacesBean.Type type)
+ protected PanelCaptionGroupRenderer(
+ FacesBean.Type type)
{
super(type);
}
@@ -45,17 +47,20 @@
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_captionTextKey = type.findKey("captionText");
}
- protected String getCaptionText(FacesBean bean)
+ protected String getCaptionText(
+ UIComponent component,
+ FacesBean bean)
{
return toString(this.resolveProperty(bean, _captionTextKey));
}
-
+
protected String getRootStyle()
{
return SkinSelectors.AF_PANEL_CAPTION_GROUP_ROOT_STYLE_CLASS;
@@ -68,38 +73,41 @@
@SuppressWarnings("unchecked")
@Override
- protected void encodeAll(FacesContext context, RenderingContext arc,
- UIComponent component, FacesBean bean) throws IOException
+ protected void encodeAll(
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
-
+
writer.startElement(XhtmlConstants.FIELDSET_ELEMENT, component);
- renderAllAttributes(context, arc, bean, false);
- renderStyleAttributes(context, arc, bean, getRootStyle());
+ renderAllAttributes(context, rc, component, bean, false);
+ renderStyleAttributes(context, rc, component, bean, getRootStyle());
UIComponent captionFacet = getFacet(component, CorePanelCaptionGroup.CAPTION_FACET);
- String captionText = getCaptionText(bean);
-
+ String captionText = getCaptionText(component, bean);
+
// Render either the caption facet or the captionText
if (captionFacet != null || captionText != null)
{
writer.startElement(XhtmlConstants.LEGEND_ELEMENT, null);
- renderStyleClass(context, arc, getCaptionStyle());
-
+ renderStyleClass(context, rc, getCaptionStyle());
+
if (captionFacet != null)
encodeChild(context, captionFacet);
else
writer.writeText(captionText, "captionText");
-
+
writer.endElement(XhtmlConstants.LEGEND_ELEMENT);
}
-
+
// Output all the body of the component
encodeAllChildren(context, component);
writer.endElement(XhtmlConstants.FIELDSET_ELEMENT);
}
-
+
private PropertyKey _captionTextKey;
-
}
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelFormLayoutRenderer.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/PanelFormLayoutRenderer.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/PanelFormLayoutRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelFormLayoutRenderer.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,7 +19,9 @@
package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
import java.awt.Dimension;
+
import java.io.IOException;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -31,7 +33,6 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-
import javax.faces.render.Renderer;
import org.apache.myfaces.trinidad.bean.FacesBean;
@@ -45,15 +46,17 @@
import org.apache.myfaces.trinidad.context.Agent;
import org.apache.myfaces.trinidad.context.RenderingContext;
+
public class PanelFormLayoutRenderer extends XhtmlRenderer
{
public PanelFormLayoutRenderer()
{
super(CorePanelFormLayout.TYPE);
}
-
+
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
@@ -78,14 +81,17 @@
protected void renderStyleAttributes(
FacesContext context,
RenderingContext rc,
- FacesBean bean)
- throws IOException
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
- renderStyleAttributes(context, rc, bean, SkinSelectors.AF_PANEL_FORM_STYLE_CLASS);
+ renderStyleAttributes(context, rc, component, bean, SkinSelectors.AF_PANEL_FORM_STYLE_CLASS);
}
@Override
- protected String getDefaultStyleClass(FacesBean bean)
+ protected String getDefaultStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
return SkinSelectors.AF_LABEL_TEXT_STYLE_CLASS;
}
@@ -102,10 +108,10 @@
ResponseWriter rw = context.getResponseWriter();
rw.startElement("div", component); // the root element
renderId(context, component);
- renderAllAttributes(context, rc, bean);
+ renderAllAttributes(context, rc, component, bean);
int maxColumns = 0;
- Number maxColumnsNumber = _getMaxColumns(bean);
+ Number maxColumnsNumber = _getMaxColumns(component, bean);
if (maxColumnsNumber != null)
{
maxColumns = maxColumnsNumber.intValue();
@@ -120,7 +126,7 @@
{
maxColumns = 1;
}
- Number rowsNumber = _getRows(bean);
+ Number rowsNumber = _getRows(component, bean);
if (rowsNumber == null)
{
rows = Integer.MAX_VALUE;
@@ -146,7 +152,9 @@
* @param component the component being rendered
* @return true if the parent is a PanelFormLayout
*/
- static boolean __isInPanelFormLayout(FacesContext context, UIComponent component)
+ static boolean __isInPanelFormLayout(
+ FacesContext context,
+ UIComponent component)
{
Map requestMap = context.getExternalContext().getRequestMap();
Object formItem = requestMap.get(_PANEL_FORM_LAYOUT_FORM_ITEM_KEY);
@@ -170,8 +178,8 @@
UIComponent component,
FacesBean bean,
int maxColumns,
- int rows)
- throws IOException
+ int rows
+ ) throws IOException
{
// We cannot render a nested panelForm with any more than a single column
// so we must monitor whether we are nested or not:
@@ -221,9 +229,9 @@
// we really need:
int actualColumns = maxColumns;
int actualRows = rows;
- Object labelAlignment;
-
- // In the case of narrow-screen PDAs, the label and field are rendered
+ Object labelAlignment;
+
+ // In the case of narrow-screen PDAs, the label and field are rendered
// vertically to reduce the overall page's width. Thus, labelAlignment
// is always "top" for narrow-screen PDAs.
if (supportsNarrowScreen(rc))
@@ -232,9 +240,9 @@
}
else
{
- labelAlignment = _getLabelAlignment(bean);
+ labelAlignment = _getLabelAlignment(component, bean);
}
-
+
boolean forceSingleColumn = (nestLevel != 0);
boolean startAlignedLabels = !forceSingleColumn;
if ("start".equals(labelAlignment))
@@ -278,8 +286,8 @@
// These widths can either be pixels, percentages, or undefined.
// We must ensure that if using percentages or undefined that we correct them
// to total up properly.
- String labelWidth = (String)_getLabelWidth(bean);
- String fieldWidth = (String)_getFieldWidth(bean);
+ String labelWidth = (String)_getLabelWidth(component, bean);
+ String fieldWidth = (String)_getFieldWidth(component, bean);
// Create the DOM for the form:
ResponseWriter rw = context.getResponseWriter();
@@ -325,7 +333,7 @@
int[] footerGroupSizes = new int[totalFooterItemCount];
_computeRenderedGroupSizes(footerGroupStates, footerGroupSizes);
- List<LayoutAction> footerLayoutActions =
+ List<LayoutAction> footerLayoutActions =
_computeLayoutActions(totalFooterItemCount, footerGroupSizes, footerGroupStates);
ColumnEncodingState footerEncodingState = new ColumnEncodingState(
@@ -369,7 +377,7 @@
*/
private static int _computeRenderedGroupSizes(
List<GroupState> groupStates,
- int[] renderedGroupSizes)
+ int[] renderedGroupSizes)
{
int totalFormItemCount = renderedGroupSizes.length;
@@ -415,8 +423,8 @@
* @return LayoutActions for each child to lay out
*/
private static List<LayoutAction> _computeLayoutActions(
- int rowCount,
- int[] renderedGroupSizes,
+ int rowCount,
+ int[] renderedGroupSizes,
List<GroupState> groupStates)
{
int totalFormItemCount = groupStates.size();
@@ -461,7 +469,7 @@
(GroupState.OUTSIDE_GROUP.equals(currGroupState) &&
GroupState.START_GROUP.equals(lastGroupState)))
layoutAction = LayoutAction.NEW_GROUP;
- else
+ else
layoutAction = LayoutAction.FLAT;
}
@@ -486,11 +494,11 @@
* represents the number of rows
*/
private static Dimension _computeActualColumnsAndRows(
- int guessColumns,
- int guessRows,
- int totalFormItemCount,
+ int guessColumns,
+ int guessRows,
+ int totalFormItemCount,
int[] renderedGroupSizes,
- int renderedGroupsCount)
+ int renderedGroupsCount)
{
if (totalFormItemCount == 0)
return new Dimension(0, 0);
@@ -575,9 +583,9 @@
*/
private FormWidths _getFormWidths(
boolean startAlignLabels,
- String labelWidth,
- String fieldWidth,
- int actualColumns)
+ String labelWidth,
+ String fieldWidth,
+ int actualColumns)
{
WidthType labelWidthType = WidthType.NONE;
WidthType fieldWidthType = WidthType.NONE;
@@ -621,11 +629,11 @@
* @return width information for various parts of the form
*/
private FormWidths _getStartAlignedFormWidths(
- String labelWidth,
+ String labelWidth,
WidthType labelWidthType,
- String fieldWidth,
+ String fieldWidth,
WidthType fieldWidthType,
- int actualColumns)
+ int actualColumns)
{
String effectiveLabelWidth = null;
String effectiveFieldWidth = null;
@@ -677,15 +685,15 @@
labelRatio = Double.valueOf(labelWidth.substring(0, labelPercentCharIndex));
int fieldPercentCharIndex = fieldWidth.indexOf("%");
fieldRatio = Double.valueOf(fieldWidth.substring(0, fieldPercentCharIndex));
-
- // BlackBerry(BB) browsers cannot handle width if it is expressed in
- // percentage and the percentage value contains a decimal points like
- // 40.0%. So lets truncate the percentage value from the decimal point
+
+ // BlackBerry(BB) browsers cannot handle width if it is expressed in
+ // percentage and the percentage value contains a decimal points like
+ // 40.0%. So lets truncate the percentage value from the decimal point
// for BB browsers. Example, instead of 40.0%, lets render 40%.
RenderingContext arc = RenderingContext.getCurrentInstance();
Agent agent = arc.getAgent();
-
- boolean isBlackBerry =
+
+ boolean isBlackBerry =
Agent.AGENT_BLACKBERRY.equals(agent.getAgentName());
// Now normalize the percentages (including the footer label width):
@@ -693,18 +701,18 @@
double effectiveLabelWidthDouble = labelRatio / ratioTotal;
double footerLabel = effectiveLabelWidthDouble / actualColumns;
double footerField = 100 - footerLabel;
-
+
if (isBlackBerry)
{
effectiveLabelWidth = (int) effectiveLabelWidthDouble + "%";
- effectiveFieldWidth = (int) (fieldRatio / ratioTotal) + "%";
+ effectiveFieldWidth = (int) (fieldRatio / ratioTotal) + "%";
effectiveFooterLabelWidth = (int) _roundTo2DecimalPlaces(footerLabel) + "%";
effectiveFooterFieldWidth = (int) _roundTo2DecimalPlaces(footerField) + "%";
}
else
{
effectiveLabelWidth = Math.floor(effectiveLabelWidthDouble) + "%";
- effectiveFieldWidth = Math.floor(fieldRatio / ratioTotal) + "%";
+ effectiveFieldWidth = Math.floor(fieldRatio / ratioTotal) + "%";
effectiveFooterLabelWidth = _roundTo2DecimalPlaces(footerLabel) + "%";
effectiveFooterFieldWidth = _roundTo2DecimalPlaces(footerField) + "%";
}
@@ -744,11 +752,11 @@
* @return width information for various parts of the form
*/
private FormWidths _getTopAlignedFormWidths(
- String labelWidth,
+ String labelWidth,
WidthType labelWidthType,
- String fieldWidth,
+ String fieldWidth,
WidthType fieldWidthType,
- int actualColumns)
+ int actualColumns)
{
String effectiveLabelWidth = null;
String effectiveFieldWidth = null;
@@ -763,7 +771,7 @@
}
else if (labelWidthType.equals(WidthType.PERCENT) || fieldWidthType.equals(WidthType.PERCENT))
{
- //If either one is set to a percent, then we use 100%, because with top aligned the only
+ //If either one is set to a percent, then we use 100%, because with top aligned the only
//choices are auto, pixel value, or 100%
outerTableWidth = "100%";
effectiveLabelWidth = labelWidthType.equals(WidthType.PERCENT) ? "100%" : null;
@@ -771,21 +779,21 @@
effectiveFooterLabelWidth = effectiveLabelWidth;
effectiveFooterFieldWidth = effectiveFieldWidth;
}
- else
+ else
{
- //either label or field has a pixel (or no) width value. Use the larger value of the two for
+ //either label or field has a pixel (or no) width value. Use the larger value of the two for
//the table width.
int labelPixels = 0;
int fieldPixels = 0;
-
+
if (labelWidthType.equals(WidthType.PIXEL))
{
effectiveLabelWidth = labelWidth + "px";
effectiveFooterLabelWidth = effectiveLabelWidth;
labelPixels = Integer.valueOf(labelWidth);
}
-
+
if (fieldWidthType.equals(WidthType.PIXEL))
{
effectiveFieldWidth = fieldWidth + "px";
@@ -804,7 +812,8 @@
outerTableWidth);
}
- private double _roundTo2DecimalPlaces(double value)
+ private double _roundTo2DecimalPlaces(
+ double value)
{
return Math.round(value * 100) / 100.0;
}
@@ -819,8 +828,8 @@
private static void _encodeGroupDivider(
FacesContext context,
RenderingContext rc,
- boolean startAlignedLabels)
- throws IOException
+ boolean startAlignedLabels
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
rw.startElement("tr", null);
@@ -852,8 +861,8 @@
FacesContext context,
RenderingContext rc,
boolean startAlignedLabels,
- UIComponent item)
- throws IOException
+ UIComponent item
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
boolean isFullRow = _isFullRow(context, item);
@@ -907,7 +916,7 @@
renderStyleClass(context, rc,
SkinSelectors.AF_PANEL_FORM_CONTENT_CELL_STYLE_CLASS);
}
-
+
encodeChild(context, item);
if(isSimple)
@@ -966,8 +975,8 @@
*/
private static void _encodeBeforeLabelTd(
FacesContext context,
- boolean startAlignedLabels)
- throws IOException
+ boolean startAlignedLabels
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
// startAlignedLabels means (labels side-by-side with fields)
@@ -986,8 +995,8 @@
*/
private static void _encodeAfterFieldTd(
FacesContext context,
- boolean startAlignedLabels)
- throws IOException
+ boolean startAlignedLabels
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
if (!startAlignedLabels) // top-aligned (labels stacked above fields)
@@ -1082,7 +1091,9 @@
* @return true if the child can and should render a complete form
* layout row specifically structured for the panelFormLayout
*/
- private boolean _isFullRow(FacesContext context, UIComponent component)
+ private boolean _isFullRow(
+ FacesContext context,
+ UIComponent component)
{
String rendererType = component.getRendererType();
@@ -1111,11 +1122,14 @@
* @param component the child component
* @return true if the child is rendered in simple mode
*/
- private boolean _isSimple(UIComponent component, Renderer renderer)
+ private boolean _isSimple(
+ UIComponent component,
+ Renderer renderer)
{
if (renderer != null && renderer instanceof InputLabelAndMessageRenderer)
{
- return (((InputLabelAndMessageRenderer)renderer).getSimple(getFacesBean(component)));
+ return (((InputLabelAndMessageRenderer)renderer)
+ .getSimple(component, getFacesBean(component)));
}
else
{
@@ -1130,7 +1144,9 @@
* @param component the child component
* @return <code>Renderer</code> for the given <code>UIComponent</code>.
*/
- private Renderer _getRenderer(FacesContext context, UIComponent component)
+ private Renderer _getRenderer(
+ FacesContext context,
+ UIComponent component)
{
// =-= AEW Might consider altering the following approach of getting the
// child renderer in case anyone wants to use renderer decoration.
@@ -1156,7 +1172,9 @@
* @param bean the FacesBean of the component to render
* @return the defined "labelWidth" or null if not defined
*/
- private Object _getLabelWidth(FacesBean bean)
+ private Object _getLabelWidth(
+ UIComponent component,
+ FacesBean bean)
{
return bean.getProperty(_labelWidthKey);
}
@@ -1166,7 +1184,9 @@
* @param bean the FacesBean of the component to render
* @return the defined "labelAlignment" or null if not defined
*/
- private Object _getLabelAlignment(FacesBean bean)
+ private Object _getLabelAlignment(
+ UIComponent component,
+ FacesBean bean)
{
return bean.getProperty(_labelAlignmentKey);
}
@@ -1176,7 +1196,9 @@
* @param bean the FacesBean of the component to render
* @return the defined "fieldWidth" or null if not defined
*/
- private Object _getFieldWidth(FacesBean bean)
+ private Object _getFieldWidth(
+ UIComponent component,
+ FacesBean bean)
{
return bean.getProperty(_fieldWidthKey);
}
@@ -1186,7 +1208,9 @@
* @param bean the FacesBean of the component to render
* @return the defined "rows" or null if not defined
*/
- private Number _getRows(FacesBean bean)
+ private Number _getRows(
+ UIComponent component,
+ FacesBean bean)
{
return (Number)bean.getProperty(_rowsKey);
}
@@ -1196,7 +1220,9 @@
* @param bean the FacesBean of the component to render
* @return the defined "maxColumns" or null if not defined
*/
- private Number _getMaxColumns(FacesBean bean)
+ private Number _getMaxColumns(
+ UIComponent component,
+ FacesBean bean)
{
return (Number)bean.getProperty(_maxColumnsKey);
}
@@ -1207,7 +1233,9 @@
* @param defaultValue
* @return the current nesting level
*/
- private static int _getNestLevel(FacesContext context, int defaultValue)
+ private static int _getNestLevel(
+ FacesContext context,
+ int defaultValue)
{
Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
@@ -1224,7 +1252,8 @@
*/
private static class GroupingState
{
- public GroupingState(int initialSize)
+ public GroupingState(
+ int initialSize)
{
this.groupStates = new ArrayList<GroupState>(initialSize);
}
@@ -1257,7 +1286,7 @@
private enum LayoutAction
{
/** create a new column for this child */
- NEW_COLUMN,
+ NEW_COLUMN,
/** create a new group for this child */
NEW_GROUP,
@@ -1270,14 +1299,15 @@
* Visitor used to collect information about the rendered flattened children into the
* GroupingState. This information is later processed to determine the correct layout.
*/
- private class RenderedItemExtractor implements ComponentProcessor<GroupingState>
+ private class RenderedItemExtractor
+ implements ComponentProcessor<GroupingState>
{
public void processComponent(
FacesContext context,
ComponentProcessingContext cpContext,
UIComponent currChild,
- GroupingState groupingState)
- throws IOException
+ GroupingState groupingState
+ ) throws IOException
{
int groupDepth = cpContext.getGroupDepth();
@@ -1341,8 +1371,8 @@
FacesContext context,
ComponentProcessingContext cpContext,
UIComponent currChild,
- ColumnEncodingState columnEncodingState)
- throws IOException
+ ColumnEncodingState columnEncodingState
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
@@ -1407,7 +1437,7 @@
}
}
- // render the separator, if any
+ // render the separator, if any
if (LayoutAction.NEW_GROUP.equals(currLayoutAction))
{
PanelFormLayoutRenderer._encodeGroupDivider(context,
@@ -1428,15 +1458,16 @@
}
}
- private void _finishColumn(ResponseWriter rw) throws IOException
+ private void _finishColumn(
+ ResponseWriter rw
+ ) throws IOException
{
rw.endElement("tbody"); // the inner tbody
rw.endElement("table"); // the inner table
- rw.endElement("td"); // the outer column
+ rw.endElement("td"); // the outer column
}
}
-
/**
* Request map key for child renderers to inspect to see if their
* labels should be stacked above their fields as opposed to the side.
@@ -1476,9 +1507,9 @@
private static final int _COLUMNS_DEFAULT = 3;
// we need a resource key map since we are using LabelAndMessageRenderer.
- private static final Map<String, String> _RESOURCE_KEY_SIDE_BY_SIDE_MAP =
+ private static final Map<String, String> _RESOURCE_KEY_SIDE_BY_SIDE_MAP =
new HashMap<String, String>();
- private static final Map<String, String> _RESOURCE_KEY_STACKED_MAP =
+ private static final Map<String, String> _RESOURCE_KEY_STACKED_MAP =
new HashMap<String, String>();
static
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelGroupLayoutRenderer.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/PanelGroupLayoutRenderer.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/PanelGroupLayoutRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelGroupLayoutRenderer.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,9 +29,9 @@
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.core.layout.CorePanelGroupLayout;
-
import org.apache.myfaces.trinidad.context.RenderingContext;
+
public class PanelGroupLayoutRenderer extends XhtmlRenderer
{
public PanelGroupLayoutRenderer()
@@ -39,13 +39,15 @@
this(CorePanelGroupLayout.TYPE);
}
- protected PanelGroupLayoutRenderer(FacesBean.Type type)
+ protected PanelGroupLayoutRenderer(
+ FacesBean.Type type)
{
super(type);
}
-
+
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_layoutKey = type.findKey("layout");
@@ -57,34 +59,33 @@
return true;
}
- /**
- * @see org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer#getDefaultStyleClass(
- * org.apache.myfaces.trinidad.bean.FacesBean)
- */
@Override
- protected String getDefaultStyleClass(FacesBean bean)
+ protected String getDefaultStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
// Fix for TRINIDAD-652
return SkinSelectors.AF_PANEL_GROUP_LAYOUT_STYLE_CLASS;
}
-
+
@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();
- Object layout = getLayout(bean);
+ Object layout = getLayout(component, bean);
boolean isVertical = CorePanelGroupLayout.LAYOUT_VERTICAL.equals(layout);;
boolean isHorizontal = CorePanelGroupLayout.LAYOUT_HORIZONTAL.equals(layout);
if (isHorizontal)
{
rw.startElement("table", component);
- OutputUtils.renderLayoutTableAttributes(context, arc, "0", null);
+ OutputUtils.renderLayoutTableAttributes(context, rc, "0", null);
}
else if (isVertical)
{
@@ -96,7 +97,7 @@
}
renderId(context, component);
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, component, bean);
if (isHorizontal)
{
@@ -162,7 +163,8 @@
protected void encodeSeparator(
FacesContext context,
UIComponent separator,
- boolean isHorizontal) throws IOException
+ boolean isHorizontal
+ ) throws IOException
{
if (separator != null)
encodeChild(context, separator, isHorizontal);
@@ -174,7 +176,8 @@
protected void encodeChild(
FacesContext context,
UIComponent child,
- boolean isHorizontal) throws IOException
+ boolean isHorizontal
+ ) throws IOException
{
if (isHorizontal)
{
@@ -189,11 +192,12 @@
}
}
- protected Object getLayout(FacesBean bean)
+ protected Object getLayout(
+ UIComponent component,
+ FacesBean bean)
{
return bean.getProperty(_layoutKey);
}
-
private PropertyKey _layoutKey;
}
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelHeaderRenderer.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/PanelHeaderRenderer.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/PanelHeaderRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelHeaderRenderer.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
@@ -43,13 +43,15 @@
this(CorePanelHeader.TYPE);
}
- protected PanelHeaderRenderer(FacesBean.Type type)
+ protected PanelHeaderRenderer(
+ 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");
@@ -57,7 +59,7 @@
_sizeKey = type.findKey("size");
_messageTypeKey = type.findKey("messageType");
}
-
+
@Override
public boolean getRendersChildren()
{
@@ -66,54 +68,54 @@
@Override
protected void encodeAll(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
- Number oldSize = getContextHeaderSize(arc, null);
+ Number oldSize = getContextHeaderSize(rc, null);
- int nestLevel = getHeaderNestLevel(arc);
- int size = _getAndStoreSize(arc, bean);
+ int nestLevel = getHeaderNestLevel(rc);
+ int size = _getAndStoreSize(rc, component, bean);
- String messageType = getMessageType(bean);
- String text = getText(arc, bean, messageType);
+ String messageType = getMessageType(component, bean);
+ String text = getText(rc, component, bean, messageType);
List<String> headerElementList = XhtmlConstants.HEADER_ELEMENTS;
String headerElement = headerElementList.get(
Math.min(size, headerElementList.size() - 1));
-
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement("div", component);
- renderId(context, component);
- renderAllAttributes(context, arc, bean);
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement("div", component);
+ renderId(context, component);
+ renderAllAttributes(context, rc, component, bean);
boolean nesting = ((nestLevel > 0) &&
- !Boolean.FALSE.equals(arc.getSkin().getProperty(
+ !Boolean.FALSE.equals(rc.getSkin().getProperty(
SkinProperties.AF_PANELHEADER_INDENT_CONTENT)));
// =-=AEW What if style class is already set?
if (nesting)
- renderStyleClass(context, arc, SkinSelectors.HEADER_NEST_STYLE_CLASS);
+ renderStyleClass(context, rc, SkinSelectors.HEADER_NEST_STYLE_CLASS);
writer.startElement(headerElement, null);
- renderStyleClass(context, arc, SkinSelectors.AF_PANEL_HEADER_STYLE_CLASS);
-
- renderIcon(context, arc, component, bean, messageType);
+ renderStyleClass(context, rc, SkinSelectors.AF_PANEL_HEADER_STYLE_CLASS);
+
+ renderIcon(context, rc, component, bean, messageType);
boolean isError = XhtmlConstants.MESSAGE_TYPE_ERROR.equals(messageType);
if (isError)
{
// If this is an error header, render the text within
- // a SkinSelectors.AF_PANEL_HEADER_ERROR_STYLE_CLASS span so that header will pick up
+ // a SkinSelectors.AF_PANEL_HEADER_ERROR_STYLE_CLASS span so that header will pick up
// the error text foreground color
writer.startElement("span", null);
- renderStyleClass(context, arc,
+ renderStyleClass(context, rc,
SkinSelectors.AF_PANEL_HEADER_ERROR_STYLE_CLASS);
}
-
+
if (text != null)
writer.writeText(text, "text");
@@ -125,40 +127,41 @@
// Close up the header
writer.endElement(headerElement);
-
+
// increment header nesting
- incrementHeaderNestLevel(arc);
+ incrementHeaderNestLevel(rc);
- if (shouldRenderChildren(bean))
+ if (shouldRenderChildren(component, bean))
encodeAllChildren(context, component);
- decrementHeaderNestLevel(arc);
+ decrementHeaderNestLevel(rc);
- writer.endElement("div");
+ writer.endElement("div");
- // using float to indent in IE on windows, but that means you
+ // using float to indent in IE on windows, but that means you
// need to clear after the header or you get strange behavior
if ( nesting &&
- isIE(arc)) // no need to check "Windows" - IE Mac is desupported
+ isIE(rc)) // no need to check "Windows" - IE Mac is desupported
{
writer.startElement("div", component);
writer.writeAttribute("style","clear:both", null);
writer.endElement("div");
}
- setContextHeaderSize(arc, oldSize);
+ setContextHeaderSize(rc, oldSize);
}
// Renders the header's icon. If the header has a message type,
// then the icon is retrieved from the Skin. Otherwise,
// we use the icon specified via the header's ICON_ATTR.
protected void renderIcon(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean,
- String messageType) throws IOException
- {
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean,
+ String messageType
+ ) throws IOException
+ {
if ((messageType != null) &&
!XhtmlConstants.MESSAGE_TYPE_NONE.equals(messageType))
{
@@ -166,12 +169,12 @@
String iconName = getMessageIconName(messageType);
if (iconName != null)
{
- Icon icon = arc.getIcon(iconName);
+ Icon icon = rc.getIcon(iconName);
// If we've got an Icon, render it
if (icon != null)
{
OutputUtils.renderIcon(context,
- arc,
+ rc,
icon,
XhtmlConstants.EMPTY_STRING_ATTRIBUTE_VALUE,
null);
@@ -182,15 +185,15 @@
}
else
{
- String iconUri = getIconUri(bean);
+ String iconUri = getIconUri(component, bean);
if( iconUri != null)
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement("img", null);
- OutputUtils.renderAltAndTooltipForImage(context, arc,
+ OutputUtils.renderAltAndTooltipForImage(context, rc,
XhtmlConstants.EMPTY_STRING_ATTRIBUTE_VALUE);
- renderStyleClass(context, arc,
+ renderStyleClass(context, rc,
SkinSelectors.AF_PANEL_HEADER_ICON_STYLE_CLASS);
renderEncodedResourceURI(context, "src", iconUri);
writer.endElement("img");
@@ -202,9 +205,10 @@
* Returns text of header
*/
protected String getText(
- RenderingContext arc,
- FacesBean bean,
- String messageType
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean,
+ String messageType
)
{
String text = toString(bean.getProperty(_textKey));
@@ -229,50 +233,55 @@
else
return null;
- return arc.getTranslatedString(key);
+ return rc.getTranslatedString(key);
}
/**
* Returns the uri for icon.
*/
protected String getIconUri(
- FacesBean bean)
+ UIComponent component,
+ FacesBean bean)
{
if (_iconKey == null)
return null;
return toResourceUri(FacesContext.getCurrentInstance(), bean.getProperty(_iconKey));
}
- protected Number getSize(FacesBean bean)
+ protected Number getSize(
+ UIComponent component,
+ FacesBean bean)
{
if (_sizeKey == null)
return null;
return (Number) bean.getProperty(_sizeKey);
}
-
- protected String getMessageType(FacesBean bean)
+ protected String getMessageType(
+ UIComponent component,
+ FacesBean bean)
{
if (_messageTypeKey == null)
return null;
return toString(bean.getProperty(_messageTypeKey));
}
- protected boolean shouldRenderChildren(FacesBean bean)
+ protected boolean shouldRenderChildren(
+ UIComponent component,
+ FacesBean bean)
{
return true;
}
-
protected static Number getContextHeaderSize(
- RenderingContext arc,
+ RenderingContext rc,
Number defaultValue
)
{
- Number number = (Number) arc.getProperties().get(HEADER_SIZE);
+ Number number = (Number) rc.getProperties().get(HEADER_SIZE);
if (number == null)
number = defaultValue;
-
+
return number;
}
@@ -280,45 +289,42 @@
* Set the size of the header stored on the context
*/
protected static void setContextHeaderSize(
- RenderingContext arc,
+ RenderingContext rc,
Number size
)
{
- arc.getProperties().put(HEADER_SIZE, size);
+ rc.getProperties().put(HEADER_SIZE, size);
}
-
-
/**
* Returns the current depth of the nesting.
*/
protected static int getHeaderNestLevel(
- RenderingContext arc
+ RenderingContext rc
)
{
- Number n = (Number) arc.getProperties().get(HEADER_NEST_LEVEL);
+ Number n = (Number) rc.getProperties().get(HEADER_NEST_LEVEL);
if (n == null)
return 0;
return n.intValue();
}
-
protected static void incrementHeaderNestLevel(
- RenderingContext arc
+ RenderingContext rc
)throws IOException
{
- arc.getProperties().put(HEADER_NEST_LEVEL,
- Integer.valueOf(getHeaderNestLevel(arc) + 1));
+ rc.getProperties().put(HEADER_NEST_LEVEL,
+ Integer.valueOf(getHeaderNestLevel(rc) + 1));
}
protected static void decrementHeaderNestLevel(
- RenderingContext arc
+ RenderingContext rc
)throws IOException
{
- int headerNestLevel = getHeaderNestLevel(arc);
+ int headerNestLevel = getHeaderNestLevel(rc);
assert (headerNestLevel > 0):"cannot decrement header nest level";
- arc.getProperties().put(HEADER_NEST_LEVEL,
+ rc.getProperties().put(HEADER_NEST_LEVEL,
Integer.valueOf(headerNestLevel - 1));
}
@@ -331,7 +337,8 @@
* @param messageType
* @return The icon name for the specfied messageType.
*/
- protected String getMessageIconName(String messageType)
+ protected String getMessageIconName(
+ String messageType)
{
String iconName = null;
@@ -352,29 +359,29 @@
return iconName;
}
-
private int _getAndStoreSize(
- RenderingContext arc,
- FacesBean bean)
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean)
{
- Number sizeNumber = getSize(bean);
-
+ Number sizeNumber = getSize(component, bean);
+
if (sizeNumber != null && sizeNumber.intValue() >= 0)
{
- setContextHeaderSize(arc, sizeNumber);
+ setContextHeaderSize(rc, sizeNumber);
return sizeNumber.intValue();
- }
+ }
else
{
- sizeNumber = getContextHeaderSize(arc, null);
+ sizeNumber = getContextHeaderSize(rc, null);
int size;
if (sizeNumber == null)
size = 0;
else
size = sizeNumber.intValue() + 1;
-
- setContextHeaderSize(arc, size);
+
+ setContextHeaderSize(rc, size);
return size;
}
}
@@ -393,7 +400,6 @@
// key for retrieving size from the AdfRenderingContext
public static final Object HEADER_SIZE = new Object();
-
// text keys
static private final String _INFORMATION_KEY = "af_panelHeader.INFORMATION";
static private final String _WARNING_KEY = "af_panelHeader.WARNING";
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelHorizontalLayoutRenderer.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/PanelHorizontalLayoutRenderer.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/PanelHorizontalLayoutRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelHorizontalLayoutRenderer.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,9 +29,9 @@
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.core.layout.CorePanelHorizontalLayout;
-
import org.apache.myfaces.trinidad.context.RenderingContext;
+
public class PanelHorizontalLayoutRenderer extends XhtmlRenderer
{
public PanelHorizontalLayoutRenderer()
@@ -39,13 +39,15 @@
this(CorePanelHorizontalLayout.TYPE);
}
- protected PanelHorizontalLayoutRenderer(FacesBean.Type type)
+ protected PanelHorizontalLayoutRenderer(
+ FacesBean.Type type)
{
super(type);
}
-
+
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_valignKey = type.findKey("valign");
@@ -60,57 +62,57 @@
@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();
- Object valign = getValign(bean);
- Object halign = getHalign(bean);
-
+ Object valign = getValign(component, bean);
+ Object halign = getHalign(component, bean);
rw.startElement("table", component);
- OutputUtils.renderLayoutTableAttributes(context, arc, "0", null);
+ OutputUtils.renderLayoutTableAttributes(context, rc, "0", null);
if (CorePanelHorizontalLayout.HALIGN_CENTER.equals(halign))
rw.writeAttribute("align", "center", "halign");
renderId(context, component);
- renderAllAttributes(context, arc, bean);
-
+ renderAllAttributes(context, rc, component, bean);
rw.startElement("tr", null);
- _encodeChildren(context, arc, component, valign, halign);
-
+ _encodeChildren(context, rc, component, valign, halign);
rw.endElement("tr");
rw.endElement("table");
-
}
-
- protected Object getValign(FacesBean bean)
+ protected Object getValign(
+ UIComponent component,
+ FacesBean bean)
{
return bean.getProperty(_valignKey);
}
- protected Object getHalign(FacesBean bean)
+ protected Object getHalign(
+ UIComponent component,
+ FacesBean bean)
{
return bean.getProperty(_halignKey);
- }
+ }
/**
* Render all the children of the PanelGroup
*/
@SuppressWarnings("unchecked")
private void _encodeChildren(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- Object vAlign,
- Object hAlign
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ Object vAlign,
+ Object hAlign
) throws IOException
{
@@ -124,17 +126,17 @@
* ignore endAligment(<td width = 100%>) in PDA
*/
boolean isEndAlignment;
- if (isPDA(arc))
+ if (isPDA(rc))
isEndAlignment = false;
else if (CorePanelHorizontalLayout.HALIGN_END.equals(hAlign))
isEndAlignment = true;
else if (CorePanelHorizontalLayout.HALIGN_LEFT.equals(hAlign))
- isEndAlignment = arc.isRightToLeft();
+ isEndAlignment = rc.isRightToLeft();
else if (CorePanelHorizontalLayout.HALIGN_RIGHT.equals(hAlign))
- isEndAlignment = !arc.isRightToLeft();
+ isEndAlignment = !rc.isRightToLeft();
else
isEndAlignment = false;
-
+
for(UIComponent child : (List<UIComponent>)component.getChildren())
{
if (!child.isRendered())
@@ -168,7 +170,8 @@
protected void encodeChild(
FacesContext context,
UIComponent child,
- Object vAlign) throws IOException
+ Object vAlign
+ ) throws IOException
{
ResponseWriter rw = context.getResponseWriter();
rw.startElement("td", null);
@@ -179,14 +182,14 @@
rw.endElement("td");
}
-
/**
- * Render a separator
+ * Render a separator
*/
protected void encodeSeparator(
FacesContext context,
UIComponent separator,
- Object vAlign) throws IOException
+ Object vAlign
+ ) throws IOException
{
if (separator != null)
encodeChild(context, separator, vAlign);
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelLabelAndMessageRenderer.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/PanelLabelAndMessageRenderer.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/PanelLabelAndMessageRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelLabelAndMessageRenderer.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
@@ -40,42 +40,47 @@
{
super(CorePanelLabelAndMessage.TYPE);
}
-
+
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_forKey = type.findKey("for");
_labelInlineStyleKey = type.findKey("labelStyle");
- }
+ }
@Override
- protected boolean labelShowRequired(FacesBean bean)
+ protected boolean labelShowRequired(
+ UIComponent component,
+ FacesBean bean)
{
// Simpler algorithm for panelLabelAndMessage
- return getShowRequired(bean);
- }
+ return getShowRequired(component, bean);
+ }
@Override
protected boolean isLeafRenderer()
{
return false;
}
-
+
@Override
- protected String getRootStyleClass(FacesBean bean)
+ protected String getRootStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
return "af|panelLabelAndMessage";
}
-
+
@Override
protected String getLabelFor(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean)
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean)
{
- String forValue = getFor(bean);
+ String forValue = getFor(component, bean);
String val = null;
if (forValue != null)
@@ -86,23 +91,24 @@
{
if (component.getChildCount() > 0)
{
- UIComponent child = findForComponent(context, arc, component, bean);
+ UIComponent child = findForComponent(context, rc, component, bean);
if (child != null)
{
val = child.getClientId(context);
}
}
}
-
+
return val;
}
@Override
protected void renderFieldCellContents(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
// The structure of this part of the DOM looks like this:
// +------------------+-----------+
@@ -110,7 +116,7 @@
// +------------------+-----------+
ResponseWriter rw = context.getResponseWriter();
rw.startElement("table", component);
- OutputUtils.renderLayoutTableAttributes(context, arc, "0", null/*width*/);
+ OutputUtils.renderLayoutTableAttributes(context, rc, "0", null/*width*/);
UIComponent end = getFacet(component, CorePanelLabelAndMessage.END_FACET);
@@ -119,15 +125,15 @@
rw.startElement("td", null);
encodeAllChildren(context, component);
rw.endElement("td");
-
+
// For narrow-screen PDAs, End facet is rendered vertically
// below the Help facet. So skip the End facet rendering here.
- if (end != null && !supportsNarrowScreen(arc))
+ if (end != null && !supportsNarrowScreen(rc))
{
rw.startElement("td", null);
// =-= mcc TODO apply className for "af|panelLabelAndMessage::end-facet"
// renderStyleClass(context, arc, ...);
- //apply className for "af|panelLabelAndMessage::help-facet"
+ //apply className for "af|panelLabelAndMessage::help-facet"
encodeChild(context, end);
rw.endElement("td");
}
@@ -136,13 +142,17 @@
rw.endElement("table");
}
- protected String getFor(FacesBean bean)
+ protected String getFor(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_forKey));
}
@Override
- protected String getLabelInlineStyleKey(FacesBean bean)
+ protected String getLabelInlineStyleKey(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_labelInlineStyleKey));
}
@@ -150,7 +160,7 @@
/**
* In the event that the {@link #getFor(FacesBean)} returns null,
* this class finds the first child that implements {@link EditableValueHolder}
- *
+ *
* @param context
* @param arc
* @param component
@@ -172,7 +182,7 @@
return child;
}
}
-
+
// recursively search the children of the children
for (Object obj : component.getChildren())
{
@@ -183,46 +193,46 @@
return result;
}
}
-
+
return null;
}
-
- /* This method is responsible for rendering the End facet for narrow-screen
- * PDAs. In the case of narrow-screen PDAs, End facet is rendered after the
+
+ /* This method is responsible for rendering the End facet for narrow-screen
+ * PDAs. In the case of narrow-screen PDAs, End facet is rendered after the
* Help facet as shown below
* +------+
- * |Label |
+ * |Label |
* +------+
* |Field |
* +----------+
- * |Help facet|
+ * |Help facet|
* +----------+
- * |End facet |
+ * |End facet |
* ------------
* @param context a <code>FacesContext</code>
- * @param arc a <code>RenderingContext</code>
+ * @param rc a <code>RenderingContext</code>
* @param component a <code>UIComponent</code> the component to render
* @param insideTableData a <code>boolean</code> indicates whether End
* Facet to be rendered is in inside a table data(<TD>)
* @throws IOException if there are problems in rendering contents
*/
- @Override
+ @Override
protected void renderEndFacetForNarrowPDA(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
UIComponent component,
boolean insideTableData)
throws IOException
{
- if (!supportsNarrowScreen(arc))
- return;
-
+ if (!supportsNarrowScreen(rc))
+ return;
+
UIComponent end = getFacet(component, CorePanelLabelAndMessage.END_FACET);
-
+
if (end != null)
{
ResponseWriter rw = context.getResponseWriter();
-
+
if (insideTableData)
{
rw.startElement("div", null);
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelListRenderer.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/PanelListRenderer.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/PanelListRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelListRenderer.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
@@ -33,10 +33,10 @@
import org.apache.myfaces.trinidad.component.ComponentProcessor;
import org.apache.myfaces.trinidad.component.UIXComponent;
import org.apache.myfaces.trinidad.component.core.layout.CorePanelList;
-
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext;
import org.apache.myfaces.trinidad.util.IntegerUtils;
+import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext;
+
public class PanelListRenderer extends XhtmlRenderer
{
@@ -46,7 +46,8 @@
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_maxColumnsKey = type.findKey("maxColumns");
@@ -63,10 +64,11 @@
protected void renderStyleAttributes(
FacesContext context,
RenderingContext rc,
+ UIComponent component,
FacesBean bean)
throws IOException
{
- renderStyleAttributes(context, rc, bean, SkinSelectors.AF_PANEL_LIST_STYLE_CLASS);
+ renderStyleAttributes(context, rc, component, bean, SkinSelectors.AF_PANEL_LIST_STYLE_CLASS);
}
@Override
@@ -80,10 +82,10 @@
FacesContext context,
RenderingContext rc,
UIComponent component,
- FacesBean bean)
- throws IOException
+ FacesBean bean
+ ) throws IOException
{
- Number rowsNumber = getRows(bean);
+ Number rowsNumber = getRows(component, bean);
int rows;
if (rowsNumber == null)
{
@@ -94,7 +96,7 @@
rows = rowsNumber.intValue();
}
- Number maxColumnsNumber = getMaxColumns(bean);
+ Number maxColumnsNumber = getMaxColumns(component, bean);
int maxCols;
if (maxColumnsNumber == null)
{
@@ -105,12 +107,12 @@
maxCols = maxColumnsNumber.intValue();
}
- String listStyle = getListStyle(bean);
+ String listStyle = getListStyle(component, bean);
ResponseWriter writer = context.getResponseWriter();
writer.startElement("div", component);
renderId(context, component);
- renderAllAttributes(context, rc, bean);
+ renderAllAttributes(context, rc, component, bean);
((CoreRenderingContext) rc).setDefaultLinkStyleDisabled(true);
@@ -181,25 +183,31 @@
((CoreRenderingContext) rc).setDefaultLinkStyleDisabled(false);
}
- protected Number getRows(FacesBean bean)
+ protected Number getRows(
+ UIComponent component,
+ FacesBean bean)
{
return (Number)bean.getProperty(_rowsKey);
}
- protected Number getMaxColumns(FacesBean bean)
+ protected Number getMaxColumns(
+ UIComponent component,
+ FacesBean bean)
{
return (Number)bean.getProperty(_maxColumnsKey);
}
- protected String getListStyle(FacesBean bean)
+ protected String getListStyle(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_listStyleKey));
}
private void _renderListStyle(
FacesContext context,
- String listStyle)
- throws IOException
+ String listStyle
+ ) throws IOException
{
if (listStyle != null)
{
@@ -210,7 +218,8 @@
/**
* Get the default columns off of the skin property.
*/
- private int _getDefaultColumns(RenderingContext rc)
+ private int _getDefaultColumns(
+ RenderingContext rc)
{
// TODO Either document this skin property in skin-selectors.xml and add it to the skin demo
// page or put it into the panelList component metadata xml file.
@@ -239,7 +248,8 @@
*/
private static class GroupingCallbackState
{
- public GroupingCallbackState(int initialSize)
+ public GroupingCallbackState(
+ int initialSize)
{
this.groupStates = new ArrayList<GroupState>(initialSize);
}
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelPartialRootRenderer.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/PanelPartialRootRenderer.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/PanelPartialRootRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelPartialRootRenderer.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
@@ -22,7 +22,6 @@
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
-import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -31,9 +30,9 @@
import org.apache.myfaces.trinidad.component.visit.VisitCallback;
import org.apache.myfaces.trinidad.component.visit.VisitContext;
import org.apache.myfaces.trinidad.component.visit.VisitResult;
-import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.context.PartialPageContext;
import org.apache.myfaces.trinidad.context.RenderingContext;
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
/**
@@ -43,7 +42,8 @@
*/
public class PanelPartialRootRenderer extends XhtmlRenderer
{
- protected PanelPartialRootRenderer(FacesBean.Type type)
+ protected PanelPartialRootRenderer(
+ FacesBean.Type type)
{
super(type);
}
@@ -55,14 +55,15 @@
}
protected void renderContent(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
// determinie whether we should try and optimize the PPR rendering
boolean encodeAllChildren = !PartialPageUtils.isOptimizedPPREnabled(context, true);
-
+
if (encodeAllChildren)
{
// No PPR optimization, so encode all children
@@ -71,10 +72,10 @@
else
{
// perform an optimized partial visit of the children
- PartialPageContext pprContext = arc.getPartialPageContext();
-
+ PartialPageContext pprContext = rc.getPartialPageContext();
+
VisitContext visitContext = pprContext.getVisitContext();
-
+
try
{
for (UIComponent currChild : component.getChildren())
@@ -86,7 +87,7 @@
catch (FacesException e)
{
Throwable cause = e.getCause();
-
+
// unwrap and throw IOExceptions
if (cause instanceof IOException)
throw (IOException)cause;
@@ -98,21 +99,22 @@
@Override
protected void encodeAll(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
- XhtmlUtils.addLib(context, arc, "openWindow()");
+ XhtmlUtils.addLib(context, rc, "openWindow()");
- if (PartialPageUtils.isPartialRenderingPass(arc))
+ if (PartialPageUtils.isPartialRenderingPass(rc))
{
// Mark that PPR is in fact active
PartialPageUtils.markPPRActive(context);
try
{
- renderContent(context, arc, component, bean);
+ renderContent(context, rc, component, bean);
}
// For RuntimeExceptions and Errors, make sure we don't
// just drop the error on the ground during PPR requests.
@@ -131,31 +133,32 @@
throw error;
}
- renderAtEnd(context, arc);
+ renderAtEnd(context, rc);
}
else
{
boolean alreadyRenderedPPR = PartialPageUtils.isPPRActive(context);
// @TODO: Find out the reason for the second half of this "or"
if (!(alreadyRenderedPPR ||
- PartialPageUtils.isPartialRenderingPass(arc)))
+ PartialPageUtils.isPartialRenderingPass(rc)))
{
// Render the iframe that we use to make partial page requests
- if (PartialPageUtils.supportsPartialRendering(arc))
+ if (PartialPageUtils.supportsPartialRendering(rc))
{
PartialPageUtils.markPPRActive(context);
- renderPPRSupport(context, arc, component, bean);
+ renderPPRSupport(context, rc, component, bean);
}
}
- renderContent(context, arc, component, bean);
- renderAtEnd(context, arc);
+ renderContent(context, rc, component, bean);
+ renderAtEnd(context, rc);
}
}
protected void renderAtEnd(
FacesContext context,
- RenderingContext arc) throws IOException
+ RenderingContext rc
+ ) throws IOException
{
}
@@ -165,32 +168,33 @@
}
// Is this a partial page rendering pass?
- protected static boolean isPartialPass(RenderingContext arc)
+ protected static boolean isPartialPass(
+ RenderingContext rc)
{
- return (PartialPageUtils.isPartialRenderingPass(arc));
+ return (PartialPageUtils.isPartialRenderingPass(rc));
}
protected void renderPPRSupport(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
// Render anything that will be needed to block clicks when the
// partial render is in progress
- _renderPartialBlocking(context, arc, component);
+ _renderPartialBlocking(context, rc, component);
}
-
// Renders the DIV element which is used to block user input during the
// handling of a partial update.
private static void _renderPartialBlocking(
- FacesContext context,
- RenderingContext arc,
- UIComponent component)
- throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component
+ ) throws IOException
{
- if (PartialPageUtils.supportsBlocking(arc))
+ if (PartialPageUtils.supportsBlocking(rc))
{
ResponseWriter writer = context.getResponseWriter();
@@ -217,7 +221,9 @@
*/
private static final class EncodeAllCallback implements VisitCallback
{
- public VisitResult visit(VisitContext context, UIComponent target)
+ public VisitResult visit(
+ VisitContext context,
+ UIComponent target)
{
try
{
@@ -229,9 +235,9 @@
// launder the IOException as a FacesException, we'll unwrap this later
throw new FacesException(ioe);
}
-
+
PartialPageContext pprContext = RenderingContext.getCurrentInstance().getPartialPageContext();
-
+
// if we finished rendering all of the destired targets, return that we are
// done. Otherwise, reject this subtree so that we don't traverse into it, since
// we have already rendered all of the targets in it
@@ -242,8 +248,6 @@
}
}
-
-
// Div element used for blocking
private static final String _PARTIAL_DIV_ID = "tr_pprBlockingDiv";
private static final String _PARTIAL_DIV_CLICK_HANDLER =
@@ -252,7 +256,7 @@
private static final String _PARTIAL_DIV_STYLE =
"position:absolute;left:0;top:0;width:0;height:0;cursor:wait;";
- // callback used to render optimized PPR
+ // callback used to render optimized PPR
private static final VisitCallback _ENCODE_ALL_CALLBACK = new EncodeAllCallback();
private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelPopupRenderer.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/PanelPopupRenderer.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/PanelPopupRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelPopupRenderer.java Thu Dec 17 02:33:05 2009
@@ -26,6 +26,7 @@
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.skin.Icon;
+
/**
* @author Danny Robinson
*/
@@ -36,7 +37,8 @@
this(CorePanelPopup.TYPE);
}
- protected PanelPopupRenderer(FacesBean.Type type)
+ protected PanelPopupRenderer(
+ FacesBean.Type type)
{
super(type);
}
@@ -47,7 +49,8 @@
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_textKey = type.findKey("text");
@@ -64,62 +67,86 @@
_triggerRenderer = new TriggerRenderer();
}
- protected String getText(FacesBean bean)
+ protected String getText(
+ UIComponent component,
+ FacesBean bean)
{
return toString(resolveProperty(bean, _textKey));
}
- protected String getIcon(FacesBean bean)
+ protected String getIcon(
+ UIComponent component,
+ FacesBean bean)
{
return toResourceUri(FacesContext.getCurrentInstance(), resolveProperty(bean, _iconKey));
}
- protected String getTitle(FacesBean bean)
+ protected String getTitle(
+ UIComponent component,
+ FacesBean bean)
{
return toString(resolveProperty(bean, _titleKey));
}
- protected String getTriggerType(FacesBean bean)
+ protected String getTriggerType(
+ UIComponent component,
+ FacesBean bean)
{
return toString(resolveProperty(bean, _triggerTypeKey, true));
}
- protected String getPosition(FacesBean bean)
+ protected String getPosition(
+ UIComponent component,
+ FacesBean bean)
{
return toString(resolveProperty(bean, _positionKey));
}
- protected String getContentStyle(FacesBean bean)
+ protected String getContentStyle(
+ UIComponent component,
+ FacesBean bean)
{
return toString(resolveProperty(bean, _contentStyleKey));
}
- protected int getWidth(FacesBean bean)
+ protected int getWidth(
+ UIComponent component,
+ FacesBean bean)
{
return toInt(resolveProperty(bean, _widthKey, true));
}
- protected int getHeight(FacesBean bean)
+ protected int getHeight(
+ UIComponent component,
+ FacesBean bean)
{
return toInt(resolveProperty(bean, _heightKey, true));
}
- protected int getHorzOffset(FacesBean bean)
+ protected int getHorzOffset(
+ UIComponent component,
+ FacesBean bean)
{
return toInt(resolveProperty(bean, _horzOffsetKey, true));
}
- protected int getVertOffset(FacesBean bean)
+ protected int getVertOffset(
+ UIComponent component,
+ FacesBean bean)
{
return toInt(resolveProperty(bean, _vertOffsetKey, true));
}
- protected boolean isModal(FacesBean bean)
+ protected boolean isModal(
+ UIComponent component,
+ FacesBean bean)
{
return (Boolean)resolveProperty(bean, _modalKey, true);
}
- protected boolean isCentered(FacesBean bean)
+ protected boolean isCentered(
+ UIComponent component,
+ FacesBean bean)
{
String centeredString = toString(resolveProperty(bean, _positionKey));
return CorePanelPopup.POSITION_CENTERED.equalsIgnoreCase(centeredString);
@@ -127,33 +154,37 @@
@SuppressWarnings("unchecked")
@Override
- protected void encodeAll(FacesContext context, RenderingContext arc,
- UIComponent component, FacesBean bean) throws IOException
+ protected void encodeAll(
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
//HKuhn - in printable mode (scripting is disabled) we need only the trigger
- if (!supportsScripting(arc))
+ if (!supportsScripting(rc))
{
- renderTrigger(context, arc, component, bean);
+ renderTrigger(context, rc, component, bean);
return;
}
ResponseWriter writer = context.getResponseWriter();
String clientId = getClientId(context, component);
-
+
// Make sure we don't have anything to save
- assert(arc.getCurrentClientId() == null);
- // Set current clientId so we can access this in getOnclick
- arc.setCurrentClientId(clientId);
-
+ assert(rc.getCurrentClientId() == null);
+ // Set current clientId so we can access this in getOnclick
+ rc.setCurrentClientId(clientId);
+
// Render the outer span that is the component container,
// this element is rendered so the component can be updated via ppr.
writer.startElement(XhtmlConstants.SPAN_ELEMENT, component);
- writer.writeAttribute(XhtmlConstants.ID_ATTRIBUTE + _POPUP_TRIGGER_ID_SUFFIX,
+ writer.writeAttribute(XhtmlConstants.ID_ATTRIBUTE + _POPUP_TRIGGER_ID_SUFFIX,
XhtmlUtils.getJSIdentifier(clientId), null);
- renderStyleClass(context, arc, SkinSelectors.AF_PANEL_POPUP_TRIGGER_STYLE_CLASS);
-
- renderTrigger(context, arc, component, bean);
-
+ renderStyleClass(context, rc, SkinSelectors.AF_PANEL_POPUP_TRIGGER_STYLE_CLASS);
+
+ renderTrigger(context, rc, component, bean);
+
// Render the outer div that is the actual popup container
writer.startElement(XhtmlConstants.DIV_ELEMENT, null);
writer.writeAttribute(XhtmlConstants.ID_ATTRIBUTE, XhtmlUtils.getJSIdentifier(clientId)
@@ -162,20 +193,20 @@
// Output the non-modifiable styles the keep the popup hidden initially
writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE,
_POPUP_CONTAINER_DIV_STYLES, null);
-
+
// Render the skinnable container div
writer.startElement(XhtmlConstants.DIV_ELEMENT, null);
- renderStyleClass(context, arc, SkinSelectors.AF_PANEL_POPUP_CONTAINER_STYLE_CLASS);
- renderInlineStyle(context, arc, bean);
+ renderStyleClass(context, rc, SkinSelectors.AF_PANEL_POPUP_CONTAINER_STYLE_CLASS);
+ renderInlineStyle(context, rc, component, bean);
- renderTitleBar(context, arc, component, bean);
+ renderTitleBar(context, rc, component, bean);
// Render the child components in a content div
writer.startElement(XhtmlConstants.DIV_ELEMENT, null);
- renderStyleClass(context, arc, SkinSelectors.AF_PANEL_POPUP_CONTENT_STYLE_CLASS);
+ renderStyleClass(context, rc, SkinSelectors.AF_PANEL_POPUP_CONTENT_STYLE_CLASS);
// If width is set, then add that style to the content
- int height = getHeight(bean);
+ int height = getHeight(component, bean);
if (height > 0)
{
String style = "overflow: auto; height:" + height + "px";
@@ -189,76 +220,84 @@
// Close skinnable container div
writer.endElement(XhtmlConstants.DIV_ELEMENT);
-
+
// Close outer show/hide div
writer.endElement(XhtmlConstants.DIV_ELEMENT);
-
+
// Close outer span
writer.endElement(XhtmlConstants.SPAN_ELEMENT);
-
+
// Reset current clientId
- arc.setCurrentClientId(null);
+ rc.setCurrentClientId(null);
}
- protected void renderTrigger(FacesContext context, RenderingContext arc,
- UIComponent component, FacesBean bean) throws IOException
+ protected void renderTrigger(
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
// Render the trigger, including the facet if specified
- delegateRendererBegin(context, arc, component, bean, _triggerRenderer);
+ delegateRendererBegin(context, rc, component, bean, _triggerRenderer);
UIComponent triggerFacet = getFacet(component,
CorePanelPopup.TRIGGER_FACET);
if (triggerFacet != null)
encodeChild(context, triggerFacet);
-
+
//render trigger icon
- OutputUtils.renderImage(context, arc, getIcon(bean), null, null, null, "",
+ OutputUtils.renderImage(context, rc, getIcon(component, bean), null, null, null, "",
component, null, SkinSelectors.AF_PANEL_POPUP_ICON_STYLE_CLASS);
-
- delegateRendererEnd(context, arc, component, bean, _triggerRenderer);
+
+ delegateRendererEnd(context, rc, component, bean, _triggerRenderer);
}
- protected void renderTitleBar(FacesContext context, RenderingContext arc,
- UIComponent component, FacesBean bean) throws IOException
+ protected void renderTitleBar(
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
- String title = getTitle(bean);
+ String title = getTitle(component, bean);
if (title == null)
return;
// Render the skinnable title bar div
writer.startElement(XhtmlConstants.DIV_ELEMENT, null);
- renderStyleClass(context, arc, SkinSelectors.AF_PANEL_POPUP_TITLEBAR_STYLE_CLASS);
+ renderStyleClass(context, rc, SkinSelectors.AF_PANEL_POPUP_TITLEBAR_STYLE_CLASS);
// Render the skinnable title text
writer.startElement(XhtmlConstants.DIV_ELEMENT, null);
- renderStyleClass(context, arc, SkinSelectors.AF_PANEL_POPUP_TITLE_STYLE_CLASS);
+ renderStyleClass(context, rc, SkinSelectors.AF_PANEL_POPUP_TITLE_STYLE_CLASS);
writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE, "float:left;", null);
writer.writeText(title, "title");
writer.endElement(XhtmlConstants.DIV_ELEMENT);
- Icon icon = arc.getIcon(SkinSelectors.AF_PANEL_POPUP_CLOSE_ICON_STYLE_CLASS);
+ Icon icon = rc.getIcon(SkinSelectors.AF_PANEL_POPUP_CLOSE_ICON_STYLE_CLASS);
- if (isModal(bean))
+ if (isModal(component, bean))
{
// Render the skinnable container div
writer.startElement(XhtmlConstants.DIV_ELEMENT, null);
- renderStyleClass(context, arc, SkinSelectors.AF_PANEL_POPUP_CLOSE_ICON_STYLE_CLASS);
-
+ renderStyleClass(context, rc, SkinSelectors.AF_PANEL_POPUP_CLOSE_ICON_STYLE_CLASS);
+
writer.startElement(XhtmlConstants.LINK_ELEMENT, null);
writer.writeAttribute(XhtmlConstants.HREF_ATTRIBUTE, "#", null);
- writer.writeAttribute(XhtmlConstants.ONCLICK_ATTRIBUTE,
+ writer.writeAttribute(XhtmlConstants.ONCLICK_ATTRIBUTE,
"TrPanelPopup.hidePopup(event); return false;",
null);
-
+
if (icon != null && !icon.isNull())
{
- String closeText = arc.getTranslatedString("af_panelPopup.CLOSE");
- OutputUtils.renderIcon(context, arc, icon, closeText, null);
+ String closeText = rc.getTranslatedString("af_panelPopup.CLOSE");
+ OutputUtils.renderIcon(context, rc, icon, closeText, null);
}
else
{
@@ -278,111 +317,130 @@
writer.endElement(XhtmlConstants.DIV_ELEMENT);
}
-
- // Handles rendering of the trigger text/icon and or
+
+ // Handles rendering of the trigger text/icon and or
private class TriggerRenderer extends GoLinkRenderer
{
-
@Override
- protected boolean shouldRenderId(FacesContext context, UIComponent component)
+ protected boolean shouldRenderId(
+ FacesContext context,
+ UIComponent component)
{
// Force rendering of the ID, so the trigger element can be found through scripting
return true;
}
-
+
@Override
- protected String getClientId(FacesContext context, UIComponent component)
+ protected String getClientId(
+ FacesContext context,
+ UIComponent component)
{
// Ensure the ID is encoded, otherwise it will fail when included in tables.
return XhtmlUtils.getJSIdentifier(
PanelPopupRenderer.this.getClientId(context, component));
}
-
+
@Override
- protected String getOnclick(FacesBean bean)
+ protected String getOnclick(
+ UIComponent component,
+ FacesBean bean)
{
- String onclick = PanelPopupRenderer.this.getOnclick(bean);
+ String onclick = PanelPopupRenderer.this.getOnclick(component, bean);
String script = null;
-
+
// Only render onclick script for 'click'
- if (CorePanelPopup.TRIGGER_TYPE_CLICK.equalsIgnoreCase(getTriggerType(bean)))
+ if (CorePanelPopup.TRIGGER_TYPE_CLICK.equalsIgnoreCase(getTriggerType(
+ component, bean)))
{
String componentId = RenderingContext.getCurrentInstance().getCurrentClientId();
-
- script = getTriggerScript(bean, componentId);
+
+ script = getTriggerScript(component, bean, componentId);
}
return XhtmlUtils.getChainedJS(onclick, script, true);
}
-
+
@Override
- protected String getOnmouseover(FacesBean bean)
+ protected String getOnmouseover(
+ UIComponent component,
+ FacesBean bean)
{
- String onclick = super.getOnmouseover(bean);
+ String onclick = super.getOnmouseover(component, bean);
String script = null;
-
+
// Only render onclick script for 'click'
- if (CorePanelPopup.TRIGGER_TYPE_HOVER.equalsIgnoreCase(getTriggerType(bean)))
+ if (CorePanelPopup.TRIGGER_TYPE_HOVER.equalsIgnoreCase(getTriggerType(component, bean)))
{
String componentId = RenderingContext.getCurrentInstance().getCurrentClientId();
-
- script = getTriggerScript(bean, componentId);
+
+ script = getTriggerScript(component, bean, componentId);
}
return XhtmlUtils.getChainedJS(onclick, script, true);
}
@Override
- protected String getText(FacesBean bean)
+ protected String getText(
+ UIComponent component,
+ FacesBean bean)
{
- return PanelPopupRenderer.this.getText(bean);
+ return PanelPopupRenderer.this.getText(component, bean);
}
-
+
@Override
- protected String getInlineStyle(FacesBean bean)
+ protected String getInlineStyle(
+ UIComponent component,
+ FacesBean bean)
{
- return PanelPopupRenderer.this.getInlineStyle(bean);
+ return PanelPopupRenderer.this.getInlineStyle(component, bean);
}
-
+
@Override
- protected String getStyleClass(FacesBean bean)
+ protected String getStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
- return PanelPopupRenderer.this.getStyleClass(bean);
+ return PanelPopupRenderer.this.getStyleClass(component, bean);
}
-
+
@Override
- protected String getDefaultStyleClass(FacesBean bean)
+ protected String getDefaultStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
return SkinSelectors.AF_PANEL_POPUP_LINK_STYLE_CLASS;
}
-
- protected String getTriggerScript(FacesBean bean, String componentId)
+
+ protected String getTriggerScript(
+ UIComponent component,
+ FacesBean bean,
+ String componentId)
{
String clientId = XhtmlUtils.getJSIdentifier(componentId);
StringBuilder script = new StringBuilder();
script.append("TrPanelPopup.showPopup('");
script.append(clientId);
- script.append(_POPUP_CONTAINER_ID_SUFFIX);
+ script.append(_POPUP_CONTAINER_ID_SUFFIX);
script.append("', '");
script.append(clientId);
script.append("', event, '");
- script.append(PanelPopupRenderer.this.getTriggerType(bean));
+ script.append(PanelPopupRenderer.this.getTriggerType(component, bean));
script.append("','");
- script.append(PanelPopupRenderer.this.getPosition(bean));
+ script.append(PanelPopupRenderer.this.getPosition(component, bean));
script.append("',");
- script.append(PanelPopupRenderer.this.isModal(bean));
+ script.append(PanelPopupRenderer.this.isModal(component, bean));
script.append(",");
- script.append(PanelPopupRenderer.this.getWidth(bean));
+ script.append(PanelPopupRenderer.this.getWidth(component, bean));
script.append(",");
- script.append(PanelPopupRenderer.this.getHeight(bean));
+ script.append(PanelPopupRenderer.this.getHeight(component, bean));
script.append(",");
- script.append(PanelPopupRenderer.this.getHorzOffset(bean));
+ script.append(PanelPopupRenderer.this.getHorzOffset(component, bean));
script.append(",");
- script.append(PanelPopupRenderer.this.getVertOffset(bean));
-
+ script.append(PanelPopupRenderer.this.getVertOffset(component, bean));
+
script.append("); return false;");
-
+
return script.toString();
}
}
@@ -401,7 +459,7 @@
private PropertyKey _horzOffsetKey;
private PropertyKey _vertOffsetKey;
private XhtmlRenderer _triggerRenderer;
-
+
private PropertyKey _iconKey;
private static final String _POPUP_CONTAINER_ID_SUFFIX = "_popupContainer";
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelTipRenderer.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/PanelTipRenderer.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/PanelTipRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelTipRenderer.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
@@ -23,9 +23,11 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+
import org.apache.myfaces.trinidad.bean.FacesBean;
-import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidad.component.core.layout.CorePanelTip;
+import org.apache.myfaces.trinidad.context.RenderingContext;
+
/**
* Renders the page or section level tip UI element.
@@ -47,23 +49,26 @@
}
@Override
- protected String getDefaultStyleClass(FacesBean bean)
+ protected String getDefaultStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
return "af|panelTip";
}
@Override
protected void encodeAll(
- FacesContext context,
- RenderingContext rc,
- 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, rc, bean);
-
+ renderAllAttributes(context, rc, component, bean);
+
// tip label
rw.startElement("span", null);
renderStyleClass(context, rc, SkinSelectors.AF_PANEL_TIP_LABEL_STYLE_CLASS);
@@ -81,7 +86,7 @@
}
rw.endElement("span");
-
+
// content
rw.startElement("span", null);
renderStyleClass(context, rc, SkinSelectors.AF_PANEL_TIP_CONTENT_STYLE_CLASS);